Files
threshold-ui/ui/admin/app/templates/scopes/scope/roles/role/principals.hbs
T
Dharini Jeeva f3dbd7cdab Add links to role principals with ability (#1545)
chore: 🤖 add links to role/principals
2022-12-22 14:41:00 -08:00

117 lines
3.8 KiB
Handlebars

{{page-title (t 'resources.role.principal.title_plural')}}
<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.principal.description'}}</p>
<Copyable
@text={{@model.role.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{@model.role.id}}</code>
</Copyable>
</page.header>
<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.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'resources.scope.title'}}</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>
{{#if (can 'readPrincipal role' principal)}}
<LinkToPrincipal @model={{principal}} />
{{else}}
{{principal.displayName}}
{{/if}}
{{#if principal.accountName}}
<br /><Hds::Badge @text={{principal.accountName}} />
{{/if}}
</row.headerCell>
<row.cell>
<Copyable
@text={{principal.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{principal.id}}</code>
</Copyable>
</row.cell>
<row.cell>
<PrincipalTypeBadge @model={{principal}} />
</row.cell>
<row.cell>
<ScopeBadge @scope={{principal.scopeModel}} />
</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)}}
>
{{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>