« get me outta code hell

data: WikiInfo.enableSearch, WikiInfo.searchDataAvailable - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-01 21:26:37 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:47 -0300
commitce56dec7da53739f8c02e6ddf6a8e1ebe4b245b2 (patch)
treec6695dd99f5d12f09e1b3b18b21280fc0811f942
parent5bff100c3864c244482c1b690e4cef090076d3ab (diff)
data: WikiInfo.enableSearch, WikiInfo.searchDataAvailable
-rw-r--r--src/data/things/wiki-info.js21
-rwxr-xr-xsrc/upd8.js4
2 files changed, 24 insertions, 1 deletions
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index 316bd3bb..2a2c9986 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -3,8 +3,9 @@ export const WIKI_INFO_FILE = 'wiki-info.yaml';
 import {input} from '#composite';
 import find from '#find';
 import Thing from '#thing';
-import {isColor, isLanguageCode, isName, isURL} from '#validators';
+import {isBoolean, isColor, isLanguageCode, isName, isURL} from '#validators';
 
+import {exitWithoutDependency} from '#composite/control-flow';
 import {contentString, flag, name, referenceList, wikiData}
   from '#composite/wiki-properties';
 
@@ -64,8 +65,26 @@ export class WikiInfo extends Thing {
     enableArtTagUI: flag(false),
     enableGroupUI: flag(false),
 
+    enableSearch: [
+      exitWithoutDependency({
+        dependency: 'searchDataAvailable',
+        mode: input.value('falsy'),
+        value: input.value(false),
+      }),
+
+      flag(true),
+    ],
+
     // Update only
 
+    searchDataAvailable: {
+      flags: {update: true},
+      update: {
+        validate: isBoolean,
+        default: false,
+      },
+    },
+
     groupData: wikiData({
       class: input.value(Group),
     }),
diff --git a/src/upd8.js b/src/upd8.js
index 258abd95..74f38ece 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -2215,6 +2215,10 @@ async function main() {
     });
   }
 
+  wikiData.wikiInfo.searchDataAvailable =
+    webRouteSources
+      .some(({to}) => to[0].startsWith('searchData'));
+
   if (stepStatusSummary.performBuild.status === STATUS_NOT_APPLICABLE) {
     return true;
   }