mirror of https://github.com/rancher/ui.git
Merge pull request #1738 from loganhz/fix
Fix edit cluster issue and update storage class
This commit is contained in:
commit
32346a4389
|
|
@ -127,7 +127,7 @@ export default Component.extend({
|
|||
|
||||
const remove = [];
|
||||
original.forEach((pool) => {
|
||||
if ( !nodePools.includes(pool) ) {
|
||||
if ( !nodePools.some(p => p.id === pool.id) ) {
|
||||
// Remove
|
||||
remove.push(pool);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,74 @@
|
|||
import Component from '@ember/component';
|
||||
import layout from './template';
|
||||
import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner';
|
||||
import { get, setProperties, observer } from '@ember/object';
|
||||
|
||||
const FIELDS = ['skuName', 'location', 'storageAccount', 'storageaccounttype', 'kind'];
|
||||
|
||||
const KIND_OPTIONS = [
|
||||
{ value: 'shared', translationKey: 'cruStorageClass.azure-disk.kind.shared' },
|
||||
{ value: 'dedicated', translationKey: 'cruStorageClass.azure-disk.kind.dedicated' },
|
||||
{ value: 'managed', translationKey: 'cruStorageClass.azure-disk.kind.managed' },
|
||||
];
|
||||
export default Component.extend(StorageClassProvisioner, {
|
||||
layout,
|
||||
|
||||
provisioner: 'azure-disk',
|
||||
fields: FIELDS,
|
||||
kindOptions: KIND_OPTIONS,
|
||||
|
||||
volumeType: 'new',
|
||||
skuName: null,
|
||||
location: null,
|
||||
storageAccount: null,
|
||||
storageaccounttype: null,
|
||||
kind: 'shared',
|
||||
|
||||
didReceiveAttrs() {
|
||||
const changes = {};
|
||||
const skuName = get(this, 'parameters.skuName') || '';
|
||||
const location = get(this, 'parameters.location') || '';
|
||||
const storageAccount = get(this, 'parameters.storageAccount') || '';
|
||||
|
||||
const storageaccounttype = get(this, 'parameters.storageaccounttype') || '';
|
||||
const kind = get(this, 'parameters.kind') || 'shared';
|
||||
if (skuName || location || storageAccount) {
|
||||
changes['skuName'] = skuName;
|
||||
changes['location'] = location;
|
||||
changes['storageAccount'] = storageAccount;
|
||||
changes['volumeType'] = 'unmanaged';
|
||||
} else {
|
||||
changes['storageaccounttype'] = storageaccounttype;
|
||||
changes['kind'] = kind;
|
||||
changes['volumeType'] = 'new';
|
||||
}
|
||||
setProperties(this, changes);
|
||||
},
|
||||
|
||||
sendUpdate: observer('volumeType', 'skuName', 'location', 'storageAccount', 'storageaccounttype', 'kind', function () {
|
||||
const type = get(this, 'volumeType');
|
||||
const skuName = get(this, 'skuName');
|
||||
const location = get(this, 'location');
|
||||
const storageAccount = get(this, 'storageAccount');
|
||||
const storageaccounttype = get(this, 'storageaccounttype');
|
||||
const kind = get(this, 'kind');
|
||||
|
||||
const out = {};
|
||||
if (type === 'unmanaged') {
|
||||
if (skuName) {
|
||||
out['skuName'] = skuName;
|
||||
}
|
||||
if (location) {
|
||||
out['location'] = location;
|
||||
}
|
||||
if (storageAccount) {
|
||||
out['storageAccount'] = storageAccount;
|
||||
}
|
||||
} else {
|
||||
if (storageaccounttype) {
|
||||
out['storageaccounttype'] = storageaccounttype;
|
||||
}
|
||||
if (kind) {
|
||||
out['kind'] = kind;
|
||||
}
|
||||
}
|
||||
this.sendAction('changed', out);
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,69 @@
|
|||
{{#each fieldsGroup as |fields|}}
|
||||
<div class="row">
|
||||
{{#if editing}}
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=volumeType value='unmanaged'}}
|
||||
{{t 'cruStorageClass.azure-disk.unmanaged'}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=volumeType value='new'}}
|
||||
{{t 'cruStorageClass.azure-disk.new'}}
|
||||
</label>
|
||||
</div>
|
||||
{{else if (eq volumeType 'unmanaged')}}
|
||||
{{t 'cruStorageClass.azure-disk.unmanaged'}}
|
||||
{{else}}
|
||||
{{t 'cruStorageClass.azure-disk.new'}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if (eq volumeType 'unmanaged')}}
|
||||
<div class="row mb-20">
|
||||
{{#each fields as |field|}}
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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'))}}
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.skuName.label')}}</label>
|
||||
{{#input-or-display editable=editing value=skuName}}
|
||||
{{input type="text" value=skuName classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.skuName.placeholder'))}}
|
||||
{{/input-or-display}}
|
||||
</div>
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.location.label')}}</label>
|
||||
{{#input-or-display editable=editing value=location}}
|
||||
{{input type="text" value=location classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.location.placeholder'))}}
|
||||
{{/input-or-display}}
|
||||
</div>
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.storageAccount.label')}}</label>
|
||||
{{#input-or-display editable=editing value=storageAccount}}
|
||||
{{input type="text" value=storageAccount classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.storageAccount.placeholder'))}}
|
||||
{{/input-or-display}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<div class="row mb-20">
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.storageaccounttype.label')}}</label>
|
||||
{{#input-or-display editable=editing value=storageaccounttype}}
|
||||
{{input type="text" value=storageaccounttype classNames="form-control" placeholder=(t (concat 'cruStorageClass.' provisioner '.storageaccounttype.placeholder'))}}
|
||||
{{/input-or-display}}
|
||||
</div>
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.kind.label')}}</label>
|
||||
|
||||
{{#if editing}}
|
||||
{{new-select
|
||||
classNames="form-control"
|
||||
content=kindOptions
|
||||
value=kind
|
||||
optionLabelPath="translationKey"
|
||||
localizedLabel=true
|
||||
}}
|
||||
{{else}}
|
||||
<div class="text-muted">
|
||||
{{kind}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
@ -1,12 +1,49 @@
|
|||
import Component from '@ember/component';
|
||||
import layout from './template';
|
||||
import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner';
|
||||
|
||||
const FIELDS = ['type', 'availability'];
|
||||
import { get, setProperties, observer } from '@ember/object';
|
||||
|
||||
export default Component.extend(StorageClassProvisioner, {
|
||||
layout,
|
||||
|
||||
provisioner: 'cinder',
|
||||
fields: FIELDS,
|
||||
|
||||
type: null,
|
||||
availability: null,
|
||||
|
||||
didReceiveAttrs() {
|
||||
const changes = {};
|
||||
|
||||
changes['type'] = get(this, 'parameters.type') || '';
|
||||
|
||||
const zone = get(this, 'parameters.availability');
|
||||
if (zone) {
|
||||
changes['zoneAutomatic'] = false;
|
||||
changes['availability'] = zone;
|
||||
} else {
|
||||
changes['zoneAutomatic'] = true;
|
||||
changes['availability'] = '';
|
||||
}
|
||||
|
||||
setProperties(this, changes);
|
||||
},
|
||||
|
||||
sendUpdate: observer('type', 'availability', 'zoneAutomatic', function () {
|
||||
const type = get(this, 'type');
|
||||
const out = {};
|
||||
|
||||
if (type) {
|
||||
out['type'] = type;
|
||||
}
|
||||
|
||||
const zoneAutomatic = get(this, 'zoneAutomatic');
|
||||
if (!zoneAutomatic) {
|
||||
const zones = (get(this, 'availability') || '').trim();
|
||||
if (zones) {
|
||||
out['availability'] = zones;
|
||||
}
|
||||
}
|
||||
|
||||
this.sendAction('changed', out);
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,36 @@
|
|||
{{#each fieldsGroup as |fields|}}
|
||||
<div class="row mb-20">
|
||||
{{#each fields as |field|}}
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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}}
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="row">
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t 'cruStorageClass.cinder.type.label'}}</label>
|
||||
{{#input-or-display editable=editing value=type}}
|
||||
{{input type="text" value=type classNames="form-control" placeholder=(t 'cruStorageClass.cinder.type.placeholder')}}
|
||||
{{/input-or-display}}
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t 'cruStorageClass.cinder.availability.label'}}</label>
|
||||
{{#if editing}}
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=zoneAutomatic value=true}}
|
||||
{{t 'cruStorageClass.cinder.availability.automatic'}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
{{radio-button selection=zoneAutomatic value=false}}
|
||||
{{t 'cruStorageClass.cinder.availability.manual'}}
|
||||
</label>
|
||||
</div>
|
||||
{{#unless zoneAutomatic}}
|
||||
{{textarea-autogrow placeholder="cruStorageClass.cinder.availability.placeholder" spellcheck="false" required=true value=availability}}
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
<div>
|
||||
{{#if zoneAutomatic}}
|
||||
{{t 'cruStorageClass.cinder.availability.automatic'}}
|
||||
{{else}}
|
||||
{{zones}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -2,8 +2,27 @@ import Component from '@ember/component';
|
|||
import layout from './template';
|
||||
import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner';
|
||||
|
||||
const FIELDS = ['gateway', 'system', 'protectionDomain',
|
||||
'storagePool', 'storageMode', 'secretRef', 'readOnly', 'fsType'];
|
||||
const FIELDS = [
|
||||
'gateway',
|
||||
'system',
|
||||
'protectionDomain',
|
||||
'storagePool',
|
||||
{
|
||||
id: 'storageMode',
|
||||
options: [
|
||||
{ value: 'ThinProvisioned', translationKey: 'cruStorageClass.scaleio.storageMode.ThinProvisioned' },
|
||||
{ value: 'ThickProvisioned',translationKey: 'cruStorageClass.scaleio.storageMode.ThickProvisioned' },
|
||||
]
|
||||
},
|
||||
'secretRef',
|
||||
{
|
||||
id: 'readOnly',
|
||||
options: [
|
||||
{ value: 'false',translationKey: 'generic.no' },
|
||||
{ value: 'true', translationKey: 'generic.yes' },
|
||||
]
|
||||
},
|
||||
'fsType'];
|
||||
|
||||
export default Component.extend(StorageClassProvisioner, {
|
||||
layout,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,27 @@
|
|||
<div class="row mb-20">
|
||||
{{#each fields as |field|}}
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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}}
|
||||
{{#if field.options}}
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field.id '.label')}}</label>
|
||||
{{#if editing}}
|
||||
{{new-select
|
||||
classNames="form-control"
|
||||
content=field.options
|
||||
value=(get model field.id)
|
||||
optionLabelPath="translationKey"
|
||||
localizedLabel=true
|
||||
}}
|
||||
{{else}}
|
||||
<div class="text-muted">
|
||||
{{get model field.id}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,20 @@ import Component from '@ember/component';
|
|||
import layout from './template';
|
||||
import StorageClassProvisioner from 'shared/mixins/storage-class-provisioner';
|
||||
|
||||
const FIELDS = ['diskformat', 'storagePolicyName', 'datastore',
|
||||
'hostFailuresToTolerate', 'cachereservation', 'fstype'];
|
||||
const FIELDS = [
|
||||
{
|
||||
id: 'diskformat',
|
||||
options: [
|
||||
{ value: 'thin', label: 'thin', translationKey: 'cruStorageClass.vsphere-volume.diskformat.thin' },
|
||||
{ value: 'zeroedthick', label: 'zeroedthick', translationKey: 'cruStorageClass.vsphere-volume.diskformat.zeroedthick' },
|
||||
{ value: 'eagerzeroedthick', label: 'eagerzeroedthick', translationKey: 'cruStorageClass.vsphere-volume.diskformat.eagerzeroedthick' }]
|
||||
},
|
||||
'storagePolicyName',
|
||||
'datastore',
|
||||
'hostFailuresToTolerate',
|
||||
'cachereservation',
|
||||
'fstype'
|
||||
];
|
||||
|
||||
export default Component.extend(StorageClassProvisioner, {
|
||||
layout,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,27 @@
|
|||
<div class="row mb-20">
|
||||
{{#each fields as |field|}}
|
||||
<div class="col span-4">
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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}}
|
||||
{{#if field.options}}
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field.id '.label')}}</label>
|
||||
{{#if editing}}
|
||||
{{new-select
|
||||
classNames="form-control"
|
||||
content=field.options
|
||||
value=(get model field.id)
|
||||
optionLabelPath="translationKey"
|
||||
localizedLabel=true
|
||||
}}
|
||||
{{else}}
|
||||
<div class="text-muted">
|
||||
{{get model field.id}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<label class="acc-label">{{t (concat 'cruStorageClass.' provisioner '.' field '.label')}}</label>
|
||||
{{#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}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ export default Mixin.create({
|
|||
const fields = get(this, 'fields') || [];
|
||||
if (fields.length > 0) {
|
||||
fields.forEach(field => {
|
||||
this.addObserver(`model.${field}`, this, 'sendUpdate');
|
||||
const key = field.id ? field.id : field;
|
||||
this.addObserver(`model.${key}`, this, 'sendUpdate');
|
||||
});
|
||||
this.sendUpdate();
|
||||
}
|
||||
|
|
@ -36,7 +37,8 @@ export default Mixin.create({
|
|||
if (fields.length > 0) {
|
||||
const changes = {};
|
||||
fields.forEach(field => {
|
||||
changes[field] = get(this, `parameters.${field}`) || '';
|
||||
const key = field.id ? field.id : field;
|
||||
changes[key] = get(this, `parameters.${key}`) || get(field, 'options.firstObject.value') || '';
|
||||
});
|
||||
setProperties(this, {
|
||||
model: changes
|
||||
|
|
@ -49,9 +51,10 @@ export default Mixin.create({
|
|||
if (fields.length > 0) {
|
||||
const out = {};
|
||||
fields.forEach(field => {
|
||||
const value = get(this, `model.${field}`) || '';
|
||||
const key = field.id ? field.id : field;
|
||||
const value = get(this, `model.${key}`) || '';
|
||||
if (value) {
|
||||
out[field] = value;
|
||||
out[key] = value;
|
||||
}
|
||||
});
|
||||
this.sendAction('changed', out);
|
||||
|
|
|
|||
|
|
@ -1783,11 +1783,15 @@ cruStorageClass:
|
|||
placeholder: "e.g. fast"
|
||||
availability:
|
||||
label: Availability Zone
|
||||
automatic: "Automatic: Zones the cluster has a node in"
|
||||
manual: "Manual: Choose specific zones"
|
||||
placeholder: "e.g. nova"
|
||||
vsphere-volume:
|
||||
diskformat:
|
||||
label: Disk Format
|
||||
placeholder: "e.g. thin"
|
||||
thin: Thin
|
||||
zeroedthick: Zeroed Thick
|
||||
eagerzeroedthick: Eager Zeroed Thick
|
||||
storagePolicyName:
|
||||
label: Storage Policy Name
|
||||
placeholder: "e.g. gold"
|
||||
|
|
@ -1804,6 +1808,8 @@ cruStorageClass:
|
|||
label: Cache Reservation
|
||||
placeholder: "e.g. 20"
|
||||
azure-disk:
|
||||
new: New Azure Disk
|
||||
unmanaged: Azure Unmanaged Disk
|
||||
skuName:
|
||||
label: Sku Name
|
||||
placeholder: "e.g. Standard_LRS"
|
||||
|
|
@ -1818,6 +1824,9 @@ cruStorageClass:
|
|||
placeholder: "e.g. Standard_LRS"
|
||||
kind:
|
||||
label: Kind
|
||||
shared: Shared
|
||||
dedicated: Dedicated
|
||||
managed: Managed
|
||||
placeholder: "e.g. Shared"
|
||||
azure-file:
|
||||
skuName:
|
||||
|
|
@ -1866,7 +1875,8 @@ cruStorageClass:
|
|||
placeholder: "e.g. sp1"
|
||||
storageMode:
|
||||
label: Storage Mode
|
||||
placeholder: "e.g. ThinProvisioned"
|
||||
ThinProvisioned: Thin Provisioned
|
||||
ThickProvisioned: Thick Provisioned
|
||||
secretRef:
|
||||
label: Secret Ref
|
||||
placeholder: "e.g. sio-secret"
|
||||
|
|
|
|||
Loading…
Reference in New Issue