Skip to content

Commit

Permalink
added filtering of the permission management filter to conceptset-man…
Browse files Browse the repository at this point in the history
…ager
  • Loading branch information
rkboyce committed Jul 19, 2023
1 parent 1c0ae07 commit 498565a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion js/pages/concept-sets/conceptset-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
<!-- ko if: $component.currentConceptSet().id != null && $component.currentConceptSet().id != 0 -->
<button type="button" class="btn btn-primary" data-bind="click: () => isTagsModalShown(!isTagsModalShown()), visible: canEdit() && !previewVersion(), css: { disabled: isProcessing() }, title: ko.i18n('common.tags', 'Tags')"><i class="fa fa-tags"></i></button>
<button type="button" class="btn btn-primary" data-bind="visible: !previewVersion(), click: optimize, css: { disabled: !canOptimize() || isProcessing() }, text: ko.i18n('cs.manager.optimize', 'Optimize')"></button>
<button class="btn btn-primary" data-bind="visible: !previewVersion() && isOwner(), click: () => isAccessModalShown(!isAccessModalShown()), title: ko.i18n('common.configureAccess', 'Configure access')">
<!-- ko if: enablePermissionManagement -->
<button class="btn btn-primary" data-bind="visible: !previewVersion() && isOwner(), click: () => isAccessModalShown(!isAccessModalShown()), title: ko.i18n('common.configureAccess', 'Configure access')">
<i class="fa fa-lock"></i>
</button>
<!-- /ko -->

<button type="button" class="btn btn-danger" data-bind="visible: !previewVersion(), click: $component.delete, css: { disabled: !canDelete() || isProcessing() }, title: ko.i18n('common.delete', 'Delete')"><i class="fa fa-trash-alt"></i></button>
<!-- /ko -->
</div>
Expand Down
15 changes: 9 additions & 6 deletions js/pages/concept-sets/conceptset-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ define([
'text!./conceptset-manager.html',
'pages/Page',
'utils/AutoBind',
'utils/CommonUtils',
'appConfig',
'utils/CommonUtils',
'appConfig',
'./const',
'const',
'components/conceptset/utils',
Expand Down Expand Up @@ -46,11 +46,11 @@ define([
'components/ac-access-denied',
'components/versions/versions'
], function (
ko,
ko,
view,
Page,
AutoBind,
commonUtils,
commonUtils,
config,
constants,
globalConstants,
Expand All @@ -75,7 +75,7 @@ define([
constructor(params) {
super(params);
this.commonUtils = commonUtils;
this.conceptSetStore = ConceptSetStore.repository();
this.conceptSetStore = ConceptSetStore.repository();
this.selectedSource = ko.observable();
this.currentConceptSet = ko.pureComputed(() => this.conceptSetStore.current());
this.previewVersion = sharedState.currentConceptSetPreviewVersion;
Expand Down Expand Up @@ -174,6 +174,9 @@ define([
this.canCopy = ko.computed(() => {
return this.currentConceptSet() && this.currentConceptSet().id > 0;
});
this.enablePermissionManagement = ko.pureComputed(() => {
return config.enablePermissionManagement;
});
this.isSaving = ko.observable(false);
this.isDeleting = ko.observable(false);
this.isOptimizing = ko.observable(false);
Expand Down Expand Up @@ -363,7 +366,7 @@ define([
}
});

this.conceptSetStore.isEditable(this.canEdit());
this.conceptSetStore.isEditable(this.canEdit());
this.subscriptions.push(this.conceptSetStore.observer.subscribe(async () => {
// when the conceptSetStore changes (either through a new concept set being loaded or changes to concept set options), the concept set resolves and the view is refreshed.
// this must be done within the same subscription due to the asynchronous nature of the AJAX and UI interface (ie: user can switch tabs at any time)
Expand Down

0 comments on commit 498565a

Please sign in to comment.