Merge pull request #916 from hashicorp/refactor-roles-render-template
Remove renderTemplate usage from roles resource
This commit is contained in:
15 files changed
+201
-223
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -16,28 +16,4 @@ export default class ScopesScopeRolesRoleRoute extends Route {
|
||||
adapterOptions: { scopeID },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the role specific templates for header, navigation,
|
||||
* and actions page sections.
|
||||
* @override
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/roles/role/-header', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'header',
|
||||
});
|
||||
|
||||
this.render('scopes/scope/roles/role/-navigation', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'navigation',
|
||||
});
|
||||
|
||||
this.render('scopes/scope/roles/role/-actions', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'actions',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -28,30 +28,6 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the add-principals-specific header template.
|
||||
* Empties the actions and navigation outlets and renders a custom empty header.
|
||||
* @override
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/roles/role/add-principals/-header', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'header',
|
||||
});
|
||||
|
||||
this.render('-empty', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'navigation',
|
||||
});
|
||||
|
||||
this.render('-empty', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'actions',
|
||||
});
|
||||
}
|
||||
|
||||
// =actions
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,22 +10,6 @@ export default class ScopesScopeRolesRoleGrantsRoute extends Route {
|
||||
@service intl;
|
||||
@service notify;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Renders the grants-specific header template.
|
||||
* Empties the actions and navigation outlets and renders a custom empty header.
|
||||
* @override
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/roles/role/grants/-header', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'header',
|
||||
});
|
||||
}
|
||||
|
||||
// =actions
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,20 +45,6 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the principals-specific header template.
|
||||
* Empties the actions and navigation outlets and renders a custom empty header.
|
||||
* @override
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
|
||||
this.render('scopes/scope/roles/role/principals/-header', {
|
||||
into: 'scopes/scope/roles/role',
|
||||
outlet: 'header',
|
||||
});
|
||||
}
|
||||
|
||||
// =actions
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.actions>
|
||||
{{outlet 'actions'}}
|
||||
</page.actions>
|
||||
|
||||
<page.navigation>
|
||||
{{outlet 'navigation'}}
|
||||
</page.navigation>
|
||||
|
||||
<page.body>
|
||||
{{outlet}}
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
{{outlet}}
|
||||
@@ -1,9 +1,27 @@
|
||||
{{page-title (t 'resources.role.principal.actions.add-principals')}}
|
||||
|
||||
<Form::Role::AddPrincipals
|
||||
@model={{@model.role}}
|
||||
@users={{@model.users}}
|
||||
@groups={{@model.groups}}
|
||||
@submit={{route-action 'addPrincipals' @model.role}}
|
||||
@cancel={{route-action 'cancel'}}
|
||||
/>
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<page.breadcrumbs>
|
||||
<BreadCrumbs />
|
||||
</page.breadcrumbs>
|
||||
|
||||
<page.header>
|
||||
<h2>
|
||||
{{t 'resources.role.principal.messages.add-principals.title'}}
|
||||
<DocLink @doc='role.add-principals' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.principal.messages.add-principals.description'}}</p>
|
||||
</page.header>
|
||||
|
||||
<page.body>
|
||||
<Form::Role::AddPrincipals
|
||||
@model={{@model.role}}
|
||||
@users={{@model.users}}
|
||||
@groups={{@model.groups}}
|
||||
@submit={{route-action 'addPrincipals' @model.role}}
|
||||
@cancel={{route-action 'cancel'}}
|
||||
/>
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -1,5 +0,0 @@
|
||||
<h2>
|
||||
{{t 'resources.role.principal.messages.add-principals.title'}}
|
||||
<DocLink @doc='role.add-principals' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.principal.messages.add-principals.description'}}</p>
|
||||
@@ -1,9 +1,42 @@
|
||||
{{page-title (t 'resources.role.grant.title_plural')}}
|
||||
|
||||
<Form::Role::Grants
|
||||
@model={{@model}}
|
||||
@submit={{route-action 'save' @model}}
|
||||
@cancel={{route-action 'cancel' @model}}
|
||||
@addGrant={{route-action 'addGrant' @model}}
|
||||
@removeGrant={{route-action 'removeGrant' @model}}
|
||||
/>
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<page.breadcrumbs>
|
||||
<BreadCrumbs />
|
||||
</page.breadcrumbs>
|
||||
|
||||
<page.header>
|
||||
<h2>
|
||||
{{t 'resources.role.title'}}
|
||||
<DocLink @doc='role' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.grant.description'}}</p>
|
||||
<Copyable
|
||||
@text={{@model.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{@model.id}}</code>
|
||||
</Copyable>
|
||||
</page.header>
|
||||
|
||||
<page.actions>
|
||||
<Roles::Role::Actions @model={{@model}} />
|
||||
</page.actions>
|
||||
|
||||
<page.navigation>
|
||||
<Roles::Role::Nav @model={{@model}} />
|
||||
</page.navigation>
|
||||
|
||||
<page.body>
|
||||
<Form::Role::Grants
|
||||
@model={{@model}}
|
||||
@submit={{route-action 'save' @model}}
|
||||
@cancel={{route-action 'cancel' @model}}
|
||||
@addGrant={{route-action 'addGrant' @model}}
|
||||
@removeGrant={{route-action 'removeGrant' @model}}
|
||||
/>
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -1,12 +0,0 @@
|
||||
<h2>
|
||||
{{t 'resources.role.title'}}
|
||||
<DocLink @doc='role' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.grant.description'}}</p>
|
||||
<Copyable
|
||||
@text={{@model.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{@model.id}}</code>
|
||||
</Copyable>
|
||||
@@ -1,6 +1,28 @@
|
||||
<Form::Role
|
||||
@model={{@model}}
|
||||
@grantScopes={{this.grantScopes}}
|
||||
@submit={{route-action 'save' @model}}
|
||||
@cancel={{route-action 'cancel' @model}}
|
||||
/>
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<page.breadcrumbs>
|
||||
<BreadCrumbs />
|
||||
</page.breadcrumbs>
|
||||
|
||||
<page.header>
|
||||
<Roles::Role::Header @model={{@model}} />
|
||||
</page.header>
|
||||
|
||||
<page.actions>
|
||||
<Roles::Role::Actions @model={{@model}} />
|
||||
</page.actions>
|
||||
|
||||
<page.navigation>
|
||||
<Roles::Role::Nav @model={{@model}} />
|
||||
</page.navigation>
|
||||
|
||||
<page.body>
|
||||
<Form::Role
|
||||
@model={{@model}}
|
||||
@grantScopes={{this.grantScopes}}
|
||||
@submit={{route-action 'save' @model}}
|
||||
@cancel={{route-action 'cancel' @model}}
|
||||
/>
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -1,79 +1,113 @@
|
||||
{{page-title (t 'resources.role.principal.title_plural')}}
|
||||
|
||||
{{#if @model.principals}}
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model.principals as |principal|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{principal.model.displayName}}
|
||||
{{#if principal.model.accountName}}
|
||||
<br /><Rose::Badge>{{principal.model.accountName}}</Rose::Badge>
|
||||
{{/if}}
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
{{t (concat 'resources.role.principal.types.' principal.type)}}
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{principal.model.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{principal.model.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
{{#if (can 'removePrincipals role' @model.role)}}
|
||||
<Rose::Dropdown
|
||||
@icon='flight-icons/svg/more-horizontal-16'
|
||||
@iconOnly={{true}}
|
||||
@showCaret={{false}}
|
||||
@dropdownRight={{true}}
|
||||
@text='{{t 'actions.manage'}}'
|
||||
as |dropdown|
|
||||
>
|
||||
<dropdown.button
|
||||
@style='danger'
|
||||
{{on
|
||||
'click'
|
||||
(route-action 'removePrincipal' principal.model)
|
||||
}}
|
||||
>
|
||||
{{t 'actions.remove'}}
|
||||
</dropdown.button>
|
||||
</Rose::Dropdown>
|
||||
{{/if}}
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
<page.breadcrumbs>
|
||||
<BreadCrumbs />
|
||||
</page.breadcrumbs>
|
||||
|
||||
{{else}}
|
||||
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message
|
||||
@title={{t 'resources.role.principal.messages.welcome.title'}}
|
||||
as |message|
|
||||
<page.header>
|
||||
<h2>
|
||||
{{t 'resources.role.title'}}
|
||||
<DocLink @doc='role' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.principal.description'}}</p>
|
||||
<Copyable
|
||||
@text={{@model.role.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<message.description>
|
||||
{{t 'resources.role.principal.messages.welcome.description'}}
|
||||
</message.description>
|
||||
<message.link @route='scopes.scope.roles.role.add-principals'>
|
||||
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
|
||||
{{t 'resources.role.principal.actions.add-principals'}}
|
||||
</message.link>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
<code>{{@model.role.id}}</code>
|
||||
</Copyable>
|
||||
</page.header>
|
||||
|
||||
{{/if}}
|
||||
<page.actions>
|
||||
<Roles::Role::Actions @model={{@model.role}} />
|
||||
</page.actions>
|
||||
|
||||
<page.navigation>
|
||||
<Roles::Role::Nav @model={{@model.role}} />
|
||||
</page.navigation>
|
||||
|
||||
<page.body>
|
||||
{{#if @model.principals}}
|
||||
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model.principals as |principal|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{principal.model.displayName}}
|
||||
{{#if principal.model.accountName}}
|
||||
<br /><Rose::Badge
|
||||
>{{principal.model.accountName}}</Rose::Badge>
|
||||
{{/if}}
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
{{t (concat 'resources.role.principal.types.' principal.type)}}
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{principal.model.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{principal.model.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
{{#if (can 'removePrincipals role' @model.role)}}
|
||||
<Rose::Dropdown
|
||||
@icon='flight-icons/svg/more-horizontal-16'
|
||||
@iconOnly={{true}}
|
||||
@showCaret={{false}}
|
||||
@dropdownRight={{true}}
|
||||
@text='{{t 'actions.manage'}}'
|
||||
as |dropdown|
|
||||
>
|
||||
<dropdown.button
|
||||
@style='danger'
|
||||
{{on
|
||||
'click'
|
||||
(route-action 'removePrincipal' principal.model)
|
||||
}}
|
||||
>
|
||||
{{t 'actions.remove'}}
|
||||
</dropdown.button>
|
||||
</Rose::Dropdown>
|
||||
{{/if}}
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
|
||||
{{else}}
|
||||
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message
|
||||
@title={{t 'resources.role.principal.messages.welcome.title'}}
|
||||
as |message|
|
||||
>
|
||||
<message.description>
|
||||
{{t 'resources.role.principal.messages.welcome.description'}}
|
||||
</message.description>
|
||||
<message.link @route='scopes.scope.roles.role.add-principals'>
|
||||
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
|
||||
{{t 'resources.role.principal.actions.add-principals'}}
|
||||
</message.link>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
|
||||
{{/if}}
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -1,12 +0,0 @@
|
||||
<h2>
|
||||
{{t 'resources.role.title'}}
|
||||
<DocLink @doc='role' @iconSize='large' />
|
||||
</h2>
|
||||
<p>{{t 'resources.role.principal.description'}}</p>
|
||||
<Copyable
|
||||
@text={{@model.role.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{@model.role.id}}</code>
|
||||
</Copyable>
|
||||
Reference in new issue
Block a user