From cff8918fb42d637d4f11ed75fefad9da1417bce5 Mon Sep 17 00:00:00 2001 From: MakTakin Date: Tue, 1 Nov 2022 16:09:21 +0300 Subject: [PATCH 01/10] Conceptsets search | create the components for a advanced search --- .../advancedSearch/advancedSearch.html | 55 +++++++++++++ .../advancedSearch/advancedSearch.js | 77 +++++++++++++++++++ .../advancedSearch/components/panel-list.less | 38 +++++++++ .../advancedSearch/components/panelList.html | 19 +++++ .../advancedSearch/components/panelList.js | 29 +++++++ 5 files changed, 218 insertions(+) create mode 100644 js/components/advancedSearch/advancedSearch.html create mode 100644 js/components/advancedSearch/advancedSearch.js create mode 100644 js/components/advancedSearch/components/panel-list.less create mode 100644 js/components/advancedSearch/components/panelList.html create mode 100644 js/components/advancedSearch/components/panelList.js diff --git a/js/components/advancedSearch/advancedSearch.html b/js/components/advancedSearch/advancedSearch.html new file mode 100644 index 000000000..61bd63278 --- /dev/null +++ b/js/components/advancedSearch/advancedSearch.html @@ -0,0 +1,55 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ + +
+ \ No newline at end of file diff --git a/js/components/advancedSearch/advancedSearch.js b/js/components/advancedSearch/advancedSearch.js new file mode 100644 index 000000000..51cba74ce --- /dev/null +++ b/js/components/advancedSearch/advancedSearch.js @@ -0,0 +1,77 @@ +define([ + 'knockout', + 'components/Component', + 'utils/AutoBind', + 'utils/CommonUtils', + 'text!./advancedSearch.html', + 'services/http', + 'pages/vocabulary/const', + './components/panelList', +], function ( + ko, + Component, + AutoBind, + commonUtils, + view, + httpService, + constants, +) { + class AdvancedSearch extends AutoBind(Component) { + constructor(params) { + super(params); + this.querySearch = ko.observable(''); + this.loading = ko.observable(false); + this.domains = ko.observable(); + this.selectedDomains = new Set(); + this.panelCollapsable = ko.observable(true); + this.searchConceptSets = params.searchConceptSets; + this.showSearch = params.showSearch; + this.getDomains(); + + //subscriptions + this.showSearch.subscribe((newValue) => { + if(!newValue) { + this.panelCollapsable(true); + } + }); + } + + clearAll(data,event) { + event.stopPropagation(); + $('.advanced-options input').attr('checked', false); + this.selectedDomains.clear(); + } + + selectDomain(id) { + this.selectedDomains.has(id) + ? this.selectedDomains.delete(id) + : this.selectedDomains.add(id, true); + } + + search() { + if (this.querySearch().trim().length < 2) { + return alert('Search must have at least 2 letters'); + } + const searchParams = { + query: this.querySearch, + domainId: Array.from(this.selectedDomains) + }; + this.panelCollapsable(false); + this.searchConceptSets(searchParams); + + } + + getDomains() { + this.loading(true); + httpService.doGet(constants.apiPaths.domains()) + .then(({ data }) => { + this.domains(data); + }) + .catch(er => console.error('Error occured when loading domains', er)) + .finally(() => { + this.loading(false); + }); + } + } + return commonUtils.build('advanced-search', AdvancedSearch, view); +}); diff --git a/js/components/advancedSearch/components/panel-list.less b/js/components/advancedSearch/components/panel-list.less new file mode 100644 index 000000000..b511b4f6b --- /dev/null +++ b/js/components/advancedSearch/components/panel-list.less @@ -0,0 +1,38 @@ +.panel { + + &__header { + font-size: 1.4rem; + padding-left: 1rem; + padding-right: 1rem; + } + + &__content { + padding: 1rem; + } +} + +.panel-heading-collapsible { + display: flex; + justify-content: space-between; + cursor: pointer; + border-top-right-radius: 4px; + border-top-left-radius: 4px; +} +.active .icon-chevron:after { + /* symbol for "collapsed" panels */ + font-family: 'Font Awesome 5 Free'; + content: "\f078"; + font-weight: 900; +} + +.icon-chevron:after { + font-family: 'Font Awesome 5 Free'; + content: "\f077"; + font-weight: 900; + +} + +.advanced-panel { + margin: 10px 0; + border-radius: 4px; +} diff --git a/js/components/advancedSearch/components/panelList.html b/js/components/advancedSearch/components/panelList.html new file mode 100644 index 000000000..18d33a8b1 --- /dev/null +++ b/js/components/advancedSearch/components/panelList.html @@ -0,0 +1,19 @@ +
+
+
+
+ +
+
+
+ +
+
+ + + + + diff --git a/js/components/advancedSearch/components/panelList.js b/js/components/advancedSearch/components/panelList.js new file mode 100644 index 000000000..f00d7b9a3 --- /dev/null +++ b/js/components/advancedSearch/components/panelList.js @@ -0,0 +1,29 @@ +define([ + 'knockout', + 'text!./panelList.html', + 'components/Component', + 'utils/CommonUtils', + 'less!./panel-list.less', +], function ( + ko, + view, + Component, + commonUtils +) { + class PanelList extends Component { + constructor(params) { + super(params); + this.title = params.title; + this.templateId = params.templateId; + this.context = params.context; + this.selectElement = params.selectElement; + this.showText = params.panelCollapsable; + } + + toggleShow() { + this.showText(!this.showText()); + } + } + + return commonUtils.build('panel-list', PanelList, view); +}); From bfc41b237fbbdd878e38dc0370aed09be65b2203 Mon Sep 17 00:00:00 2001 From: MakTakin Date: Tue, 1 Nov 2022 16:10:35 +0300 Subject: [PATCH 02/10] Conceptsets search | added a concept sets search to the concept sets page --- .../circe/components/ConceptSetBrowser.js | 33 ++++++++++++++++--- .../components/ConceptSetBrowserTemplate.html | 10 ++++-- js/components/circe/components/style.css | 8 ++--- js/services/ConceptSet.js | 8 ++++- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/js/components/circe/components/ConceptSetBrowser.js b/js/components/circe/components/ConceptSetBrowser.js index db9df0830..e90bf2781 100644 --- a/js/components/circe/components/ConceptSetBrowser.js +++ b/js/components/circe/components/ConceptSetBrowser.js @@ -7,10 +7,12 @@ define([ 'services/AuthAPI', 'utils/DatatableUtils', 'utils/CommonUtils', + 'services/ConceptSet', 'components/ac-access-denied', + 'components/advancedSearch/advancedSearch', 'databindings', 'css!./style.css' -], function (ko, template, VocabularyProvider, appConfig, ConceptSet, authApi, datatableUtils, commonUtils) { +], function (ko, template, VocabularyProvider, appConfig, ConceptSet, authApi, datatableUtils, commonUtils, conceptSetService) { function CohortConceptSetBrowser(params) { var self = this; @@ -59,7 +61,6 @@ define([ }); } - function setDisabledConceptSetButton(action) { if (action && action()) { return action() @@ -68,6 +69,12 @@ define([ } } + function prepareDataTable (results) { + datatableUtils.coalesceField(results, 'modifiedDate', 'createdDate'); + datatableUtils.addTagGroupsToFacets(results, self.options.Facets); + datatableUtils.addTagGroupsToColumns(results, self.columns); + } + self.datatableUtils = datatableUtils; self.criteriaContext = params.criteriaContext; self.cohortConceptSets = params.cohortConceptSets; @@ -99,9 +106,7 @@ define([ VocabularyProvider.getConceptSetList(url) .done(function (results) { - datatableUtils.coalesceField(results, 'modifiedDate', 'createdDate'); - datatableUtils.addTagGroupsToFacets(results, self.options.Facets); - datatableUtils.addTagGroupsToColumns(results, self.columns); + prepareDataTable(results); self.repositoryConceptSets(results); self.loading(false); }) @@ -179,6 +184,24 @@ define([ const { pageLength, lengthMenu } = commonUtils.getTableOptions('M'); this.pageLength = params.pageLength || pageLength; this.lengthMenu = params.lengthMenu || lengthMenu; + + // advanced search + this.showSearch = ko.observable(false); + this.toggleShowSearch = function () { + this.showSearch(!this.showSearch()); + }; + self.searchConceptSets = async function (searchParams) { + self.loading(true); + try { + const data = await conceptSetService.searchConceptSets(searchParams); + prepareDataTable(data); + self.repositoryConceptSets(data); + } catch(e) { + throw new Error(e); + } finally { + self.loading(false); + } + }; } var component = { diff --git a/js/components/circe/components/ConceptSetBrowserTemplate.html b/js/components/circe/components/ConceptSetBrowserTemplate.html index 07a5acbb8..d8d5ee296 100644 --- a/js/components/circe/components/ConceptSetBrowserTemplate.html +++ b/js/components/circe/components/ConceptSetBrowserTemplate.html @@ -7,9 +7,15 @@
-
+ +
+ +
+
- - +
+ +
+
+ + +
\ No newline at end of file diff --git a/js/components/advancedSearch/advancedSearch.js b/js/components/advancedSearch/advancedSearch.js index 51cba74ce..6a35912a0 100644 --- a/js/components/advancedSearch/advancedSearch.js +++ b/js/components/advancedSearch/advancedSearch.js @@ -26,12 +26,15 @@ define([ this.panelCollapsable = ko.observable(true); this.searchConceptSets = params.searchConceptSets; this.showSearch = params.showSearch; + this.showAdvanced = ko.observable(false); + this.refreshConceptSets = params.refreshConceptSets; this.getDomains(); //subscriptions this.showSearch.subscribe((newValue) => { if(!newValue) { this.panelCollapsable(true); + this.showAdvanced(false); } }); } @@ -56,11 +59,17 @@ define([ query: this.querySearch, domainId: Array.from(this.selectedDomains) }; - this.panelCollapsable(false); + this.showAdvanced(false); + this.panelCollapsable(true); this.searchConceptSets(searchParams); } + resetSearchConceptSets() { + this.showSearch(false); + this.refreshConceptSets(); + } + getDomains() { this.loading(true); httpService.doGet(constants.apiPaths.domains()) @@ -72,6 +81,14 @@ define([ this.loading(false); }); } + + toggleAdvanced() { + if(this.showAdvanced()) { + this.panelCollapsable(true); + } + this.showAdvanced(!this.showAdvanced()); + } + } return commonUtils.build('advanced-search', AdvancedSearch, view); }); diff --git a/js/components/circe/components/ConceptSetBrowser.js b/js/components/circe/components/ConceptSetBrowser.js index e90bf2781..cd52b6a98 100644 --- a/js/components/circe/components/ConceptSetBrowser.js +++ b/js/components/circe/components/ConceptSetBrowser.js @@ -103,8 +103,8 @@ define([ self.loadConceptSetsFromRepository = function (url) { self.loading(true); - - VocabularyProvider.getConceptSetList(url) + const sourceUrl = url ? url : self.selectedSource().url; + VocabularyProvider.getConceptSetList(sourceUrl) .done(function (results) { prepareDataTable(results); self.repositoryConceptSets(results); @@ -194,7 +194,11 @@ define([ self.loading(true); try { const data = await conceptSetService.searchConceptSets(searchParams); - prepareDataTable(data); + const facets = self.options.Facets.find(item => item.caption == 'Status'); + if (!facets) { + prepareDataTable(data); + } + self.repositoryConceptSets(data); } catch(e) { throw new Error(e); diff --git a/js/components/circe/components/ConceptSetBrowserTemplate.html b/js/components/circe/components/ConceptSetBrowserTemplate.html index d8d5ee296..18cb6e83f 100644 --- a/js/components/circe/components/ConceptSetBrowserTemplate.html +++ b/js/components/circe/components/ConceptSetBrowserTemplate.html @@ -7,13 +7,14 @@
- +
- +
diff --git a/js/components/advancedSearch/advancedSearch.js b/js/components/advancedSearch/advancedSearch.js index 6a35912a0..27a0fdcf9 100644 --- a/js/components/advancedSearch/advancedSearch.js +++ b/js/components/advancedSearch/advancedSearch.js @@ -35,6 +35,7 @@ define([ if(!newValue) { this.panelCollapsable(true); this.showAdvanced(false); + this.refreshConceptSets(); } }); } @@ -66,7 +67,11 @@ define([ } resetSearchConceptSets() { - this.showSearch(false); + $('.advanced-options input').attr('checked', false); + this.selectedDomains.clear(); + this.querySearch(''); + this.showAdvanced(false); + this.panelCollapsable(true); this.refreshConceptSets(); } diff --git a/js/components/circe/components/ConceptSetBrowser.js b/js/components/circe/components/ConceptSetBrowser.js index 071eae577..7c5752df1 100644 --- a/js/components/circe/components/ConceptSetBrowser.js +++ b/js/components/circe/components/ConceptSetBrowser.js @@ -190,10 +190,12 @@ define([ this.toggleShowSearch = function () { this.showSearch(!this.showSearch()); }; + this.searchAvailable = ko.observable(false); self.searchConceptSets = async function (searchParams) { self.loading(true); try { const data = await conceptSetService.searchConceptSets(searchParams); + prepareDataTable(data); self.repositoryConceptSets(data); } catch(e) { @@ -202,6 +204,19 @@ define([ self.loading(false); } }; + + self.checkSearchAvailable = async function () { + self.loading(true); + try { + const data = await conceptSetService.checkSearchAvailable(); + self.searchAvailable(data); + } catch(e) { + throw new Error(e); + } finally { + self.loading(false); + } + }; + self.checkSearchAvailable(); } var component = { diff --git a/js/components/circe/components/ConceptSetBrowserTemplate.html b/js/components/circe/components/ConceptSetBrowserTemplate.html index 18cb6e83f..97d59be2a 100644 --- a/js/components/circe/components/ConceptSetBrowserTemplate.html +++ b/js/components/circe/components/ConceptSetBrowserTemplate.html @@ -7,7 +7,10 @@
- + + + +
data); } + function checkSearchAvailable() { + return httpService.doGet(config.api.url + 'conceptset/searchAvailable').then(({ data }) => data); + } + function lookupIdentifiers(identifiers) { return httpService.doPost(sharedState.vocabularyUrl() + 'lookup/identifiers', identifiers); } @@ -145,7 +149,8 @@ define(function (require) { getVersionExpression, updateVersion, copyVersion, - searchConceptSets + searchConceptSets, + checkSearchAvailable }; return api; From cda5781cab0fc72a49b5a15997c8ff8888ac0030 Mon Sep 17 00:00:00 2001 From: MakTakin Date: Wed, 23 Nov 2022 16:03:41 +0300 Subject: [PATCH 07/10] Concept sets search - add method reindex concept sets to configuration --- js/pages/configuration/configuration.html | 34 ++++++++++++++++------ js/pages/configuration/configuration.js | 35 +++++++++++++++++++++++ js/pages/configuration/configuration.less | 13 +++++++++ js/services/ConceptSet.js | 7 ++++- js/styles/atlas.css | 1 - 5 files changed, 80 insertions(+), 10 deletions(-) diff --git a/js/pages/configuration/configuration.html b/js/pages/configuration/configuration.html index 85e6aead5..d37dfa191 100644 --- a/js/pages/configuration/configuration.html +++ b/js/pages/configuration/configuration.html @@ -4,18 +4,31 @@
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+ + ( + )
+
+
+
+
+
+
+
+
- ( - ) +
+
@@ -130,6 +143,11 @@
+
+ +
diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index 1f7586dd7..de4037e67 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -13,6 +13,7 @@ define([ 'services/Poll', 'services/job/jobDetail', 'services/CacheAPI', + 'services/ConceptSet', 'less!./configuration.less', 'components/heading' ], function ( @@ -30,6 +31,7 @@ define([ {PollService}, jobDetail, cacheApi, + conceptSetService ) { class Configuration extends AutoBind(Page) { constructor(params) { @@ -82,8 +84,38 @@ define([ callback: () => this.checkJobs(), interval: 5000 }); + + this.searchAvailable = ko.observable(false); + + this.checkSearchAvailable(); } + async checkSearchAvailable () { + this.loading(true); + try { + const data = await conceptSetService.checkSearchAvailable(); + this.searchAvailable(data); + } catch(e) { + throw new Error(e); + } finally { + this.loading(false); + } + }; + + async reindexConceptSets () { + const confirmAction = confirm(ko.unwrap(ko.i18n('configuration.confirms.reindexSource', 'Reindexing may take a long time. It depends on amount and complexity of concept sets'))); + if (!confirmAction) { + return; + } + const sourceKey = this.sharedState.sourceKeyOfVocabUrl(); + try { + const data = await conceptSetService.reindexConceptSets(sourceKey); + + } catch(e) { + throw new Error(e); + } + }; + dispose() { PollService.stop(this.intervalId); } @@ -185,6 +217,9 @@ define([ var selectedSource = sharedState.sources().find((item) => { return item.vocabularyUrl === newVocabUrl; }); sharedState.priorityScope() === 'application' && sharedState.defaultVocabularyUrl(newVocabUrl); this.updateSourceDaimonPriority(selectedSource.sourceKey, 'Vocabulary'); + if (this.searchAvailable()) { + alert(ko.unwrap(ko.i18n('configuration.alerts.changeSource', 'You are changing current source, we recommend you to do reindexing concept sets'))); + } return true; }; diff --git a/js/pages/configuration/configuration.less b/js/pages/configuration/configuration.less index 0567e502b..9a9ef7dae 100644 --- a/js/pages/configuration/configuration.less +++ b/js/pages/configuration/configuration.less @@ -16,4 +16,17 @@ &__manage-btn { width: 175px; } +} + +.status-container { + display: flex; + flex-direction: column; + align-items: flex-start; +} +.status { + display: flex; + margin-bottom: 8px; + :last-child { + margin-bottom: 0; + } } \ No newline at end of file diff --git a/js/services/ConceptSet.js b/js/services/ConceptSet.js index e223b4e46..e51d4549f 100644 --- a/js/services/ConceptSet.js +++ b/js/services/ConceptSet.js @@ -40,6 +40,10 @@ define(function (require) { return httpService.doGet(config.api.url + 'conceptset/searchAvailable').then(({ data }) => data); } + function reindexConceptSets(sourceKey) { + return httpService.doGet(`${config.api.url}${sourceKey}/index`).then(({ data }) => data); + } + function lookupIdentifiers(identifiers) { return httpService.doPost(sharedState.vocabularyUrl() + 'lookup/identifiers', identifiers); } @@ -150,7 +154,8 @@ define(function (require) { updateVersion, copyVersion, searchConceptSets, - checkSearchAvailable + checkSearchAvailable, + reindexConceptSets }; return api; diff --git a/js/styles/atlas.css b/js/styles/atlas.css index ecfdb1ae0..224231c26 100644 --- a/js/styles/atlas.css +++ b/js/styles/atlas.css @@ -601,7 +601,6 @@ th { .configureHeader .left{ display: flex; - align-items: center; box-sizing: border-box; } From 53b4cf2161dfcd31757783ebe625f3641f12c797 Mon Sep 17 00:00:00 2001 From: Anton Abushkevich Date: Fri, 25 Nov 2022 13:36:07 +0300 Subject: [PATCH 08/10] Concept sets search - reindex and search small fixes, async reindex initial, WIP --- js/pages/configuration/configuration.html | 3 +-- js/pages/configuration/configuration.js | 3 +-- js/services/ConceptSet.js | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/js/pages/configuration/configuration.html b/js/pages/configuration/configuration.html index d37dfa191..a3591c68e 100644 --- a/js/pages/configuration/configuration.html +++ b/js/pages/configuration/configuration.html @@ -24,8 +24,7 @@
-
- +
diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index de4037e67..0aae4704a 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -107,9 +107,8 @@ define([ if (!confirmAction) { return; } - const sourceKey = this.sharedState.sourceKeyOfVocabUrl(); try { - const data = await conceptSetService.reindexConceptSets(sourceKey); + const data = await conceptSetService.reindexConceptSets(); } catch(e) { throw new Error(e); diff --git a/js/services/ConceptSet.js b/js/services/ConceptSet.js index e51d4549f..520b8d0e7 100644 --- a/js/services/ConceptSet.js +++ b/js/services/ConceptSet.js @@ -40,8 +40,9 @@ define(function (require) { return httpService.doGet(config.api.url + 'conceptset/searchAvailable').then(({ data }) => data); } - function reindexConceptSets(sourceKey) { - return httpService.doGet(`${config.api.url}${sourceKey}/index`).then(({ data }) => data); + function reindexConceptSets() { + const sourceKey = sharedState.sourceKeyOfVocabUrl(); + return httpService.doGet(`${config.api.url}conceptset/${sourceKey}/index`).then(({ data }) => data); } function lookupIdentifiers(identifiers) { From cf830a69b64b799f821b9d632a8d6a9d21d24fc2 Mon Sep 17 00:00:00 2001 From: ssuvorov-fls Date: Wed, 30 Nov 2022 12:19:22 +0300 Subject: [PATCH 09/10] added progress indication for reindexing --- js/pages/configuration/configuration.html | 5 +- js/pages/configuration/configuration.js | 65 ++++++++++++++++++++--- js/services/ConceptSet.js | 8 ++- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/js/pages/configuration/configuration.html b/js/pages/configuration/configuration.html index a3591c68e..1c8e7039e 100644 --- a/js/pages/configuration/configuration.html +++ b/js/pages/configuration/configuration.html @@ -143,8 +143,9 @@
-
diff --git a/js/pages/configuration/configuration.js b/js/pages/configuration/configuration.js index 0aae4704a..c211e759f 100644 --- a/js/pages/configuration/configuration.js +++ b/js/pages/configuration/configuration.js @@ -44,6 +44,7 @@ define([ this.jobListing = sharedState.jobListing; this.sourceJobs = new Map(); this.sources = sharedState.sources; + this.reindexJob = ko.observable(); this.priorityOptions = [ {id: 'session', name: ko.i18n('configuration.priorityOptions.session', 'Current Session')}, @@ -81,7 +82,10 @@ define([ }); this.intervalId = PollService.add({ - callback: () => this.checkJobs(), + callback: () => { + this.checkJobs(); + this.checkReindexJob(); + }, interval: 5000 }); @@ -100,20 +104,24 @@ define([ } finally { this.loading(false); } - }; + } - async reindexConceptSets () { + async reindexConceptSets() { const confirmAction = confirm(ko.unwrap(ko.i18n('configuration.confirms.reindexSource', 'Reindexing may take a long time. It depends on amount and complexity of concept sets'))); if (!confirmAction) { return; } try { - const data = await conceptSetService.reindexConceptSets(); - + const data =await conceptSetService.reindexConceptSets(); + if (data.status === 'RUNNING') { + alert(ko.unwrap(ko.i18n('configuration.alerts.reindexRunning', 'Reindexing of concept sets is currently in progress'))); + } else { + this.reindexJob(data); + } } catch(e) { throw new Error(e); } - }; + } dispose() { PollService.stop(this.intervalId); @@ -141,6 +149,21 @@ define([ }); } + async checkReindexJob() { + try { + let data; + if (this.reindexJob()) { + data = await conceptSetService.statusReindexConceptSets(this.reindexJob().executionId); + } else { + data = await conceptSetService.statusReindexConceptSets(); + } + this.reindexJob(data); + } catch(e) { + this.reindexJob(null); + throw new Error(e); + } + } + async onPageCreated() { this.loading(true); await sourceApi.initSourcesConfig(); @@ -271,6 +294,36 @@ define([ return this.getButtonStyles(source.connectionCheck()); } + getReindexButtonStyles() { + let iconClass = 'fa-caret-right'; + let buttonClass = 'btn-primary'; + let state = sourceApi.buttonCheckState.unknown; + if (this.reindexJob()) { + switch(this.reindexJob().status) { + case 'COMPLETED': + state = sourceApi.buttonCheckState.success; + break; + case 'FAILED': + state = sourceApi.buttonCheckState.failed; + break; + case 'CREATED': + case 'RUNNING': + state = sourceApi.buttonCheckState.checking; + break; + } + } + return this.getButtonStyles(state); + } + + getReindexButtonTitle() { + if (this.reindexJob() && this.reindexJob().status !== 'UNAVAILABLE') { + return ko.unwrap(ko.i18nformat('configuration.buttons.reindexCSStatus', 'Concept Sets Reindex (<%=doneCount%> of <%=maxCount%>)', + {doneCount: this.reindexJob().doneCount, maxCount: this.reindexJob().maxCount})()); + } else { + return ko.unwrap(ko.i18n('configuration.buttons.reindexCS', 'Concept Sets Reindex')); + } + } + getButtonStyles(sourceState) { let iconClass = 'fa-caret-right'; let buttonClass = 'btn-primary'; diff --git a/js/services/ConceptSet.js b/js/services/ConceptSet.js index 520b8d0e7..cbac0d215 100644 --- a/js/services/ConceptSet.js +++ b/js/services/ConceptSet.js @@ -45,6 +45,11 @@ define(function (require) { return httpService.doGet(`${config.api.url}conceptset/${sourceKey}/index`).then(({ data }) => data); } + function statusReindexConceptSets(jobExecutionId) { + const sourceKey = sharedState.sourceKeyOfVocabUrl(); + return httpService.doGet(`${config.api.url}conceptset/${sourceKey}/index/${jobExecutionId || -1}/status`).then(({ data }) => data); + } + function lookupIdentifiers(identifiers) { return httpService.doPost(sharedState.vocabularyUrl() + 'lookup/identifiers', identifiers); } @@ -156,7 +161,8 @@ define(function (require) { copyVersion, searchConceptSets, checkSearchAvailable, - reindexConceptSets + reindexConceptSets, + statusReindexConceptSets }; return api; From 771e8c2891619c1a1737ad6a044091a613e5e41f Mon Sep 17 00:00:00 2001 From: Anton Abushkevich Date: Thu, 1 Dec 2022 00:38:09 +0300 Subject: [PATCH 10/10] Concept sets search - UI rework --- .../advancedSearch/advancedSearch.html | 2 +- .../circe/components/ConceptSetBrowser.js | 22 ++++++++----------- .../components/ConceptSetBrowserTemplate.html | 4 ---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/js/components/advancedSearch/advancedSearch.html b/js/components/advancedSearch/advancedSearch.html index 1fc3fa160..0c60f1adb 100644 --- a/js/components/advancedSearch/advancedSearch.html +++ b/js/components/advancedSearch/advancedSearch.html @@ -35,7 +35,7 @@ element: 'input', extra: 'form-control' }), - placeholder: ko.i18n('search.placeholder', 'Type your search here'), + placeholder: ko.i18n('cs.browser.searchQueryPlaceholder', 'Search by Concept ID, Concept Code, Concept Name'), disable: loading()" />
diff --git a/js/components/circe/components/ConceptSetBrowser.js b/js/components/circe/components/ConceptSetBrowser.js index 7c5752df1..5a2f0d6eb 100644 --- a/js/components/circe/components/ConceptSetBrowser.js +++ b/js/components/circe/components/ConceptSetBrowser.js @@ -187,29 +187,25 @@ define([ // advanced search this.showSearch = ko.observable(false); - this.toggleShowSearch = function () { - this.showSearch(!this.showSearch()); - }; - this.searchAvailable = ko.observable(false); - self.searchConceptSets = async function (searchParams) { + + self.checkSearchAvailable = async function () { self.loading(true); try { - const data = await conceptSetService.searchConceptSets(searchParams); - - prepareDataTable(data); - self.repositoryConceptSets(data); + const data = await conceptSetService.checkSearchAvailable(); + self.showSearch(data); } catch(e) { throw new Error(e); } finally { self.loading(false); } }; - - self.checkSearchAvailable = async function () { + self.searchConceptSets = async function (searchParams) { self.loading(true); try { - const data = await conceptSetService.checkSearchAvailable(); - self.searchAvailable(data); + const data = await conceptSetService.searchConceptSets(searchParams); + + prepareDataTable(data); + self.repositoryConceptSets(data); } catch(e) { throw new Error(e); } finally { diff --git a/js/components/circe/components/ConceptSetBrowserTemplate.html b/js/components/circe/components/ConceptSetBrowserTemplate.html index 97d59be2a..00dd33eb7 100644 --- a/js/components/circe/components/ConceptSetBrowserTemplate.html +++ b/js/components/circe/components/ConceptSetBrowserTemplate.html @@ -7,10 +7,6 @@
- - - -