Files
threshold-ui/ui/admin/app/templates/scopes/scope/sessions/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

166 lines
5.3 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<Breadcrumbs::Container />
</page.breadcrumbs>
<page.header>
<Hds::Text::Display @tag='h2' @size='400' @weight='bold'>
{{t 'resources.session.title_plural'}}
<DocLink @doc='session' />
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @size='300' class='p'>
{{t 'resources.session.description'}}
</Hds::Text::Body>
</page.header>
<page.body class='search-filtering'>
{{#if @model.allSessions}}
<div class='search-filtering-toolbar'>
<Hds::SegmentedGroup data-test-sessions-bar as |S|>
<S.TextInput
@value={{this.search}}
@type='search'
placeholder={{t 'actions.search'}}
aria-label={{t 'actions.search'}}
{{on 'input' this.handleSearchInput}}
/>
{{#if @model.associatedUsers}}
<S.Generic>
<Dropdown
name='user'
@toggleText={{t 'resources.user.title'}}
@itemOptions={{@model.associatedUsers}}
@checkedItems={{this.users}}
@applyFilter={{fn this.applyFilter 'users'}}
@isSearchable={{true}}
as |FD selectItem itemOptions|
>
{{#each itemOptions as |itemOption|}}
<FD.Checkbox
@value={{itemOption.id}}
checked={{includes itemOption.id this.users}}
{{on 'change' selectItem}}
>
{{itemOption.name}}
</FD.Checkbox>
{{/each}}
</Dropdown>
</S.Generic>
{{/if}}
{{#if @model.associatedTargets}}
<S.Generic>
<Dropdown
name='target'
@toggleText={{t 'resources.target.title'}}
@itemOptions={{@model.associatedTargets}}
@checkedItems={{this.targets}}
@applyFilter={{fn this.applyFilter 'targets'}}
@isSearchable={{true}}
/>
</S.Generic>
{{/if}}
<S.Generic>
<Dropdown
name='status'
@toggleText={{t 'form.status.label'}}
@itemOptions={{this.sessionStatusOptions}}
@checkedItems={{this.status}}
@applyFilter={{fn this.applyFilter 'status'}}
/>
</S.Generic>
</Hds::SegmentedGroup>
<ToolbarRefresher @onClick={{this.refresh}} />
</div>
<FilterTags @filters={{this.filters}} />
{{#if @model.sessions}}
<Hds::Table
@columns={{array
(hash label=(t 'form.id.label'))
(hash label=(t 'resources.user.title'))
(hash label=(t 'resources.target.title'))
(hash label=(t 'form.started.label'))
(hash key='status' label=(t 'form.status.label') isSortable=true)
(hash label=(t 'titles.actions'))
}}
@sortBy='status'
@model={{@model.sessions}}
@density='short'
@valign='middle'
>
<:body as |B|>
<B.Tr data-test-sessions-table-row={{B.data.id}}>
<B.Td>
<Hds::Copy::Snippet
data-test-session={{B.data.id}}
@textToCopy={{B.data.id}}
@color='secondary'
/>
</B.Td>
<B.Td>
{{B.data.user.displayName}}
</B.Td>
<B.Td>
{{B.data.target.displayName}}
</B.Td>
<B.Td>
<time datetime={{format-date-iso B.data.created_time}}>
{{format-date-iso-human B.data.created_time}}
</time>
</B.Td>
<B.Td>
<SessionStatus @model={{B.data}} />
</B.Td>
<B.Td>
{{#if (can 'cancel session' B.data)}}
<Hds::Button
@color='secondary'
@text={{t 'actions.cancel'}}
{{on 'click' (fn this.cancelSession B.data)}}
/>
{{/if}}
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
<Rose::Pagination
@totalItems={{@model.totalItems}}
@currentPage={{this.page}}
@currentPageSize={{this.pageSize}}
/>
{{else}}
<Hds::ApplicationState data-test-no-session-results 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.session.title_plural')
}}
/>
</Hds::ApplicationState>
{{/if}}
{{else}}
<Hds::ApplicationState data-test-no-sessions as |A|>
<A.Header
@title={{t 'resources.session.messages.none-friendly.title'}}
/>
<A.Body
@text={{t 'resources.session.messages.none-friendly.description'}}
/>
</Hds::ApplicationState>
{{/if}}
</page.body>
</Rose::Layout::Page>