From b748dac7bf3a5e6701881f659df40eb75ba424d0 Mon Sep 17 00:00:00 2001 From: Garrett Date: Mon, 21 Aug 2023 11:08:52 -0700 Subject: [PATCH 1/2] Indicate that the list of interfaces is loading --- src/renderer/src/stories/List.ts | 4 ++++ .../src/stories/pages/guided-mode/data/GuidedStructure.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/stories/List.ts b/src/renderer/src/stories/List.ts index e2f72d87d..7a6a3bb21 100644 --- a/src/renderer/src/stories/List.ts +++ b/src/renderer/src/stories/List.ts @@ -58,6 +58,10 @@ export class List extends LitElement { items: { type: Array, reflect: true + }, + emptyMessage: { + type: String, + reflect: true } }; } diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js index f8c115b08..60dd6feaa 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js @@ -48,8 +48,6 @@ export class GuidedStructurePage extends Page { const interfaces = { ...this.list.object }; - // if (Object.keys(interfaces).length === 0) throw new Error('No interfaces selected.') - const schema = await fetch(`${baseUrl}/neuroconv/schema`, { method: "POST", headers: { "Content-Type": "application/json" }, @@ -69,6 +67,8 @@ export class GuidedStructurePage extends Page { async updated() { const selected = this.info.globalState.interfaces; + if (Object.keys(selected).length > 0) this.list.emptyMessage = 'Loading valid interfaces...' + this.search.options = await fetch(`${baseUrl}/neuroconv`) .then((res) => res.json()) .then((json) => @@ -97,6 +97,9 @@ export class GuidedStructurePage extends Page { this.list.add({ ...found, key }); // Add previously selected items } + + this.addButton.removeAttribute('hidden') + } render() { @@ -104,6 +107,7 @@ export class GuidedStructurePage extends Page { this.list.style.display = "inline-block"; this.list.clear(); this.addButton.style.display = "block"; + this.addButton.setAttribute('hidden', '') return html`
${this.list} ${this.addButton}
From 5024d337633118435bc042e38fba476587990054 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:20:54 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../src/stories/pages/guided-mode/data/GuidedStructure.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js index 60dd6feaa..e13ce00e0 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js @@ -67,7 +67,7 @@ export class GuidedStructurePage extends Page { async updated() { const selected = this.info.globalState.interfaces; - if (Object.keys(selected).length > 0) this.list.emptyMessage = 'Loading valid interfaces...' + if (Object.keys(selected).length > 0) this.list.emptyMessage = "Loading valid interfaces..."; this.search.options = await fetch(`${baseUrl}/neuroconv`) .then((res) => res.json()) @@ -98,8 +98,7 @@ export class GuidedStructurePage extends Page { this.list.add({ ...found, key }); // Add previously selected items } - this.addButton.removeAttribute('hidden') - + this.addButton.removeAttribute("hidden"); } render() { @@ -107,7 +106,7 @@ export class GuidedStructurePage extends Page { this.list.style.display = "inline-block"; this.list.clear(); this.addButton.style.display = "block"; - this.addButton.setAttribute('hidden', '') + this.addButton.setAttribute("hidden", ""); return html`
${this.list} ${this.addButton}