Files
threshold-ui/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs
T

182 lines
6.1 KiB
Handlebars

<Rose::Layout::Page as |page|>
<page.header>
<h2>
{{t 'resources.auth-method.title_plural'}}
<DocLink @doc='auth-method' @iconSize='large' />
</h2>
<p>{{t 'resources.auth-method.description'}}</p>
</page.header>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.actions>
{{#if @model}}
<Rose::Dropdown
@text={{t 'titles.new'}}
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.link
@route='scopes.scope.auth-methods.new'
@query={{hash type='password'}}
>
{{t 'resources.auth-method.types.password'}}
</dropdown.link>
<dropdown.link
@route='scopes.scope.auth-methods.new'
@query={{hash type='oidc'}}
>
{{t 'resources.auth-method.types.oidc'}}
</dropdown.link>
</Rose::Dropdown>
{{/if}}
</page.actions>
<page.body>
{{#if @model}}
{{#if (feature-flag 'primary-auth-method')}}
{{#unless this.hasPrimaryAuthMethod}}
<Rose::Notification
@style='warning'
@heading={{t
'resources.auth-method.messages.no-primary-auth-method.title'
}}
>
{{t
'resources.auth-method.messages.no-primary-auth-method.description'
}}
</Rose::Notification>
{{/unless}}
{{/if}}
<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>
{{#if (feature-flag 'primary-auth-method')}}
<row.cell />
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
{{/if}}
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |authMethod|}}
<body.row as |row|>
<row.headerCell>
{{!
Show link to auth method route if non-OIDC and when
oidc-crud feature is enabled, otherwise show just the name
(when the method is OIDC and oidc-crud is disabled)
}}
{{#if authMethod.isOIDC}}
{{#if (feature-flag 'oidc-crud')}}
{{#if (can 'read model' authMethod)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method'
@model={{authMethod.id}}
>
{{authMethod.displayName}}
</LinkTo>
{{else}}
{{authMethod.displayName}}
{{/if}}
{{/if}}
{{else}}
{{#if (can 'read model' authMethod)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method'
@model={{authMethod.id}}
>
{{authMethod.displayName}}
</LinkTo>
{{else}}
{{authMethod.displayName}}
{{/if}}
{{/if}}
<p>{{authMethod.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge>
{{t (concat 'resources.auth-method.types.' authMethod.type)}}
</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{authMethod.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{authMethod.id}}</code>
</Copyable>
</row.cell>
{{#if (feature-flag 'primary-auth-method')}}
<row.cell>
{{#if authMethod.isPrimary}}
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
{{/if}}
</row.cell>
<row.cell>
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
@iconOnly={{true}}
@showCaret={{false}}
@icon='flight-icons/more-horizontal-16'
as |dropdown|
>
{{#unless authMethod.isPrimary}}
<dropdown.button
{{on 'click' (route-action 'makePrimary' authMethod)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/unless}}
{{#if authMethod.isPrimary}}
<dropdown.button
{{on
'click'
(route-action 'removeAsPrimary' authMethod)
}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{/if}}
</Rose::Dropdown>
</row.cell>
{{/if}}
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.auth-method.messages.welcome.title'}}
as |message|
>
<message.description>
{{t 'resources.auth-method.messages.welcome.description'}}
</message.description>
<message.link
@route='scopes.scope.auth-methods.new'
@query={{hash type='password'}}
>
<Rose::Icon @name='flight-icons/plus-circle-16' />
{{t 'titles.new'}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>