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

View File

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

View File

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

View File

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