mirror of https://github.com/rancher/ui.git
commit
ea90cefa27
|
|
@ -23,18 +23,6 @@ export default Resource.extend({
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
canBulkRemove: computed('clusterTemplateId', function() {
|
|
||||||
let { clusterTemplate } = this;
|
|
||||||
|
|
||||||
if (clusterTemplate &&
|
|
||||||
clusterTemplate.defaultRevisionId &&
|
|
||||||
clusterTemplate.defaultRevisionId !== this.id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}),
|
|
||||||
|
|
||||||
canMakeDefault: computed('clusterTemplate.defaultRevisionId', function() {
|
canMakeDefault: computed('clusterTemplate.defaultRevisionId', function() {
|
||||||
let { clusterTemplate: { defaultRevisionId = '' } } = this;
|
let { clusterTemplate: { defaultRevisionId = '' } } = this;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -824,6 +824,15 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
allErrors: computed('errors.[]', 'clusterErrors.[]', 'otherErrors.[]', 'clusterOptErrors.[]', function() {
|
||||||
|
let {
|
||||||
|
errors, clusterErrors, clusterOptErrors, otherErrors,
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
return [...(errors || []), ...(clusterErrors || []), ...(clusterOptErrors || []), ...(otherErrors || [])];
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
getClusterFields(primaryResource) {
|
getClusterFields(primaryResource) {
|
||||||
let pojoPr = JSON.parse(JSON.stringify(removeEmpty(primaryResource, EXCLUDED_KEYS)));
|
let pojoPr = JSON.parse(JSON.stringify(removeEmpty(primaryResource, EXCLUDED_KEYS)));
|
||||||
let decamelizedObj = {};
|
let decamelizedObj = {};
|
||||||
|
|
@ -986,13 +995,25 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
|
||||||
|
|
||||||
let errors = this.errors || [];
|
let errors = this.errors || [];
|
||||||
|
|
||||||
errors.pushObjects(this.clusterErrors || []);
|
|
||||||
errors.pushObjects(this.clusterOptErrors || []);
|
|
||||||
errors.pushObjects(this.otherErrors || []);
|
|
||||||
|
|
||||||
if (this.clusterTemplateCreate) {
|
if (this.clusterTemplateCreate) {
|
||||||
if (this.model.clusterTemplateRevision) {
|
const revision = this.model.clusterTemplateRevision;
|
||||||
errors.pushObjects(this.model.clusterTemplateRevision.validationErrors());
|
|
||||||
|
if ( revision ) {
|
||||||
|
errors.pushObjects(revision.validationErrors());
|
||||||
|
|
||||||
|
const cloudProvider = get(revision, 'clusterConfig.rancherKubernetesEngineConfig.cloudProvider.name');
|
||||||
|
const azureProvider = get(revision, 'clusterConfig.rancherKubernetesEngineConfig.cloudProvider.azureCloudProvider') || {};
|
||||||
|
|
||||||
|
if ( cloudProvider === 'azure' ) {
|
||||||
|
const azureQuestions = (get(revision, 'nuestions') || []).map((x) => x.variable.replace(/^rancherKubernetesEngineConfig\.cloudProvider\.azureCloudProvider\./, ''));
|
||||||
|
const requiredFields = Object.keys(AzureInfo).filter((k) => AzureInfo[k].required);
|
||||||
|
|
||||||
|
requiredFields.forEach((key) => {
|
||||||
|
if ( !get(azureProvider, key) && !azureQuestions.includes(key)) {
|
||||||
|
errors.push(intl.t('validation.requiredOrOverride', { key }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( !get(this, 'isCustom') ) {
|
if ( !get(this, 'isCustom') ) {
|
||||||
|
|
@ -1025,7 +1046,7 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
|
||||||
|
|
||||||
set(this, 'errors', errors);
|
set(this, 'errors', errors);
|
||||||
|
|
||||||
return errors.length === 0;
|
return get(this, 'errors.length') === 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
validateAuthorizedClusterEndpoint(errors) {
|
validateAuthorizedClusterEndpoint(errors) {
|
||||||
|
|
|
||||||
|
|
@ -1251,7 +1251,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{top-errors errors=errors}}
|
{{top-errors errors=allErrors}}
|
||||||
|
|
||||||
{{#if (or (and notView (eq step 1)) (and isEdit (eq step 2)))}}
|
{{#if (or (and notView (eq step 1)) (and isEdit (eq step 2)))}}
|
||||||
{{save-cancel
|
{{save-cancel
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import { inject as service } from '@ember/service';
|
||||||
import { alias } from '@ember/object/computed';
|
import { alias } from '@ember/object/computed';
|
||||||
import Errors from 'ui/utils/errors';
|
import Errors from 'ui/utils/errors';
|
||||||
import { reject } from 'rsvp';
|
import { reject } from 'rsvp';
|
||||||
import { azure as AzureInfo } from '../cru-cloud-provider/cloud-provider-info';
|
|
||||||
|
|
||||||
export default Component.extend(ViewNewEdit, ChildHook, {
|
export default Component.extend(ViewNewEdit, ChildHook, {
|
||||||
globalStore: service(),
|
globalStore: service(),
|
||||||
|
|
@ -93,14 +92,9 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
||||||
|
|
||||||
willSave() {
|
willSave() {
|
||||||
set(this, 'clusterTemplateRevision.clusterTemplateId', '__TEMPID__');
|
set(this, 'clusterTemplateRevision.clusterTemplateId', '__TEMPID__');
|
||||||
|
this.validate();
|
||||||
|
|
||||||
let revisionOkay = this.validateClusterTemplateRevision();
|
|
||||||
|
|
||||||
if (revisionOkay) {
|
|
||||||
return this._super(...arguments);
|
return this._super(...arguments);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -137,36 +131,4 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
||||||
return reject();
|
return reject();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
validateClusterTemplateRevision() {
|
|
||||||
const intl = get(this, 'intl');
|
|
||||||
// var model = get(this, 'clusterTemplateRevision');
|
|
||||||
// TODO - localclusterauth and rkeconfig get cleared in trimvalues
|
|
||||||
// var errors = model.validationErrors();
|
|
||||||
var errors = [];
|
|
||||||
|
|
||||||
const azureProvider = get(this, 'clusterTemplateRevision.clusterConfig.rancherKubernetesEngineConfig.cloudProvider.azureCloudProvider');
|
|
||||||
|
|
||||||
if ( azureProvider ) {
|
|
||||||
const azureQuestions = (get(this, 'clusterTemplateRevision.questions') || []).map((x) => x.variable.replace(/^rancherKubernetesEngineConfig\.cloudProvider\.azureCloudProvider\./, ''));
|
|
||||||
const requiredFields = Object.keys(AzureInfo).filter((k) => AzureInfo[k].required);
|
|
||||||
|
|
||||||
requiredFields.forEach((k) => {
|
|
||||||
if ( !get(azureProvider, k) && !azureQuestions.includes(k)) {
|
|
||||||
errors.push(intl.t('validation.requiredOrOverride', { key: k }));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( errors.get('length') ) {
|
|
||||||
set(this, 'errors', errors);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
set(this, 'errors', null);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
@addAuthorizedPrincipal={{action "addAuthorizedPrincipal"}}
|
@addAuthorizedPrincipal={{action "addAuthorizedPrincipal"}}
|
||||||
@removeMember={{action "removeMember"}}
|
@removeMember={{action "removeMember"}}
|
||||||
@users={{users}}
|
@users={{users}}
|
||||||
@errors={{errors}}
|
@errors={{memberErrors}}
|
||||||
/>
|
/>
|
||||||
</AccordionListItem>
|
</AccordionListItem>
|
||||||
</AccordionList>
|
</AccordionList>
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#unless routeLoading}}
|
{{#unless routeLoading}}
|
||||||
|
{{#if driverInfo}}
|
||||||
{{component driverInfo.driverComponent
|
{{component driverInfo.driverComponent
|
||||||
applyClusterTemplate=applyClusterTemplate
|
applyClusterTemplate=applyClusterTemplate
|
||||||
clusterTemplateQuestions=model.clusterTemplateRevision.questions
|
clusterTemplateQuestions=model.clusterTemplateRevision.questions
|
||||||
|
|
@ -107,6 +108,7 @@
|
||||||
registerHook=(action "registerHook")
|
registerHook=(action "registerHook")
|
||||||
updateFromYaml=(action "updateFromYaml")
|
updateFromYaml=(action "updateFromYaml")
|
||||||
}}
|
}}
|
||||||
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
{{#if (and isEdit (not provider))}}
|
{{#if (and isEdit (not provider))}}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default Helper.extend({
|
||||||
const driver = params[0];
|
const driver = params[0];
|
||||||
|
|
||||||
const intl = get(this, 'intl');
|
const intl = get(this, 'intl');
|
||||||
const key = `nodeDriver.displayName.${ driver }`;
|
const key = `nodeDriver.displayName.${ driver.toLowerCase() }`;
|
||||||
let name = ucFirst(driver);
|
let name = ucFirst(driver);
|
||||||
|
|
||||||
if ( intl.exists(key) ) {
|
if ( intl.exists(key) ) {
|
||||||
|
|
|
||||||
|
|
@ -6620,6 +6620,7 @@ nodeDriver:
|
||||||
otc: Open Telekom Cloud
|
otc: Open Telekom Cloud
|
||||||
packet: Packet
|
packet: Packet
|
||||||
rackspace: RackSpace
|
rackspace: RackSpace
|
||||||
|
rancherkubernetesengine: RKE
|
||||||
softlayer: SoftLayer
|
softlayer: SoftLayer
|
||||||
tencenttke: Tencent TKE
|
tencenttke: Tencent TKE
|
||||||
upcloud: UpCloud
|
upcloud: UpCloud
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue