From 1d6826dad164da6af0f55cc20b3a26d71bab76d9 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 11:02:15 +0800 Subject: [PATCH 01/13] Add more custom UI for storage classes --- app/models/storageclass.js | 24 ++--- .../provisioner-azure-disk/component.js | 93 ++++++++++++++++ .../provisioner-azure-disk/template.hbs | 101 ++++++++++++++++++ .../provisioner-azure-file/component.js | 93 ++++++++++++++++ .../provisioner-azure-file/template.hbs | 101 ++++++++++++++++++ .../provisioner-cinder/component.js | 93 ++++++++++++++++ .../provisioner-cinder/template.hbs | 101 ++++++++++++++++++ .../provisioner-gce-pd/component.js | 93 ++++++++++++++++ .../provisioner-gce-pd/template.hbs | 101 ++++++++++++++++++ .../provisioner-glusterfs/component.js | 93 ++++++++++++++++ .../provisioner-glusterfs/template.hbs | 101 ++++++++++++++++++ .../provisioner-portworx-volume/component.js | 93 ++++++++++++++++ .../provisioner-portworx-volume/template.hbs | 101 ++++++++++++++++++ .../provisioner-quobyte/component.js | 93 ++++++++++++++++ .../provisioner-quobyte/template.hbs | 101 ++++++++++++++++++ .../provisioner-rbd/component.js | 93 ++++++++++++++++ .../provisioner-rbd/template.hbs | 101 ++++++++++++++++++ .../provisioner-scaleio/component.js | 93 ++++++++++++++++ .../provisioner-scaleio/template.hbs | 101 ++++++++++++++++++ .../provisioner-storageos/component.js | 93 ++++++++++++++++ .../provisioner-storageos/template.hbs | 101 ++++++++++++++++++ .../provisioner-vsphere-volume/component.js | 93 ++++++++++++++++ .../provisioner-vsphere-volume/template.hbs | 101 ++++++++++++++++++ .../provisioner-azure-disk/component.js | 1 + .../provisioner-azure-file/component.js | 1 + .../provisioner-cinder/component.js | 1 + .../provisioner-gce-pd/component.js | 1 + .../provisioner-glusterfs/component.js | 1 + .../provisioner-portworx-volume/component.js | 1 + .../provisioner-quobyte/component.js | 1 + .../provisioner-rbd/component.js | 1 + .../provisioner-scaleio/component.js | 1 + .../provisioner-storageos/component.js | 1 + .../provisioner-vsphere-volume/component.js | 1 + 34 files changed, 2157 insertions(+), 12 deletions(-) create mode 100644 lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-azure-file/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-cinder/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-quobyte/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-rbd/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-scaleio/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-storageos/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs create mode 100644 lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js create mode 100644 lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs create mode 100644 lib/shared/app/components/storage-class/provisioner-azure-disk/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-azure-file/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-cinder/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-gce-pd/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-glusterfs/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-portworx-volume/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-quobyte/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-rbd/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-scaleio/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-storageos/component.js create mode 100644 lib/shared/app/components/storage-class/provisioner-vsphere-volume/component.js diff --git a/app/models/storageclass.js b/app/models/storageclass.js index 26294ac11..9a5758e04 100644 --- a/app/models/storageclass.js +++ b/app/models/storageclass.js @@ -6,18 +6,18 @@ import { all } from 'rsvp'; const DEFAULT_ANNOTATION = 'storageclass.kubernetes.io/is-default-class'; const PROVISIONERS = []; -registerProvisioner('aws-ebs', 'kubernetes.io/aws-ebs', true); -registerProvisioner('gce-pd', 'kubernetes.io/gce-pd', ); -registerProvisioner('glusterfs', 'kubernetes.io/glusterfs', ); -registerProvisioner('cinder', 'kubernetes.io/cinder', ); -registerProvisioner('vsphere-volume', 'kubernetes.io/vpshere-volume', ); -registerProvisioner('rbd', 'kubernetes.io/rbd', ); -registerProvisioner('quobyte', 'kubernetes.io/quobyte', ); -registerProvisioner('azure-disk', 'kubernetes.io/azure-disk', ); -registerProvisioner('azure-file', 'kubernetes.io/azure-file', ); -registerProvisioner('portworx-volume','kubernetes.io/portworx-volume',); -registerProvisioner('scaleio', 'kubernetes.io/scaleio', ); -registerProvisioner('storageos', 'kubernetes.io/storageos', ); +registerProvisioner('aws-ebs', 'kubernetes.io/aws-ebs', true); +registerProvisioner('gce-pd', 'kubernetes.io/gce-pd', true); +registerProvisioner('glusterfs', 'kubernetes.io/glusterfs', true); +registerProvisioner('cinder', 'kubernetes.io/cinder', true); +registerProvisioner('vsphere-volume', 'kubernetes.io/vpshere-volume', true); +registerProvisioner('rbd', 'kubernetes.io/rbd', true); +registerProvisioner('quobyte', 'kubernetes.io/quobyte', true); +registerProvisioner('azure-disk', 'kubernetes.io/azure-disk', true); +registerProvisioner('azure-file', 'kubernetes.io/azure-file', true); +registerProvisioner('portworx-volume','kubernetes.io/portworx-volume', true); +registerProvisioner('scaleio', 'kubernetes.io/scaleio', true); +registerProvisioner('storageos', 'kubernetes.io/storageos', true); export function registerProvisioner(name, provisioner, component) { if ( component === true ) { diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs b/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs b/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-cinder/component.js b/lib/shared/addon/components/storage-class/provisioner-cinder/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-cinder/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs b/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js b/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs b/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js b/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs b/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs b/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-rbd/component.js b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs b/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs b/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-storageos/component.js b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs b/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js new file mode 100644 index 000000000..0c9272ae1 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js @@ -0,0 +1,93 @@ +import Component from '@ember/component'; +import layout from './template'; +import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; +import { get, setProperties, computed, observer } from '@ember/object'; + +export const VOLUME_TYPES = [ + 'gp2', + 'io1', + 'st1', + 'sc1', +]; + +export default Component.extend(StorageClassProvisioner, { + layout, + volumeTypes: VOLUME_TYPES, + + volumeType: null, + zones: null, + zoneAutomatic: null, + iopsPerGB: null, + encrypted: true, + kmsKeyId: null, + kmsAutomatic: null, + + didReceiveAttrs() { + const changes = {}; + + changes['volumeType'] = get(this, 'parameters.type')||'gp2'; + changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + + const zone = get(this, 'parameters.zone'); + const zones = get(this, 'parameters.zones'); + if ( zones && zones.length ) { + changes['zoneAutomatic'] = false; + changes['zones'] = zones; + } else if ( zone ) { + changes['zoneAutomatic'] = false; + changes['zones'] = 'zone'; + } else { + changes['zoneAutomatic'] = true; + changes['zones'] = ''; + } + + changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; + + const key = get(this, 'parameters.kmsKeyId'); + if ( key ) { + changes['kmsKeyId'] = key; + changes['kmsAutomatic'] = false; + } else { + changes['kmsAutomatic'] = true; + } + + setProperties(this, changes); + }, + + sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + const type = get(this, 'volumeType'); + const out = { + type: type, + }; + + const zoneAutomatic = get(this, 'zoneAutomatic'); + if ( !zoneAutomatic ) { + const zones = (get(this, 'zones')||'').trim(); + if ( zones ) { + out['zones'] = zones; + } + } + + if ( get(this, 'supportsIops') ) { + out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; + } + + const encrypted = get(this, 'encrypted'); + const kmsKeyId = get(this, 'kmsKeyId'); + const kmsAutomatic = get(this, 'kmsAutomatic'); + if ( encrypted ) { + out['encrypted'] = 'true'; + if ( !kmsAutomatic && kmsKeyId ) { + out['kmsKeyId'] = kmsKeyId; + } + } else { + out['encrypted'] = 'false'; + } + + this.sendAction('changed', out); + }), + + supportsIops: computed('volumeType', function() { + return !!get(this, 'volumeType').match(/^io\d+$/); + }) +}); diff --git a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs new file mode 100644 index 000000000..2da736b95 --- /dev/null +++ b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs @@ -0,0 +1,101 @@ +
+
+ + {{#if editing}} + {{#each volumeTypes as |name|}} +
+ +
+ {{/each}} + {{else}} + {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{/if}} + + {{#if supportsIops}} + + {{#if editing}} +
+ {{input-integer classNames="form-control" value=iopsPerGB}} + {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} +
+ {{else}} + {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} + {{/if}} + {{/if}} + +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{#unless zoneAutomatic}} + {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{/unless}} + {{else}} + {{#if zoneAutomatic}} + {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{else}} + {{zones}} + {{/if}} + {{/if}} +
+
+ + {{#if editing}} +
+ +
+
+ +
+ {{else}} + {{t (if encrypted 'generic.enabled' 'generic.disabled')}} + {{/if}} + + {{#if encrypted}} + + {{#if editing}} +
+ +
+
+ +
+ + {{#unless kmsAutomatic}} + {{input value=kmsKeyId}} + {{/unless}} + {{else if kmsAutomatic}} + {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} + {{else}} + {{kmsKeyId}} + {{/if}} + {{/if}} +
+
diff --git a/lib/shared/app/components/storage-class/provisioner-azure-disk/component.js b/lib/shared/app/components/storage-class/provisioner-azure-disk/component.js new file mode 100644 index 000000000..bc0e7fe8f --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-azure-disk/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-azure-disk/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-azure-file/component.js b/lib/shared/app/components/storage-class/provisioner-azure-file/component.js new file mode 100644 index 000000000..0f6c07677 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-azure-file/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-azure-file/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-cinder/component.js b/lib/shared/app/components/storage-class/provisioner-cinder/component.js new file mode 100644 index 000000000..7bebfc451 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-cinder/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-cinder/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-gce-pd/component.js b/lib/shared/app/components/storage-class/provisioner-gce-pd/component.js new file mode 100644 index 000000000..86ba9929b --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-gce-pd/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-gce-pd/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-glusterfs/component.js b/lib/shared/app/components/storage-class/provisioner-glusterfs/component.js new file mode 100644 index 000000000..a9c5cfd48 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-glusterfs/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-glusterfs/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-portworx-volume/component.js b/lib/shared/app/components/storage-class/provisioner-portworx-volume/component.js new file mode 100644 index 000000000..6f7cfe82f --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-portworx-volume/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-portworx-volume/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-quobyte/component.js b/lib/shared/app/components/storage-class/provisioner-quobyte/component.js new file mode 100644 index 000000000..3f9a188ac --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-quobyte/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-quobyte/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-rbd/component.js b/lib/shared/app/components/storage-class/provisioner-rbd/component.js new file mode 100644 index 000000000..d8708fb53 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-rbd/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-rbd/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-scaleio/component.js b/lib/shared/app/components/storage-class/provisioner-scaleio/component.js new file mode 100644 index 000000000..de8c5a13f --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-scaleio/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-scaleio/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-storageos/component.js b/lib/shared/app/components/storage-class/provisioner-storageos/component.js new file mode 100644 index 000000000..71bfe91e7 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-storageos/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-storageos/component'; diff --git a/lib/shared/app/components/storage-class/provisioner-vsphere-volume/component.js b/lib/shared/app/components/storage-class/provisioner-vsphere-volume/component.js new file mode 100644 index 000000000..703ab5448 --- /dev/null +++ b/lib/shared/app/components/storage-class/provisioner-vsphere-volume/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/storage-class/provisioner-vsphere-volume/component'; From 678de58b1ef06bb184854deb6988f5bab5041740 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 11:39:56 +0800 Subject: [PATCH 02/13] Add gce storage class UI --- .../provisioner-aws-ebs/template.hbs | 2 +- .../provisioner-gce-pd/component.js | 47 ++---------- .../provisioner-gce-pd/template.hbs | 74 ++----------------- translations/en-us.yaml | 12 ++- 4 files changed, 25 insertions(+), 110 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-aws-ebs/template.hbs b/lib/shared/addon/components/storage-class/provisioner-aws-ebs/template.hbs index 2da736b95..6ff127568 100644 --- a/lib/shared/addon/components/storage-class/provisioner-aws-ebs/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-aws-ebs/template.hbs @@ -43,7 +43,7 @@ {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{textarea-autogrow placeholder="cruStorageClass.aws-ebs.zone.placeholder" spellcheck="false" required=true value=zones}} {{/unless}} {{else}} {{#if zoneAutomatic}} diff --git a/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js b/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js index 0c9272ae1..5ca6c20fd 100644 --- a/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-gce-pd/component.js @@ -4,10 +4,8 @@ import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; import { get, setProperties, computed, observer } from '@ember/object'; export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', + 'pd-standard', + 'pd-ssd', ]; export default Component.extend(StorageClassProvisioner, { @@ -17,16 +15,11 @@ export default Component.extend(StorageClassProvisioner, { volumeType: null, zones: null, zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, didReceiveAttrs() { const changes = {}; - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; + changes['volumeType'] = get(this, 'parameters.type')||'pd-standard'; const zone = get(this, 'parameters.zone'); const zones = get(this, 'parameters.zones'); @@ -35,26 +28,16 @@ export default Component.extend(StorageClassProvisioner, { changes['zones'] = zones; } else if ( zone ) { changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; + changes['zones'] = zone; } else { changes['zoneAutomatic'] = true; changes['zones'] = ''; } - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - setProperties(this, changes); }, - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { + sendUpdate: observer('volumeType','zones','zoneAutomatic', function() { const type = get(this, 'volumeType'); const out = { type: type, @@ -68,26 +51,6 @@ export default Component.extend(StorageClassProvisioner, { } } - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); }) }); diff --git a/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs b/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs index 2da736b95..5cbb43947 100644 --- a/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-gce-pd/template.hbs @@ -1,101 +1,43 @@
- + {{#if editing}} {{#each volumeTypes as |name|}}
{{/each}} {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} + {{t (concat 'cruStorageClass.gce-pd.type.' volumeType)}} {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} -
- + {{#if editing}}
{{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} + {{textarea-autogrow placeholder="cruStorageClass.gce-pd.zone.placeholder" spellcheck="false" required=true value=zones}} {{/unless}} {{else}} {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} + {{t 'cruStorageClass.gce-pd.zone.automatic'}} {{else}} {{zones}} {{/if}} {{/if}}
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 122141152..9f1eb240f 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1753,6 +1753,7 @@ cruStorageClass: label: Availability Zone automatic: "Automatic: Zones the cluster has a node in" manual: "Manual: Choose specific zones" + placeholder: "us-east-1d, us-east-1c" iopsPerGB: label: Provisioned IOPS unit: per second, per GB @@ -1762,7 +1763,16 @@ cruStorageClass: label: KMS Key ID for Encryption automatic: "Automatic: Generate a key" manual: "Manual: Use a specific key (full ARN)" - + gce-pd: + type: + label: Volume Type + pd-standard: 'Standard' + pd-ssd: 'SSD' + zone: + label: Availability Zone + automatic: "Automatic: Zones the cluster has a node in" + manual: "Manual: Choose specific zones" + placeholder: "us-central1-a, us-central1-b" dangerZone: header: Advanced Settings From 05a2a309f5a85b70f393803a4b489a7a7b315cbb Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 12:00:01 +0800 Subject: [PATCH 03/13] Add detail page and edit page storage class --- .../storage-classes/detail/edit/controller.js | 9 +++++++ .../storage-classes/detail/edit/route.js | 9 +++++++ .../storage-classes/detail/edit/template.hbs | 6 +++++ .../storage-classes/detail/index/template.hbs | 4 ++++ .../cluster/storage-classes/detail/route.js | 9 +++++++ .../storage-classes/index/template.hbs | 2 +- app/models/storageclass.js | 2 ++ .../components/cru-storage-class/template.hbs | 9 +++---- .../components/form-value-array/template.hbs | 2 ++ translations/en-us.yaml | 24 +++++++++++++++++++ 10 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 app/authenticated/cluster/storage-classes/detail/edit/controller.js create mode 100644 app/authenticated/cluster/storage-classes/detail/edit/route.js create mode 100644 app/authenticated/cluster/storage-classes/detail/edit/template.hbs create mode 100644 app/authenticated/cluster/storage-classes/detail/index/template.hbs create mode 100644 app/authenticated/cluster/storage-classes/detail/route.js diff --git a/app/authenticated/cluster/storage-classes/detail/edit/controller.js b/app/authenticated/cluster/storage-classes/detail/edit/controller.js new file mode 100644 index 000000000..197a564fd --- /dev/null +++ b/app/authenticated/cluster/storage-classes/detail/edit/controller.js @@ -0,0 +1,9 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + actions: { + back() { + this.transitionToRoute('authenticated.cluster.storage-classes'); + }, + }, +}); diff --git a/app/authenticated/cluster/storage-classes/detail/edit/route.js b/app/authenticated/cluster/storage-classes/detail/edit/route.js new file mode 100644 index 000000000..8e7606910 --- /dev/null +++ b/app/authenticated/cluster/storage-classes/detail/edit/route.js @@ -0,0 +1,9 @@ +import Route from '@ember/routing/route'; +import { set } from '@ember/object'; + +export default Route.extend({ + model() { + const original = this.modelFor('authenticated.cluster.storage-classes.detail'); + return original.clone(); + }, +}); diff --git a/app/authenticated/cluster/storage-classes/detail/edit/template.hbs b/app/authenticated/cluster/storage-classes/detail/edit/template.hbs new file mode 100644 index 000000000..2d363d662 --- /dev/null +++ b/app/authenticated/cluster/storage-classes/detail/edit/template.hbs @@ -0,0 +1,6 @@ +{{cru-storage-class + mode="edit" + model=model + done=(action "back") + cancel=(action "back") +}} \ No newline at end of file diff --git a/app/authenticated/cluster/storage-classes/detail/index/template.hbs b/app/authenticated/cluster/storage-classes/detail/index/template.hbs new file mode 100644 index 000000000..cabd27c4f --- /dev/null +++ b/app/authenticated/cluster/storage-classes/detail/index/template.hbs @@ -0,0 +1,4 @@ +{{cru-storage-class + mode="view" + model=model +}} diff --git a/app/authenticated/cluster/storage-classes/detail/route.js b/app/authenticated/cluster/storage-classes/detail/route.js new file mode 100644 index 000000000..3a98bb1b4 --- /dev/null +++ b/app/authenticated/cluster/storage-classes/detail/route.js @@ -0,0 +1,9 @@ +import { get } from '@ember/object'; +import Route from '@ember/routing/route'; + +export default Route.extend({ + model(params) { + const store = get(this, 'clusterStore'); + return store.find('storageClass', params.storage_class_id) + }, +}); diff --git a/app/authenticated/cluster/storage-classes/index/template.hbs b/app/authenticated/cluster/storage-classes/index/template.hbs index 9db3f26c8..898917cee 100644 --- a/app/authenticated/cluster/storage-classes/index/template.hbs +++ b/app/authenticated/cluster/storage-classes/index/template.hbs @@ -27,7 +27,7 @@ {{badge-state model=obj}} - {{obj.displayName}} + {{obj.displayName}} {{obj.displayProvisioner}} diff --git a/app/models/storageclass.js b/app/models/storageclass.js index 9a5758e04..e182fb1ea 100644 --- a/app/models/storageclass.js +++ b/app/models/storageclass.js @@ -42,6 +42,7 @@ export function getProvisioners() { export default Resource.extend({ clusterStore: service(), + router: service(), type: 'storageClass', state: 'active', @@ -60,6 +61,7 @@ export default Resource.extend({ }, edit() { + get(this,'router').transitionTo('authenticated.cluster.storage-classes.detail.edit', get(this,'id')); }, }, diff --git a/lib/shared/addon/components/cru-storage-class/template.hbs b/lib/shared/addon/components/cru-storage-class/template.hbs index 85ee30dbe..aec7c93a5 100644 --- a/lib/shared/addon/components/cru-storage-class/template.hbs +++ b/lib/shared/addon/components/cru-storage-class/template.hbs @@ -16,9 +16,9 @@ {{else}} {{form-name-description model=primaryResource - nameRequired=true - namePlaceholder="newSecret.name.placeholder" - descriptionPlaceholder="newSecret.description.placeholder" + nameRequired=false + namePlaceholder="cruStorageClass.name.placeholder" + descriptionPlaceholder="cruStorageClass.description.placeholder" }} {{/if}} @@ -95,7 +95,7 @@
@@ -104,6 +104,7 @@
{{form-value-array initialValues=primaryResource.mountOptions + editing=(not isView) valueLabel="cruStorageClass.mountOptions.label" addActionLabel="cruStorageClass.mountOptions.addActionLabel" changed=(action "updateOptions") diff --git a/lib/shared/addon/components/form-value-array/template.hbs b/lib/shared/addon/components/form-value-array/template.hbs index 9423c08d0..27a9a1b33 100644 --- a/lib/shared/addon/components/form-value-array/template.hbs +++ b/lib/shared/addon/components/form-value-array/template.hbs @@ -20,6 +20,8 @@ {{/each}} +{{else if (not editing)}} + {{t 'formValueArray.noData'}} {{/if}} {{#if editing}} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 9f1eb240f..e5338984b 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1719,6 +1719,10 @@ cruRegistry: saved: Saved cruStorageClass: + name: + placeholder: e.g. storage + description: + placeholder: e.g. AWS EBS Storage title: new: Add Storage Class edit: 'Edit Storage Class: {name}' @@ -1773,6 +1777,25 @@ cruStorageClass: automatic: "Automatic: Zones the cluster has a node in" manual: "Manual: Choose specific zones" placeholder: "us-central1-a, us-central1-b" + glusterfs: + resturl: + label: REST URL + restuser: + label: REST User + restuserkey: + label: REST User Key + secretNamespace: + label: Secret Namespace + secretName: + label: Secret Name + clusterid: + label: Cluster ID + gidMin: + label: GID MIN + gidMax: + label: GID MAX + volumetype: + label: Volume Type dangerZone: header: Advanced Settings @@ -2860,6 +2883,7 @@ formValueArray: addActionLabel: Add Value valueLabel: Value valuePlaceholder: Value + noData: No Data protip: "ProTip: Paste one or more lines of values into any field for easy bulk entry." formVolumeRow: From 69a1396d921ccd3651ee82e84c6e0d57b9036c21 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 14:40:12 +0800 Subject: [PATCH 04/13] Add Glusterfs storage class UI --- .../provisioner-glusterfs/component.js | 88 +------------- .../provisioner-glusterfs/template.hbs | 111 ++---------------- .../addon/mixins/storage-class-provisioner.js | 53 ++++++++- translations/en-us.yaml | 9 ++ 4 files changed, 76 insertions(+), 185 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js b/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js index 0c9272ae1..9e8743c4d 100644 --- a/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-glusterfs/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'glusterfs', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs b/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-glusterfs/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/mixins/storage-class-provisioner.js b/lib/shared/addon/mixins/storage-class-provisioner.js index 14326f8ef..1fc152a1a 100644 --- a/lib/shared/addon/mixins/storage-class-provisioner.js +++ b/lib/shared/addon/mixins/storage-class-provisioner.js @@ -1,8 +1,59 @@ import Mixin from '@ember/object/mixin'; - +import { get, setProperties, computed } from '@ember/object'; export default Mixin.create({ parameters: null, editing: null, + fields: [], + model: null, + + didInsertElement() { + const fields = get(this, 'fields') || []; + if (fields.length > 0) { + fields.forEach(field => { + this.addObserver(`model.${field}`, this, 'sendUpdate'); + }); + this.sendUpdate(); + } + }, + + fieldsGroup: computed('fields.[]', function() { + const fields = get(this, 'fields') || []; + const group = []; + let groupIndex = 0; + fields.forEach((item, index) => { + if (index % 3 === 0) { + group.push([item]); + groupIndex++; + } else { + group[groupIndex - 1].push(item); + } + }); + return group; + }), + + didReceiveAttrs() { + const fields = get(this, 'fields') || []; + if (fields.length > 0) { + const changes = {}; + fields.forEach(field => { + changes[field] = get(this, `parameters.${field}`) || ''; + }); + setProperties(this, { + model: changes + }); + } + }, + + sendUpdate: function () { + const fields = get(this, 'fields') || []; + if (fields.length > 0) { + const out = {}; + fields.forEach(field => { + out[field] = get(this, `model.${field}`) || ''; + }); + this.sendAction('changed', out); + } + }, actions: { changed(map) { diff --git a/translations/en-us.yaml b/translations/en-us.yaml index e5338984b..b59cb08a4 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1780,22 +1780,31 @@ cruStorageClass: glusterfs: resturl: label: REST URL + placeholder: "e.g. http://127.0.0.1:8081" restuser: label: REST User + placeholder: "e.g. admin" restuserkey: label: REST User Key + placeholder: "e.g. password" secretNamespace: label: Secret Namespace + placeholder: "e.g. default" secretName: label: Secret Name + placeholder: "e.g. heketi-secret" clusterid: label: Cluster ID + placeholder: "e.g. 630372ccdc720a92c681fb928f27b53f" gidMin: label: GID MIN + placeholder: "e.g. 40000" gidMax: label: GID MAX + placeholder: "e.g. 50000" volumetype: label: Volume Type + placeholder: "e.g. replicate:3" dangerZone: header: Advanced Settings From 182db0ffdee906f67fc67060601c2e670b7c5346 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 14:47:50 +0800 Subject: [PATCH 05/13] Add Cinder --- .../provisioner-azure-disk/component.js | 88 +------------- .../provisioner-azure-disk/template.hbs | 111 ++---------------- .../provisioner-azure-file/component.js | 88 +------------- .../provisioner-azure-file/template.hbs | 111 ++---------------- .../provisioner-cinder/component.js | 87 +------------- .../provisioner-cinder/template.hbs | 111 ++---------------- .../provisioner-portworx-volume/component.js | 88 +------------- .../provisioner-portworx-volume/template.hbs | 111 ++---------------- .../provisioner-quobyte/component.js | 88 +------------- .../provisioner-quobyte/template.hbs | 111 ++---------------- .../provisioner-rbd/component.js | 88 +------------- .../provisioner-rbd/template.hbs | 111 ++---------------- .../provisioner-scaleio/component.js | 88 +------------- .../provisioner-scaleio/template.hbs | 111 ++---------------- .../provisioner-storageos/component.js | 88 +------------- .../provisioner-storageos/template.hbs | 111 ++---------------- .../provisioner-vsphere-volume/component.js | 88 +------------- .../provisioner-vsphere-volume/template.hbs | 111 ++---------------- translations/en-us.yaml | 7 ++ 19 files changed, 141 insertions(+), 1656 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs b/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-azure-disk/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs b/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-azure-file/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-cinder/component.js b/lib/shared/addon/components/storage-class/provisioner-cinder/component.js index 0c9272ae1..af2109748 100644 --- a/lib/shared/addon/components/storage-class/provisioner-cinder/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-cinder/component.js @@ -1,93 +1,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['type', 'availability']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs b/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-cinder/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs b/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-quobyte/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-rbd/component.js b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-rbd/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs b/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-rbd/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs b/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-scaleio/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-storageos/component.js b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-storageos/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs b/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-storageos/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js index 0c9272ae1..43709f8fc 100644 --- a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js @@ -1,93 +1,13 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -import { get, setProperties, computed, observer } from '@ember/object'; -export const VOLUME_TYPES = [ - 'gp2', - 'io1', - 'st1', - 'sc1', -]; +const FIELDS = ['resturl', 'restuser', 'restuserkey', + 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; export default Component.extend(StorageClassProvisioner, { layout, - volumeTypes: VOLUME_TYPES, - volumeType: null, - zones: null, - zoneAutomatic: null, - iopsPerGB: null, - encrypted: true, - kmsKeyId: null, - kmsAutomatic: null, - - didReceiveAttrs() { - const changes = {}; - - changes['volumeType'] = get(this, 'parameters.type')||'gp2'; - changes['iopsPerGB'] = get(this, 'parameters.iopsPerGB')||''; - - const zone = get(this, 'parameters.zone'); - const zones = get(this, 'parameters.zones'); - if ( zones && zones.length ) { - changes['zoneAutomatic'] = false; - changes['zones'] = zones; - } else if ( zone ) { - changes['zoneAutomatic'] = false; - changes['zones'] = 'zone'; - } else { - changes['zoneAutomatic'] = true; - changes['zones'] = ''; - } - - changes['encrypted'] = get(this, 'parameters.encrypted') === "true"; - - const key = get(this, 'parameters.kmsKeyId'); - if ( key ) { - changes['kmsKeyId'] = key; - changes['kmsAutomatic'] = false; - } else { - changes['kmsAutomatic'] = true; - } - - setProperties(this, changes); - }, - - sendUpdate: observer('volumeType','zones','zoneAutomatic','iopsPerGB','encrypted','kmsKeyId','kmsAutomatic', function() { - const type = get(this, 'volumeType'); - const out = { - type: type, - }; - - const zoneAutomatic = get(this, 'zoneAutomatic'); - if ( !zoneAutomatic ) { - const zones = (get(this, 'zones')||'').trim(); - if ( zones ) { - out['zones'] = zones; - } - } - - if ( get(this, 'supportsIops') ) { - out['opsePerGB'] = (get(this,'iopsPerGB')||'')+''; - } - - const encrypted = get(this, 'encrypted'); - const kmsKeyId = get(this, 'kmsKeyId'); - const kmsAutomatic = get(this, 'kmsAutomatic'); - if ( encrypted ) { - out['encrypted'] = 'true'; - if ( !kmsAutomatic && kmsKeyId ) { - out['kmsKeyId'] = kmsKeyId; - } - } else { - out['encrypted'] = 'false'; - } - - this.sendAction('changed', out); - }), - - supportsIops: computed('volumeType', function() { - return !!get(this, 'volumeType').match(/^io\d+$/); - }) + provisioner: 'cinder', + fields: FIELDS, }); diff --git a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs index 2da736b95..e80e6de2f 100644 --- a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs +++ b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/template.hbs @@ -1,101 +1,12 @@ -
-
- - {{#if editing}} - {{#each volumeTypes as |name|}} -
- -
- {{/each}} - {{else}} - {{t (concat 'cruStorageClass.aws-ebs.type.' volumeType)}} - {{/if}} - - {{#if supportsIops}} - - {{#if editing}} -
- {{input-integer classNames="form-control" value=iopsPerGB}} - {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} -
- {{else}} - {{iopsPerGB}} {{t 'cruStorageClass.aws-ebs.iopsPerGB.unit'}} - {{/if}} - {{/if}} - +{{#each fieldsGroup as |fields|}} +
+ {{#each fields as |field|}} +
+ + {{#input-or-display editable=editing value=(get model field)}} + {{input type="text" value=(get model field) classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.' field '.placeholder'))}} + {{/input-or-display}} +
+ {{/each}}
-
- - {{#if editing}} -
- -
-
- -
- {{#unless zoneAutomatic}} - {{textarea-autogrow spellcheck="false" required=true value=zones}} - {{/unless}} - {{else}} - {{#if zoneAutomatic}} - {{t 'cruStorageClass.aws-ebs.zone.automatic'}} - {{else}} - {{zones}} - {{/if}} - {{/if}} -
-
- - {{#if editing}} -
- -
-
- -
- {{else}} - {{t (if encrypted 'generic.enabled' 'generic.disabled')}} - {{/if}} - - {{#if encrypted}} - - {{#if editing}} -
- -
-
- -
- - {{#unless kmsAutomatic}} - {{input value=kmsKeyId}} - {{/unless}} - {{else if kmsAutomatic}} - {{t 'cruStorageClass.aws-ebs.kmsKeyId.automatic'}} - {{else}} - {{kmsKeyId}} - {{/if}} - {{/if}} -
-
+{{/each}} \ No newline at end of file diff --git a/translations/en-us.yaml b/translations/en-us.yaml index b59cb08a4..fc70d6080 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1777,6 +1777,13 @@ cruStorageClass: automatic: "Automatic: Zones the cluster has a node in" manual: "Manual: Choose specific zones" placeholder: "us-central1-a, us-central1-b" + cinder: + type: + label: Volume Type + placeholder: "e.g. fast" + availability: + label: Availability Zone + placeholder: "e.g. nova" glusterfs: resturl: label: REST URL From 6a44d75e9ab8b346e3a4714f9f6f3cca622bf621 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:02:34 +0800 Subject: [PATCH 06/13] Add vsphere --- .../provisioner-vsphere-volume/component.js | 6 +++--- .../addon/mixins/storage-class-provisioner.js | 7 +++++-- translations/en-us.yaml | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js index 43709f8fc..bbc836cb6 100644 --- a/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-vsphere-volume/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['diskformat', 'storagePolicyName', 'datastore', + 'hostFailuresToTolerate', 'cachereservation', 'fstype']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'vsphere-volume', fields: FIELDS, }); diff --git a/lib/shared/addon/mixins/storage-class-provisioner.js b/lib/shared/addon/mixins/storage-class-provisioner.js index 1fc152a1a..d0c378097 100644 --- a/lib/shared/addon/mixins/storage-class-provisioner.js +++ b/lib/shared/addon/mixins/storage-class-provisioner.js @@ -16,7 +16,7 @@ export default Mixin.create({ } }, - fieldsGroup: computed('fields.[]', function() { + fieldsGroup: computed('fields.[]', function () { const fields = get(this, 'fields') || []; const group = []; let groupIndex = 0; @@ -49,7 +49,10 @@ export default Mixin.create({ if (fields.length > 0) { const out = {}; fields.forEach(field => { - out[field] = get(this, `model.${field}`) || ''; + const value = get(this, `model.${field}`) || ''; + if (value) { + out[field] = value; + } }); this.sendAction('changed', out); } diff --git a/translations/en-us.yaml b/translations/en-us.yaml index fc70d6080..303bd1462 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1784,6 +1784,25 @@ cruStorageClass: availability: label: Availability Zone placeholder: "e.g. nova" + vsphere-volume: + diskformat: + label: Disk Format + placeholder: "e.g. thin" + storagePolicyName: + label: Storage Policy Name + placeholder: "e.g. gold" + datastore: + label: Datastore + placeholder: "e.g. VSANDatastore" + fstype: + label: FS Type + placeholder: "e.g. ext3" + hostFailuresToTolerate: + label: Host Failures To Tolerate + placeholder: "e.g. 2" + cachereservation: + label: Cache Reservation + placeholder: "e.g. 20" glusterfs: resturl: label: REST URL From fa4e3649e90379b0f3e25cac46609a438df0575c Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:16:12 +0800 Subject: [PATCH 07/13] Add RBD --- .../components/cru-storage-class/template.hbs | 1 + .../provisioner-rbd/component.js | 6 ++-- translations/en-us.yaml | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/cru-storage-class/template.hbs b/lib/shared/addon/components/cru-storage-class/template.hbs index aec7c93a5..a6d694584 100644 --- a/lib/shared/addon/components/cru-storage-class/template.hbs +++ b/lib/shared/addon/components/cru-storage-class/template.hbs @@ -17,6 +17,7 @@ {{form-name-description model=primaryResource nameRequired=false + nameDisabled=isEdit namePlaceholder="cruStorageClass.name.placeholder" descriptionPlaceholder="cruStorageClass.description.placeholder" }} diff --git a/lib/shared/addon/components/storage-class/provisioner-rbd/component.js b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js index 43709f8fc..3a0bb5fa7 100644 --- a/lib/shared/addon/components/storage-class/provisioner-rbd/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-rbd/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['monitors', 'adminId', 'adminSecretNamespace', + 'adminSecret', 'pool', 'userId', 'userSecretName', 'fsType', 'imageFormat', 'imageFeatures']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'rbd', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 303bd1462..e9a70efaa 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1803,6 +1803,37 @@ cruStorageClass: cachereservation: label: Cache Reservation placeholder: "e.g. 20" + rbd: + monitors: + label: Monitors + placeholder: "e.g. 10.16.153.105:6789" + adminId: + label: Admin ID + placeholder: "e.g. kube" + adminSecretNamespace: + label: Admin Secret Namespace + placeholder: "e.g. kube-system" + adminSecret: + label: Admin Secret + placeholder: "e.g. secret" + pool: + label: Pool + placeholder: "e.g. kube" + userId: + label: User ID + placeholder: "e.g. kube" + userSecretName: + label: User Secret Name + placeholder: "e.g. ceph-secret-user" + fsType: + label: FS Type + placeholder: "e.g. ext4" + imageFormat: + label: Image Format + placeholder: "e.g. 2" + imageFeatures: + label: Image Features + placeholder: "e.g. layering" glusterfs: resturl: label: REST URL From a3e033af7fe96c6326fcdee27e6c2eb5f72a7097 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:23:13 +0800 Subject: [PATCH 08/13] Add quobyte --- .../provisioner-quobyte/component.js | 6 ++--- translations/en-us.yaml | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js index 43709f8fc..94dcacce8 100644 --- a/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-quobyte/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['quobyteAPIServer', 'registry', 'adminSecretNamespace', + 'adminSecretName', 'user', 'group', 'quobyteConfig', 'quobyteTenant']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'quobyte', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index e9a70efaa..835ba6170 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1803,6 +1803,31 @@ cruStorageClass: cachereservation: label: Cache Reservation placeholder: "e.g. 20" + quobyte: + quobyteAPIServer: + label: Quobyte API Server + placeholder: "e.g. http://138.68.74.142:7860" + registry: + label: Registry + placeholder: "e.g. 138.68.74.142:7861" + adminSecretNamespace: + label: Admin Secret Namespace + placeholder: "e.g. kube-system" + adminSecretName: + label: Admin Secret Name + placeholder: "e.g. quobyte-admin-secret" + user: + label: User + placeholder: "e.g. root" + group: + label: Group + placeholder: "e.g. root" + quobyteConfig: + label: Quobyte Config + placeholder: "e.g. BASE" + quobyteTenant: + label: Quobyte Tenant + placeholder: "e.g. DEFAULT" rbd: monitors: label: Monitors From be2ec96f9a6e54913509cef7af36a7736908c4cd Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:29:20 +0800 Subject: [PATCH 09/13] Add Azure Disk --- .../provisioner-azure-disk/component.js | 5 ++--- translations/en-us.yaml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js index 43709f8fc..4d0965af9 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-azure-disk/component.js @@ -2,12 +2,11 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['skuName', 'location', 'storageAccount', 'storageaccounttype', 'kind']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'azure-disk', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 835ba6170..0acc29e05 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1803,6 +1803,22 @@ cruStorageClass: cachereservation: label: Cache Reservation placeholder: "e.g. 20" + azure-disk: + skuName: + label: Sku Name + placeholder: "e.g. Standard_LRS" + location: + label: Location + placeholder: "e.g. eastus" + storageAccount: + label: Storage Account + placeholder: "e.g. azure_storage_account_name" + storageaccounttype: + label: Storage Account Type + placeholder: "e.g. Standard_LRS" + kind: + label: Kind + placeholder: "e.g. Shared" quobyte: quobyteAPIServer: label: Quobyte API Server From 74f0ae319fd09a2af31bb337df8ad8595e431621 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:32:04 +0800 Subject: [PATCH 10/13] Add Azure file --- .../storage-class/provisioner-azure-file/component.js | 5 ++--- translations/en-us.yaml | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js index 43709f8fc..e17e7afd2 100644 --- a/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-azure-file/component.js @@ -2,12 +2,11 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['skuName', 'location', 'storageAccount']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'azure-file', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 0acc29e05..49e6119e1 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1819,6 +1819,16 @@ cruStorageClass: kind: label: Kind placeholder: "e.g. Shared" + azure-file: + skuName: + label: Sku Name + placeholder: "e.g. Standard_LRS" + location: + label: Location + placeholder: "e.g. eastus" + storageAccount: + label: Storage Account + placeholder: "e.g. azure_storage_account_name" quobyte: quobyteAPIServer: label: Quobyte API Server From 7ed7c8997e511d7f47eb3184f876e3239deaa70b Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:41:49 +0800 Subject: [PATCH 11/13] Add Portworx volume --- .../provisioner-portworx-volume/component.js | 6 ++--- translations/en-us.yaml | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js index 43709f8fc..77d702ce8 100644 --- a/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-portworx-volume/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['fs', 'block_size', 'repl', + 'io_priority', 'snap_interval', 'aggregation_level', 'ephemeral']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'portworx-volume', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 49e6119e1..8125dd26f 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1829,6 +1829,28 @@ cruStorageClass: storageAccount: label: Storage Account placeholder: "e.g. azure_storage_account_name" + portworx-volume: + fs: + label: Filesystem + placeholder: "e.g. ext4" + block_size: + label: Block Size + placeholder: "e.g. 32" + repl: + label: Repl + placeholder: "e.g. 1" + io_priority: + label: I/O Priority + placeholder: "e.g. low" + snap_interval: + label: Snapshots Interval + placeholder: "e.g. 70" + aggregation_level: + label: Aggregation Level + placeholder: "e.g. 0" + ephemeral: + label: Ephemeral + placeholder: "e.g. true" quobyte: quobyteAPIServer: label: Quobyte API Server From 0fa535d6ee8c39d0257a00cf92cf8abb17bd0053 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:47:08 +0800 Subject: [PATCH 12/13] Add scaleio --- .../provisioner-scaleio/component.js | 6 ++--- translations/en-us.yaml | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js index 43709f8fc..3eaf7b575 100644 --- a/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-scaleio/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['gateway', 'system', 'protectionDomain', + 'storagePool', 'storageMode', 'secretRef', 'readOnly', 'fsType']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'scaleio', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 8125dd26f..ed4a8c282 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1851,6 +1851,31 @@ cruStorageClass: ephemeral: label: Ephemeral placeholder: "e.g. true" + scaleio: + gateway: + label: Gateway + placeholder: "e.g. https://192.168.99.200:443/api" + system: + label: System + placeholder: "e.g. scaleio" + protectionDomain: + label: Protection Domain + placeholder: "e.g. pd0" + storagePool: + label: Storage Pool + placeholder: "e.g. sp1" + storageMode: + label: Storage Mode + placeholder: "e.g. ThinProvisioned" + secretRef: + label: Secret Ref + placeholder: "e.g. sio-secret" + readOnly: + label: Read Only + placeholder: "e.g. false" + fsType: + label: FS Type + placeholder: "e.g. xfs" quobyte: quobyteAPIServer: label: Quobyte API Server From 2f917e5432658ddeb52358c44270c76b5a22fb8b Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 15 Mar 2018 15:52:06 +0800 Subject: [PATCH 13/13] Add storageos --- .../provisioner-storageos/component.js | 6 +++--- translations/en-us.yaml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/shared/addon/components/storage-class/provisioner-storageos/component.js b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js index 43709f8fc..3bd4a30d5 100644 --- a/lib/shared/addon/components/storage-class/provisioner-storageos/component.js +++ b/lib/shared/addon/components/storage-class/provisioner-storageos/component.js @@ -2,12 +2,12 @@ import Component from '@ember/component'; import layout from './template'; import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner'; -const FIELDS = ['resturl', 'restuser', 'restuserkey', - 'secretNamespace', 'secretName', 'clusterid', 'gidMin', 'gidMax', 'volumetype']; +const FIELDS = ['pool', 'description', 'fsType', + 'adminSecretNamespace', 'adminSecretName']; export default Component.extend(StorageClassProvisioner, { layout, - provisioner: 'cinder', + provisioner: 'storageos', fields: FIELDS, }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index ed4a8c282..47aa43e9c 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1876,6 +1876,22 @@ cruStorageClass: fsType: label: FS Type placeholder: "e.g. xfs" + storageos: + pool: + label: Pool + placeholder: "e.g. default" + description: + label: Description + placeholder: "e.g. Kubernetes volume" + adminSecretNamespace: + label: Admin Secret Namespace + placeholder: "e.g. default" + adminSecretName: + label: Admin Secret Name + placeholder: "e.g. storageos-secret" + fsType: + label: FS Type + placeholder: "e.g. ext4" quobyte: quobyteAPIServer: label: Quobyte API Server