diff --git a/app/models/volume.js b/app/models/volume.js index 43ed7ddf2..782be6724 100644 --- a/app/models/volume.js +++ b/app/models/volume.js @@ -4,26 +4,26 @@ import Resource from 'ember-api-store/models/resource'; const SOURCES = []; registerSource('aws-ebs', 'awsElasticBlockStore', true); -registerSource('azure-disk', 'azureDisk', ''); -registerSource('azure-file', 'azureFile', ''); -registerSource('cephfs', 'cephfs', ''); -registerSource('cinder', 'cinder', ''); -registerSource('fc', 'fc', ''); -registerSource('flex-volume', 'flexVolume', ''); -registerSource('flocker', 'flocker', ''); -registerSource('gce-pd', 'gcePersistentDisk', ''); -registerSource('glusterfs', 'glusterfs', ''); -registerSource('host-path', 'hostPath', ''); -registerSource('iscsi', 'iscsi', ''); -registerSource('local', 'local', ''); -registerSource('nfs', 'nfs', ''); -registerSource('photon', 'photonPersistentDisk', ''); -registerSource('portworx', 'portworxVolume', ''); -registerSource('quobyte', 'quobyte', ''); -registerSource('rbd', 'rbd', ''); -registerSource('scaleio', 'scaleIO', ''); -registerSource('storageos', 'storageos', ''); -registerSource('vsphere-volume', 'vsphereVolume', ''); +registerSource('azure-disk', 'azureDisk', true); +registerSource('azure-file', 'azureFile', true); +registerSource('cephfs', 'cephfs', true); +registerSource('cinder', 'cinder', true); +registerSource('fc', 'fc', true); +registerSource('flex-volume', 'flexVolume', true); +registerSource('flocker', 'flocker', true); +registerSource('gce-pd', 'gcePersistentDisk', true); +registerSource('glusterfs', 'glusterfs', true); +registerSource('host-path', 'hostPath', true); +registerSource('iscsi', 'iscsi', true); +registerSource('local', 'local', true); +registerSource('nfs', 'nfs', true); +registerSource('photon', 'photonPersistentDisk', true); +registerSource('portworx', 'portworxVolume', true); +registerSource('quobyte', 'quobyte', true); +registerSource('rbd', 'rbd', true); +registerSource('scaleio', 'scaleIO', true); +registerSource('storageos', 'storageos', true); +registerSource('vsphere-volume', 'vsphereVolume', true); export function registerSource(name, field, component) { if ( component === true ) { diff --git a/lib/shared/addon/components/cru-persistent-volume/component.js b/lib/shared/addon/components/cru-persistent-volume/component.js index 4e02163b3..d3316ac2c 100644 --- a/lib/shared/addon/components/cru-persistent-volume/component.js +++ b/lib/shared/addon/components/cru-persistent-volume/component.js @@ -26,6 +26,16 @@ export default Component.extend(ViewNewEdit, { updateOptions(ary) { set(this, 'primaryResource.mountOptions', ary); }, + + updateParams(key, map) { + getSources().forEach(source => { + if(source.value === key){ + set(this, `primaryResource.${key}`, map); + } else { + set(this, `primaryResource.${source.value}`, null); + } + }); + }, }, init() { @@ -123,8 +133,13 @@ export default Component.extend(ViewNewEdit, { sourceComponent: computed('sourceName', function() { const name = get(this, 'sourceName'); - if ( name ) { - return `volume-source/source-${name}`; + const sources = getSources(); + const entry = sources.findBy('name', name); + if (entry) { + return { + component: `volume-source/source-${name}`, + field: entry.value, + } } }), }); diff --git a/lib/shared/addon/components/cru-persistent-volume/template.hbs b/lib/shared/addon/components/cru-persistent-volume/template.hbs index df3600716..3a1195701 100644 --- a/lib/shared/addon/components/cru-persistent-volume/template.hbs +++ b/lib/shared/addon/components/cru-persistent-volume/template.hbs @@ -80,9 +80,11 @@ expandOnInit=true }} {{#if sourceComponent}} - {{component sourceComponent + {{component sourceComponent.component + plugin=sourceComponent.field editing=notView volume=model + changed=(action "updateParams") }} {{else}}

Choose a Volume Source above...

diff --git a/lib/shared/addon/components/volume-source/source-aws-ebs/component.js b/lib/shared/addon/components/volume-source/source-aws-ebs/component.js index 06e8140e7..463475d33 100644 --- a/lib/shared/addon/components/volume-source/source-aws-ebs/component.js +++ b/lib/shared/addon/components/volume-source/source-aws-ebs/component.js @@ -1,24 +1,12 @@ import Component from '@ember/component'; import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; import VolumeSource from 'shared/mixins/volume-source'; -import { get, set } from '@ember/object'; - -const FIELD = 'awsElasticBlockStore'; -const TYPE = 'awsElasticBlockStoreVolumeSource'; export default Component.extend(VolumeSource, { layout, - volume: null, - - didReceiveAttrs() { - if ( !get(this, `volume.${FIELD}`) ) { - set(this, `volume.${FIELD}`, get(this, 'store').createRecord({ - type: TYPE, - })); - } - - // @TODO-2.0 hack, the field is called type... - set(this, `volume.${FIELD}.type`, ''); - }, + inputDidUpdate: observer('config.{fsType,readOnly,partition,volumeID}', function () { + this.sendUpdate(); + }), }); diff --git a/lib/shared/addon/components/volume-source/source-aws-ebs/template.hbs b/lib/shared/addon/components/volume-source/source-aws-ebs/template.hbs index 93ec50b42..55071b780 100644 --- a/lib/shared/addon/components/volume-source/source-aws-ebs/template.hbs +++ b/lib/shared/addon/components/volume-source/source-aws-ebs/template.hbs @@ -1,6 +1,41 @@ -
-
+
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.awsElasticBlockStore.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.partition}} + {{input-integer type="text" value=config.partition classNames="form-control" placeholder=(t 'cruPersistentVolume.awsElasticBlockStore.partition.placeholder')}} + {{/input-or-display}} +
-
-
-
+
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+ +
+ + {{#input-or-display editable=editing value=config.volumeID}} + {{input type="text" value=config.volumeID classNames="form-control" placeholder=(t 'cruPersistentVolume.awsElasticBlockStore.volumeID.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-azure-disk/component.js b/lib/shared/addon/components/volume-source/source-azure-disk/component.js new file mode 100644 index 000000000..4e9efad96 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-azure-disk/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{cachingMode,diskName,diskURI,fsType,kind,readOnly}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-azure-disk/template.hbs b/lib/shared/addon/components/volume-source/source-azure-disk/template.hbs new file mode 100644 index 000000000..8c3cd5825 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-azure-disk/template.hbs @@ -0,0 +1,56 @@ +
+
+ + {{#input-or-display editable=editing value=config.cachingMode}} + {{input type="text" value=config.cachingMode classNames="form-control" placeholder=(t 'cruPersistentVolume.azureDisk.cachingMode.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.diskName}} + {{input type="text" value=config.diskName classNames="form-control" placeholder=(t 'cruPersistentVolume.azureDisk.diskName.placeholder')}} + {{/input-or-display}} +
+
+
+
+ + {{#input-or-display editable=editing value=config.diskURI}} + {{input type="text" value=config.diskURI classNames="form-control" placeholder=(t 'cruPersistentVolume.azureDisk.diskURI.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.azureDisk.fsType.placeholder')}} + {{/input-or-display}} +
+
+
+
+ + {{#input-or-display editable=editing value=config.kind}} + {{input type="text" value=config.kind classNames="form-control" placeholder=(t 'cruPersistentVolume.azureDisk.kind.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-azure-file/component.js b/lib/shared/addon/components/volume-source/source-azure-file/component.js new file mode 100644 index 000000000..3127d86ad --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-azure-file/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{readOnly,secretName,secretNamespace,shareName}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-azure-file/template.hbs b/lib/shared/addon/components/volume-source/source-azure-file/template.hbs new file mode 100644 index 000000000..96e089237 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-azure-file/template.hbs @@ -0,0 +1,41 @@ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ + {{#input-or-display editable=editing value=config.secretName}} + {{input type="text" value=config.secretName classNames="form-control" placeholder=(t 'cruPersistentVolume.azureFile.secretName.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.secretNamespace}} + {{input type="text" value=config.secretNamespace classNames="form-control" placeholder=(t 'cruPersistentVolume.azureFile.secretNamespace.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.shareName}} + {{input type="text" value=config.shareName classNames="form-control" placeholder=(t 'cruPersistentVolume.azureFile.shareName.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-cephfs/component.js b/lib/shared/addon/components/volume-source/source-cephfs/component.js new file mode 100644 index 000000000..32ed3ae1f --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-cephfs/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{monitors.[],path,readOnly,secretFile,secretRef.name,secretRef.namespace,user}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-cephfs/template.hbs b/lib/shared/addon/components/volume-source/source-cephfs/template.hbs new file mode 100644 index 000000000..3f358c3fd --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-cephfs/template.hbs @@ -0,0 +1,70 @@ +
+
+ {{form-value-array + initialValues=config.monitors + editing=editing + valueLabel="cruPersistentVolume.cephfs.monitors.label" + addActionLabel="cruPersistentVolume.cephfs.monitors.addActionLabel" + changed=(action "updateOptions" "monitors") + }} +
+ +
+ + {{#input-or-display editable=editing value=config.path}} + {{input type="text" value=config.path classNames="form-control" placeholder=(t 'cruPersistentVolume.cephfs.path.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ + {{#input-or-display editable=editing value=config.secretFile}} + {{input type="text" value=config.secretFile classNames="form-control" placeholder=(t 'cruPersistentVolume.cephfs.secretFile.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.cephfs.secretRef.name.placeholder')}} + {{/input-or-display}} +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.namespace}} + {{input type="text" value=config.secretRef.namespace classNames="form-control" placeholder=(t 'cruPersistentVolume.cephfs.secretRef.namespace.placeholder')}} + {{/input-or-display}} +
+
+
+
+ + {{#input-or-display editable=editing value=config.user}} + {{input type="text" value=config.user classNames="form-control" placeholder=(t 'cruPersistentVolume.cephfs.user.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-cinder/component.js b/lib/shared/addon/components/volume-source/source-cinder/component.js new file mode 100644 index 000000000..91931e75b --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-cinder/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{readOnly,fsType,volumeID}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-cinder/template.hbs b/lib/shared/addon/components/volume-source/source-cinder/template.hbs new file mode 100644 index 000000000..2c8cdb1cb --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-cinder/template.hbs @@ -0,0 +1,35 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.cinder.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.volumeID}} + {{input type="text" value=config.volumeID classNames="form-control" placeholder=(t 'cruPersistentVolume.cinder.volumeID.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-fc/component.js b/lib/shared/addon/components/volume-source/source-fc/component.js new file mode 100644 index 000000000..1284cb069 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-fc/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{readOnly,fsType,lun,targetWWNs.[],wwids.[]}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-fc/template.hbs b/lib/shared/addon/components/volume-source/source-fc/template.hbs new file mode 100644 index 000000000..18e583a5b --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-fc/template.hbs @@ -0,0 +1,57 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.fc.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.lun}} + {{input-integer type="text" value=config.lun classNames="form-control" placeholder=(t 'cruPersistentVolume.fc.lun.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+ +
+ {{form-value-array + initialValues=config.targetWWNs + editing=editing + valueLabel="cruPersistentVolume.fc.targetWWNs.label" + addActionLabel="cruPersistentVolume.fc.targetWWNs.addActionLabel" + changed=(action "updateOptions" "targetWWNs") + }} +
+
+ +
+
+ {{form-value-array + initialValues=config.wwids + editing=editing + valueLabel="cruPersistentVolume.fc.wwids.label" + addActionLabel="cruPersistentVolume.fc.wwids.addActionLabel" + changed=(action "updateOptions" "wwids") + }} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-flex-volume/component.js b/lib/shared/addon/components/volume-source/source-flex-volume/component.js new file mode 100644 index 000000000..c738fb742 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-flex-volume/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{driver,fsType,readOnly,options,secretRef.name,}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-flex-volume/template.hbs b/lib/shared/addon/components/volume-source/source-flex-volume/template.hbs new file mode 100644 index 000000000..c73c01e8c --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-flex-volume/template.hbs @@ -0,0 +1,55 @@ +
+
+ + {{#input-or-display editable=editing value=config.driver}} + {{input type="text" value=config.driver classNames="form-control" placeholder=(t 'cruPersistentVolume.flexVolume.driver.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.flexVolume.fsType.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ {{form-key-value + initialMap=config.options + editing=editing + header=(t 'cruPersistentVolume.flexVolume.options.label') + addActionLabel="cruPersistentVolume.flexVolume.options.addActionLabel" + changed=(action "updateOptions" "options") + }} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+ +
+ +
+
+ + {{#input-or-display editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.flexVolume.secretRef.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-flocker/component.js b/lib/shared/addon/components/volume-source/source-flocker/component.js new file mode 100644 index 000000000..0e01f7f1a --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-flocker/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{datasetName,datasetUUID}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-flocker/template.hbs b/lib/shared/addon/components/volume-source/source-flocker/template.hbs new file mode 100644 index 000000000..b60d38d9a --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-flocker/template.hbs @@ -0,0 +1,15 @@ +
+
+ + {{#input-or-display editable=editing value=config.datasetName}} + {{input type="text" value=config.datasetName classNames="form-control" placeholder=(t 'cruPersistentVolume.flocker.datasetName.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.datasetUUID}} + {{input type="text" value=config.datasetUUID classNames="form-control" placeholder=(t 'cruPersistentVolume.flocker.datasetUUID.placeholder')}} + {{/input-or-display}} +
+
diff --git a/lib/shared/addon/components/volume-source/source-gce-pd/component.js b/lib/shared/addon/components/volume-source/source-gce-pd/component.js new file mode 100644 index 000000000..6a6941cf1 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-gce-pd/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{pdName,partition,fsType,readOnly}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-gce-pd/template.hbs b/lib/shared/addon/components/volume-source/source-gce-pd/template.hbs new file mode 100644 index 000000000..45aa85e3d --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-gce-pd/template.hbs @@ -0,0 +1,40 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.gcePersistentDisk.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.partition}} + {{input-integer type="text" value=config.partition classNames="form-control" placeholder=(t 'cruPersistentVolume.gcePersistentDisk.partition.placeholder')}} + {{/input-or-display}} +
+
+
+
+ + {{#input-or-display editable=editing value=config.pdName}} + {{input type="text" value=config.pdName classNames="form-control" placeholder=(t 'cruPersistentVolume.gcePersistentDisk.pdName.placeholder')}} + {{/input-or-display}} +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-glusterfs/component.js b/lib/shared/addon/components/volume-source/source-glusterfs/component.js new file mode 100644 index 000000000..e141a6ce3 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-glusterfs/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{path,readOnly,endpoints}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-glusterfs/template.hbs b/lib/shared/addon/components/volume-source/source-glusterfs/template.hbs new file mode 100644 index 000000000..b923bd6e5 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-glusterfs/template.hbs @@ -0,0 +1,35 @@ +
+
+ + {{#input-or-display editable=editing value=config.endpoints}} + {{input type="text" value=config.endpoints classNames="form-control" placeholder=(t 'cruPersistentVolume.glusterfs.endpoints.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.path}} + {{input type="text" value=config.path classNames="form-control" placeholder=(t 'cruPersistentVolume.glusterfs.path.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-host-path/component.js b/lib/shared/addon/components/volume-source/source-host-path/component.js index c9958cb75..5364b6250 100644 --- a/lib/shared/addon/components/volume-source/source-host-path/component.js +++ b/lib/shared/addon/components/volume-source/source-host-path/component.js @@ -1,12 +1,11 @@ import Component from '@ember/component'; import layout from './template'; -import VolumeSource from 'shared/mixins/volume-source'; import { get } from '@ember/object'; const FIELD = 'hostPath'; const TYPE = 'hostPathVolumeSource'; -export default Component.extend(VolumeSource, { +export default Component.extend({ layout, field: FIELD, diff --git a/lib/shared/addon/components/volume-source/source-iscsi/component.js b/lib/shared/addon/components/volume-source/source-iscsi/component.js new file mode 100644 index 000000000..77d0951d8 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-iscsi/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{chapAuthDiscovery,chapAuthSession,fsType,initiatorName,iqn,iscsiInterface,lun,portals.[],readOnly,secretRef.name,targetPortal}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-iscsi/template.hbs b/lib/shared/addon/components/volume-source/source-iscsi/template.hbs new file mode 100644 index 000000000..aaa55b291 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-iscsi/template.hbs @@ -0,0 +1,123 @@ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.chapAuthDiscovery}} +
+ {{/if}} +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.chapAuthSession}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.initiatorName}} + {{input type="text" value=config.initiatorName classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.initiatorName.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.iqn}} + {{input type="text" value=config.iqn classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.iqn.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.iscsiInterface}} + {{input type="text" value=config.iscsiInterface classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.iscsiInterface.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.lun}} + {{input-integer type="text" value=config.lun classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.lun.placeholder')}} + {{/input-or-display}} +
+ +
+ {{form-value-array + initialValues=config.portals + editing=editing + valueLabel="cruPersistentVolume.iscsi.portals.label" + addActionLabel="cruPersistentVolume.iscsi.portals.addActionLabel" + changed=(action "updateOptions" "portals") + }} +
+
+ +
+
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+ +
+ + {{#input-or-display editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.secretRef.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.targetPortal}} + {{input type="text" value=config.targetPortal classNames="form-control" placeholder=(t 'cruPersistentVolume.iscsi.targetPortal.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-local/component.js b/lib/shared/addon/components/volume-source/source-local/component.js new file mode 100644 index 000000000..5bf7a4fc4 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-local/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{path}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-local/template.hbs b/lib/shared/addon/components/volume-source/source-local/template.hbs new file mode 100644 index 000000000..96c5e81bc --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-local/template.hbs @@ -0,0 +1,8 @@ +
+
+ + {{#input-or-display editable=editing value=config.path}} + {{input type="text" value=config.path classNames="form-control" placeholder=(t 'cruPersistentVolume.local.path.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-nfs/component.js b/lib/shared/addon/components/volume-source/source-nfs/component.js new file mode 100644 index 000000000..44166ba19 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-nfs/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{path,readOnly,server}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-nfs/template.hbs b/lib/shared/addon/components/volume-source/source-nfs/template.hbs new file mode 100644 index 000000000..b6709ae95 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-nfs/template.hbs @@ -0,0 +1,35 @@ +
+
+ + {{#input-or-display editable=editing value=config.path}} + {{input type="text" value=config.path classNames="form-control" placeholder=(t 'cruPersistentVolume.nfs.path.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.server}} + {{input type="text" value=config.server classNames="form-control" placeholder=(t 'cruPersistentVolume.nfs.server.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-photon/component.js b/lib/shared/addon/components/volume-source/source-photon/component.js new file mode 100644 index 000000000..25da2aa66 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-photon/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,pdID}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-photon/template.hbs b/lib/shared/addon/components/volume-source/source-photon/template.hbs new file mode 100644 index 000000000..27bf41f24 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-photon/template.hbs @@ -0,0 +1,15 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.photonPersistentDisk.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.pdID}} + {{input type="text" value=config.pdID classNames="form-control" placeholder=(t 'cruPersistentVolume.photonPersistentDisk.pdID.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-portworx/component.js b/lib/shared/addon/components/volume-source/source-portworx/component.js new file mode 100644 index 000000000..965abcdd2 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-portworx/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,readOnly,volumeID}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-portworx/template.hbs b/lib/shared/addon/components/volume-source/source-portworx/template.hbs new file mode 100644 index 000000000..308910357 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-portworx/template.hbs @@ -0,0 +1,35 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.portworxVolume.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.volumeID}} + {{input type="text" value=config.volumeID classNames="form-control" placeholder=(t 'cruPersistentVolume.portworxVolume.volumeID.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-quobyte/component.js b/lib/shared/addon/components/volume-source/source-quobyte/component.js new file mode 100644 index 000000000..98ab3df91 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-quobyte/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{group,readOnly,registry,user,volume}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-quobyte/template.hbs b/lib/shared/addon/components/volume-source/source-quobyte/template.hbs new file mode 100644 index 000000000..ff84c561e --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-quobyte/template.hbs @@ -0,0 +1,51 @@ +
+
+ + {{#input-or-display editable=editing value=config.group}} + {{input type="text" value=config.group classNames="form-control" placeholder=(t 'cruPersistentVolume.quobyte.group.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.registry}} + {{input type="text" value=config.registry classNames="form-control" placeholder=(t 'cruPersistentVolume.quobyte.registry.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.user}} + {{input type="text" value=config.user classNames="form-control" placeholder=(t 'cruPersistentVolume.quobyte.user.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.volume}} + {{input type="text" value=config.volume classNames="form-control" placeholder=(t 'cruPersistentVolume.quobyte.volume.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-rbd/component.js b/lib/shared/addon/components/volume-source/source-rbd/component.js new file mode 100644 index 000000000..e30205997 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-rbd/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,image,keyring,monitors.[],pool,readOnly,secretRef.name,user}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-rbd/template.hbs b/lib/shared/addon/components/volume-source/source-rbd/template.hbs new file mode 100644 index 000000000..9b4b71d0d --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-rbd/template.hbs @@ -0,0 +1,76 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.image}} + {{input type="text" value=config.image classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.image.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.keyring}} + {{input type="text" value=config.keyring classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.keyring.placeholder')}} + {{/input-or-display}} +
+ +
+ {{form-value-array + initialValues=config.monitors + editing=editing + valueLabel="cruPersistentVolume.rbd.monitors.label" + addActionLabel="cruPersistentVolume.rbd.monitors.addActionLabel" + changed=(action "updateOptions" "monitors") + }} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.pool}} + {{input type="text" value=config.pool classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.pool.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.secretRef.placeholder')}} + {{/input-or-display}} +
+
+ + {{#input-or-display editable=editing value=config.user}} + {{input type="text" value=config.user classNames="form-control" placeholder=(t 'cruPersistentVolume.rbd.user.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-scaleio/component.js b/lib/shared/addon/components/volume-source/source-scaleio/component.js new file mode 100644 index 000000000..803a9a104 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-scaleio/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,gateway,protectionDomain,readOnly,secretRef.name,secretRef.namespace,sslEnabled,storageMode,storagePool,system,volumeName}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-scaleio/template.hbs b/lib/shared/addon/components/volume-source/source-scaleio/template.hbs new file mode 100644 index 000000000..6523af2e5 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-scaleio/template.hbs @@ -0,0 +1,112 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.gateway}} + {{input type="text" value=config.gateway classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.gateway.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.protectionDomain}} + {{input type="text" value=config.protectionDomain classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.protectionDomain.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+ +
+
+ +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.secretRef.name.placeholder')}} + {{/input-or-display}} +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.namespace}} + {{input type="text" value=config.secretRef.namespace classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.secretRef.namespace.placeholder')}} + {{/input-or-display}} +
+
+
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.sslEnabled}} +
+ {{/if}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.storageMode}} + {{input type="text" value=config.storageMode classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.storageMode.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.storagePool}} + {{input type="text" value=config.storagePool classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.storagePool.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.system}} + {{input type="text" value=config.system classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.system.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.volumeName}} + {{input type="text" value=config.volumeName classNames="form-control" placeholder=(t 'cruPersistentVolume.scaleIO.volumeName.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-storageos/component.js b/lib/shared/addon/components/volume-source/source-storageos/component.js new file mode 100644 index 000000000..4b6a10596 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-storageos/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,readOnly,secretRef.name,secretRef.namespace,volumeName,volumeNamespace}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-storageos/template.hbs b/lib/shared/addon/components/volume-source/source-storageos/template.hbs new file mode 100644 index 000000000..bac8146a8 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-storageos/template.hbs @@ -0,0 +1,61 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.storageos.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#if editing}} +
+ + +
+ {{else}} +
+ {{config.readOnly}} +
+ {{/if}} +
+
+
+
+ +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.name}} + {{input type="text" value=config.secretRef.name classNames="form-control" placeholder=(t 'cruPersistentVolume.storageos.secretRef.name.placeholder')}} + {{/input-or-display}} +
+
+ + {{#input-or-display class="inline-block" editable=editing value=config.secretRef.namespace}} + {{input type="text" value=config.secretRef.namespace classNames="form-control" placeholder=(t 'cruPersistentVolume.storageos.secretRef.namespace.placeholder')}} + {{/input-or-display}} +
+
+
+ +
+ + {{#input-or-display editable=editing value=config.volumeName}} + {{input type="text" value=config.volumeName classNames="form-control" placeholder=(t 'cruPersistentVolume.storageos.volumeName.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.volumeNamespace}} + {{input type="text" value=config.volumeNamespace classNames="form-control" placeholder=(t 'cruPersistentVolume.storageos.volumeNamespace.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/components/volume-source/source-vsphere-volume/component.js b/lib/shared/addon/components/volume-source/source-vsphere-volume/component.js new file mode 100644 index 000000000..77703c646 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-vsphere-volume/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; +import { get, setProperties, computed, observer } from '@ember/object'; +import VolumeSource from 'shared/mixins/volume-source'; + +export default Component.extend(VolumeSource, { + layout, + + inputDidUpdate: observer('config.{fsType,storagePolicyID,storagePolicyName,volumePath}', function () { + this.sendUpdate(); + }), +}); diff --git a/lib/shared/addon/components/volume-source/source-vsphere-volume/template.hbs b/lib/shared/addon/components/volume-source/source-vsphere-volume/template.hbs new file mode 100644 index 000000000..8dc56db57 --- /dev/null +++ b/lib/shared/addon/components/volume-source/source-vsphere-volume/template.hbs @@ -0,0 +1,31 @@ +
+
+ + {{#input-or-display editable=editing value=config.fsType}} + {{input type="text" value=config.fsType classNames="form-control" placeholder=(t 'cruPersistentVolume.vsphereVolume.fsType.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.storagePolicyID}} + {{input type="text" value=config.storagePolicyID classNames="form-control" placeholder=(t 'cruPersistentVolume.vsphereVolume.storagePolicyID.placeholder')}} + {{/input-or-display}} +
+
+ +
+
+ + {{#input-or-display editable=editing value=config.storagePolicyName}} + {{input type="text" value=config.storagePolicyName classNames="form-control" placeholder=(t 'cruPersistentVolume.vsphereVolume.storagePolicyName.placeholder')}} + {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=config.volumePath}} + {{input type="text" value=config.volumePath classNames="form-control" placeholder=(t 'cruPersistentVolume.vsphereVolume.volumePath.placeholder')}} + {{/input-or-display}} +
+
\ No newline at end of file diff --git a/lib/shared/addon/mixins/volume-source.js b/lib/shared/addon/mixins/volume-source.js index 1720a6192..c1a19f930 100644 --- a/lib/shared/addon/mixins/volume-source.js +++ b/lib/shared/addon/mixins/volume-source.js @@ -1,27 +1,94 @@ import Mixin from '@ember/object/mixin'; -import { get, set } from '@ember/object'; +import { get, set, computed, setProperties } from '@ember/object'; +import { inject as service } from '@ember/service'; export default Mixin.create({ + clusterStore: service(), // Inputs from comonent caller volume: null, editing: null, // Override from component definition - field: null, + plugin: null, + fields: null, // Locals config: null, didReceiveAttrs() { this._super(...arguments); + const plugin = get(this, 'plugin'); + const typeName = this.getTypeName(); + const schema = get(this, 'clusterStore').getById('schema', typeName); + const resourceFields = get(schema, 'resourceFields'); - const field = get(this,'field'); - let config = get(this, `volume.${field}`); - if ( !config ) { - config = this.configForNew(); - set(this, `volume.${field}`, config); - } - - set(this, 'config', config); + const changes = {}; + const fields = []; + Object.keys(resourceFields).forEach(key => { + const field = resourceFields[key]; + set(field, 'fieldKey', key); + fields.push(field); + const value = get(this, `volume.${plugin}.${key}`); + if (value !== undefined) { + changes[key] = value; + } else if (get(field, 'default') !== undefined) { + changes[key] = get(field, 'default') + } else if (get(field, 'type') === 'localObjectReference') { + changes[key] = { + name: '', + }; + } else if (get(field, 'type') === 'objectReference') { + changes[key] = { + name: '', + }; + } else if (get(field, 'type') === 'localObjectReference') { + changes[key] = { + name: '', + namespace: '', + }; + } else if (get(field, 'type') === 'secretReference') { + changes[key] = { + name: '', + namespace: '', + }; + } else if (get(field, 'type') === 'array[string]') { + changes[key] = []; + } else if (get(field, 'type') === 'map[string]') { + changes[key] = {}; + } else { + changes[key] = ''; + } + }); + setProperties(this, { + config: changes, + fields, + }); + this.sendUpdate(); }, + + sendUpdate: function () { + const plugin = get(this, 'plugin'); + const fields = get(this, 'fields') || []; + const out = {}; + fields.forEach(field => { + const key = field.fieldKey; + const value = get(this, `config.${key}`); + if (value !== undefined && value !== '') { + out[key] = value; + } + }); + console.log(plugin, out) + this.sendAction('changed', plugin, out); + }, + + getTypeName: function () { + const plugin = get(this, 'plugin'); + return get(this, 'clusterStore').getById('schema', 'persistentvolume').resourceFields[plugin].type.toLocaleLowerCase(); + }, + + actions: { + updateOptions(key, ary) { + set(this, `config.${key}`, ary); + }, + } }); diff --git a/lib/shared/app/components/volume-source/source-azure-disk/component.js b/lib/shared/app/components/volume-source/source-azure-disk/component.js new file mode 100644 index 000000000..f7bd27b25 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-azure-disk/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-azure-disk/component'; diff --git a/lib/shared/app/components/volume-source/source-azure-file/component.js b/lib/shared/app/components/volume-source/source-azure-file/component.js new file mode 100644 index 000000000..36ede6521 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-azure-file/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-azure-file/component'; diff --git a/lib/shared/app/components/volume-source/source-cephfs/component.js b/lib/shared/app/components/volume-source/source-cephfs/component.js new file mode 100644 index 000000000..1819e8dc9 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-cephfs/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-cephfs/component'; diff --git a/lib/shared/app/components/volume-source/source-cinder/component.js b/lib/shared/app/components/volume-source/source-cinder/component.js new file mode 100644 index 000000000..49ac4266f --- /dev/null +++ b/lib/shared/app/components/volume-source/source-cinder/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-cinder/component'; diff --git a/lib/shared/app/components/volume-source/source-fc/component.js b/lib/shared/app/components/volume-source/source-fc/component.js new file mode 100644 index 000000000..c3c4a7975 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-fc/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-fc/component'; diff --git a/lib/shared/app/components/volume-source/source-flex-volume/component.js b/lib/shared/app/components/volume-source/source-flex-volume/component.js new file mode 100644 index 000000000..12dafea61 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-flex-volume/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-flex-volume/component'; diff --git a/lib/shared/app/components/volume-source/source-flocker/component.js b/lib/shared/app/components/volume-source/source-flocker/component.js new file mode 100644 index 000000000..1b46262e3 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-flocker/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-flocker/component'; diff --git a/lib/shared/app/components/volume-source/source-gce-pd/component.js b/lib/shared/app/components/volume-source/source-gce-pd/component.js new file mode 100644 index 000000000..4b443a7b0 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-gce-pd/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-gce-pd/component'; diff --git a/lib/shared/app/components/volume-source/source-glusterfs/component.js b/lib/shared/app/components/volume-source/source-glusterfs/component.js new file mode 100644 index 000000000..4d7950fb5 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-glusterfs/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-glusterfs/component'; diff --git a/lib/shared/app/components/volume-source/source-iscsi/component.js b/lib/shared/app/components/volume-source/source-iscsi/component.js new file mode 100644 index 000000000..bf2b048ca --- /dev/null +++ b/lib/shared/app/components/volume-source/source-iscsi/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-iscsi/component'; diff --git a/lib/shared/app/components/volume-source/source-local/component.js b/lib/shared/app/components/volume-source/source-local/component.js new file mode 100644 index 000000000..ad8fe24cc --- /dev/null +++ b/lib/shared/app/components/volume-source/source-local/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-local/component'; diff --git a/lib/shared/app/components/volume-source/source-nfs/component.js b/lib/shared/app/components/volume-source/source-nfs/component.js new file mode 100644 index 000000000..77657e939 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-nfs/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-nfs/component'; diff --git a/lib/shared/app/components/volume-source/source-photon/component.js b/lib/shared/app/components/volume-source/source-photon/component.js new file mode 100644 index 000000000..619a6955b --- /dev/null +++ b/lib/shared/app/components/volume-source/source-photon/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-photon/component'; diff --git a/lib/shared/app/components/volume-source/source-portworx/component.js b/lib/shared/app/components/volume-source/source-portworx/component.js new file mode 100644 index 000000000..d19897278 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-portworx/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-portworx/component'; diff --git a/lib/shared/app/components/volume-source/source-quobyte/component.js b/lib/shared/app/components/volume-source/source-quobyte/component.js new file mode 100644 index 000000000..d09f586f3 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-quobyte/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-quobyte/component'; diff --git a/lib/shared/app/components/volume-source/source-rbd/component.js b/lib/shared/app/components/volume-source/source-rbd/component.js new file mode 100644 index 000000000..e6a87240c --- /dev/null +++ b/lib/shared/app/components/volume-source/source-rbd/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-rbd/component'; diff --git a/lib/shared/app/components/volume-source/source-scaleio/component.js b/lib/shared/app/components/volume-source/source-scaleio/component.js new file mode 100644 index 000000000..2db5dbc59 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-scaleio/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-scaleio/component'; diff --git a/lib/shared/app/components/volume-source/source-storageos/component.js b/lib/shared/app/components/volume-source/source-storageos/component.js new file mode 100644 index 000000000..aab830fa0 --- /dev/null +++ b/lib/shared/app/components/volume-source/source-storageos/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-storageos/component'; diff --git a/lib/shared/app/components/volume-source/source-vsphere-volume/component.js b/lib/shared/app/components/volume-source/source-vsphere-volume/component.js new file mode 100644 index 000000000..1cedd6f7d --- /dev/null +++ b/lib/shared/app/components/volume-source/source-vsphere-volume/component.js @@ -0,0 +1 @@ +export { default } from 'shared/components/volume-source/source-vsphere-volume/component'; diff --git a/translations/en-us.yaml b/translations/en-us.yaml index b4a7689b0..ea51a7f7c 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1761,7 +1761,304 @@ cruPersistentVolume: label: Mount Options addActionLabel: Add Option noData: No Mount Options - + awsElasticBlockStore: + fsType: + label: FS Type + placeholder: "e.g. ext4" + readOnly: + label: Read Only + partition: + label: Partition + placeholder: "e.g. 1" + volumeID: + label: Volume ID + placeholder: "e.g. volume1" + azureDisk: + cachingMode: + label: Caching Mode + placeholder: "e.g. None" + diskName: + label: Disk Name + placeholder: "e.g. kubernetes-pvc" + diskURI: + label: Disk URI + placeholder: "e.g. https://example.com/disk" + fsType: + label: FS Type + placeholder: "e.g. ext4" + kind: + label: Kind + placeholder: "e.g. PersistentVolumeClaim" + readOnly: + label: Read Only + azureFile: + secretName: + label: Secret Name + placeholder: "e.g. secret" + secretNamespace: + label: Secret Namespace + placeholder: "e.g. default" + shareName: + label: Share Name + placeholder: "e.g. abc" + readOnly: + label: Read Only + cephfs: + monitors: + label: Monitors + addActionLabel: Add + path: + label: Path + placeholder: "e.g. /var" + readOnly: + label: Read Only + secretFile: + label: Secret File + placeholder: "e.g. secret" + secretRef: + name: + label: Name + placeholder: "e.g. abc" + namespace: + label: Namespace + placeholder: "e.g. default" + label: Secret + user: + label: User + placeholder: "e.g. root" + rbd: + fsType: + label: FS Type + placeholder: "e.g. ext4" + image: + label: Image + placeholder: "e.g. image" + keyring: + label: Key Ring + placeholder: "e.g. /etc/ceph/keyring" + monitors: + label: Monitors + addActionLabel: Add + pool: + label: Pool + placeholder: "e.g. rbd" + readOnly: + label: Read Only + secretRef: + label: Secret + placeholder: "e.g. secret" + user: + label: User + placeholder: "e.g. root" + fc: + fsType: + label: FS Type + placeholder: "e.g. ext4" + lun: + label: Lun + placeholder: "e.g. 2" + readOnly: + label: Read Only + targetWWNs: + label: Target WWNs + addActionLabel: Add + wwids: + label: Wwids + addActionLabel: Add + flexVolume: + driver: + label: Driver + placeholder: "e.g. driver" + fsType: + label: FS Type + placeholder: "e.g. ext4" + options: + label: Options + addActionLabel: Add + readOnly: + label: Read Only + secretRef: + label: Secret + placeholder: "e.g. secret" + flocker: + datasetName: + label: Dataset Name + placeholder: "e.g. dataset" + datasetUUID: + label: Dataset UUID + placeholder: "e.g. uuid" + glusterfs: + endpoints: + label: Endpoints + placeholder: "e.g. 10.240.106.152:1" + path: + label: Path + placeholder: "e.g. kube_vol" + readOnly: + label: Read Only + gcePersistentDisk: + fsType: + label: FS Type + placeholder: "e.g. ext4" + partition: + label: Partition + placeholder: "e.g. 1" + pdName: + label: PD Name + placeholder: "e.g. abc" + readOnly: + label: Read Only + iscsi: + chapAuthDiscovery: + label: Chap Auth Discovery + chapAuthSession: + label: Chap Auth Session + fsType: + label: FS Type + placeholder: "e.g. ext4" + initiatorName: + label: Initiator Name + placeholder: "e.g. abc" + iqn: + label: IQN + placeholder: "e.g. 2" + iscsiInterface: + label: iSCSI Interface + placeholder: "e.g. interface" + lun: + label: Lun + placeholder: "e.g. 2" + portals: + label: Portals + addActionLabel: Add + readOnly: + label: Read Only + secretRef: + label: Secret + placeholder: "e.g. secret" + targetPortal: + label: Target Portal + placeholder: "e.g. portal" + local: + path: + label: Path + placeholder: "e.g. /var" + nfs: + path: + label: Path + placeholder: "e.g. /var" + readOnly: + label: Read Only + server: + label: Server + placeholder: "e.g. 10.244.1.4" + cinder: + fsType: + label: FS Type + placeholder: "e.g. ext4" + readOnly: + label: Read Only + volumeID: + label: Volume ID + placeholder: "e.g. vol" + photonPersistentDisk: + fsType: + label: FS Type + placeholder: "e.g. ext4" + pdID: + label: PD ID + placeholder: "e.g. abc" + portworxVolume: + fsType: + label: FS Type + placeholder: "e.g. ext4" + readOnly: + label: Read Only + volumeID: + label: Volume ID + placeholder: "e.g. abc" + quobyte: + group: + label: Group + placeholder: "e.g. abc" + readOnly: + label: Read Only + registry: + label: Registry + placeholder: "e.g. abc" + user: + label: User + placeholder: "e.g. root" + volume: + label: Volume + placeholder: "e.g. vol" + scaleIO: + fsType: + label: FS Type + placeholder: "e.g. ext4" + gateway: + label: Gateway + placeholder: "e.g. https://localhost:443/api" + protectionDomain: + label: Protection Domain + placeholder: "e.g. pd01" + readOnly: + label: Read Only + secretRef: + name: + label: Name + placeholder: "e.g. secret" + namespace: + label: Namespace + placeholder: "e.g. default" + label: Secret + sslEnabled: + label: SSL Enabled + storageMode: + label: Storage Mode + placeholder: "e.g. ThinProvisioned" + storagePool: + label: Storage Pool + placeholder: "e.g. sp01" + system: + label: System + placeholder: "e.g. scaleio" + volumeName: + label: Volume Name + placeholder: "e.g. vol-0" + storageos: + fsType: + label: FS Type + placeholder: "e.g. ext4" + readOnly: + label: Read Only + secretRef: + name: + label: Name + placeholder: "e.g. secret" + namespace: + label: Namespace + placeholder: "e.g. default" + label: Secret + volumeName: + label: Volume Name + placeholder: "e.g. vol" + volumeNamespace: + label: Volume Namespace + placeholder: "e.g. default" + vsphereVolume: + fsType: + label: FS Type + placeholder: "e.g. ext4" + storagePolicyID: + label: Storage Policy ID + placeholder: "e.g. sp1" + storagePolicyName: + label: Storage Policy Name + placeholder: "e.g. sp" + volumePath: + label: Volume Path + placeholder: "e.g. /" cruStorageClass: name: placeholder: e.g. storage