Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Solr Vocab status to Configuration page #2869

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions js/pages/configuration/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
</span>
</div>
</div>
<div data-bind="if: $component.isSolrVocabEnabled" class="configureHeader">
<div class="left">
<div data-bind="if: $component.isSolrVocabCoreAvailable">
<div class="serviceStatus serviceAvailable fa fa-check-circle"></div>
</div>

<div data-bind="ifnot: $component.isSolrVocabCoreAvailable">
<div class="serviceStatus serviceUnavailable fa fa-exclamation-circle"></div>
</div>

<span class="serviceName" data-bind="text:ko.i18n('configuration.solrVocab', 'Solr Vocab')"></span> (
<span class="serviceUrl" data-bind="text: $component.solrVocabCoreName"></span>)
</div>
</div>
<div data-bind="if: $component.config.useExecutionEngine" class="configureHeader">
<div class="left">
<div data-bind="if:isExecutionEngineAvailable()==true">
Expand Down
19 changes: 19 additions & 0 deletions js/pages/configuration/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ define([
'utils/CommonUtils',
'appConfig',
'services/AuthAPI',
'services/BuildInfoService',
'services/SourceAPI',
'atlas-state',
'const',
Expand All @@ -23,6 +24,7 @@ define([
commonUtils,
config,
authApi,
buildInfoService,
sourceApi,
sharedState,
constants,
Expand All @@ -42,6 +44,9 @@ define([
this.jobListing = sharedState.jobListing;
this.sourceJobs = new Map();
this.sources = sharedState.sources;
this.isSolrVocabEnabled = ko.observable();
this.isSolrVocabCoreAvailable = ko.observable();
this.solrVocabCoreName = ko.observable();

this.priorityOptions = [
{id: 'session', name: ko.i18n('configuration.priorityOptions.session', 'Current Session')},
Expand Down Expand Up @@ -113,11 +118,25 @@ define([

async onPageCreated() {
this.loading(true);
const info = await buildInfoService.getBuildInfo();
await sourceApi.initSourcesConfig();
super.onPageCreated();
this.isSolrVocabEnabled = info.configuration.vocabulary.solrEnabled && info.configuration.vocabulary.hasOwnProperty("cores");
this.isSolrVocabCoreAvailable = false;
Copy link
Collaborator

@chrisknoll chrisknoll Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the top of your object, you've defined isSolrVocabEnabled as an observable, but on this line (125) you are overwriting it with a boolean. So, if it's not important to have this value observable (ie: have the UI respond to changes in this value) then just declare it to default to 'false'. Or, if you do want the UI to respond to changes in the value of that variable: then you should say this.isSolrVocabCoreAvailable(false)...btw, just looking at your coe changes, it seems that it is always false...unless I'm missing whre this.isSolrVocabCoreAvailable is set to true somewhere?

if (this.isSolrVocabEnabled) {
this.solrVocabCoreName = this.getSolrVocabCoreName(info);
}
this.loading(false);
}

getSolrVocabCoreName(info) {
if (typeof(info.configuration.vocabulary.cores) != "string") {
this.isSolrVocabCoreAvailable = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i found where isSolrVocabCoreAvailable is assigned to true here. Note, it's not observable, you're just storing a boolean value. This may work if this all happens when the page loads (ie: the configuration page loads) and there is no change in the isSolrVocabCoreAvailable state while the page is alive. If that's the case, don't make anything observable.

return info.configuration.vocabulary.cores[0];
}
return info.configuration.vocabulary.cores;
}

canReadSource(source) {
if (!config.userAuthenticationEnabled) {
return false;
Expand Down