diff --git a/app/workload/controller.js b/app/workload/controller.js index 3ac471bcc..b6f747ad9 100644 --- a/app/workload/controller.js +++ b/app/workload/controller.js @@ -2,6 +2,7 @@ import { computed } from '@ember/object'; import { oneWay } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Controller, { inject as controller } from '@ember/controller'; +import { get, set } from '@ember/object'; export default Controller.extend({ application: controller(), @@ -9,12 +10,23 @@ export default Controller.extend({ allWorkloads: service(), service: oneWay('model.workload'), - + namespace: "", sortBy: 'priority', fixedLaunchConfig: null, activeLaunchConfig: null, portSortBy: 'privatePort', + init(){ + this._super(...arguments); + let namespaceId = null; + namespaceId = get(this, 'service.namespaceId'); + if (namespaceId) { + let namespace = get(this, 'clusterStore').getById('namespace', namespaceId); + if (namespace) { + set(this, 'namespace', namespace); + } + } + }, headers: [ { name: 'priority', diff --git a/app/workload/template.hbs b/app/workload/template.hbs index caf05f7a7..2583b570d 100644 --- a/app/workload/template.hbs +++ b/app/workload/template.hbs @@ -167,7 +167,7 @@ {{container/form-volumes launchConfig=activeLaunchConfig - service=service + workload=service editing=false expandAll=al.expandAll expandFn=expandFn diff --git a/lib/shared/addon/components/container/form-volume-row/template.hbs b/lib/shared/addon/components/container/form-volume-row/template.hbs index 556d4aec2..75fc0b4b0 100644 --- a/lib/shared/addon/components/container/form-volume-row/template.hbs +++ b/lib/shared/addon/components/container/form-volume-row/template.hbs @@ -2,42 +2,54 @@
- {{input type="text" value=model.volume.name placeholder=(t 'formVolumeRow.name.placeholder')}} + {{#input-or-display editable=editing value=model.volume.name}} + {{input type="text" value=model.volume.name placeholder=(t 'formVolumeRow.name.placeholder')}} + {{/input-or-display}}
{{t (concat 'formVolumeRow.mode.' model.mode)}} - {{#if (eq model.mode "newPvc")}} - - {{else if (or (eq model.mode "existingVolume") (eq model.mode "newVolume"))}} - + {{#if editing}} + {{#if (eq model.mode "newPvc")}} + + {{else if (or (eq model.mode "existingVolume") (eq model.mode "newVolume"))}} + + {{/if}} {{/if}}
-
- -
+ {{#if editing}} +
+ +
+ {{/if}}
{{#if (eq model.mode "existingPvc")}}
- - {{new-select - value=model.volume.persistentVolumeClaim.persistentVolumeClaimId - content=pvcChoices - prompt="Select a Persistent Volume Claim..." - localizedLabel=false - }} + + {{#if editing}} + {{new-select + value=model.volume.persistentVolumeClaim.persistentVolumeClaimId + content=pvcChoices + prompt="Select a Persistent Volume Claim..." + localizedLabel=false + }} + {{else}} +
+ {{model.volume.persistentVolumeClaim.persistentVolumeClaimId}} +
+ {{/if}}
{{else if (eq model.mode "bindMount")}} @@ -58,45 +70,58 @@ {{#if model.mounts.length}} - + - + - - + + {{#if editing}} + + {{/if}} {{#each model.mounts as |mnt|}} - + {{#if editing}} + + {{/if}} {{/each}}
Mount Point{{field-required}}{{t "formVolumes.table.mountPoint"}}{{field-required}}  Sub Path in Volume{{t "formVolumeRow.subPath"}}  Read-Only {{t "formVolumeRow.readOnly"}} 
- {{input value=mnt.mountPath}} + {{#input-or-display editable=editing value=mnt.mountPath}} + {{input value=mnt.mountPath}} + {{/input-or-display}} - {{input value=mnt.subPath}} + {{#input-or-display editable=editing value=mnt.subPath}} + {{input value=mnt.subPath}} + {{/input-or-display}} - {{input type="checkbox" classNames="form-control" checked=mnt.readOnly}} - - + {{#if editing}} + {{input type="checkbox" classNames="form-control" checked=mnt.readOnly}} + {{else}} + {{mnt.readOnly}} + {{/if}} + +
{{else}} - The volume will not be mounted in the current container. It may be used by other containers in the pod. + {{t "formVolumeRow.noVolume"}} + {{/if}} + {{#if editing}} +
+ +
{{/if}} - -
- -
diff --git a/lib/shared/addon/components/container/form-volumes/template.hbs b/lib/shared/addon/components/container/form-volumes/template.hbs index 31b24d516..b485709f9 100644 --- a/lib/shared/addon/components/container/form-volumes/template.hbs +++ b/lib/shared/addon/components/container/form-volumes/template.hbs @@ -8,6 +8,7 @@ expand=(action expandFn) everExpanded=true }} + {{log volumesArray}} {{#if volumesArray.length}} {{#each volumesArray as |row|}} {{container/form-volume-row diff --git a/translations/en-us.yaml b/translations/en-us.yaml index aba50f953..1de96bd46 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -3621,7 +3621,11 @@ formVolumeRow: bindMount: Bind-Mount tmpfs: Tmpfs secret: Secret - + remove: Remove Volume + subPath: Sub Path in Volume + readOnly: Read-Only + noVolume: The volume will not be mounted in the current container. It may be used by other containers in the pod. + addMount: Add Mount formVolumes: title: Volumes detail: Persist and share data separate from the lifecycle of an individual container.