From 9249f79aa666cb5e2704ed715b1eff663ae5a776 Mon Sep 17 00:00:00 2001 From: alondhe Date: Wed, 14 Jun 2023 10:00:50 -0700 Subject: [PATCH 1/3] Adds solr vocab status to configuration page based on webapi buildinfo Only is visibe if the app config's useSolrVocabSearch setting is true --- js/config/app.js | 1 + js/pages/configuration/configuration.html | 14 ++++++++++++++ js/pages/configuration/configuration.js | 15 +++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/js/config/app.js b/js/config/app.js index 111748f14..af7d1ce14 100644 --- a/js/config/app.js +++ b/js/config/app.js @@ -13,6 +13,7 @@ define(function () { appConfig.userAuthenticationEnabled = false; appConfig.enableSkipLogin = false; // automatically opens login window when user is not authenticated appConfig.plpResultsEnabled = false; + appConfig.useSolrVocabSearch = false; appConfig.useExecutionEngine = false; appConfig.viewProfileDates = false; appConfig.enableCosts = false; diff --git a/js/pages/configuration/configuration.html b/js/pages/configuration/configuration.html index ebbaf5493..b6fb7f95e 100644 --- a/js/pages/configuration/configuration.html +++ b/js/pages/configuration/configuration.html @@ -25,6 +25,20 @@ +
+
+
+
+
+ +
+
+
+ + ( + ) +
+
diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index 091488fc7..ef4f3e808 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -6,6 +6,7 @@ define([ 'utils/CommonUtils', 'appConfig', 'services/AuthAPI', + 'services/BuildInfoService', 'services/SourceAPI', 'atlas-state', 'const', @@ -23,6 +24,7 @@ define([ commonUtils, config, authApi, + buildInfoService, sourceApi, sharedState, constants, @@ -42,6 +44,8 @@ define([ this.jobListing = sharedState.jobListing; this.sourceJobs = new Map(); this.sources = sharedState.sources; + this.isSolrVocabCoreAvailable = ko.observable(); + this.solrVocabCoreName = ko.observable(); this.priorityOptions = [ {id: 'session', name: ko.i18n('configuration.priorityOptions.session', 'Current Session')}, @@ -113,11 +117,22 @@ define([ async onPageCreated() { this.loading(true); + const info = await buildInfoService.getBuildInfo(); await sourceApi.initSourcesConfig(); super.onPageCreated(); + this.isSolrVocabCoreAvailable = false; + this.solrVocabCoreName = this.getSolrVocabCoreName(info); this.loading(false); } + getSolrVocabCoreName(info) { + if (typeof(info.configuration.vocabulary.cores) != "string") { + this.isSolrVocabCoreAvailable = true; + return info.configuration.vocabulary.cores[0]; + } + return info.configuration.vocabulary.cores; + } + canReadSource(source) { if (!config.userAuthenticationEnabled) { return false; From 15c8121431ce2f9eae152db9395c1fc1948b9dd0 Mon Sep 17 00:00:00 2001 From: alondhe Date: Wed, 21 Jun 2023 14:24:34 -0700 Subject: [PATCH 2/3] Removed need for useSolrVocabSearch config parameter. Now will show solr vocab information if solrEnabled is true. --- js/config/app.js | 1 - js/pages/configuration/configuration.html | 6 +++--- js/pages/configuration/configuration.js | 8 +++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/config/app.js b/js/config/app.js index af7d1ce14..111748f14 100644 --- a/js/config/app.js +++ b/js/config/app.js @@ -13,7 +13,6 @@ define(function () { appConfig.userAuthenticationEnabled = false; appConfig.enableSkipLogin = false; // automatically opens login window when user is not authenticated appConfig.plpResultsEnabled = false; - appConfig.useSolrVocabSearch = false; appConfig.useExecutionEngine = false; appConfig.viewProfileDates = false; appConfig.enableCosts = false; diff --git a/js/pages/configuration/configuration.html b/js/pages/configuration/configuration.html index b6fb7f95e..2a664e218 100644 --- a/js/pages/configuration/configuration.html +++ b/js/pages/configuration/configuration.html @@ -25,13 +25,13 @@
-
+
-
+
-
+
diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index ef4f3e808..f9d271281 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -44,7 +44,7 @@ define([ this.jobListing = sharedState.jobListing; this.sourceJobs = new Map(); this.sources = sharedState.sources; - this.isSolrVocabCoreAvailable = ko.observable(); + this.isSolrVocabEnabled = ko.observable(); this.solrVocabCoreName = ko.observable(); this.priorityOptions = [ @@ -120,8 +120,10 @@ define([ const info = await buildInfoService.getBuildInfo(); await sourceApi.initSourcesConfig(); super.onPageCreated(); - this.isSolrVocabCoreAvailable = false; - this.solrVocabCoreName = this.getSolrVocabCoreName(info); + this.isSolrVocabEnabled = info.configuration.vocabulary.solrEnabled; + if (this.isSolrVocabEnabled) { + this.solrVocabCoreName = this.getSolrVocabCoreName(info); + } this.loading(false); } From 7826c3270c018e1b591be1468bfb314a264c08d8 Mon Sep 17 00:00:00 2001 From: alondhe Date: Wed, 21 Jun 2023 16:30:59 -0700 Subject: [PATCH 3/3] Added check to see if solr core is not only enabled but also reporting core information --- js/pages/configuration/configuration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index f9d271281..c504ccc83 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -45,6 +45,7 @@ define([ this.sourceJobs = new Map(); this.sources = sharedState.sources; this.isSolrVocabEnabled = ko.observable(); + this.isSolrVocabCoreAvailable = ko.observable(); this.solrVocabCoreName = ko.observable(); this.priorityOptions = [ @@ -120,7 +121,8 @@ define([ const info = await buildInfoService.getBuildInfo(); await sourceApi.initSourcesConfig(); super.onPageCreated(); - this.isSolrVocabEnabled = info.configuration.vocabulary.solrEnabled; + this.isSolrVocabEnabled = info.configuration.vocabulary.solrEnabled && info.configuration.vocabulary.hasOwnProperty("cores"); + this.isSolrVocabCoreAvailable = false; if (this.isSolrVocabEnabled) { this.solrVocabCoreName = this.getSolrVocabCoreName(info); }