feat: Add type param support to creation form of host catalog

This commit is contained in:
Susmitha Girumala authored and dharini committed 2022-01-31 11:38:55 -08:00
1 parent d595b6c899
commit c1d71e5166
3 files changed
+79 -4

No files matched your search

@@ -7,4 +7,68 @@
}}
{{/if}}
{{{log @model 'modede'}}}
<<<<<<< HEAD
{{{log @model 'modede'}}}
=======
<form.input
@name='name'
@type='name'
@value={{@model.name}}
@label={{t 'form.name.label'}}
@helperText={{t 'form.name.help'}}
@error={{@model.errors.name}}
readonly={{false}}
as |field|
>
{{#if @model.errors.name}}
<field.errors as |errors|>
{{#each @model.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
<form.textarea
@name='description'
@type='description'
@value={{@model.description}}
@label={{t 'form.description.label'}}
@helperText={{t 'form.description.help'}}
@error={{@model.errors.description}}
disabled={{@model.isSaving}}
readonly={{false}}
as |field|
>
{{#if @model.errors.description}}
<field.errors as |errors|>
{{#each @model.errors.description as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.textarea>
<p>Place Radio Button Group Here</p>
{{#if @model.isNew}}
{{#if @model.type}}
{{component
(concat 'form/host-catalog/' @model.type)
model=@model
submit=@submit
cancel=@cancel
}}
{{/if}}
{{/if}}
{{#if (can 'save model' @model)}}
<form.actions
@disabled={{if @model.cannotSave @model.cannotSave}}
@enableEditText={{t 'actions.edit-form'}}
@submitText={{t 'actions.save'}}
@cancelText={{t 'actions.cancel'}}
/>
{{/if}}
</Rose::Form>
>>>>>>> 6a8bbcad (feat: Add type param support to creation form of host catalog)
@@ -71,4 +71,4 @@
{{/if}}
</Rose::Form>
{{{log @model.compositeType 'compostite type'}}}
{{{log @model.compositeType 'compostite type'}}}
@@ -1,16 +1,27 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsNewRoute extends Route {
// =attributes
queryParams = {
type: {
refreshModel: true,
},
};
// =methods
/**
* Creates a new unsaved host catalog belonging to the current scope.
* @return {HostCatalogModel}
*/
model() {
model(params) {
const scopeModel = this.modelFor('scopes.scope');
// TODO Use model provider type method
// to set params.type to 'static' if type is not provided
params.type = 'static';
return this.store.createRecord('host-catalog', {
type: 'static',
type: params.type,
scopeModel,
});
}