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

256 lines
8.6 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 (can 'create collection' this.scopeModel collection='auth-methods')}}
<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
(or
@model
(has-resource-filter-param-selections 'scopes.scope.auth-methods')
)
}}
<Rose::Toolbar>
<Rose::Form as |form|>
{{#with
(resource-filter-param 'scopes.scope.auth-methods' 'type')
as |filter|
}}
<Rose::Dropdown
@text={{t (concat 'form.' filter.name '.label')}}
@count={{filter.selectedValue.length}}
@ignoreClickInside={{true}}
as |dropdown|
>
<form.checkboxGroup
@name={{filter.name}}
@items={{filter.allowedValues}}
@selectedItems={{filter.selectedValue}}
@onChange={{route-action 'filterBy' filter.name}}
as |group|
>
<dropdown.item>
<group.checkbox
@label={{t
(concat 'resources.auth-method.types.' group.item)
}}
value={{group.item}}
/>
</dropdown.item>
</form.checkboxGroup>
</Rose::Dropdown>
{{/with}}
{{#if
(has-resource-filter-param-selections 'scopes.scope.auth-methods')
}}
<Rose::Button
@style='inline-link-action'
@iconLeft='flight-icons/svg/x-16'
{{on 'click' (route-action 'clearAllFilters')}}
>{{t 'actions.clear-all-filters'}}</Rose::Button>
{{/if}}
</Rose::Form>
</Rose::Toolbar>
{{/if}}
{{#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/svg/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 if (has-resource-filter-param-selections
'scopes.scope.auth-methods'
)}}
<Rose::Layout::Centered>
<Rose::Message @title={{t 'titles.no-results'}} as |message|>
<message.description>
{{t 'descriptions.no-results'}}
</message.description>
</Rose::Message>
</Rose::Layout::Centered>
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.auth-method.messages.welcome.title'}}
as |message|
>
<message.description>
{{#if
(can 'list collection' this.scopeModel collection='auth-methods')
}}
{{! can list (at least): show default welcome message}}
{{t 'resources.auth-method.messages.welcome.description'}}
{{else if (can
'create collection' this.scopeModel collection='auth-methods'
)}}
{{! can create (only): show create-but-not-list welcome message}}
{{t
'descriptions.create-but-not-list'
resource=(t 'resources.auth-method.title_plural')
}}
{{else}}
{{! can neither list nor create }}
{{t
'descriptions.neither-list-nor-create'
resource=(t 'resources.auth-method.title_plural')
}}
{{/if}}
</message.description>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>