From 57798d74c534972e8b1452b2bb0810578d9bc1fc Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Thu, 5 Mar 2020 09:48:14 -0700 Subject: [PATCH] conditionally hide or show manage namespaces --- ui/app/components/namespace-picker.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ui/app/components/namespace-picker.js b/ui/app/components/namespace-picker.js index 91f888cbddfe..57c73c851330 100644 --- a/ui/app/components/namespace-picker.js +++ b/ui/app/components/namespace-picker.js @@ -17,7 +17,7 @@ export default Component.extend({ store: service(), namespace: null, listCapability: null, - canList: alias('listCapability.canList'), + canList: false, init() { this._super(...arguments); @@ -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*() {