Merge pull request #3248 from vincent99/master

Missing RKE config
This commit is contained in:
Vincent Fiduccia 2019-08-14 10:47:56 -07:00 committed by GitHub
commit 2b7f156324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 55 deletions

View File

@ -548,10 +548,8 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
return remapped;
}),
canSave: computed('allErrors.[]', function() {
let { clusterOptErrors, } = this;
return (clusterOptErrors || []).length > 0;
canEditForm: computed('clusterOptErrors.[]', function() {
return (this.clusterOptErrors || []).length === 0;
}),
kubeApiPodSecurityPolicy: computed('config.services.kubeApi.podSecurityPolicy', {
@ -826,11 +824,9 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
},
set(key, value) {
if (this.clusterOptErrors && this.clusterOptErrors.length > 0) {
next(() => {
set(this, 'clusterOptErrors', this.checkYamlForRkeConfig(value));
});
}
return value;
}
@ -881,7 +877,7 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
let decamledYaml = this.parseOptsFromYaml(yamlValue);
if (decamledYaml && isEmpty(decamledYaml.rancherKubernetesEngineConfig)) {
set(this, 'clusterOptErrors', [`Cluster Options Parse Error: Missing Rancher Kubernetes Engine Config`]);
set(this, 'clusterOptErrors', [`Cluster Options Parse Error: Missing rancher_kubernetes_engine_config key`]);
return;
}
@ -931,10 +927,6 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
if (this.updateFromYaml) {
this.updateFromYaml(newOpts);
}
} else {
ok = false;
return ok;
}
}
@ -1035,11 +1027,9 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
errors = this.validateAuthorizedClusterEndpoint(errors);
}
const clusterOptErrors = get(this, 'clusterOptErrors') || [];
set(this, 'errors', errors);
return errors.length === 0 && clusterOptErrors.length === 0;
return errors.length === 0;
},
validateAuthorizedClusterEndpoint(errors) {

View File

@ -16,23 +16,13 @@
<div class="right-buttons">
{{#if (or (not applyClusterTemplate) (and (eq step 1) (not applyClusterTemplate)))}}
{{#if pasteOrUpload}}
{{#if clusterOptErrors.length}}
<button class="btn btn-sm bg-primary" disabled>
<button {{action "cancel"}} type="button" class="btn btn-sm bg-primary" disabled={{not canEditForm}}>
{{#if notView}}
{{t "clusterNew.advanced.cancel"}}
{{else}}
{{t "clusterNew.advanced.viewCancel"}}
{{/if}}
</button>
{{else}}
<button class="btn btn-sm bg-primary" {{action "cancel"}}>
{{#if notView}}
{{t "clusterNew.advanced.cancel"}}
{{else}}
{{t "clusterNew.advanced.viewCancel"}}
{{/if}}
</button>
{{/if}}
{{else}}
<button class="btn btn-sm bg-primary" {{action "showPaste"}}>
{{#if notView}}
@ -123,8 +113,9 @@
</div>
<div class="accordion-content">
{{top-errors errors=clusterOptErrors}}
<div class="mt-25">
{{input-yaml
showCopy=true
showDownload=false
canChangeName=false
autoResize=true
@ -135,13 +126,6 @@
valueUpdated=(action "yamlValUpdated")
}}
</div>
{{copy-to-clipboard
tooltipText=""
buttonText="copyToClipboard.tooltip"
clipboardText=yamlValue
class="with-clip"
}}
</div>
</div>
{{else}}
{{!-- EDIT FORM --}}
@ -1266,9 +1250,7 @@
{{/if}}
{{/if}}
{{#unless (and pasteOrUpload clusterOptErrors)}}
{{top-errors errors=allErrors}}
{{/unless}}
{{#if (or (and notView (eq step 1)) (and isEdit (eq step 2)))}}
{{save-cancel
@ -1276,7 +1258,6 @@
editing=isEdit
save=(action "driverSave")
cancel=(action "close")
saveDisabled=canSave
}}
{{else}}
<div class="footer-actions">

View File

@ -36,6 +36,7 @@ export default Component.extend(ThrottledResize, {
tagName: ['div'],
showUpload: true,
showDownload: true,
showCopy: false,
shouldChangeName: true,

View File

@ -1,6 +1,14 @@
{{#if title}}
<section class="header clearfix">
<div class="right-buttons">
{{#if showCopy}}
{{copy-to-clipboard
tooltipText=""
buttonText="copyToClipboard.tooltip"
clipboardText=value
class="with-clip"
}}
{{/if}}
{{#if showUpload}}
<button class="btn bg-link icon-btn" {{action "click"}}>
<span class="darken"><i class="icon icon-upload text-small"/></span>
@ -18,6 +26,14 @@
</section>
{{else}}
<div class="text-right mb-20">
{{#if showCopy}}
{{copy-to-clipboard
tooltipText=""
buttonText="copyToClipboard.tooltip"
clipboardText=value
class="with-clip"
}}
{{/if}}
{{#if showUpload}}
<button class="btn bg-link icon-btn" {{action "click"}}>
<span class="darken"><i class="icon icon-upload text-small"/></span>