chore: 🤖 build initial host catalogs/update flow

This commit is contained in:
Randall Morey committed 2020-06-05 19:16:33 -04:00
1 parent c6ca1c09b6
commit 5fbc91a743
16 files changed
+191 -2

No files matched your search

@@ -0,0 +1,49 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@error={{true}}
as |form|
>
<form.input
name="name"
@type="name"
@value={{@model.name}}
@label={{t "form.label.name"}}
@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.label.description"}}
@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>
<form.actions
@disabled={{if @model.cannotSave @model.cannotSave}}
@submitText={{t "actions.save"}}
@cancelText={{t "actions.cancel"}} />
</Rose::Form>
+5 -2
View File
@@ -10,10 +10,13 @@ Router.map(function () {
this.route('orgs', function () {
this.route('org', { path: ':org_id' }, function () {
this.route('projects', function () {
this.route('project', { path: ':project_id' }, function() {});
this.route('project', { path: ':project_id' }, function() {
this.route('host-catalogs', function() {
this.route('host-catalog', { path: ':host_catalog_id' }, function() {});
});
});
this.route('new');
});
});
});
this.route('projects');
});
@@ -0,0 +1,14 @@
import Route from '@ember/routing/route';
export default class OrgsOrgProjectsProjectHostCatalogsRoute extends Route {
// =methods
/**
* Returns host catalogs for the current scope.
* @return {Promise[HostCatalogModel]}
*/
model() {
return this.store.findAll('host-catalog');
}
}
@@ -0,0 +1,16 @@
import Route from '@ember/routing/route';
export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogRoute extends Route {
// =methods
/**
* Returns a host catalog by id.
* @param {object} params
* @return {Promise{HostCatalogModel}}
*/
model({ host_catalog_id: id }) {
return this.store.findRecord('host-catalog', id);
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class OrgsOrgProjectsProjectHostCatalogsIndexRoute extends Route {
}
@@ -0,0 +1,3 @@
{{title (t "resources.host-catalogs")}}
{{outlet}}
@@ -0,0 +1,18 @@
<div class="project-overview">
<h2>{{t "resources.host-catalog"}}</h2>
<Form::HostCatalog
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
/>
<Rose::Button
@style="warning"
@disabled={{@model.canSave}}
{{on "click" (route-action "delete" @model)}}
>
{{t 'actions.delete'}}
</Rose::Button>
</div>
@@ -0,0 +1,18 @@
<div class="projects-overview">
<h2>{{t "resources.host-catalogs"}}</h2>
<ul>
{{#each @model as |hostCatalog|}}
<li>
<LinkTo
@route="orgs.org.projects.project.host-catalogs.host-catalog"
@model={{hostCatalog}}
>
{{hostCatalog.name}}
</LinkTo>
</li>
{{/each}}
</ul>
</div>
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
//import { render } from '@ember/test-helpers';
//import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host-catalog', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
assert.expect(0);
// TODO
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | orgs/org/projects/project/host-catalogs', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/host-catalog');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/host-catalog/index');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | orgs/org/projects/project/host-catalogs/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/index');
assert.ok(route);
});
});
+2
View File
@@ -7,6 +7,8 @@ resources:
projects: Projects
project:
settings: Project Settings
host-catalog: Host Catalog
host-catalogs: Host Catalogs
titles:
new: New
states: