233 lines
7.1 KiB
Handlebars
233 lines
7.1 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: MPL-2.0
|
|
}}
|
|
|
|
<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 model' 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 @model}}
|
|
{{#unless this.hasPrimaryAuthMethod}}
|
|
<Hds::Alert
|
|
class='auth-methods-list-alert'
|
|
@type='inline'
|
|
@color='warning'
|
|
as |A|
|
|
>
|
|
<A.Title>
|
|
{{t 'resources.auth-method.messages.no-primary-auth-method.title'}}
|
|
</A.Title>
|
|
<A.Description>
|
|
{{t
|
|
'resources.auth-method.messages.no-primary-auth-method.description'
|
|
}}
|
|
</A.Description>
|
|
</Hds::Alert>
|
|
{{/unless}}
|
|
{{/if}}
|
|
{{#if
|
|
(or
|
|
@model
|
|
(has-resource-filter-selections 'scopes.scope.auth-methods' 'type')
|
|
)
|
|
}}
|
|
<Rose::Toolbar>
|
|
<Rose::Form as |form|>
|
|
{{#let
|
|
(resource-filter '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>
|
|
{{/let}}
|
|
|
|
{{#if
|
|
(has-resource-filter-selections 'scopes.scope.auth-methods' 'type')
|
|
}}
|
|
<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}}
|
|
<Hds::Table
|
|
class='auth-methods-list-table'
|
|
@model={{@model}}
|
|
@columns={{array
|
|
(hash label=(t 'form.name.label'))
|
|
(hash label=(t 'form.type.label'))
|
|
(hash label=(t 'form.id.label'))
|
|
(hash label='')
|
|
(hash label=(t 'titles.actions'))
|
|
}}
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr>
|
|
<B.Td>
|
|
{{#if (can 'read auth-method' B.data)}}
|
|
<LinkTo
|
|
@route='scopes.scope.auth-methods.auth-method'
|
|
@model={{B.data.id}}
|
|
>
|
|
{{B.data.displayName}}
|
|
</LinkTo>
|
|
{{else}}
|
|
{{B.data.displayName}}
|
|
{{/if}}
|
|
<p>{{B.data.description}}</p>
|
|
</B.Td>
|
|
<B.Td>
|
|
<Hds::Badge
|
|
@text={{t (concat 'resources.auth-method.types.' B.data.type)}}
|
|
/>
|
|
</B.Td>
|
|
<B.Td>
|
|
<Copyable
|
|
@text={{B.data.id}}
|
|
@buttonText={{t 'actions.copy-to-clipboard'}}
|
|
@acknowledgeText={{t 'states.copied'}}
|
|
>
|
|
<code>{{B.data.id}}</code>
|
|
</Copyable>
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if B.data.isPrimary}}
|
|
<Hds::Badge @text={{t 'states.primary'}} @color='success' />
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if (can 'makePrimary auth-method' B.data)}}
|
|
<Hds::Dropdown as |dd|>
|
|
<dd.ToggleIcon
|
|
@icon='more-horizontal'
|
|
@text={{t 'actions.manage'}}
|
|
@hasChevron={{false}}
|
|
/>
|
|
{{#unless B.data.isPrimary}}
|
|
<dd.Interactive
|
|
@text={{t 'resources.auth-method.actions.make-primary'}}
|
|
{{on 'click' (route-action 'makePrimary' B.data)}}
|
|
/>
|
|
{{/unless}}
|
|
{{#if B.data.isPrimary}}
|
|
<dd.Interactive
|
|
@text={{t
|
|
'resources.auth-method.actions.remove-as-primary'
|
|
}}
|
|
{{on 'click' (route-action 'removeAsPrimary' B.data)}}
|
|
/>
|
|
{{/if}}
|
|
</Hds::Dropdown>
|
|
{{/if}}
|
|
</B.Td>
|
|
</B.Tr>
|
|
</:body>
|
|
</Hds::Table>
|
|
|
|
{{else if (has-resource-filter-selections
|
|
'scopes.scope.auth-methods' 'type'
|
|
)}}
|
|
|
|
<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 model' this.scopeModel collection='auth-methods')}}
|
|
{{! can list (at least): show default welcome message}}
|
|
{{t 'resources.auth-method.messages.welcome.description'}}
|
|
{{else if (can
|
|
'create model' 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> |