mirror of https://github.com/rancher/ui.git
commit
ea90cefa27
|
|
@ -23,18 +23,6 @@ export default Resource.extend({
|
|||
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() {
|
||||
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) {
|
||||
let pojoPr = JSON.parse(JSON.stringify(removeEmpty(primaryResource, EXCLUDED_KEYS)));
|
||||
let decamelizedObj = {};
|
||||
|
|
@ -986,13 +995,25 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
|
|||
|
||||
let errors = this.errors || [];
|
||||
|
||||
errors.pushObjects(this.clusterErrors || []);
|
||||
errors.pushObjects(this.clusterOptErrors || []);
|
||||
errors.pushObjects(this.otherErrors || []);
|
||||
|
||||
if (this.clusterTemplateCreate) {
|
||||
if (this.model.clusterTemplateRevision) {
|
||||
errors.pushObjects(this.model.clusterTemplateRevision.validationErrors());
|
||||
const revision = this.model.clusterTemplateRevision;
|
||||
|
||||
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 {
|
||||
if ( !get(this, 'isCustom') ) {
|
||||
|
|
@ -1025,7 +1046,7 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
|
|||
|
||||
set(this, 'errors', errors);
|
||||
|
||||
return errors.length === 0;
|
||||
return get(this, 'errors.length') === 0;
|
||||
},
|
||||
|
||||
validateAuthorizedClusterEndpoint(errors) {
|
||||
|
|
|
|||
|
|
@ -1251,7 +1251,7 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{top-errors errors=errors}}
|
||||
{{top-errors errors=allErrors}}
|
||||
|
||||
{{#if (or (and notView (eq step 1)) (and isEdit (eq step 2)))}}
|
||||
{{save-cancel
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { inject as service } from '@ember/service';
|
|||
import { alias } from '@ember/object/computed';
|
||||
import Errors from 'ui/utils/errors';
|
||||
import { reject } from 'rsvp';
|
||||
import { azure as AzureInfo } from '../cru-cloud-provider/cloud-provider-info';
|
||||
|
||||
export default Component.extend(ViewNewEdit, ChildHook, {
|
||||
globalStore: service(),
|
||||
|
|
@ -93,14 +92,9 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
|
||||
willSave() {
|
||||
set(this, 'clusterTemplateRevision.clusterTemplateId', '__TEMPID__');
|
||||
this.validate();
|
||||
|
||||
let revisionOkay = this.validateClusterTemplateRevision();
|
||||
|
||||
if (revisionOkay) {
|
||||
return this._super(...arguments);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
|
||||
|
||||
|
|
@ -137,36 +131,4 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
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"}}
|
||||
@removeMember={{action "removeMember"}}
|
||||
@users={{users}}
|
||||
@errors={{errors}}
|
||||
@errors={{memberErrors}}
|
||||
/>
|
||||
</AccordionListItem>
|
||||
</AccordionList>
|
||||
|
|
@ -109,4 +109,4 @@
|
|||
close=(action "cancel")
|
||||
registerHook=(action "registerHook")
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -90,23 +90,25 @@
|
|||
{{/if}}
|
||||
|
||||
{{#unless routeLoading}}
|
||||
{{component driverInfo.driverComponent
|
||||
applyClusterTemplate=applyClusterTemplate
|
||||
clusterTemplateQuestions=model.clusterTemplateRevision.questions
|
||||
clusterTemplateRevisionId=clusterTemplateRevisionId
|
||||
clusterErrors=errors
|
||||
mode=mode
|
||||
model=model
|
||||
nodePoolErrors=nodePoolErrors
|
||||
nodeWhich=driverInfo.nodeWhich
|
||||
originalCluster=originalCluster
|
||||
otherErrors=memberErrors
|
||||
isEditCluster=isEdit
|
||||
save=(action "save")
|
||||
close=(action "close")
|
||||
registerHook=(action "registerHook")
|
||||
updateFromYaml=(action "updateFromYaml")
|
||||
}}
|
||||
{{#if driverInfo}}
|
||||
{{component driverInfo.driverComponent
|
||||
applyClusterTemplate=applyClusterTemplate
|
||||
clusterTemplateQuestions=model.clusterTemplateRevision.questions
|
||||
clusterTemplateRevisionId=clusterTemplateRevisionId
|
||||
clusterErrors=errors
|
||||
mode=mode
|
||||
model=model
|
||||
nodePoolErrors=nodePoolErrors
|
||||
nodeWhich=driverInfo.nodeWhich
|
||||
originalCluster=originalCluster
|
||||
otherErrors=memberErrors
|
||||
isEditCluster=isEdit
|
||||
save=(action "save")
|
||||
close=(action "close")
|
||||
registerHook=(action "registerHook")
|
||||
updateFromYaml=(action "updateFromYaml")
|
||||
}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
{{#if (and isEdit (not provider))}}
|
||||
|
|
@ -116,4 +118,4 @@
|
|||
save=(action "save" )
|
||||
cancel=(action "close")
|
||||
}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default Helper.extend({
|
|||
const driver = params[0];
|
||||
|
||||
const intl = get(this, 'intl');
|
||||
const key = `nodeDriver.displayName.${ driver }`;
|
||||
const key = `nodeDriver.displayName.${ driver.toLowerCase() }`;
|
||||
let name = ucFirst(driver);
|
||||
|
||||
if ( intl.exists(key) ) {
|
||||
|
|
|
|||
|
|
@ -6620,6 +6620,7 @@ nodeDriver:
|
|||
otc: Open Telekom Cloud
|
||||
packet: Packet
|
||||
rackspace: RackSpace
|
||||
rancherkubernetesengine: RKE
|
||||
softlayer: SoftLayer
|
||||
tencenttke: Tencent TKE
|
||||
upcloud: UpCloud
|
||||
|
|
|
|||
Loading…
Reference in New Issue