From 42ac77ec6ffcf0983a34c66fe940cf80a275dc15 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Wed, 9 Mar 2022 10:20:53 -0700 Subject: [PATCH] Add loading message to manage page --- public/scripts/manage.js | 5 +++++ views/manage.pug | 1 + 2 files changed, 6 insertions(+) diff --git a/public/scripts/manage.js b/public/scripts/manage.js index a77a7d6..04ebb1c 100644 --- a/public/scripts/manage.js +++ b/public/scripts/manage.js @@ -3,6 +3,7 @@ import * as Data from "./data.js"; const categoryDropdown = document.getElementById('category-dropdown'); const itemsListTable = document.getElementById('items-list'); const addNewButton = document.getElementById('add-new-button'); +const loadingSpan = document.getElementById('loading-message'); function getGenderLetter(genderName) { @@ -362,6 +363,8 @@ CATEGORIES.push(new Category( async function listItems(category) { + loadingSpan.textContent = "Loading..."; + itemsListTable.innerHTML = ""; const itemsList = await category.getItems(); @@ -389,6 +392,8 @@ async function listItems(category) { itemsListTable.appendChild(row); }); + + loadingSpan.textContent = ''; } if(window.location.hash) { let correctIndex; diff --git a/views/manage.pug b/views/manage.pug index 63d76ec..bd8a228 100644 --- a/views/manage.pug +++ b/views/manage.pug @@ -18,6 +18,7 @@ block content option(value="accounts") Accounts div h2#table-header + span#loading-message Loading... table#items-list button#add-new-button Add new...