Disable toolbar state button only for archived inventories [SCI-10531]

This commit is contained in:
sboursen-scinote 2024-04-24 15:47:25 +02:00
parent ffbf36e1e8
commit 67ba0c1c85
2 changed files with 4 additions and 2 deletions

View file

@ -20,14 +20,15 @@ export default {
props: { props: {
viewMode: { type: String, required: true }, viewMode: { type: String, required: true },
activeUrl: { type: String, required: true }, activeUrl: { type: String, required: true },
archivedUrl: { type: String, required: true } archivedUrl: { type: String, required: true },
disabled: { type: String, default: 'false' }
}, },
beforeDestroy() { beforeDestroy() {
delete window.initRepositoryStateMenu; delete window.initRepositoryStateMenu;
}, },
computed: { computed: {
disabled() { disabled() {
return this.viewMode === 'archived' ? ' disabled' : ''; return this.disabled === 'true' ? ' disabled' : '';
}, },
btnText() { btnText() {
return I18n.t(`toolbar.${this.viewMode}_state`); return I18n.t(`toolbar.${this.viewMode}_state`);

View file

@ -58,6 +58,7 @@
<div id='repositoryStateMenu' data-behaviour="vue"> <div id='repositoryStateMenu' data-behaviour="vue">
<repository-state-menu <repository-state-menu
view-mode="<%= view_mode %>" view-mode="<%= view_mode %>"
disabled="<%= @repository.archived? %>"
active-url="<%= repository_url(@repository) %>" active-url="<%= repository_url(@repository) %>"
archived-url="<%= repository_url(@repository, params: { archived: true }) %>"> archived-url="<%= repository_url(@repository, params: { archived: true }) %>">
</repository-state-menu> </repository-state-menu>