diff --git a/app/components/new-catalog/component.js b/app/components/new-catalog/component.js index b5fb8f981..27c15f4eb 100644 --- a/app/components/new-catalog/component.js +++ b/app/components/new-catalog/component.js @@ -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 ) { diff --git a/app/components/new-catalog/template.hbs b/app/components/new-catalog/template.hbs index 0e012330f..860a5186d 100644 --- a/app/components/new-catalog/template.hbs +++ b/app/components/new-catalog/template.hbs @@ -111,30 +111,20 @@

-
- {{#unless (or customizeNamespace (not selectedTemplateModel))}} -
- {{t - "newCatalog.customizeNamespace" - namespaceId=(if requiredNamespace requiredNamespace primaryResource.name) - htmlSafe=true - }} - {{#unless (or editing requiredNamespace)}} - - {{/unless}} -
- {{/unless}} -
- {{#if customizeNamespace}} -
- {{form-namespace - namespace=primaryResource - errors=namespaceErrors - }} - {{/if}} +
+ + {{t "generic.namespace"}} + +
+ +
+
+ {{form-namespace + namespace=primaryResource + errors=namespaceErrors + registerHook=(action "registerHook") + }}
@@ -244,15 +234,7 @@
{{/if}} - {{#if errors.length}} -
-
-
- {{top-errors errors=errors}} -
-
-
- {{/if}} + {{top-errors errors=errors}} @@ -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}}
{{else}} - -

{{namespace.displayName}}

+ +

+ {{namespace.displayName}} +

{{/if}}