mirror of https://github.com/rancher/ui.git
Fix app launch double click & no errors
rancher/rancher#19168 rancher/rancher#19236
This commit is contained in:
parent
018f3c20d1
commit
3316235ee4
|
|
@ -14,8 +14,9 @@ import { isEmpty } from '@ember/utils';
|
|||
import CatalogApp from 'shared/mixins/catalog-app';
|
||||
import { isNumeric } from 'shared/utils/util';
|
||||
import convertDotAnswersToYaml from 'shared/utils/convert-yaml';
|
||||
import ChildHook from 'shared/mixins/child-hook';
|
||||
|
||||
export default Component.extend(NewOrEdit, CatalogApp, {
|
||||
export default Component.extend(NewOrEdit, CatalogApp, ChildHook, {
|
||||
catalog: service(),
|
||||
intl: service(),
|
||||
scope: service(),
|
||||
|
|
@ -319,7 +320,11 @@ export default Component.extend(NewOrEdit, CatalogApp, {
|
|||
set(get(this, 'catalogApp'), 'answers', get(this, 'answers'));
|
||||
}
|
||||
|
||||
return true;
|
||||
return this.applyHooks('_beforeSaveHooks').catch((err) => {
|
||||
set(this, 'errors', [err.message]);
|
||||
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
// TODO 2.0 this is part of the volumes stuff so we need to investigate if this still works
|
||||
// let versionId = null;
|
||||
|
|
@ -340,12 +345,12 @@ export default Component.extend(NewOrEdit, CatalogApp, {
|
|||
},
|
||||
|
||||
didSave(neu) {
|
||||
let app = get(this, 'catalogApp');
|
||||
let app = get(this, 'catalogApp');
|
||||
let yaml = get(this, 'selectedTemplateModel.valuesYaml');
|
||||
|
||||
if ( !yaml && this.shouldFallBackToYaml() ) {
|
||||
const questions = get(this, 'selectedTemplateModel.allQuestions') || [];
|
||||
const input = {};
|
||||
const input = {};
|
||||
|
||||
questions.forEach((q) => {
|
||||
if ( q.answer !== undefined && q.answer !== null ) {
|
||||
|
|
|
|||
|
|
@ -111,30 +111,20 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#unless (or customizeNamespace (not selectedTemplateModel))}}
|
||||
<div class="col span-12">
|
||||
{{t
|
||||
"newCatalog.customizeNamespace"
|
||||
namespaceId=(if requiredNamespace requiredNamespace primaryResource.name)
|
||||
htmlSafe=true
|
||||
}}
|
||||
{{#unless (or editing requiredNamespace)}}
|
||||
<button class="btn btn-sm bg-transparent pl-0" {{action "toogleNamespace"}}>
|
||||
{{t "generic.customize"}}
|
||||
</button>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
<div class="col span-12">
|
||||
{{#if customizeNamespace}}
|
||||
<hr class="mt-20 mb-20"/>
|
||||
|
||||
{{form-namespace
|
||||
namespace=primaryResource
|
||||
errors=namespaceErrors
|
||||
}}
|
||||
{{/if}}
|
||||
<div class="over-hr">
|
||||
<span>
|
||||
{{t "generic.namespace"}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col span-12">
|
||||
{{form-namespace
|
||||
namespace=primaryResource
|
||||
errors=namespaceErrors
|
||||
registerHook=(action "registerHook")
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -244,15 +234,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if errors.length}}
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col span-12">
|
||||
{{top-errors errors=errors}}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{/if}}
|
||||
{{top-errors errors=errors}}
|
||||
|
||||
<div class="footer-actions">
|
||||
{{save-cancel
|
||||
|
|
|
|||
|
|
@ -36,7 +36,18 @@ export default Component.extend({
|
|||
isReuse: equal('mode', REUSE),
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
set(this, 'choices', get(this, 'clusterStore').all('namespace').filterBy('projectId', get(this, 'scope.currentProject.id')).sortBy('displayName'));
|
||||
|
||||
if (this.registerHook) {
|
||||
this.registerHook(this.saveNamespace.bind(this), {
|
||||
name: get(this, 'hookName'),
|
||||
key: '_beforeSaveHooks'
|
||||
});
|
||||
}
|
||||
|
||||
const currentProjectsNamespaces = get(this, 'clusterStore').all('namespace').filterBy('projectId', get(this, 'scope.currentProject.id'));
|
||||
|
||||
set(this, 'choices', currentProjectsNamespaces).sortBy('displayName');
|
||||
|
||||
let all = get(this, 'choices');
|
||||
|
||||
set(this, 'createNamespace', get(this, 'clusterStore').createRecord({
|
||||
|
|
@ -46,8 +57,6 @@ export default Component.extend({
|
|||
containerDefaultResourceLimit: get(this, 'scope.currentProject.containerDefaultResourceLimit'),
|
||||
}));
|
||||
|
||||
// TODO
|
||||
// Find a namespace
|
||||
if ( get(this, 'mode') === REUSE ) {
|
||||
let namespace = get(this, 'namespace') || // Passed in
|
||||
all.findBy('isDefault', true) || // The default one
|
||||
|
|
@ -70,13 +79,6 @@ export default Component.extend({
|
|||
this.updateNamespace();
|
||||
});
|
||||
}
|
||||
|
||||
if (this.registerHook) {
|
||||
this.registerHook(this.saveNamespace.bind(this), {
|
||||
name: get(this, 'hookName'),
|
||||
key: '_beforeSaveHooks'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
{{field-required}}
|
||||
</label>
|
||||
<div class="pull-right text-small">
|
||||
<a role="button" class="btn bg-transparent p-0" {{action "toggle"}}>{{t (if isReuse 'formNamespace.toggle.create' 'formNamespace.toggle.reuse')}}</a>
|
||||
<a role="button" class="btn bg-transparent p-0" {{action "toggle"}}>
|
||||
{{t (if isReuse "formNamespace.toggle.create" "formNamespace.toggle.reuse")}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -13,16 +15,24 @@
|
|||
{{#if isReuse}}
|
||||
{{new-select
|
||||
content=choices
|
||||
prompt=(t 'formNamespace.reuse.prompt')
|
||||
prompt=(t "formNamespace.reuse.prompt")
|
||||
optionLabelPath="displayName"
|
||||
optionValuePath="id"
|
||||
value=reuseNamespaceId
|
||||
}}
|
||||
{{else}}
|
||||
{{input classNames="new-name" placeholder=(t 'formNamespace.create.placeholder') value=createNamespace.name}}
|
||||
{{input
|
||||
classNames="new-name"
|
||||
placeholder=(t "formNamespace.create.placeholder")
|
||||
value=createNamespace.name
|
||||
}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<label class="acc-label pb-5">{{t 'formNamespace.label.reuse'}}</label>
|
||||
<p class="mt-0">{{namespace.displayName}}</p>
|
||||
<label class="acc-label pb-5">
|
||||
{{t "formNamespace.label.reuse"}}
|
||||
</label>
|
||||
<p class="mt-0">
|
||||
{{namespace.displayName}}
|
||||
</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue