Merge remote-tracking branch 'origin/develop' into add-manage-button-to-edit-form
This commit is contained in:
60 files changed
+541
-245
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import ApplicationAdapter from './application';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class HostSetAdapter extends ApplicationAdapter {
|
||||
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Append a host catalog URL ahead of the host sets path if `hostCatalogID` is
|
||||
* passed via adapter options. Otherwise, generate the prefix as normal.
|
||||
*
|
||||
* TODO: generalize the interface to resource-prefixed URLs by accepting
|
||||
* a modelName and an ID, rather than looking for a known key.
|
||||
*
|
||||
* @override
|
||||
* @param {string} path
|
||||
* @param {string} parentURL
|
||||
* @param {string} modelName
|
||||
* @param {string} id
|
||||
* @param {object} snapshot
|
||||
* @return {string} urlPrefix
|
||||
*/
|
||||
urlPrefix(path, parentURL, modelName, id, snapshot) {
|
||||
const hostCatalogID = snapshot?.adapterOptions?.hostCatalogID;
|
||||
if (hostCatalogID) {
|
||||
const hostCatalogAdapter = this.store.adapterFor('host-catalog');
|
||||
return hostCatalogAdapter
|
||||
._buildPrefixedURL('host-catalog', hostCatalogID, snapshot);
|
||||
} else {
|
||||
return super.urlPrefix(...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import ApplicationAdapter from './application';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class HostAdapter extends ApplicationAdapter {
|
||||
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Append a host catalog URL ahead of the host path if `hostCatalogID` is
|
||||
* passed via adapter options. Otherwise, generate the prefix as normal.
|
||||
*
|
||||
* TODO: generalize the interface to resource-prefixed URLs by accepting
|
||||
* a modelName and an ID, rather than looking for a known key.
|
||||
*
|
||||
* @override
|
||||
* @param {string} path
|
||||
* @param {string} parentURL
|
||||
* @param {string} modelName
|
||||
* @param {string} id
|
||||
* @param {object} snapshot
|
||||
* @return {string} urlPrefix
|
||||
*/
|
||||
urlPrefix(path, parentURL, modelName, id, snapshot) {
|
||||
const hostCatalogID = snapshot?.adapterOptions?.hostCatalogID;
|
||||
if (hostCatalogID) {
|
||||
const hostCatalogAdapter = this.store.adapterFor('host-catalog');
|
||||
return hostCatalogAdapter
|
||||
._buildPrefixedURL('host-catalog', hostCatalogID, snapshot);
|
||||
} else {
|
||||
return super.urlPrefix(...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
* HostSet is a collection of Hosts created and managed by a HostCatalog
|
||||
*/
|
||||
export default class GeneratedHostSetModel extends BaseModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('string', {
|
||||
description: 'The type of the resource, to help differentiate schemas'
|
||||
}) type;
|
||||
|
||||
@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('number', {
|
||||
description: 'Current version number of this resource.',
|
||||
})
|
||||
version;
|
||||
|
||||
@attr('number', {
|
||||
description: 'The total count of hosts in this host set\nOutput only.'
|
||||
}) size;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
* Host contains all fields related to a Host resource
|
||||
*/
|
||||
export default class GeneratedHostModel extends BaseModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('string', {
|
||||
description: 'The type of the resource, to help differentiate schemas'
|
||||
}) type;
|
||||
|
||||
@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('number', {
|
||||
description: 'Current version number of this resource.',
|
||||
})
|
||||
version;
|
||||
|
||||
@attr('string', {
|
||||
description: 'The address (DNS or IP name) used to reach the host'
|
||||
}) address;
|
||||
|
||||
}
|
||||
@@ -46,6 +46,31 @@ export default Mixin.create({
|
||||
return '';
|
||||
},
|
||||
|
||||
/**
|
||||
* Builds the (mostly full) URL with a prefix, but not the suffix.
|
||||
* The `_buildURL` method adds a suffix.
|
||||
* Do not call directly.
|
||||
* @override
|
||||
* @param {String} modelName
|
||||
* @param {String} id
|
||||
* @return {String} url
|
||||
*/
|
||||
_buildPrefixedURL(modelName, id, snapshot) {
|
||||
let path;
|
||||
let url = [];
|
||||
const host = get(this, 'host');
|
||||
const prefix = this.urlPrefix(null, null, modelName, id, snapshot);
|
||||
if (modelName) {
|
||||
path = this.pathForType(modelName);
|
||||
if (path) url.push(path);
|
||||
}
|
||||
if (id) url.push(encodeURIComponent(id));
|
||||
if (prefix) url.unshift(prefix);
|
||||
url = url.join('/');
|
||||
if (!host && url && url.charAt(0) !== '/') url = '/' + url;
|
||||
return `${url}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* Overrides the default `_buildURL` with a nearly identical version.
|
||||
* This method simply passes arguments into the `urlPrefix` method for
|
||||
@@ -58,19 +83,8 @@ export default Mixin.create({
|
||||
* @return {String} url
|
||||
*/
|
||||
_buildURL(modelName, id, snapshot) {
|
||||
let path;
|
||||
let url = [];
|
||||
const host = get(this, 'host');
|
||||
const prefix = this.urlPrefix(null, null, modelName, id, snapshot);
|
||||
const url = this._buildPrefixedURL(modelName, id, snapshot);
|
||||
const suffix = this.urlSuffix(modelName, id, snapshot);
|
||||
if (modelName) {
|
||||
path = this.pathForType(modelName);
|
||||
if (path) url.push(path);
|
||||
}
|
||||
if (id) url.push(encodeURIComponent(id));
|
||||
if (prefix) url.unshift(prefix);
|
||||
url = url.join('/');
|
||||
if (!host && url && url.charAt(0) !== '/') url = '/' + url;
|
||||
return `${url}${suffix}`;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import GeneratedHostCatalogModel from '../generated/models/host-catalog';
|
||||
|
||||
export default class HostCatalogModel extends GeneratedHostCatalogModel { }
|
||||
export default class HostCatalogModel extends GeneratedHostCatalogModel {}
|
||||
@@ -0,0 +1,3 @@
|
||||
import GeneratedHostSetModel from '../generated/models/host-set';
|
||||
|
||||
export default class HostSetModel extends GeneratedHostSetModel {}
|
||||
@@ -0,0 +1,3 @@
|
||||
import GeneratedHostModel from '../generated/models/host';
|
||||
|
||||
export default class HostModel extends GeneratedHostModel {}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/adapters/host-set';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/adapters/host';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/host-set';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/host';
|
||||
@@ -0,0 +1,28 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | host set', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it generates correct complete URLs', function (assert) {
|
||||
assert.expect(2);
|
||||
const scopeID = 'o_1';
|
||||
const hostCatalogID = 'hc_098';
|
||||
const method = 'my-custom-method';
|
||||
const mockSnapshot = {
|
||||
adapterOptions: {
|
||||
scopeID,
|
||||
method
|
||||
}
|
||||
};
|
||||
const adapter = this.owner.lookup('adapter:host-set');
|
||||
// Without hostCatalogID...
|
||||
let url = adapter.buildURL('host-set', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/scopes/o_1/host-sets:my-custom-method');
|
||||
// With hostCatalogID...
|
||||
mockSnapshot.adapterOptions.hostCatalogID = hostCatalogID;
|
||||
url = adapter.buildURL('host-set', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/scopes/o_1/host-catalogs/hc_098/host-sets:my-custom-method');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | host', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it generates correct complete URLs', function (assert) {
|
||||
assert.expect(2);
|
||||
const scopeID = 'o_1';
|
||||
const hostCatalogID = 'hc_098';
|
||||
const method = 'my-custom-method';
|
||||
const mockSnapshot = {
|
||||
adapterOptions: {
|
||||
scopeID,
|
||||
method
|
||||
}
|
||||
};
|
||||
const adapter = this.owner.lookup('adapter:host');
|
||||
// Without hostCatalogID...
|
||||
let url = adapter.buildURL('host', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/scopes/o_1/hosts:my-custom-method');
|
||||
// With hostCatalogID...
|
||||
mockSnapshot.adapterOptions.hostCatalogID = hostCatalogID;
|
||||
url = adapter.buildURL('host', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/scopes/o_1/host-catalogs/hc_098/hosts:my-custom-method');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | host set', 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('host-set', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | host', 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('host', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,10 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../templates/components/rose/table';
|
||||
|
||||
/**
|
||||
* A table component that support displaying rows of data as header, body, and footer.
|
||||
* Supports setting a caption for a11y.
|
||||
*/
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { text, boolean, select } from '@storybook/addon-knobs';
|
||||
|
||||
<Meta title="Rose|Table" component="Table" />
|
||||
|
||||
# Table
|
||||
|
||||
A table component to display data in structure of rows and columns. It supports `header`, `body` and `footer` optional definitions. Each definition allows for a table row to be defined with table cells.
|
||||
A table component to display data in structure of rows and columns. It supports `header`, `body` and `footer` optional definitions. Each definition allows for a table `row` to be defined with either a `cell` or `headerCell` table element.
|
||||
|
||||
```htmlbars
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.cell>Address</row.cell>
|
||||
<row.cell>Host Set</row.cell>
|
||||
<row.cell>Name</row.cell>
|
||||
<row.cell>Description</row.cell>
|
||||
<row.headerCell>Address</row.headerCell>
|
||||
<row.headerCell>Host Set</row.headerCell>
|
||||
<row.headerCell>Name</row.headerCell>
|
||||
<row.headerCell>Description</row.headerCell>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
@@ -41,10 +39,10 @@ A table component to display data in structure of rows and columns. It supports
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.cell>Address</row.cell>
|
||||
<row.cell>Host Set</row.cell>
|
||||
<row.cell>Name</row.cell>
|
||||
<row.cell>Description</row.cell>
|
||||
<row.headerCell>Address</row.headerCell>
|
||||
<row.headerCell>Host Set</row.headerCell>
|
||||
<row.headerCell>Name</row.headerCell>
|
||||
<row.headerCell>Description</row.headerCell>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/body';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/cell';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/footer';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/header';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,6 +1,10 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/row';
|
||||
|
||||
/**
|
||||
* A table row component that uses tr table element and
|
||||
* configures a table cell element.
|
||||
*/
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/table/section';
|
||||
|
||||
/**
|
||||
* A table section component that configures a row component.
|
||||
* Section can be: thead, tbody, or tfoot table elements.
|
||||
*/
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -4,8 +4,14 @@
|
||||
{{/if}}
|
||||
|
||||
{{yield (hash
|
||||
header=(component 'rose/table/header')
|
||||
body=(component 'rose/table/body')
|
||||
footer=(component 'rose/table/footer')
|
||||
header=(component 'rose/table/section'
|
||||
tagName='thead'
|
||||
classNames='rose-table-header')
|
||||
body=(component 'rose/table/section'
|
||||
tagName='tbody'
|
||||
classNames='rose-table-body')
|
||||
footer=(component 'rose/table/section'
|
||||
tagName='tfoot'
|
||||
classNames='rose-table-foot')
|
||||
)}}
|
||||
</table>
|
||||
@@ -1,5 +0,0 @@
|
||||
<tbody ...attributes class="rose-table-body">
|
||||
{{yield (hash
|
||||
row=(component 'rose/table/row')
|
||||
)}}
|
||||
</tbody>
|
||||
@@ -1,9 +0,0 @@
|
||||
{{#if @header}}
|
||||
<th ...attributes class="rose-table-cell rose-table-header-cell">
|
||||
{{yield}}
|
||||
</th>
|
||||
{{else}}
|
||||
<td ...attributes class="{{concat "rose-table-cell" (if @footer " rose-table-footer-cell" " rose-table-body-cell")}}">
|
||||
{{yield}}
|
||||
</td>
|
||||
{{/if}}
|
||||
@@ -1,5 +0,0 @@
|
||||
<tfoot ...attributes class="rose-table-footer">
|
||||
{{yield (hash
|
||||
row=(component 'rose/table/row' footer=true)
|
||||
)}}
|
||||
</tfoot>
|
||||
@@ -1,5 +0,0 @@
|
||||
<thead ...attributes class="rose-table-header">
|
||||
{{yield (hash
|
||||
row=(component 'rose/table/row' header=true)
|
||||
)}}
|
||||
</thead>
|
||||
@@ -1,5 +1,12 @@
|
||||
<tr ...attributes class="rose-table-row">
|
||||
<tr ...attributes class='rose-table-row'>
|
||||
{{yield (hash
|
||||
cell=(component 'rose/table/cell' header=@header footer=@footer)
|
||||
cell=(component 'rose/anonymous'
|
||||
tagName='td'
|
||||
class='rose-table-cell'
|
||||
)
|
||||
headerCell=(component 'rose/anonymous'
|
||||
tagName='th'
|
||||
class='rose-table-header-cell'
|
||||
)
|
||||
)}}
|
||||
</tr>
|
||||
@@ -0,0 +1,3 @@
|
||||
{{yield (hash
|
||||
row=(component 'rose/table/row')
|
||||
)}}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'rose/components/rose/table/body';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'rose/components/rose/table/cell';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'rose/components/rose/table/footer';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'rose/components/rose/table/header';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/table/section';
|
||||
@@ -1,36 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
module('Integration | Component | rose/table/body', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Body />`);
|
||||
assert.ok(find('tbody'));
|
||||
assert.ok(find('.rose-table-body'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Body id="body"/>`);
|
||||
assert.ok(find('#body'));
|
||||
});
|
||||
|
||||
test('it renders with row', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Body as |body|>
|
||||
<body.row />
|
||||
</Rose::Table::Body>`);
|
||||
assert.ok(find('tr'));
|
||||
});
|
||||
|
||||
test('it renders with row cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Body as |body|>
|
||||
<body.row as |row|>
|
||||
<row.cell />
|
||||
</body.row>
|
||||
</Rose::Table::Body>`);
|
||||
assert.ok(find('td'));
|
||||
assert.ok(find('.rose-table-body-cell'));
|
||||
});
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
module('Integration | Component | rose/table/cell', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Cell />`);
|
||||
assert.ok(find('td'));
|
||||
assert.ok(find('.rose-table-cell'));
|
||||
assert.ok(find('.rose-table-body-cell'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Cell id="cell"/>`);
|
||||
assert.ok(find('#cell'));
|
||||
});
|
||||
|
||||
test('it renders with content', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Cell>
|
||||
Cell content
|
||||
</Rose::Table::Cell>`);
|
||||
assert.equal(find('.rose-table-cell').textContent.trim(), 'Cell content');
|
||||
});
|
||||
|
||||
test('it renders as header cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Cell @header={{true}}/>`);
|
||||
assert.ok(find('.rose-table-cell'));
|
||||
assert.ok(find('.rose-table-header-cell'));
|
||||
});
|
||||
|
||||
test('it renders as footer cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Cell @footer={{true}}/>`);
|
||||
assert.ok(find('.rose-table-cell'));
|
||||
assert.ok(find('.rose-table-footer-cell'));
|
||||
});
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
module('Integration | Component | rose/table/footer', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Footer />`);
|
||||
assert.ok(find('tfoot'));
|
||||
assert.ok(find('.rose-table-footer'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Footer id="footer"/>`);
|
||||
assert.ok(find('#footer'));
|
||||
});
|
||||
|
||||
test('it renders with row', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Footer as |footer|>
|
||||
<footer.row />
|
||||
</Rose::Table::Footer>`);
|
||||
assert.ok(find('tr'));
|
||||
});
|
||||
|
||||
test('it renders with row cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Footer as |footer|>
|
||||
<footer.row as |row|>
|
||||
<row.cell />
|
||||
</footer.row>
|
||||
</Rose::Table::Footer>`);
|
||||
assert.ok(find('td'));
|
||||
assert.ok(find('.rose-table-cell'));
|
||||
});
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
module('Integration | Component | rose/table/header', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Header />`);
|
||||
assert.ok(find('thead'));
|
||||
assert.ok(find('.rose-table-header'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Header id="header"/>`);
|
||||
assert.ok(find('#header'));
|
||||
});
|
||||
|
||||
test('it renders with row', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Header as |header|>
|
||||
<header.row />
|
||||
</Rose::Table::Header>`);
|
||||
assert.ok(find('tr'));
|
||||
});
|
||||
|
||||
test('it renders with row cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.cell />
|
||||
</header.row>
|
||||
</Rose::Table::Header>`);
|
||||
assert.ok(find('th'));
|
||||
assert.ok(find('.rose-table-header-cell'));
|
||||
});
|
||||
});
|
||||
@@ -17,10 +17,19 @@ module('Integration | Component | rose/table/row', function (hooks) {
|
||||
assert.ok(find('#row'));
|
||||
});
|
||||
|
||||
test('it renders with cell', async function (assert) {
|
||||
test('it renders a cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Row as |row|>
|
||||
<row.cell />
|
||||
</Rose::Table::Row>`);
|
||||
assert.ok(find('td'));
|
||||
assert.ok(find('.rose-table-cell'));
|
||||
});
|
||||
|
||||
test('it renders a header cell', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Row as |row|>
|
||||
<row.headerCell />
|
||||
</Rose::Table::Row>`);
|
||||
assert.ok(find('th'));
|
||||
assert.ok(find('.rose-table-header-cell'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
module('Integration | Component | rose/table/section', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Section @tagName='tag' class='tag-class'/>`);
|
||||
assert.ok(find('tag'));
|
||||
assert.ok(find('.tag-class'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::Table::section @tagName='tag' id="section"/>`);
|
||||
assert.ok(find('#section'));
|
||||
});
|
||||
|
||||
test('it renders a row', async function (assert) {
|
||||
await render(hbs`<Rose::Table::Section @tagName='tag' as |section|>
|
||||
<section.row />
|
||||
</Rose::Table::Section>`);
|
||||
assert.ok(find('tr'));
|
||||
assert.ok(find('.rose-table-row'));
|
||||
});
|
||||
});
|
||||
@@ -7,8 +7,6 @@
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<meta name="default-org-id" content="{{DEFAULT_ORG_ID}}">
|
||||
|
||||
{{content-for "head"}}
|
||||
|
||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||
|
||||
@@ -36,6 +36,7 @@ Router.map(function () {
|
||||
});
|
||||
this.route('new');
|
||||
});
|
||||
this.route('auth-methods', function() {});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Load all auth-methods under current scope
|
||||
* @return {Promise[AuthMethodModel]}
|
||||
*/
|
||||
async model() {
|
||||
const { id: scopeID} = this.modelFor('scopes.scope');
|
||||
return this.store.findAll('auth-method', { adapterOptions: { scopeID } });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeAuthMethodsIndexRoute extends Route {
|
||||
}
|
||||
@@ -1,4 +1,20 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute extends Route {
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Load a host catalog.
|
||||
* @param {object} params
|
||||
* @param {string} params.host_catalog_id
|
||||
* @return {HostCatalogModel}
|
||||
*/
|
||||
async model({ host_catalog_id }) {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.findRecord('host-catalog', host_catalog_id, {
|
||||
adapterOptions: { scopeID },
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,9 @@
|
||||
<nav.link @route="scopes.scope.roles">
|
||||
{{t "resources.roles"}}
|
||||
</nav.link>
|
||||
<nav.link @route="scopes.scope.auth-methods">
|
||||
{{t "resources.auth-methods"}}
|
||||
</nav.link>
|
||||
</Rose::Nav::Sidebar>
|
||||
|
||||
{{outlet "sidebar"}}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{{outlet}}
|
||||
@@ -0,0 +1,48 @@
|
||||
<Rose::Layout::Page as |page|>
|
||||
<page.header>
|
||||
<h2>{{t "resources.auth-methods"}}</h2>
|
||||
</page.header>
|
||||
|
||||
<page.body>
|
||||
{{#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 |authMethod|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
{{authMethod.name}}
|
||||
{{authMethod.description}}
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge @style="outline">
|
||||
{{authMethod.type}}
|
||||
</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>{{authMethod.id}}</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
|
||||
{{else}}
|
||||
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message @title={{t 'titles.auth-methods-welcome'}} as |message|>
|
||||
<message.description>
|
||||
{{t 'descriptions.auth-methods-welcome'}}
|
||||
</message.description>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
|
||||
{{/if}}
|
||||
</page.body>
|
||||
</Rose::Layout::Page>
|
||||
@@ -88,6 +88,22 @@ export default function() {
|
||||
this.patch('/scopes/:scope_id/host-catalogs/:id');
|
||||
this.del('/scopes/:scope_id/host-catalogs/:id');
|
||||
|
||||
// host
|
||||
|
||||
this.get('/scopes/:scope_id/host-catalogs/:host_catalog_id/hosts');
|
||||
this.post('/scopes/:scope_id/host-catalogs/:host_catalog_id/hosts');
|
||||
this.get('/scopes/:scope_id/host-catalogs/:host_catalog_id/hosts/:id');
|
||||
this.patch('/scopes/:scope_id/host-catalogs/:host_catalog_id/hosts/:id');
|
||||
this.del('/scopes/:scope_id/host-catalogs/:host_catalog_id/hosts/:id');
|
||||
|
||||
// host-set
|
||||
|
||||
this.get('/scopes/:scope_id/host-catalogs/:host_catalog_id/host-sets');
|
||||
this.post('/scopes/:scope_id/host-catalogs/:host_catalog_id/host-sets');
|
||||
this.get('/scopes/:scope_id/host-catalogs/:host_catalog_id/host-sets/:id');
|
||||
this.patch('/scopes/:scope_id/host-catalogs/:host_catalog_id/host-sets/:id');
|
||||
this.del('/scopes/:scope_id/host-catalogs/:host_catalog_id/host-sets/: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));
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import factory from '../generated/factories/host-set';
|
||||
|
||||
export default factory.extend();
|
||||
@@ -0,0 +1,3 @@
|
||||
import factory from '../generated/factories/host';
|
||||
|
||||
export default factory.extend();
|
||||
@@ -14,7 +14,7 @@ export default factory.extend({
|
||||
}, 'withChildren');
|
||||
}
|
||||
if (record.type === 'org') {
|
||||
server.createList('scope', 5, {
|
||||
server.createList('scope', 3, {
|
||||
type: 'project',
|
||||
scope: { id: record.id, type: record.type }
|
||||
});
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Factory } from 'ember-cli-mirage';
|
||||
import { random, date } from 'faker';
|
||||
|
||||
/**
|
||||
* GeneratedHostSetModelFactory
|
||||
*/
|
||||
export default Factory.extend({
|
||||
|
||||
type: 'static',
|
||||
name: () => random.words(),
|
||||
description: () => random.words(),
|
||||
created_time: () => date.recent(),
|
||||
updated_time: () => date.recent(),
|
||||
version: () => random.number(),
|
||||
size: () => random.number(),
|
||||
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Factory } from 'ember-cli-mirage';
|
||||
import { random, date, internet } from 'faker';
|
||||
|
||||
/**
|
||||
* GeneratedHostModelFactory
|
||||
*/
|
||||
export default Factory.extend({
|
||||
|
||||
type: 'static',
|
||||
name: () => random.words(),
|
||||
description: () => random.words(),
|
||||
created_time: () => date.recent(),
|
||||
updated_time: () => date.recent(),
|
||||
version: () => random.number(),
|
||||
address: () => internet.ipv6(),
|
||||
|
||||
});
|
||||
@@ -25,9 +25,13 @@ export default function(server) {
|
||||
|
||||
// Other resources
|
||||
|
||||
server.db.scopes.where({type: 'project'}).forEach(projectScope => {
|
||||
const scope = { id: projectScope.id, type: projectScope.type };
|
||||
server.db.scopes.where({type: 'project'}).forEach(({ id, type }) => {
|
||||
const scope = { id, type };
|
||||
server.createList('host-catalog', 2, { scope });
|
||||
// Hosts and host sets are supposed to be associated to a host catalog.
|
||||
// For simplicity of mocks, we don't actually associate them here.
|
||||
server.createList('host-set', 3, { scope });
|
||||
server.createList('host', 10, { scope });
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | scopes/scope/auth-methods', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/auth-methods');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | scopes/scope/auth-methods/index', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/auth-methods/index');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -36,6 +36,7 @@ resources:
|
||||
project: Project
|
||||
host-catalog: Host Catalog
|
||||
host-catalogs: Host Catalogs
|
||||
auth-methods: Auth Methods
|
||||
titles:
|
||||
iam: IAM
|
||||
new: New
|
||||
@@ -50,6 +51,7 @@ titles:
|
||||
users-welcome: Welcome to Users
|
||||
roles-welcome: Welcome to Roles
|
||||
groups-welcome: Welcome to Groups
|
||||
auth-methods-welcome: Welcome to Auth Methods
|
||||
grants: Permissions
|
||||
new-grant: New Grant
|
||||
principals: Principals
|
||||
@@ -61,6 +63,7 @@ descriptions:
|
||||
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.
|
||||
states:
|
||||
info: Info
|
||||
success: Success
|
||||
@@ -95,10 +98,3 @@ notify:
|
||||
create-success: Created succesfully.
|
||||
save-success: Saved succesfully.
|
||||
delete-success: Deleted successfully.
|
||||
dev:
|
||||
default-org: Default Scope
|
||||
menu-item: Menu item
|
||||
button-menu-item: Button menu item
|
||||
section: Section
|
||||
title: Title
|
||||
item-name: Item Name
|
||||
Reference in new issue
Block a user