From f7ce052d7f1517ce4eb9c75c04cf84bc50002de5 Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 13 Sep 2023 10:28:18 -0700 Subject: [PATCH] Fix interface saving and empty message --- .../stories/pages/guided-mode/data/GuidedStructure.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 b4c24266d..410d7c9fb 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js @@ -8,6 +8,8 @@ import { Search } from "../../../Search.js"; import { Modal } from "../../../Modal"; import { List } from "../../../List"; +const defaultEmptyMessage = "No interfaces selected" + export class GuidedStructurePage extends Page { constructor(...args) { super(...args); @@ -32,7 +34,8 @@ export class GuidedStructurePage extends Page { }); list = new List({ - emptyMessage: "No interfaces selected", + emptyMessage: defaultEmptyMessage, + onChange: () => this.unsavedUpdates = true }); addButton = new Button(); @@ -77,7 +80,7 @@ export class GuidedStructurePage extends Page { async updated() { const { interfaces = {} } = this.info.globalState; - if (Object.keys(interfaces).length > 0) this.list.emptyMessage = "Loading valid interfaces..."; + this.list.emptyMessage = "Loading valid interfaces..."; this.search.options = await fetch(`${baseUrl}/neuroconv`) .then((res) => res.json()) @@ -93,6 +96,8 @@ export class GuidedStructurePage extends Page { ) .catch((e) => console.error(e)); + this.list.emptyMessage = defaultEmptyMessage + for (const [key, name] of Object.entries(interfaces)) { let found = this.search.options?.find((o) => o.value === name);