Files
threshold-ui/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs
T
Cameron Perera eb9fe573b8 Icu 11937 foundation components retire rose typography styles (#2810)
* refactor: 💡 update _typography stylesheet

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update header margin styles into single rule

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 add remove-header-margin class

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 remove 'header' class

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* test: 💍 fix failing tests for branded-card in desktop

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update style rule to use :where()

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 rename remove-header-margin to remove-margin

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937

* refactor: 💡 update style comment

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11937
2025-05-15 14:48:27 -05:00

202 lines
6.6 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Rose::Layout::Page as |page|>
<page.header>
<Hds::Text::Display @tag='h2' @size='400' @weight='bold'>
{{t 'resources.auth-method.title_plural'}}
<DocLink @doc='auth-method' />
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @size='300' class='p'>
{{t 'resources.auth-method.description'}}
</Hds::Text::Body>
</page.header>
<page.breadcrumbs>
<Breadcrumbs::Container />
</page.breadcrumbs>
<page.actions>
{{#if (can 'create model' this.scopeModel collection='auth-methods')}}
<Hds::Dropdown data-test-new-dropdown as |dd|>
<dd.ToggleButton @text={{t 'titles.new'}} @color='secondary' />
<dd.Interactive
@route='scopes.scope.auth-methods.new'
@query={{hash type='password'}}
>{{t 'resources.auth-method.types.password'}}</dd.Interactive>
<dd.Interactive
@route='scopes.scope.auth-methods.new'
@query={{hash type='oidc'}}
>{{t 'resources.auth-method.types.oidc'}}</dd.Interactive>
{{#if (feature-flag 'ldap-auth-methods')}}
<dd.Interactive
@route='scopes.scope.auth-methods.new'
@query={{hash type='ldap'}}
>
{{t 'resources.auth-method.types.ldap'}}
</dd.Interactive>
{{/if}}
</Hds::Dropdown>
{{/if}}
</page.actions>
<page.body class='search-filtering'>
{{#if @model.doAuthMethodsExist}}
{{#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}}
<Hds::SegmentedGroup as |S|>
<S.TextInput
@value={{this.search}}
@type='search'
placeholder={{t 'actions.search'}}
aria-label={{t 'actions.search'}}
{{on 'input' this.handleSearchInput}}
/>
<S.Generic>
<Dropdown
name='type'
@toggleText={{t 'form.type.label'}}
@itemOptions={{this.authMethodTypeOptions}}
@checkedItems={{this.types}}
@applyFilter={{fn this.applyFilter 'types'}}
/>
</S.Generic>
<S.Generic>
<Dropdown
name='primary'
@toggleText={{t 'resources.auth-method.titles.primary'}}
@itemOptions={{this.primaryOptions}}
@checkedItems={{this.primary}}
@applyFilter={{fn this.applyFilter 'primary'}}
/>
</S.Generic>
</Hds::SegmentedGroup>
<FilterTags @filters={{this.filters}} />
{{#if @model.authMethods}}
<Hds::Table
class='auth-methods-list-table'
@model={{@model.authMethods}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
(hash
label=(t 'resources.auth-method.titles.primary')
isVisuallyHidden=true
)
(hash label=(t 'titles.actions'))
}}
@density='short'
@valign='middle'
>
<:body as |B|>
<B.Tr data-test-auth-methods-table-row={{B.data.id}}>
<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}}
<Hds::Text::Body @tag='p' class='p'>
{{B.data.description}}
</Hds::Text::Body>
</B.Td>
<B.Td>
<Hds::Badge
@text={{t
(concat 'resources.auth-method.types.' B.data.type)
}}
/>
</B.Td>
<B.Td>
<Hds::Copy::Snippet
@textToCopy={{B.data.id}}
@color='secondary'
/>
</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
{{on 'click' (fn this.makePrimary B.data)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dd.Interactive>
{{/unless}}
{{#if B.data.isPrimary}}
<dd.Interactive
{{on 'click' (fn this.removeAsPrimary B.data)}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dd.Interactive>
{{/if}}
</Hds::Dropdown>
{{/if}}
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
<Rose::Pagination
@totalItems={{@model.totalItems}}
@currentPage={{this.page}}
@currentPageSize={{this.pageSize}}
/>
{{else}}
<Hds::ApplicationState as |A|>
<A.Header @title={{t 'titles.no-results-found'}} />
<A.Body
@text={{t
(if
this.search
'descriptions.no-search-results'
'descriptions.no-filter-results'
)
query=this.search
resource=(t 'resources.auth-method.title_plural')
}}
/>
</Hds::ApplicationState>
{{/if}}
{{else}}
<Hds::ApplicationState as |A|>
<A.Header @title={{t 'resources.auth-method.messages.welcome.title'}} />
<A.Body @text={{this.messageDescription}} />
</Hds::ApplicationState>
{{/if}}
</page.body>
</Rose::Layout::Page>