From 7d96b0901f7a420655eeeddd5558e7ba5405c2b0 Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 24 May 2023 20:57:41 +0200 Subject: [PATCH] Search Button on AddTask --- Website/index.html | 1 + Website/interaction.js | 50 +++++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Website/index.html b/Website/index.html index f627171..6edce65 100644 --- a/Website/index.html +++ b/Website/index.html @@ -53,6 +53,7 @@ +
diff --git a/Website/interaction.js b/Website/interaction.js index 6b15394..8fb1ccf 100644 --- a/Website/interaction.js +++ b/Website/interaction.js @@ -67,32 +67,36 @@ GetAvailableControllers() searchPublicationQuery.addEventListener("keypress", (event) => { if(event.key === "Enter"){ - //Disable inputs - selectRecurrence.disabled = true; - connectorSelect.disabled = true; - searchPublicationQuery.disabled = true; - - //Empty previous results - selectPublication.replaceChildren(); - GetPublication(connectorSelect.value, searchPublicationQuery.value) - .then(json => - json.forEach(publication => { - var option = CreatePublication(publication, connectorSelect.value); - option.addEventListener("click", (mouseEvent) => { - ShowPublicationViewerWindow(publication.internalId, mouseEvent, true); - }); - selectPublication.appendChild(option); - } - )) - .then(() => { - //Re-enable inputs - selectRecurrence.disabled = false; - connectorSelect.disabled = false; - searchPublicationQuery.disabled = false; - }); + NewSearch(); } }); +function NewSearch(){ + //Disable inputs + selectRecurrence.disabled = true; + connectorSelect.disabled = true; + searchPublicationQuery.disabled = true; + + //Empty previous results + selectPublication.replaceChildren(); + GetPublication(connectorSelect.value, searchPublicationQuery.value) + .then(json => + json.forEach(publication => { + var option = CreatePublication(publication, connectorSelect.value); + option.addEventListener("click", (mouseEvent) => { + ShowPublicationViewerWindow(publication.internalId, mouseEvent, true); + }); + selectPublication.appendChild(option); + } + )) + .then(() => { + //Re-enable inputs + selectRecurrence.disabled = false; + connectorSelect.disabled = false; + searchPublicationQuery.disabled = false; + }); +} + //Returns a new "Publication" Item to display in the tasks section function CreatePublication(publication, connector){ var publicationElement = document.createElement('publication');