From: Alfonso Martínez Date: Wed, 22 Jan 2020 15:05:12 +0000 (+0100) Subject: mgr/dashboard: disable 'Add Capability' button when all the capabilities are added X-Git-Tag: v14.2.8~95^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=27eb4d924cc00885b314c30b01aaad83c8a2fb5e;p=ceph.git mgr/dashboard: disable 'Add Capability' button when all the capabilities are added Fixes: https://tracker.ceph.com/issues/43564 Signed-off-by: Alfonso Martínez (cherry picked from commit 4ef0e2c1ba2c7c2b12556f5ee7a593ae4ba99144) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html - Change applied manually in conflicting file. --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-capabilities.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-capabilities.ts new file mode 100644 index 0000000000000..dac6986c761a9 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-user-capabilities.ts @@ -0,0 +1,15 @@ +export enum RgwUserAvailableCapability { + USERS = 'users', + BUCKETS = 'buckets', + METADATA = 'metadata', + USAGE = 'usage', + ZONE = 'zone' +} + +export class RgwUserCapabilities { + static readonly capabilities = RgwUserAvailableCapability; + + static getAll(): string[] { + return Object.values(RgwUserCapabilities.capabilities); + } +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts index f6d9d30ad5283..d890aa902eeff 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts @@ -8,6 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'; import { ActionLabelsI18n } from '../../../shared/constants/app.constants'; import { CdFormBuilder } from '../../../shared/forms/cd-form-builder'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; +import { RgwUserCapabilities } from '../models/rgw-user-capabilities'; import { RgwUserCapability } from '../models/rgw-user-capability'; @Component({ @@ -78,7 +79,7 @@ export class RgwUserCapabilityModalComponent { usedTypes.push(capability.type); }); this.types = []; - ['users', 'buckets', 'metadata', 'usage', 'zone'].forEach((type) => { + RgwUserCapabilities.getAll().forEach((type) => { if (_.indexOf(usedTypes, type) === -1) { this.types.push(type); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html index c41346c6bb064..8feb271497d36 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html @@ -391,6 +391,11 @@