-
Notifications
You must be signed in to change notification settings - Fork 139
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,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')}, | ||
|
@@ -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; | ||
if (this.isSolrVocabEnabled) { | ||
this.solrVocabCoreName = this.getSolrVocabCoreName(info); | ||
} | ||
this.loading(false); | ||
} | ||
|
||
getSolrVocabCoreName(info) { | ||
if (typeof(info.configuration.vocabulary.cores) != "string") { | ||
this.isSolrVocabCoreAvailable = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment.
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?