Merge remote-tracking branch 'origin/create-host-catalog-supports-static-catalog' into feat-host-catalog-integration

This commit is contained in:
dharini committed 2022-01-27 10:37:31 -08:00
commit cbf5cc44f6
4 files changed
+38 -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,17 +1,37 @@
import Route from '@ember/routing/route';
import { action } from '@ember/object';
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');
// FIXME Should default static type be specified when type is undefined?
params.type = 'static';
return this.store.createRecord('host-catalog', {
type: 'static',
type: params.type,
scopeModel,
});
}
/**
* Update type of host catalog
* @param {string} type
*/
@action
async changeType(type) {
await this.router.replaceWith({ type });
}
}
@@ -18,6 +18,7 @@
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
@changeType={{route-action 'changeType' @model.type}}
/>
</page.body>