Skip to content

Commit

Permalink
conditionally hide or show manage namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkeychip committed Mar 5, 2020
1 parent e66ce6d commit 57798d7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ui/app/components/namespace-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default Component.extend({
store: service(),
namespace: null,
listCapability: null,
canList: alias('listCapability.canList'),
canList: false,

init() {
this._super(...arguments);
Expand All @@ -38,14 +38,13 @@ export default Component.extend({

fetchListCapability: task(function*() {
try {
if (this.listCapability) {
yield this.listCapability.reload();
return;
}
let capability = yield this.store.findRecord('capabilities', 'sys/namespaces/');
let capability = yield this.store.findRecord('capabilities', `sys/namespaces/`);
this.set('listCapability', capability);
this.set('canList', true);
} catch (e) {
//do nothing here
// If error out on findRecord call it's because you don't have permissions
// and therefor don't have permission to manage namespaces
this.set('canList', false);
}
}),
setForAnimation: task(function*() {
Expand Down

0 comments on commit 57798d7

Please sign in to comment.