Feature Flags: Don't show activate options if user does not have permission

This commit is contained in:
Neil MacDougall 2021-02-25 15:16:10 +00:00
parent c71016ed8c
commit 9907b82baa
3 changed files with 19 additions and 1 deletions

View File

@ -2215,6 +2215,7 @@ sortableTable:
some: "Available for {actionable} of the {total} selected"
noData: There are no rows which match your search query.
noRows: There are no rows to show.
noActions: No actions available
paging:
generic: |-
{pages, plural,

View File

@ -85,6 +85,10 @@ export default {
action, args, opts
});
this.hide();
},
hasOptions(options) {
return options.length !== undefined ? options.length : Object.keys(options).length > 0;
}
},
};
@ -98,6 +102,9 @@ export default {
<i v-if="opt.icon" :class="{icon: true, [opt.icon]: true}" />
<span v-html="opt.label" />
</li>
<li v-if="!hasOptions(options)" class="no-actions">
<span v-t="'sortableTable.noActions'" />
</li>
</ul>
</div>
</template>
@ -138,6 +145,16 @@ export default {
.icon {
display: unset;
}
&.no-actions {
color: var(--disabled-text);
}
&.no-actions:hover {
background-color: initial;
color: var(--disabled-text);
cursor: default;
}
}
}

View File

@ -25,7 +25,7 @@ export default {
action: 'toggleFeatureFlag',
label: state ? 'Deactivate' : 'Activate',
icon: 'icon icon-edit',
enabled: true,
enabled: this.canUpdate,
};
out.unshift(enableAction);