refactor: 💡 replace renderTemplate with components

This commit is contained in:
Randall Morey committed 2022-01-14 16:56:59 -05:00
1 parent 0d1dfb23b2
commit cd30e05e2e
35 files changed
+576 -542

No files matched your search

+2
View File
@@ -61,6 +61,8 @@ export default class AuthMethodModel extends GeneratedAuthMethodModel {
*/
@equal('is_primary', true) isPrimary;
options = options;
/**
* @type {boolean}
*/
+3 -2
View File
@@ -536,9 +536,10 @@ export default function () {
return managedGroups.where({ authMethodId });
}
);
this.get('/managed-groups/:id');
this.del('/managed-groups/:id');
this.post('/managed-groups');
this.get('/managed-groups/:id');
this.patch('/managed-groups/:id');
this.del('/managed-groups/:id');
/* Uncomment the following line and the Response import above
* Then change the response code to simulate error responses.
@@ -21,7 +21,7 @@
@changed={{route-action 'changeState'}}
as |radioGroup|
>
{{#each this.oidcStates as |state|}}
{{#each @model.options.oidc.state as |state|}}
<dropdown.item>
<radioGroup.radio
@label={{t (concat 'states.' state)}}
@@ -7,7 +7,7 @@
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
{{on 'click' (route-action 'delete' @model)}}
{{on 'click' (route-action 'deleteManagedGroup' @model)}}
>
{{t 'resources.managed-group.actions.delete'}}
</dropdown.button>
@@ -1,5 +1,4 @@
import Controller from '@ember/controller';
import { options } from 'api/models/auth-method';
export default class ScopesScopeAuthMethodsAuthMethodController extends Controller {
// =attributes
@@ -11,12 +10,4 @@ export default class ScopesScopeAuthMethodsAuthMethodController extends Controll
get breadCrumb() {
return this.model.displayName;
}
/**
* OIDC auth-method states
* @type {[string]}
*/
get oidcStates() {
return options.oidc.state;
}
}
@@ -15,30 +15,6 @@ export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route {
return this.store.findRecord('auth-method', auth_method_id);
}
/**
* Renders the auth-method specific templates for header, navigation,
* and actions page sections.
* @override
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/auth-methods/auth-method/-header', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
});
this.render('scopes/scope/auth-methods/auth-method/-navigation', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
});
this.render('scopes/scope/auth-methods/auth-method/-actions', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
});
}
// =actions
/**
@@ -19,16 +19,23 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
* Returns accounts for the current auth method.
* @return {Promise{[AccountModel]}}
*/
model() {
async model() {
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
const { id: auth_method_id } = authMethod;
let accounts;
if (
this.can.can('list collection', authMethod, {
collection: 'accounts',
})
) {
return this.store.query('account', { auth_method_id });
accounts = await this.store.query('account', { auth_method_id });
}
return {
authMethod,
accounts,
};
}
// =actions
@@ -12,36 +12,4 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountRoute extend
model({ account_id }) {
return this.store.findRecord('account', account_id, { reload: true });
}
/**
* Renders the route-set specific page sections
* @override
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-actions',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
}
);
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-navigation',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
}
);
}
}
@@ -1,10 +1,2 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountIndexRoute extends Route {
// setupController(controller) {
// const authMethod = this.modelFor(
// 'scopes.scope.auth-methods.auth-method'
// );
// super.setupController(...arguments);
// controller.setProperties({ authMethod });
// }
}
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountIndexRoute extends Route {}
@@ -11,23 +11,6 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
@service notify;
@service router;
// =methods
/**
* Renders the route-set specific page sections
* @override
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/set-password/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
}
// =actions
/**
@@ -16,27 +16,4 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Ro
auth_method_id,
});
}
/**
* Renders new account templates for header, navigation, and action page sections.
* @override
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/auth-methods/auth-method/accounts/new/-header', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
});
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
});
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
});
}
}
@@ -19,16 +19,24 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
*
* @returns {Promise{[ManagedGroupsModel]}}
*/
model() {
async model() {
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
const { id: auth_method_id } = authMethod;
const canListManagedGroups = this.can.can('list collection', authMethod, {
collection: 'managed-groups',
});
let managedGroups;
if (canListManagedGroups) {
return this.store.query('managed-group', { auth_method_id });
managedGroups = await this.store.query('managed-group', {
auth_method_id,
});
}
return {
authMethod,
managedGroups,
};
}
// =actions
@@ -81,7 +89,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
@confirm('questions.delete-confirm')
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.delete-success')
async delete(managedGroup) {
async deleteManagedGroup(managedGroup) {
await managedGroup.destroyRecord();
await this.router.replaceWith(
'scopes.scope.auth-methods.auth-method.managed-groups'
@@ -14,36 +14,4 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsManagedGroupRo
reload: true,
});
}
/**
* Render the route-set specific page sections
* @override
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/auth-methods/auth-method/managed-groups/managed-group/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
this.render(
'scopes/scope/auth-methods/auth-method/managed-groups/managed-group/-actions',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
}
);
this.render(
'scopes/scope/auth-methods/auth-method/managed-groups/managed-group/-navigation',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
}
);
}
}
@@ -12,15 +12,19 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsManagedGroupMe
* Returns the previously loaded managed group instances memebrs.
* @return {Promise{[AccountModel]}}
*/
model() {
const { auth_method_id, member_ids } = this.modelFor(
async model() {
const managedGroup = this.modelFor(
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
);
const { auth_method_id, member_ids } = managedGroup;
return this.resourceFilterStore.queryBy(
'account',
{ id: member_ids },
{ auth_method_id }
);
return {
managedGroup,
members: await this.resourceFilterStore.queryBy(
'account',
{ id: member_ids },
{ auth_method_id }
),
};
}
}
@@ -11,26 +11,4 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsNewRoute exten
auth_method_id,
});
}
renderTemplate() {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/auth-methods/auth-method/managed-groups/new/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
});
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
});
}
}
@@ -1,25 +1,3 @@
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
{{outlet 'header'}}
</page.header>
<page.navigation>
{{outlet 'navigation'}}
</page.navigation>
<page.actions>
{{outlet 'actions'}}
</page.actions>
<page.body>
{{outlet}}
</page.body>
</Rose::Layout::Page>
{{outlet}}
@@ -1,5 +1,28 @@
<Form::Account
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<AuthMethods::AuthMethod::Accounts::Account::Header @model={{@model}} />
</page.header>
<page.navigation>
<AuthMethods::AuthMethod::Accounts::Account::Nav @model={{@model}} />
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::Accounts::Account::Actions @model={{@model}} />
</page.actions>
<page.body>
<Form::Account
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,7 +1,37 @@
{{page-title (t 'actions.set-password')}}
<Form::Account::Password::SetPassword
@model={{@model}}
@submit={{route-action 'setPassword' @model}}
@cancel={{route-action 'cancel' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t 'resources.account.title'}}</h2>
<p>{{t 'resources.account.messages.set-password.description'}}</p>
<Copyable
@text={{@model.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.id}}</code>
</Copyable>
</page.header>
<page.navigation>
<AuthMethods::AuthMethod::Accounts::Account::Nav @model={{@model}} />
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::Accounts::Account::Actions @model={{@model}} />
</page.actions>
<page.body>
<Form::Account::Password::SetPassword
@model={{@model}}
@submit={{route-action 'setPassword' @model}}
@cancel={{route-action 'cancel' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,9 +0,0 @@
<h2>{{t 'resources.account.title'}}</h2>
<p>{{t 'resources.account.messages.set-password.description'}}</p>
<Copyable
@text={{@model.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.id}}</code>
</Copyable>
@@ -1,149 +1,175 @@
{{#if @model}}
{{! OIDC accounts display more fields }}
{{#if @model.firstObject.isOIDC}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |account|}}
<body.row as |row|>
<row.headerCell scope='row'>
{{#if (can 'read model' account)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.accounts.account'
@model={{account.id}}
>
{{account.accountName}}
</LinkTo>
{{else}}
{{account.accountName}}
{{/if}}
<p>{{account.description}}</p>
</row.headerCell>
<row.cell>
<code>{{account.attributes.issuer}}</code>
</row.cell>
<row.cell>
<code>{{account.attributes.subject}}</code>
</row.cell>
<row.cell>
<code>{{account.attributes.email}}</code>
</row.cell>
<row.cell>
{{account.attributes.full_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{account.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{account.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{account.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.login_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |account|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' account)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.accounts.account'
@model={{account.id}}
>
{{account.accountName}}
</LinkTo>
{{else}}
{{account.accountName}}
{{/if}}
<p>{{account.description}}</p>
</row.headerCell>
<row.cell>
{{account.attributes.login_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{account.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{account.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{account.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{/if}}
{{else}}
<Rose::Layout::Page as |page|>
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.account.messages.welcome.title'}}
as |message|
>
<message.description>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
{{#if (can 'list collection' this.authMethod collection='accounts')}}
{{! can list (at least): show default welcome message}}
{{t 'resources.account.description'}}
<page.header>
<AuthMethods::AuthMethod::Header @model={{@model.authMethod}} />
</page.header>
{{else if (can
'create collection' this.authMethod collection='accounts'
)}}
{{! can create (only): show create-but-not-list welcome message}}
{{t
'descriptions.create-but-not-list'
resource=(t 'resources.account.title_plural')
}}
{{else}}
{{! can neither list nor create }}
{{t
'descriptions.neither-list-nor-create'
resource=(t 'resources.account.title_plural')
}}
{{/if}}
<page.navigation>
<AuthMethods::AuthMethod::Nav @model={{@model.authMethod}} />
</page.navigation>
</message.description>
<page.actions>
<AuthMethods::AuthMethod::Actions @model={{@model.authMethod}} />
</page.actions>
{{#if (can 'create collection' this.authMethod collection='accounts')}}
<message.link
@route='scopes.scope.auth-methods.auth-method.accounts.new'
>
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
{{t 'resources.account.actions.create'}}
</message.link>
<page.body>
{{#if @model.accounts}}
{{! OIDC accounts display more fields }}
{{#if @model.accounts.firstObject.isOIDC}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.accounts as |account|}}
<body.row as |row|>
<row.headerCell scope='row'>
{{#if (can 'read model' account)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.accounts.account'
@model={{account.id}}
>
{{account.accountName}}
</LinkTo>
{{else}}
{{account.accountName}}
{{/if}}
<p>{{account.description}}</p>
</row.headerCell>
<row.cell>
<code>{{account.attributes.issuer}}</code>
</row.cell>
<row.cell>
<code>{{account.attributes.subject}}</code>
</row.cell>
<row.cell>
<code>{{account.attributes.email}}</code>
</row.cell>
<row.cell>
{{account.attributes.full_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{account.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{account.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{account.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.login_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.accounts as |account|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' account)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.accounts.account'
@model={{account.id}}
>
{{account.accountName}}
</LinkTo>
{{else}}
{{account.accountName}}
{{/if}}
<p>{{account.description}}</p>
</row.headerCell>
<row.cell>
{{account.attributes.login_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{account.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{account.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{account.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{/if}}
</Rose::Message>
</Rose::Layout::Centered>
{{else}}
{{/if}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.account.messages.welcome.title'}}
as |message|
>
<message.description>
{{#if
(can 'list collection' this.authMethod collection='accounts')
}}
{{! can list (at least): show default welcome message}}
{{t 'resources.account.description'}}
{{else if (can
'create collection' this.authMethod collection='accounts'
)}}
{{! can create (only): show create-but-not-list welcome message}}
{{t
'descriptions.create-but-not-list'
resource=(t 'resources.account.title_plural')
}}
{{else}}
{{! can neither list nor create }}
{{t
'descriptions.neither-list-nor-create'
resource=(t 'resources.account.title_plural')
}}
{{/if}}
</message.description>
{{#if
(can 'create collection' this.authMethod collection='accounts')
}}
<message.link
@route='scopes.scope.auth-methods.auth-method.accounts.new'
>
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
{{t 'resources.account.actions.create'}}
</message.link>
{{/if}}
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>
@@ -1,5 +1,23 @@
<Form::Account
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>
{{t 'titles.new'}}
<DocLink @doc='account.new' @iconSize='large' />
</h2>
</page.header>
<page.body>
<Form::Account
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,4 +0,0 @@
<h2>
{{t 'titles.new'}}
<DocLink @doc='account.new' @iconSize='large' />
</h2>
@@ -1,8 +1,30 @@
<Form::AuthMethod
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
@removeItemByIndex={{route-action 'removeItemByIndex' @model}}
@addStringItem={{route-action 'addStringItem' @model}}
@addAccountClaimMapItem={{route-action 'addAccountClaimMapItem' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<AuthMethods::AuthMethod::Header @model={{@model}} />
</page.header>
<page.navigation>
<AuthMethods::AuthMethod::Nav @model={{@model}} />
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::Actions @model={{@model}} />
</page.actions>
<page.body>
<Form::AuthMethod
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
@removeItemByIndex={{route-action 'removeItemByIndex' @model}}
@addStringItem={{route-action 'addStringItem' @model}}
@addAccountClaimMapItem={{route-action 'addAccountClaimMapItem' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,86 +1,112 @@
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.description.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<Rose::Layout::Page as |page|>
<table.body as |body|>
{{#each @model as |managed-group|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' managed-group)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
@model={{managed-group.id}}
>
{{managed-group.displayName}}
</LinkTo>
{{else}}
{{managed-group.displayName}}
{{/if}}
</row.headerCell>
<row.cell>{{managed-group.description}}</row.cell>
<row.cell>
<Rose::Badge>{{managed-group.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{managed-group.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{managed-group.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.managed-group.messages.welcome.title'}}
as |message|
>
<message.description>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
{{#if
(can 'list collection' this.authMethod collection='managed-groups')
}}
{{! Can list (at least): show default welcome message }}
{{t 'resources.managed-group.description'}}
{{else if (can
'create collection' this.authMethod collection='managed-groups'
)}}
{{! Can create only: show create but not list welcome message }}
{{t
'descriptions.create-but-not-list'
resource=(t 'resources.managed-group.title_plural')
}}
{{else}}
{{! Can neither list nor create }}
{{t
'descriptions.neither-list-nor-create'
resource=(t 'resources.managed-group.title_plural')
}}
{{/if}}
</message.description>
<page.header>
<AuthMethods::AuthMethod::Header @model={{@model.authMethod}} />
</page.header>
{{#if
(can 'create collection' this.authMethod collection='managed-groups')
}}
<message.link
@route='scopes.scope.auth-methods.auth-method.managed-groups.new'
<page.navigation>
<AuthMethods::AuthMethod::Nav @model={{@model.authMethod}} />
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::Actions @model={{@model.authMethod}} />
</page.actions>
<page.body>
{{#if @model.managedGroups}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.description.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.managedGroups as |managed-group|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' managed-group)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
@model={{managed-group.id}}
>
{{managed-group.displayName}}
</LinkTo>
{{else}}
{{managed-group.displayName}}
{{/if}}
</row.headerCell>
<row.cell>{{managed-group.description}}</row.cell>
<row.cell>
<Rose::Badge>{{managed-group.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{managed-group.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{managed-group.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.managed-group.messages.welcome.title'}}
as |message|
>
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
{{t 'resources.managed-group.actions.create'}}
</message.link>
{{/if}}
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
<message.description>
{{#if
(can
'list collection' this.authMethod collection='managed-groups'
)
}}
{{! Can list (at least): show default welcome message }}
{{t 'resources.managed-group.description'}}
{{else if (can
'create collection' this.authMethod collection='managed-groups'
)}}
{{! Can create only: show create but not list welcome message }}
{{t
'descriptions.create-but-not-list'
resource=(t 'resources.managed-group.title_plural')
}}
{{else}}
{{! Can neither list nor create }}
{{t
'descriptions.neither-list-nor-create'
resource=(t 'resources.managed-group.title_plural')
}}
{{/if}}
</message.description>
{{#if
(can
'create collection' this.authMethod collection='managed-groups'
)
}}
<message.link
@route='scopes.scope.auth-methods.auth-method.managed-groups.new'
>
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
{{t 'resources.managed-group.actions.create'}}
</message.link>
{{/if}}
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>
@@ -1,5 +1,33 @@
<Form::ManagedGroup
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Header
@model={{@model}}
/>
</page.header>
<page.navigation>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Nav
@model={{@model}}
/>
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Actions
@model={{@model}}
/>
</page.actions>
<page.body>
<Form::ManagedGroup
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,62 +1,90 @@
{{page-title (t 'resources.managed-group.member.title_plural')}}
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |member|}}
<body.row as |row|>
<row.headerCell scope='row'>
{{member.accountName}}
<p>{{member.description}}</p>
</row.headerCell>
<row.cell>
<code>{{member.attributes.issuer}}</code>
</row.cell>
<row.cell>
<code>{{member.attributes.subject}}</code>
</row.cell>
<row.cell>
<code>{{member.attributes.email}}</code>
</row.cell>
<row.cell>
{{member.attributes.full_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{member.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{member.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{member.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.managed-group.member.messages.title'}}
as |message|
>
<message.description>
{{t 'resources.managed-group.member.messages.description'}}
</message.description>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Header
@model={{@model.managedGroup}}
/>
</page.header>
<page.navigation>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Nav
@model={{@model.managedGroup}}
/>
</page.navigation>
<page.actions>
<AuthMethods::AuthMethod::ManagedGroups::ManagedGroup::Actions
@model={{@model.managedGroup}}
/>
</page.actions>
<page.body>
{{#if @model.members}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.members as |member|}}
<body.row as |row|>
<row.headerCell scope='row'>
{{member.accountName}}
<p>{{member.description}}</p>
</row.headerCell>
<row.cell>
<code>{{member.attributes.issuer}}</code>
</row.cell>
<row.cell>
<code>{{member.attributes.subject}}</code>
</row.cell>
<row.cell>
<code>{{member.attributes.email}}</code>
</row.cell>
<row.cell>
{{member.attributes.full_name}}
</row.cell>
<row.cell>
<Rose::Badge>{{member.type}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{member.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{member.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.managed-group.member.messages.title'}}
as |message|
>
<message.description>
{{t 'resources.managed-group.member.messages.description'}}
</message.description>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>
@@ -1,5 +1,23 @@
<Form::ManagedGroup
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>
{{t 'titles.new'}}
{{! TODO: change the icon link }}
<DocLink @doc='account.new' @iconSize='large' />
</h2>
</page.header>
<page.body>
<Form::ManagedGroup
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
/>
</page.body>
</Rose::Layout::Page>
@@ -1,5 +0,0 @@
<h2>
{{t 'titles.new'}}
{{! TODO: change the icon link }}
<DocLink @doc='account.new' @iconSize='large' />
</h2>