mirror of https://github.com/rancher/ui.git
commit
3b75507e32
|
|
@ -61,8 +61,6 @@
|
|||
{{/if}}
|
||||
{{/sortable-table}}
|
||||
</section>
|
||||
{{else if projectController.projects.current.isKubernetes}}
|
||||
<div class="m-40 text-center text-muted">Coming soon for Kubernetes clusters</div>
|
||||
{{else}}
|
||||
{{empty-table resource="container" newRoute="volumes.new" newTranslationKey="nav.containers.addVolume"}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,12 @@ export default Component.extend({
|
|||
if (!get(this,'everExpanded')) {
|
||||
set(this,'everExpanded', true);
|
||||
}
|
||||
|
||||
run.next(() => {
|
||||
if ( this.isDestroyed || this.isDestroying ) {
|
||||
return;
|
||||
}
|
||||
|
||||
set(this,'expanded', eoi);
|
||||
});
|
||||
}
|
||||
|
|
@ -100,7 +105,12 @@ export default Component.extend({
|
|||
if (!get(this,'everExpanded')) {
|
||||
set(this,'everExpanded', true);
|
||||
}
|
||||
|
||||
run.next(() => {
|
||||
if ( this.isDestroyed || this.isDestroying ) {
|
||||
return;
|
||||
}
|
||||
|
||||
set(this,'intent', get(this,'componentName'));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<i class="icon icon-edit"/>
|
||||
{{t 'generic.edit'}}
|
||||
</button>
|
||||
{{else if (eq model.mode "newVolume")}}
|
||||
{{else if (or (eq model.mode "existingVolume") (eq model.mode "newVolume"))}}
|
||||
<button class="btn bg-transparent" action={{action 'defineNewVolume'}}>
|
||||
<i class="icon icon-edit"/>
|
||||
{{t 'generic.edit'}}
|
||||
|
|
@ -29,11 +29,6 @@
|
|||
</div>
|
||||
</div>
|
||||
{{#if (eq model.mode "existingPvc")}}
|
||||
{{!--volume-source/source-persistent-volume-claim
|
||||
config=model.volume.persistentVolumeClaim
|
||||
volume=model.volume
|
||||
editing=true
|
||||
!--}}
|
||||
<div class="row">
|
||||
<div class="col span-6">
|
||||
<label class="acc-label">Persistent Volume Claim {{field-required}}</label>
|
||||
|
|
@ -41,7 +36,7 @@
|
|||
value=model.volume.persistentVolumeClaim.persistentVolumeClaimId
|
||||
content=pvcChoices
|
||||
prompt="Select a Persistent Volume Claim..."
|
||||
localizedPrompt=false
|
||||
localizedLabel=false
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Component from '@ember/component';
|
|||
import layout from './template';
|
||||
|
||||
export const NEW_VOLUME = 'newVolume';
|
||||
export const EXISTING_VOLUME = 'existingVolume';
|
||||
export const NEW_PVC = 'newPvc';
|
||||
export const EXISTING_PVC = 'existingPvc';
|
||||
export const BIND_MOUNT = 'bindMount';
|
||||
|
|
@ -33,15 +34,51 @@ export default Component.extend({
|
|||
this.sendAction('registerHook', this.saveVolumes.bind(this), {name: 'saveVolumes', key: '_volumeHooks'});
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
didInitAttrs() {
|
||||
if (!get(this,'expandFn')) {
|
||||
set(this,'expandFn', function(item) {
|
||||
item.toggleProperty('expanded');
|
||||
});
|
||||
}
|
||||
|
||||
//@TODO-2.0 read existing volumes/mounts from the workload/launchConfig
|
||||
set(this, 'volumesArray', []);
|
||||
const out = [];
|
||||
let entry;
|
||||
(get(this, 'workload.volumes')||[]).forEach((volume) => {
|
||||
if ( volume.persistentVolumeClaim ) {
|
||||
entry = {
|
||||
mode: EXISTING_PVC,
|
||||
volume,
|
||||
};
|
||||
} else if ( volume.hostPath ) {
|
||||
entry = {
|
||||
mode: BIND_MOUNT,
|
||||
volume,
|
||||
};
|
||||
} else if ( volume.secret ) {
|
||||
entry = {
|
||||
mode: SECRET,
|
||||
volume,
|
||||
};
|
||||
} else {
|
||||
entry = {
|
||||
mode: EXISTING_VOLUME,
|
||||
volume,
|
||||
};
|
||||
}
|
||||
|
||||
entry.mounts = [];
|
||||
out.push(entry);
|
||||
});
|
||||
|
||||
(get(this, 'launchConfig.volumeMounts')||[]).forEach((mount) => {
|
||||
entry = out.findBy('volume.name', mount.name);
|
||||
|
||||
if ( entry ) {
|
||||
entry.mounts.push(mount);
|
||||
}
|
||||
});
|
||||
|
||||
set(this, 'volumesArray', out);
|
||||
},
|
||||
|
||||
// Create (ephermal) Volume -> volume entry on pod
|
||||
|
|
|
|||
|
|
@ -95,9 +95,8 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
|
||||
} else {
|
||||
set(pr, 'storageClassId', null);
|
||||
set(pr, 'resources', null);
|
||||
set(pr, 'resources', {
|
||||
requests: Object.assign({}, get(pr, 'persistentVolume.capacity')),
|
||||
requests: Object.assign({}, get(pr,'persistentVolume.capacity')),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ export default Component.extend(ModalBase, {
|
|||
isAdmin: alias('access.admin'),
|
||||
|
||||
containerCount: function() {
|
||||
let count = this.get('containers.length');
|
||||
let count = this.get('pods.length');
|
||||
if ( count > 9 ) {
|
||||
return count;
|
||||
} else {
|
||||
return '0' + count;
|
||||
}
|
||||
}.property('containers.length'),
|
||||
}.property('pods.length'),
|
||||
|
||||
time: DEFAULT_TIME,
|
||||
timer: null,
|
||||
|
|
@ -36,7 +36,7 @@ export default Component.extend(ModalBase, {
|
|||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set('containers', this.get('store').all('container'));
|
||||
this.set('pods', this.get('store').all('pod'));
|
||||
|
||||
this.set('timer', setInterval(() => {
|
||||
this.updateTime();
|
||||
|
|
|
|||
|
|
@ -1,18 +1,31 @@
|
|||
import Component from '@ember/component';
|
||||
import layout from './template';
|
||||
import { computed } from '@ember/object';
|
||||
import VolumeSource from 'shared/mixins/volume-source';
|
||||
|
||||
export default Component.extend({
|
||||
export default Component.extend(VolumeSource, {
|
||||
layout,
|
||||
field: 'hostPath',
|
||||
fieldType: 'hostPathVolumeSource',
|
||||
|
||||
kindChoices: [
|
||||
'DirectoryOrCreate',
|
||||
kindChoices: computed(function() {
|
||||
const out = [
|
||||
{label: 'volumeSource.host-path.kind.Any', value: ""},
|
||||
];
|
||||
|
||||
['DirectoryOrCreate',
|
||||
'FileOrCreate',
|
||||
'Directory',
|
||||
'File',
|
||||
'Socket',
|
||||
'CharDevice',
|
||||
'BlockDevice',
|
||||
],
|
||||
'BlockDevice'].forEach((value) => {
|
||||
out.push({
|
||||
label: `volumeSource.host-path.kind.${value}`,
|
||||
value: value
|
||||
});
|
||||
});
|
||||
|
||||
return out;
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,20 +8,11 @@
|
|||
<div class="col span-6">
|
||||
<label class="acc-label">{{t 'volumeSource.host-path.kind.label'}}</label>
|
||||
{{#if editing}}
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=config.kind value=""}}
|
||||
{{t 'volumeSource.host-path.kind.Any'}}
|
||||
</label>
|
||||
</div>
|
||||
{{#each kindChoices as |name|}}
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=config.kind value=name}}
|
||||
{{t (concat 'volumeSource.host-path.kind.' name)}}
|
||||
</label>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{new-select
|
||||
value=config.kind
|
||||
content=kindChoices
|
||||
localizedLabel=true
|
||||
}}
|
||||
{{else if config.kind}}
|
||||
<div>
|
||||
{{t (concat 'volumeSource.host-path.kind.' config.kind)}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "2.0.27",
|
||||
"version": "2.0.28",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
|
|
|||
|
|
@ -3742,8 +3742,9 @@ formVolumeRow:
|
|||
mode:
|
||||
label: Volume Type
|
||||
newVolume: Ephemeral Volume
|
||||
existingVolume: Existing Volume
|
||||
newPvc: New Volume Claim
|
||||
existingPvc: Volume Claim
|
||||
existingPvc: Persistent Volume Claim
|
||||
bindMount: Bind-Mount
|
||||
tmpfs: Tmpfs
|
||||
secret: Secret
|
||||
|
|
@ -3768,6 +3769,7 @@ formVolumes:
|
|||
add:
|
||||
label: Add Volume...
|
||||
newVolume: Add an ephemeral volume
|
||||
existingVolume: Existing ephemeral volume
|
||||
newPvc: Add a new persistent volume (claim)
|
||||
existingPvc: Use an existing persistent volume (claim)
|
||||
bindMount: Bind-mount a host directory
|
||||
|
|
@ -5463,7 +5465,7 @@ volumeSource:
|
|||
label: Path on the Node
|
||||
placeholder: e.g. /data
|
||||
kind:
|
||||
label: The target path must be
|
||||
label: The Path on the Node must be
|
||||
Any: "Anything: do no check the target path"
|
||||
DirectoryOrCreate: A directory, or create if it does not exist
|
||||
FileOrCreate: A file, or create if it does not exist
|
||||
|
|
|
|||
Loading…
Reference in New Issue