Merge pull request #126 from hashicorp/ICU-294-new-host-set
Create a host set
This commit is contained in:
20 files changed
+249
-47
No files matched your search
@@ -6,6 +6,12 @@
|
||||
as |form|
|
||||
>
|
||||
|
||||
<form.input
|
||||
@value={{t (concat 'host-set.types.' @model.type)}}
|
||||
@label={{t "form.label.type"}}
|
||||
readonly={{true}}
|
||||
@disabled={{true}} />
|
||||
|
||||
<form.input
|
||||
@name="name"
|
||||
@type="name"
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsController extends Controller {
|
||||
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Host sets breadcrumb
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.intl.t('resources.host-sets');
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetController extends Controller {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Host set breadcrumb
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.model.displayName;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewController extends Controller {
|
||||
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Translated new host set breadcrumb
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.intl.t('titles.new');
|
||||
}
|
||||
}
|
||||
+6
-14
@@ -22,7 +22,12 @@ Router.map(function () {
|
||||
this.route('project', { path: ':project_id' }, function() {
|
||||
this.route('host-catalogs', function() {
|
||||
this.route('new');
|
||||
this.route('host-catalog', { path: ':host_catalog_id' }, function() {});
|
||||
this.route('host-catalog', { path: ':host_catalog_id' }, function() {
|
||||
this.route('host-sets', function() {
|
||||
this.route('host-set', { path: ':host_set_id' }, function() {});
|
||||
this.route('new');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
this.route('new');
|
||||
@@ -46,19 +51,6 @@ Router.map(function () {
|
||||
this.route('new');
|
||||
});
|
||||
|
||||
this.route('projects', function() {
|
||||
this.route('project', { path: ':project_id' }, function() {
|
||||
this.route('host-catalogs', function() {
|
||||
this.route('new');
|
||||
this.route('host-catalog', { path: ':host_catalog_id' }, function() {
|
||||
this.route('host-sets', function() {
|
||||
this.route('host-set', { path: ':host_set_id' }, function() {});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
this.route('new');
|
||||
});
|
||||
this.route('auth-methods', function() {
|
||||
this.route('auth-method', { path: ':auth_method_id' }, function() {});
|
||||
this.route('new');
|
||||
|
||||
@@ -20,11 +20,12 @@ export default class ScopesScopeProjectsProjectRoute extends Route {
|
||||
* @param {object} model
|
||||
*/
|
||||
renderTemplate(controller, model) {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/projects/project/_sidebar', {
|
||||
into: 'scopes/scope',
|
||||
outlet: 'sidebar',
|
||||
model: model
|
||||
});
|
||||
super.renderTemplate(...arguments);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte
|
||||
* @param {object} model
|
||||
*/
|
||||
renderTemplate(controller, model) {
|
||||
this.render('scopes/scope/projects/project/host-catalogs/host-catalog');
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-header', {
|
||||
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
|
||||
|
||||
+6
-1
@@ -28,7 +28,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
|
||||
*/
|
||||
@action
|
||||
cancel(hostSet) {
|
||||
const { isNew } = hostSet;
|
||||
hostSet.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,9 +41,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
|
||||
@action
|
||||
async save(hostSet) {
|
||||
try {
|
||||
const { isNew } = hostSet;
|
||||
await hostSet.save(this.adapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.save-success'));
|
||||
this.notify.success(
|
||||
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
|
||||
);
|
||||
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set', hostSet);
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewRoute extends Route {
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Creates a new unsaved host set in current host catalog scope.
|
||||
* @return {HostCatalogModel}
|
||||
*/
|
||||
model() {
|
||||
const scopeModel = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
|
||||
return this.store.createRecord('host-set', {
|
||||
type: 'static',
|
||||
scopeModel
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders new host-set 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/host-sets/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
|
||||
});
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
+7
@@ -1,4 +1,11 @@
|
||||
<Rose::Dropdown @text="{{t 'form.label.manage'}}" @dropdownRight={{true}} as |dropdown|>
|
||||
<dropdown.link
|
||||
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.new"
|
||||
@model={{@model}}
|
||||
>
|
||||
{{t "actions.add-host-set"}}
|
||||
</dropdown.link>
|
||||
<dropdown.separator />
|
||||
<dropdown.button
|
||||
@style="danger"
|
||||
@disabled={{@model.canSave}}
|
||||
|
||||
+48
-30
@@ -1,30 +1,48 @@
|
||||
<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>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model as |hostSet|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<LinkTo
|
||||
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set"
|
||||
@model={{hostSet}}
|
||||
>
|
||||
{{hostSet.displayName}}
|
||||
</LinkTo>
|
||||
<p>{{hostSet.description}}</p>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge @style="outline">{{hostSet.type}}</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{hostSet.id}}</code>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
{{#if @model}}
|
||||
|
||||
<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>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model as |hostSet|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<LinkTo
|
||||
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set"
|
||||
@model={{hostSet}}
|
||||
>
|
||||
{{hostSet.displayName}}
|
||||
</LinkTo>
|
||||
<p>{{hostSet.description}}</p>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge @style="outline">{{hostSet.type}}</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{hostSet.id}}</code>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
|
||||
{{else}}
|
||||
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message @title={{t "titles.host-sets-welcome"}} as |message|>
|
||||
<message.description>
|
||||
{{t "descriptions.host-sets-welcome"}}
|
||||
</message.description>
|
||||
<message.link @route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.new">
|
||||
<Rose::Icon @name="plus-circle-outline" />
|
||||
{{t "titles.new"}}
|
||||
</message.link>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
|
||||
{{/if}}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{{title (t 'titles.new')}}
|
||||
|
||||
<Form::HostSet
|
||||
@model={{@model}}
|
||||
@submit={{route-action "save" @model}}
|
||||
@cancel={{route-action "cancel" @model}}
|
||||
/>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<h2>{{t "titles.new"}}</h2>
|
||||
@@ -35,6 +35,18 @@ module('Acceptance | host sets', function (hooks) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('can create new host set', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('can cancel new host set creation', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('saving a new host set 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);
|
||||
});
|
||||
|
||||
+12
@@ -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/host-sets', 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/host-sets');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
+12
@@ -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/host-sets/host-set', 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/host-sets/host-set');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
+12
@@ -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/host-sets/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/host-sets/new');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
+11
@@ -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/host-sets/new', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,7 @@ actions:
|
||||
delete-host-catalog: Delete host catalog
|
||||
delete-auth-method: Delete auth method
|
||||
delete-host-set: Delete host set
|
||||
add-host-set: Create Host Set
|
||||
auth:
|
||||
titles:
|
||||
no-scopes: No Scopes Available
|
||||
@@ -27,6 +28,9 @@ auth:
|
||||
authenticating-with-org: "You're authenticating with {name}."
|
||||
method-types:
|
||||
password: Password
|
||||
host-set:
|
||||
types:
|
||||
static: Static
|
||||
resources:
|
||||
user: User
|
||||
users: Users
|
||||
@@ -55,6 +59,7 @@ titles:
|
||||
empty-set: No Items Yet
|
||||
projects-welcome: Welcome to Projects
|
||||
host-catalogs-welcome: Welcome to Host Catalogs
|
||||
host-sets-welcome: Welcome to Host Sets
|
||||
users-welcome: Welcome to Users
|
||||
roles-welcome: Welcome to Roles
|
||||
groups-welcome: Welcome to Groups
|
||||
@@ -69,6 +74,7 @@ descriptions:
|
||||
empty-set: There are no items to display yet. You may be able to add items or try back later.
|
||||
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.
|
||||
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.
|
||||
|
||||
Reference in new issue
Block a user