Merge branch 'develop' into chore-error-messages
This commit is contained in:
20 files changed
+199
-63
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import ApplicationAdapter from './application';
|
||||
import ScopeAdapterMixin from '../mixins/scope-adapter';
|
||||
|
||||
export default class AuthMethodAdapter extends ApplicationAdapter.extend(
|
||||
ScopeAdapterMixin
|
||||
) {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Auth method is scoped to org only.
|
||||
* @type {boolean}
|
||||
*/
|
||||
includeProject = false;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default class GeneratedOrganizationModel 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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default class GeneratedOrganizationModel extends BaseModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import GeneratedAuthMethodModel from '../generated/models/auth-method';
|
||||
|
||||
export default class AuthMethodModel extends GeneratedAuthMethodModel {}
|
||||
@@ -0,0 +1,3 @@
|
||||
import GeneratedOrganizationModel from '../generated/models/organization';
|
||||
|
||||
export default class OrganizationModel extends GeneratedOrganizationModel {}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/adapters/auth-method';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/auth-method';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/organization';
|
||||
@@ -0,0 +1,16 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import config from 'ember-get-config';
|
||||
|
||||
module('Unit | Adapter | auth method', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it generates URL prefixes without project scope', function (assert) {
|
||||
assert.expect(1);
|
||||
const service = this.owner.lookup('service:scope');
|
||||
service.org = { id: 1 };
|
||||
service.project = { id: 2 };
|
||||
const adapter = this.owner.lookup('adapter:auth-method');
|
||||
assert.equal(adapter.urlPrefix(), `${config.api.namespace}/orgs/1`);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | auth method', 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('auth-method', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | organization', 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('organization', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
@@ -1,14 +1,26 @@
|
||||
import Component from '@ember/component';
|
||||
import LinkComponent from '@ember/routing/link-component';
|
||||
import layout from '../../templates/components/rose/link-button';
|
||||
import { computed } from '@ember/object';
|
||||
|
||||
/**
|
||||
* An achor element based on `rose-button` component styles
|
||||
* An empty model cannot be passed in to `link-to` component when a route
|
||||
* is defined. Thus, `link-to` component is used to generate this component.
|
||||
*
|
||||
* @example
|
||||
* <Rose::LinkButton @submit={{true}} @style="primary">Save</Rose::LinkButton>
|
||||
* <Rose::LinkButton @disabled={{true}} @style="secondary">Disabled</Rose::LinkButton>
|
||||
*/
|
||||
export default Component.extend({
|
||||
export default LinkComponent.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
classNames: ['rose-link-button'],
|
||||
classNameBindings: [
|
||||
'linkButtonStyle',
|
||||
'iconOnly:has-icon-only',
|
||||
'iconLeft:has-icon-left',
|
||||
'iconRight:has-icon-right',
|
||||
],
|
||||
linkButtonStyle: computed(function () {
|
||||
return this.style ? `rose-button-${this.style}` : '';
|
||||
}),
|
||||
});
|
||||
@@ -12,7 +12,7 @@ Styles supported: primary, secondary, warning, and ghost.
|
||||
Disabling link button is not supported as it is an action on form components only.
|
||||
|
||||
```html
|
||||
<Rose::LinkButton @style="primary" @iconRight="chevron-right">
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconRight="chevron-right">
|
||||
Content
|
||||
</Rose::LinkButton>
|
||||
```
|
||||
@@ -21,6 +21,7 @@ Disabling link button is not supported as it is an action on form components onl
|
||||
<Story name="Advanced">{{
|
||||
template: hbs`
|
||||
<Rose::LinkButton
|
||||
@route="index"
|
||||
@style={{style}}
|
||||
@iconLeft={{iconLeft}}
|
||||
@iconRight={{iconRight}}
|
||||
@@ -67,13 +68,13 @@ Disabling link button is not supported as it is an action on form components onl
|
||||
Similar to `Rose::Button`, icon only link button is supported.
|
||||
|
||||
```html
|
||||
<Rose::LinkButton @style="primary" @iconOnly="help-circle-outline" />
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconOnly="help-circle-outline" />
|
||||
```
|
||||
|
||||
<Preview>
|
||||
<Story name="Icon Only">{{
|
||||
template: hbs`
|
||||
<Rose::LinkButton @style={{style}} @iconOnly={{iconOnly}} />
|
||||
<Rose::LinkButton @route="" @style={{style}} @iconOnly={{iconOnly}} />
|
||||
`,
|
||||
context: {
|
||||
style: select(
|
||||
|
||||
@@ -1,34 +1,26 @@
|
||||
<LinkTo
|
||||
...attributes
|
||||
@route={{@route}}
|
||||
@model={{@model}}
|
||||
class="rose-link-button {{if @style (concat "rose-button-" @style)}} {{if @iconLeft "has-icon-left"}} {{if @iconRight "has-icon-right"}} {{if @iconOnly "has-icon-only"}}"
|
||||
>
|
||||
<span class="rose-button-wrapper">
|
||||
{{#if @iconLeft}}
|
||||
<Rose::Icon
|
||||
@name={{@iconLeft}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<span class="rose-button-wrapper">
|
||||
{{#if @iconLeft}}
|
||||
<Rose::Icon
|
||||
@name={{@iconLeft}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<span class="rose-button-body">
|
||||
{{yield}}
|
||||
</span>
|
||||
|
||||
{{#if @iconOnly}}
|
||||
<Rose::Icon
|
||||
@name={{@iconOnly}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
{{#if @iconRight}}
|
||||
<Rose::Icon
|
||||
@name={{@iconRight}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
<span class="rose-button-body">
|
||||
{{yield}}
|
||||
</span>
|
||||
</LinkTo>
|
||||
|
||||
{{#if @iconOnly}}
|
||||
<Rose::Icon
|
||||
@name={{@iconOnly}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
{{#if @iconRight}}
|
||||
<Rose::Icon
|
||||
@name={{@iconRight}}
|
||||
@size="medium"
|
||||
/>
|
||||
{{/if}}
|
||||
</span>
|
||||
@@ -1,9 +1,9 @@
|
||||
<Rose::LinkButton @style="primary">Primary</Rose::LinkButton>
|
||||
<Rose::LinkButton @style="secondary">Secondary</Rose::LinkButton>
|
||||
<Rose::LinkButton @style="warning">Warning</Rose::LinkButton>
|
||||
<Rose::LinkButton @style="ghost">Ghost</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="primary">Primary</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="secondary">Secondary</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="warning">Warning</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="ghost">Ghost</Rose::LinkButton>
|
||||
<br />
|
||||
|
||||
<Rose::LinkButton @style="primary" @iconLeft="help-circle-outline">Left Icon</Rose::LinkButton>
|
||||
<Rose::LinkButton @style="primary" @iconRight="help-circle-outline">Right Icon</Rose::LinkButton>
|
||||
<Rose::LinkButton @style="primary" @iconOnly="help-circle-outline" />
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconLeft="help-circle-outline">Left Icon</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconRight="help-circle-outline">Right Icon</Rose::LinkButton>
|
||||
<Rose::LinkButton @route="index" @style="primary" @iconOnly="help-circle-outline" />
|
||||
@@ -7,19 +7,19 @@ module('Integration | Component | rose/link-button', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton />`);
|
||||
await render(hbs`<Rose::LinkButton @route="index" />`);
|
||||
assert.ok(find('a'));
|
||||
assert.notOk(find('.rose-button'));
|
||||
assert.ok(find('.rose-link-button'));
|
||||
});
|
||||
|
||||
test('it renders with attributes', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton id="link-button"/>`);
|
||||
await render(hbs`<Rose::LinkButton @route="index" id="link-button"/>`);
|
||||
assert.ok(find('#link-button'));
|
||||
});
|
||||
|
||||
test('it renders with content', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton>Link button content</Rose::LinkButton>`);
|
||||
await render(hbs`<Rose::LinkButton @route="index">Link button content</Rose::LinkButton>`);
|
||||
assert.ok(
|
||||
find('.rose-link-button').textContent.trim(),
|
||||
'Link button content'
|
||||
@@ -27,28 +27,24 @@ module('Integration | Component | rose/link-button', function (hooks) {
|
||||
});
|
||||
|
||||
test('it renders with rose button styles', async function (assert) {
|
||||
this.set('style', 'primary');
|
||||
await render(hbs`<Rose::LinkButton @style={{this.style}}/>`);
|
||||
assert.ok(find(`.rose-button-primary`));
|
||||
|
||||
this.set('style', 'sample');
|
||||
await render(hbs`<Rose::LinkButton @route="index" @style="sample"/>`);
|
||||
assert.ok(find(`.rose-button-sample`));
|
||||
});
|
||||
|
||||
test('it supports left icon with @iconLeft', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton @iconLeft="chevron-left" />`);
|
||||
await render(hbs`<Rose::LinkButton @route="index" @iconLeft="chevron-left" />`);
|
||||
assert.ok(find('.rose-icon'));
|
||||
assert.ok(find('.has-icon-left'));
|
||||
});
|
||||
|
||||
test('it supports left icon with @iconRight', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton @iconRight="chevron-right" />`);
|
||||
await render(hbs`<Rose::LinkButton @route="index" @iconRight="chevron-right" />`);
|
||||
assert.ok(find('.rose-icon'));
|
||||
assert.ok(find('.has-icon-right'));
|
||||
});
|
||||
|
||||
test('it supports only icon with @iconOnly', async function (assert) {
|
||||
await render(hbs`<Rose::LinkButton @iconOnly="help-circle-outline" />`);
|
||||
await render(hbs`<Rose::LinkButton @route="index" @iconOnly="help-circle-outline" />`);
|
||||
assert.ok(find('.rose-icon'));
|
||||
assert.ok(find('.has-icon-only'));
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</page.header>
|
||||
|
||||
<page.actions>
|
||||
<LinkTo @route="orgs.org.projects.new">{{t 'titles.new'}}</LinkTo>
|
||||
<Rose::LinkButton @route="orgs.org.projects.new" @style="primary">{{t 'titles.new'}}</Rose::LinkButton>
|
||||
</page.actions>
|
||||
|
||||
<page.body>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
@submit={{route-action "save" @model}}
|
||||
@cancel={{route-action "cancel" @model}}
|
||||
/>
|
||||
|
||||
<Rose::Separator />
|
||||
<Rose::Button
|
||||
@style="warning"
|
||||
@disabled={{@model.canSave}}
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
</page.header>
|
||||
|
||||
<page.actions>
|
||||
<LinkTo
|
||||
@route="orgs.org.projects.project.host-catalogs.new"
|
||||
>
|
||||
<Rose::LinkButton @route="orgs.org.projects.project.host-catalogs.new" @style="primary">
|
||||
{{t 'titles.new'}}
|
||||
</LinkTo>
|
||||
</Rose::LinkButton>
|
||||
</page.actions>
|
||||
|
||||
<page.body>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
@submit={{route-action "save" @model}}
|
||||
@cancel={{route-action "cancel" @model}}
|
||||
/>
|
||||
|
||||
<Rose::Separator />
|
||||
<Rose::Button
|
||||
@style="warning"
|
||||
@disabled={{@model.canSave}}
|
||||
|
||||
Reference in new issue
Block a user