Merge branch 'develop' into feature-host-selections

This commit is contained in:
Randall Morey authored and GitHub committed 2020-08-21 16:35:44 -04:00
commit 851a018fa0
84 files changed
+1312 -37

No files matched your search

@@ -39,4 +39,9 @@ export default class GeneratedAuthMethodModel extends BaseModel {
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -33,4 +33,10 @@ export default class GeneratedGroupModel extends BaseModel {
description: 'Whether the resource is disabled',
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -38,4 +38,9 @@ export default class GeneratedHostCatalogModel extends BaseModel {
description: 'Attributes specific to the catalog type'
}) attributes;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -34,4 +34,9 @@ export default class GeneratedScopeModel extends BaseModel {
})
updated_time;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -0,0 +1,41 @@
import BaseModel from '../../models/base';
import { attr } from '@ember-data/model';
/**
* Target
*/
export default class GeneratedTargetModel extends BaseModel {
// =attributes
@attr('string', {
description: 'The protocol used in the target'
}) protocol;
@attr('string', {
description: 'Optional name for identification purposes'
}) name;
@attr('string', {
description: 'Optional user-set description for identification purposes'
}) description;
@attr('date', {
description: 'The time this resource was created\nOutput only.',
readOnly: true
}) created_time;
@attr('date', {
description: 'The time this resource was last updated\nOutput only.',
readOnly: true
}) updated_time;
@attr('boolean', {
description: 'Whether the catalog is disabled'
}) disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
@@ -33,4 +33,9 @@ export default class GeneratedUserModel extends BaseModel {
description: 'Whether the resource is disabled',
})
disabled;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
}
+3
View File
@@ -0,0 +1,3 @@
import GeneratedTargetModel from '../generated/models/target';
export default class TargetModel extends GeneratedTargetModel {}
@@ -40,6 +40,10 @@ export default class ApplicationSerializer extends RESTSerializer {
let value = super.serializeAttribute(...arguments);
// Do not serialize read-only attributes.
if (options.readOnly) delete json[key];
// Version is sent only if it has a non-nullish value
if (key === 'version') {
if (json[key] === null || json[key] === undefined) delete json[key];
}
// Do not serialize `disabled` fields.
// TODO: disabled is temporarily disabled
if (key === 'disabled') delete json[key];
+1
View File
@@ -0,0 +1 @@
export { default } from 'api/models/target';
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Model | target', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('target', {});
assert.ok(model);
});
});
@@ -29,6 +29,28 @@ module('Unit | Serializer | application', function (hooks) {
});
});
test('it serializes non-nullish version fields', function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const record = store.createRecord('user', {
name: 'User',
description: 'Description',
version: null
});
let serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: 'User',
description: 'Description'
});
record.version = 1;
serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: 'User',
description: 'Description',
version: 1
});
});
test('it normalizes array records from an `items` root key', function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');
@@ -0,0 +1,55 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@error={{@model.errors.base}}
as |form|
>
<form.input
@value={{t (concat 'host.types.' @model.type)}}
@label={{t "form.label.type"}}
readonly={{true}}
@disabled={{true}} />
<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>
@@ -0,0 +1,49 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@error={{@model.errors.base}}
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>
@@ -0,0 +1,20 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsController extends Controller {
// =services
@service intl;
// =attributes
/**
* Hosts breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.hosts');
}
}
@@ -0,0 +1,15 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostController extends Controller {
// =attributes
/**
* Host breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.model.displayName;
}
}
@@ -0,0 +1,20 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new host breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -0,0 +1,20 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsController extends Controller {
// =services
@service intl;
// =attributes
/**
* Targets breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.targets');
}
}
@@ -0,0 +1,20 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new target breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -0,0 +1,15 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectTargetsTargetController extends Controller {
// =attributes
/**
* A target breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.model.displayName;
}
}
+8
View File
@@ -29,8 +29,16 @@ Router.map(function () {
});
this.route('new');
});
this.route('hosts', function() {
this.route('host', { path: ':host_id' }, function() {});
this.route('new');
});
});
});
this.route('targets', function() {
this.route('target', { path: ':target_id' }, function() {});
this.route('new');
});
});
this.route('new');
});
@@ -17,7 +17,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte
});
}
/**
/**
* Renders the host-catalog specific templates for header, navigation, and actions page sections.
* @override
* @param {object} controller
@@ -24,7 +24,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
* @param {object} model
*/
renderTemplate(controller, model) {
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets');
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
@@ -6,7 +6,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe
/**
* Creates a new unsaved host set in current host catalog scope.
* @return {HostCatalogModel}
* @return {HostSetModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
@@ -0,0 +1,81 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute extends Route {
// =services
@service intl;
@service notify;
// =methods
/**
* Loads all hosts under the current host catalog and it's parent project scope.
* @return {Promise{[HostModel]}}
*/
async model() {
return this.store.findAll('host', this.adapterOptions());
}
// =actions
/**
* Rollback changes on a host.
* @param {HostModel} host
*/
@action
cancel(host) {
const { isNew } = host;
host.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts');
}
/**
* Handle save of a host.
* @param {HostModel} host
* @param {Event} e
*/
@action
async save(host) {
try {
const { isNew } = host;
await host.save(this.adapterOptions());
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
);
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host', host);
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
/**
* Delete host in current scope and redirect to index.
* @param {HostModel} host
*/
@action
async delete(host) {
try {
await host.destroyRecord(this.adapterOptions());
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts');
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
/**
* Configure adapter options using current host catalog scope and it's parent project scope.
* @return {object}
*/
adapterOptions() {
const scopeID = this.modelFor('scopes.scope.projects.project').id;
const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id;
return { adapterOptions : { scopeID, hostCatalogID } };
}
}
@@ -0,0 +1,47 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostRoute extends Route {
// =methods
/**
* Load a host using current host-catalog and it's parent project scope.
* @param {object} params
* @param {string} params.host_id
* @return {HostModel}
*/
async model({ host_id }) {
const { id: scopeID } = this.modelFor('scopes.scope.projects.project');
const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id;
return this.store.findRecord('host', host_id, {
adapterOptions: { scopeID, hostCatalogID }
});
}
/**
* Renders the host specific templates for header, navigation, and action page sections.
* @override
* @param {object} controller
* @param {object} model
*/
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-navigation', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
});
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-actions', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
});
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostIndexRoute extends Route {
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsIndexRoute extends Route {
}
@@ -0,0 +1,46 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved host in current host catalog scope.
* @return {HostModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
return this.store.createRecord('host', {
type: 'static',
scopeModel
});
}
/**
* Renders new host specific templates for header, navigation, and action page sections.
* @override
* @param {object} controller
* @param {object} model
*/
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
});
}
}
@@ -0,0 +1,74 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
// =services
@service intl;
@service notify;
// =methods
/**
* Loads all targets under current project scope.
* @return {Promise{[TargetModel]}}
*/
async model() {
const scopeID = this.modelFor('scopes.scope.projects.project').id;
return this.store.findAll('target', { adapterOptions: { scopeID } });
}
// =actions
/**
* Rollback changes on a target.
* @param {TargetModel} target
*/
@action
cancel(target) {
const { isNew } = target;
target.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.targets');
}
/**
* Handle save.
* @param {TargetModel} target
* @param {Event} e
*/
@action
async save(target) {
const { isNew } = target;
try {
await target.save();
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
);
this.transitionTo('scopes.scope.projects.project.targets.target', target);
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
/**
* Deletes a target and redirects to targets index.
* @param {TargetModel} target
*/
@action
async delete(target) {
try {
await target.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.transitionTo('scopes.scope.projects.project.targets');
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route {
}
@@ -0,0 +1,16 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved target in current project scope.
* @return {TargetModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project');
return this.store.createRecord('target', { scopeModel });
}
}
@@ -0,0 +1,18 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route {
// =methods
/**
* Load a target.
* @param {object} params
* @param {string} params.target_id
* @return {TargetModel}
*/
async model({ target_id }) {
const { id: scopeID } = this.modelFor('scopes.scope.projects.project');
return this.store.findRecord('target', target_id, { adapterOptions: { scopeID } });
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetIndexRoute extends Route {
}
@@ -21,16 +21,16 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t 'form.label.name'}}</row.cell>
<row.cell>{{t 'form.label.type'}}</row.cell>
<row.cell>{{t 'form.label.id'}}</row.cell>
<row.headerCell>{{t 'form.label.name'}}</row.headerCell>
<row.headerCell>{{t 'form.label.type'}}</row.headerCell>
<row.headerCell>{{t 'form.label.id'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |authMethod|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<LinkTo
@route="scopes.scope.auth-methods.auth-method"
@model={{authMethod}}
@@ -38,13 +38,15 @@
{{authMethod.name}}
</LinkTo>
<p>{{authMethod.description}}</p>
</row.cell>
</row.headerCell>
<row.cell>
<Rose::Badge @style="outline">
{{t (concat 'auth.method-types.' authMethod.type)}}
</Rose::Badge>
</row.cell>
<row.cell>{{authMethod.id}}</row.cell>
<row.cell>
<code>{{authMethod.id}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -21,22 +21,25 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t 'form.label.name'}}</row.cell>
<row.cell>{{t 'form.label.description'}}</row.cell>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |group|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<LinkTo
@route="scopes.scope.groups.group"
@model={{group}}
>
{{group.name}}
</LinkTo>
<p>{{group.description}}</p>
</row.headerCell>
<row.cell>
<code>{{group.id}}</code>
</row.cell>
<row.cell>{{group.description}}</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -1,4 +1,7 @@
<Rose::Nav::Sidebar @title={{t "titles.resources"}} as |nav|>
<nav.link @route="scopes.scope.projects.project.targets">
{{t "resources.targets"}}
</nav.link>
<nav.link @route="scopes.scope.projects.project.host-catalogs">
{{t "resources.host-catalogs"}}
</nav.link>
@@ -1,4 +1,10 @@
<Rose::Dropdown @text="{{t 'form.label.manage'}}" @dropdownRight={{true}} as |dropdown|>
<dropdown.link
@route="scopes.scope.projects.project.host-catalogs.host-catalog.hosts.new"
@model={{@model}}
>
{{t "actions.add-host"}}
</dropdown.link>
<dropdown.link
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.new"
@model={{@model}}
@@ -5,4 +5,7 @@
<nav.link @route='scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'>
{{t 'titles.host-sets'}}
</nav.link>
<nav.link @route='scopes.scope.projects.project.host-catalogs.host-catalog.hosts'>
{{t 'titles.hosts'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -3,15 +3,15 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t "form.label.name"}}</row.cell>
<row.cell>{{t "form.label.type"}}</row.cell>
<row.cell>{{t "form.label.id"}}</row.cell>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.type"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |hostSet|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<LinkTo
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set"
@model={{hostSet}}
@@ -19,7 +19,7 @@
{{hostSet.displayName}}
</LinkTo>
<p>{{hostSet.description}}</p>
</row.cell>
</row.headerCell>
<row.cell>
<Rose::Badge @style="outline">{{hostSet.type}}</Rose::Badge>
</row.cell>
@@ -0,0 +1,3 @@
{{title (t "resources.hosts")}}
{{outlet}}
@@ -0,0 +1,9 @@
<Rose::Dropdown @text="{{t 'form.label.manage'}}" @dropdownRight={{true}} as |dropdown|>
<dropdown.button
@style="danger"
@disabled={{@model.canSave}}
{{on "click" (route-action "delete" @model)}}
>
{{t 'actions.delete-host'}}
</dropdown.button>
</Rose::Dropdown>
@@ -0,0 +1 @@
<h2>{{t "resources.host"}}</h2>
@@ -0,0 +1,5 @@
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host.index'>
{{t 'titles.details'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -0,0 +1,5 @@
<Form::Host
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
/>
@@ -0,0 +1,48 @@
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.type"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |host|}}
<body.row as |row|>
<row.headerCell>
<LinkTo
@route="scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host"
@model={{host}}
>
{{host.displayName}}
</LinkTo>
<p>{{host.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge @style="outline">{{host.type}}</Rose::Badge>
</row.cell>
<row.cell>
<code>{{host.id}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message @title={{t "titles.hosts-welcome"}} as |message|>
<message.description>
{{t "descriptions.hosts-welcome"}}
</message.description>
<message.link @route="scopes.scope.projects.project.host-catalogs.host-catalog.hosts.new">
<Rose::Icon @name="plus-circle-outline" />
{{t "titles.new"}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
@@ -0,0 +1,7 @@
{{title (t 'titles.new')}}
<Form::Host
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
/>
@@ -0,0 +1 @@
<h2>{{t "titles.new"}}</h2>
@@ -24,18 +24,15 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t "form.label.id"}}</row.cell>
<row.cell>{{t "form.label.name"}}</row.cell>
<row.cell>{{t "form.label.type"}}</row.cell>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.type"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |hostCatalog|}}
<body.row as |row|>
<row.cell>
<code>{{hostCatalog.id}}</code>
</row.cell>
<row.cell>
<row.headerCell>
<LinkTo
@route="scopes.scope.projects.project.host-catalogs.host-catalog"
@model={{hostCatalog}}
@@ -43,8 +40,11 @@
{{hostCatalog.displayName}}
</LinkTo>
<p>{{hostCatalog.description}}</p>
</row.cell>
</row.headerCell>
<row.cell>{{hostCatalog.type}}</row.cell>
<row.cell>
<code>{{hostCatalog.id}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -0,0 +1,3 @@
{{title (t "resources.targets")}}
{{outlet}}
@@ -0,0 +1,76 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "resources.targets"}}</h2>
</page.header>
<page.actions>
{{#if @model}}
<Rose::LinkButton @route="scopes.scope.projects.project.targets.new" @style="primary">
{{t "titles.new"}}
</Rose::LinkButton>
{{/if}}
</page.actions>
<page.body>
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.protocol"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |target|}}
<body.row as |row|>
<row.headerCell>
<LinkTo
@route="scopes.scope.projects.project.targets.target"
@model={{target}}
>
{{target.displayName}}
</LinkTo>
<p>{{target.description}}</p>
</row.headerCell>
<row.cell>
{{#if target.protocol}}
<Rose::Badge @style="outline">
{{t (concat "target.protocols." target.protocol)}}
</Rose::Badge>
{{/if}}
</row.cell>
<row.cell>
<code>{{target.id}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message @title={{t "titles.targets-welcome"}} as |message|>
<message.description>
{{t "descriptions.targets-welcome"}}
</message.description>
<message.link @route="scopes.scope.projects.project.targets.new">
<Rose::Icon @name="plus-circle-outline" />
{{t "titles.new"}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>
@@ -0,0 +1,21 @@
{{title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "titles.new"}}</h2>
</page.header>
<page.body>
<Form::Target
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -0,0 +1 @@
{{outlet}}
@@ -0,0 +1,39 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "resources.target"}}</h2>
</page.header>
<page.navigation>
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope.projects.project.targets.target'>
{{t 'titles.details'}}
</nav.link>
</Rose::Nav::Tabs>
</page.navigation>
<page.actions>
<Rose::Dropdown @text="{{t 'form.label.manage'}}" @dropdownRight={{true}} as |dropdown|>
<dropdown.button
@style="danger"
@disabled={{@model.canSave}}
{{on "click" (route-action "delete" @model)}}
>
{{t 'actions.delete-target'}}
</dropdown.button>
</Rose::Dropdown>
</page.actions>
<page.body>
<Form::Target
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -21,22 +21,25 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t 'form.label.name'}}</row.cell>
<row.cell>{{t 'form.label.description'}}</row.cell>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |role|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<LinkTo
@route="scopes.scope.roles.role"
@model={{role}}
>
{{role.displayName}}
</LinkTo>
<p>{{role.description}}</p>
</row.headerCell>
<row.cell>
<code>{{role.id}}</code>
</row.cell>
<row.cell>{{role.description}}</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -21,8 +21,8 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.label.name'}}</row.headerCell>
<row.headerCell>{{t 'form.label.description'}}</row.headerCell>
<row.headerCell>{{t "form.label.name"}}</row.headerCell>
<row.headerCell>{{t "form.label.id"}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
@@ -35,8 +35,11 @@
>
{{user.name}}
</LinkTo>
<p>{{user.description}}</p>
</row.headerCell>
<row.cell>{{user.description}}</row.cell>
<row.cell>
<code>{{user.id}}</code>
</row.cell>
</body.row>
{{/each}}
</table.body>
+8
View File
@@ -123,6 +123,14 @@ export default function() {
return hostSet.update(attrs);
});
// target
this.get('/scopes/:scope_id/targets');
this.post('/scopes/:scope_id/targets');
this.get('/scopes/:scope_id/targets/:id');
this.patch('/scopes/:scope_id/targets/:id');
this.del('/scopes/:scope_id/targets/:id');
// Uncomment the following line and the Response import above
// Then change the response code to simulate error responses.
// this.get('/scopes/:scope_id/projects', () => new Response(505));
+3
View File
@@ -0,0 +1,3 @@
import factory from '../generated/factories/target';
export default factory.extend();
@@ -0,0 +1,17 @@
import { Factory } from 'ember-cli-mirage';
import { random, date } from 'faker';
/**
* GeneratedTargetModelFactory
*/
export default Factory.extend({
protocol: 'SSH',
name: () => random.words(),
description: () => random.words(),
created_time: () => date.recent(),
updated_time: () => date.recent(),
disabled: () => random.boolean(),
version: () => random.number(),
});
+2 -1
View File
@@ -33,6 +33,7 @@ export default function(server) {
server.db.scopes.where({type: 'project'}).forEach(({ id, type }) => {
const scope = { id, type };
server.createList('host-catalog', 2, { scope }, 'withChildren');
server.createList('target', 2, { scope });
});
}
+5
View File
@@ -0,0 +1,5 @@
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
modelName: 'target'
});
@@ -69,7 +69,7 @@ module('Acceptance | host catalogs', function (hooks) {
assert.expect(1);
authenticateSession({});
await visit(urls.hostCatalogs);
await click('main tbody .rose-table-cell:nth-child(2) a');
await click('main tbody .rose-table-header-cell:nth-child(1) a');
await a11yAudit();
assert.equal(currentURL(), urls.hostCatalog);
});
+2 -2
View File
@@ -47,7 +47,7 @@ module('Acceptance | host sets', function (hooks) {
assert.expect(0);
});
test('errors are displayed when save on auth method fails', async function (assert) {
test('errors are displayed when save on host set fails', async function (assert) {
assert.expect(0);
});
@@ -55,7 +55,7 @@ module('Acceptance | host sets', function (hooks) {
assert.expect(0);
});
test('saving an existing auth method with invalid fields displays error messages', async function (assert) {
test('saving an existing host set with invalid fields displays error messages', async function (assert) {
assert.expect(0);
});
});
+61
View File
@@ -0,0 +1,61 @@
import { module, test } from 'qunit';
// import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
// import a11yAudit from 'ember-a11y-testing/test-support/audit';
// import {
// authenticateSession,
// // These are left here intentionally for future reference.
// //currentSession,
// //invalidateSession,
// } from 'ember-simple-auth/test-support';
module('Acceptance | hosts', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
hooks.beforeEach(function () {
// Setup Mirage mock resources for this test
// Generate route URLs for resources
});
test('visiting host', async function (assert) {
assert.expect(0);
});
test('can navigate to a host form', async function (assert) {
assert.expect(0);
});
test('can update a host and save changes', async function (assert) {
assert.expect(0);
});
test('can update a host and cancel changes', async function (assert) {
assert.expect(0);
});
test('can create new host', async function (assert) {
assert.expect(0);
});
test('can cancel new host creation', async function (assert) {
assert.expect(0);
});
test('saving a new host with invalid fields displays error messages', async function (assert) {
assert.expect(0);
});
test('errors are displayed when save on auth method fails', async function (assert) {
assert.expect(0);
});
test('errors are displayed when delete on a host fails', async function (assert) {
assert.expect(0);
});
test('saving an existing host with invalid fields displays error messages', async function (assert) {
assert.expect(0);
});
});
+61
View File
@@ -0,0 +1,61 @@
import { module, test } from 'qunit';
//import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
//import a11yAudit from 'ember-a11y-testing/test-support/audit';
// import {
// authenticateSession,
// // These are left here intentionally for future reference.
// //currentSession,
// //invalidateSession,
// } from 'ember-simple-auth/test-support';
module('Acceptance | targets', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
hooks.beforeEach(function () {
// Setup Mirage mock resources for this test
// Generate route URLs for resources
});
test('visiting targets', async function (assert) {
assert.expect(0);
});
test('can navigate to a target form', async function (assert) {
assert.expect(0);
});
test('can update a target and save changes', async function (assert) {
assert.expect(0);
});
test('can update a target and cancel changes', async function (assert) {
assert.expect(0);
});
test('can create new target', async function (assert) {
assert.expect(0);
});
test('can cancel new target creation', async function (assert) {
assert.expect(0);
});
test('saving a new target with invalid fields displays error messages', async function (assert) {
assert.expect(0);
});
test('errors are displayed when save on target fails', async function (assert) {
assert.expect(0);
});
test('errors are displayed when delete on a target fails', async function (assert) {
assert.expect(0);
});
test('saving an existing target with invalid fields displays error messages', async function (assert) {
assert.expect(0);
});
});
@@ -0,0 +1,23 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
this.submit = () => {};
this.cancel = () => {};
await render(hbs`
<Form::Host
@submit={{this.submit}}
@cancel={{this.cancel}}
/>`);
assert.ok(find('form'));
});
});
@@ -0,0 +1,23 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/target', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
this.submit = () => {};
this.cancel = () => {};
await render(hbs`
<Form::Target
@submit={{this.submit}}
@cancel={{this.cancel}}
/>`);
assert.ok(find('form'));
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/hosts');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/targets', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/targets');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/targets/new', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/targets/new');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/projects/project/targets/target', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/projects/project/targets/target');
assert.ok(controller);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/targets', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/targets');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/targets/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/targets/index');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/targets/new', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/targets/new');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/targets/target', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/targets/target');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/project/targets/target/index', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/projects/project/targets/target/index');
assert.ok(route);
});
});
+18
View File
@@ -16,7 +16,10 @@ actions:
delete-host-catalog: Delete host catalog
delete-auth-method: Delete auth method
delete-host-set: Delete host set
delete-host: Delete host
delete-target: Delete target
add-host-set: Create Host Set
add-host: Create Host
auth:
titles:
no-scopes: No Scopes Available
@@ -31,6 +34,12 @@ auth:
host-set:
types:
static: Static
target:
protocols:
SSH: SSH
host:
types:
static: Static
resources:
user: User
users: Users
@@ -50,6 +59,8 @@ resources:
host-sets: Host Sets
host: Host
hosts: Hosts
target: Target
targets: Targets
titles:
iam: IAM
new: New
@@ -62,14 +73,18 @@ titles:
projects-welcome: Welcome to Projects
host-catalogs-welcome: Welcome to Host Catalogs
host-sets-welcome: Welcome to Host Sets
hosts-welcome: Welcome to Hosts
users-welcome: Welcome to Users
roles-welcome: Welcome to Roles
groups-welcome: Welcome to Groups
auth-methods-welcome: Welcome to Auth Methods
targets-welcome: Create your first Target
grants: Permissions
new-grant: New Grant
principals: Principals
host-sets: Host Sets
hosts: Hosts
targets: Targets
global: Global
descriptions:
host-catalogs: Overview of collections of hosts and host sets.
@@ -77,10 +92,12 @@ descriptions:
projects-welcome: Projects allow you to create and manage host catalogs. To start, create a project.
host-catalogs-welcome: Host catalogs allow you to configure to collect and create hosts and host sets. To start, create a host catalog.
host-sets-welcome: Configure a static host set in this host catalog.
hosts-welcome: Configure a static host in this host catalog.
users-welcome: Users are authorized to access Boundary.
roles-welcome: Roles are collections of capabilities that can be granted to user and/or groups.
groups-welcome: Groups are collections of users.
auth-methods-welcome: Auth methods are configurations to authenticate users.
targets-welcome: Targets provide Users the means to connect to and interact networked services. A Target contains a collection of Hosts and a collection of Credentials.
states:
info: Info
success: Success
@@ -98,6 +115,7 @@ form:
grant: Grant
principal: Principal
address: Address
protocol: Protocol
errors:
titles:
unauthenticated-error: You are not signed in