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

This commit is contained in:
Susmitha Girumala committed 2022-01-26 10:49:48 -05:00
1 parent a380bccbf1
commit 6a8bbcad9d
3 files changed
+28 -2

No files matched your search

@@ -45,6 +45,20 @@
</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}}
@@ -0,0 +1 @@
I'm a static host catalog form.
@@ -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,
});
}