* refactor: 💡 Adopt HDS copy snippet
Adopt HDS copy snippet and delete usage of Copyable custom component
within Admin UI.
150 lines
4.5 KiB
Handlebars
150 lines
4.5 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: MPL-2.0
|
|
}}
|
|
|
|
<Rose::Layout::Page as |page|>
|
|
|
|
<page.breadcrumbs>
|
|
<Breadcrumbs::Container />
|
|
</page.breadcrumbs>
|
|
|
|
<page.header>
|
|
<h2>
|
|
{{t 'resources.session.title_plural'}}
|
|
<DocLink @doc='session' @iconSize='large' />
|
|
</h2>
|
|
<p>{{t 'resources.session.description'}}</p>
|
|
</page.header>
|
|
|
|
<page.body>
|
|
<Rose::Toolbar as |toolbar|>
|
|
<toolbar.primary>
|
|
<Rose::Form as |form|>
|
|
{{#let
|
|
(resource-filter 'scopes.scope.sessions' 'status')
|
|
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.session.status.' group.item)}}
|
|
value={{group.item}}
|
|
/>
|
|
</dropdown.item>
|
|
</form.checkboxGroup>
|
|
</Rose::Dropdown>
|
|
{{/let}}
|
|
|
|
{{#if
|
|
(has-resource-filter-selections 'scopes.scope.sessions' 'status')
|
|
}}
|
|
<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>
|
|
</toolbar.primary>
|
|
|
|
<toolbar.secondary>
|
|
<ToolbarRefresher @onClick={{route-action 'refreshSessions'}} />
|
|
</toolbar.secondary>
|
|
|
|
</Rose::Toolbar>
|
|
|
|
{{#if @model}}
|
|
|
|
<Hds::Table
|
|
@model={{@model}}
|
|
class='sessions-list-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 label=(t 'form.status.label'))
|
|
(hash label=(t 'titles.actions'))
|
|
}}
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr>
|
|
<B.Td>
|
|
<Rose::Icon
|
|
class={{concat 'session-status-' B.data.session.status}}
|
|
@name='flight-icons/svg/entry-point-16'
|
|
@size='medium'
|
|
/>
|
|
<Hds::Copy::Snippet
|
|
@textToCopy={{B.data.session.id}}
|
|
@color='secondary'
|
|
/>
|
|
</B.Td>
|
|
<B.Td>
|
|
<Hds::Text::Code>{{B.data.user.id}}</Hds::Text::Code>
|
|
{{#if B.data.user.accountName}}
|
|
<br />
|
|
<Hds::Badge @text={{B.data.user.accountName}} />
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>{{B.data.target.displayName}}</B.Td>
|
|
<B.Td>
|
|
<time datetime={{format-date-iso B.data.session.created_time}}>
|
|
{{format-date-iso-human B.data.session.created_time}}
|
|
</time>
|
|
</B.Td>
|
|
<B.Td>
|
|
<SessionStatus @model={{B.data.session}} />
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if (can 'cancel session' B.data.session)}}
|
|
<Hds::Button
|
|
@color='secondary'
|
|
@text={{t 'actions.cancel'}}
|
|
{{on 'click' (route-action 'cancelSession' B.data.session)}}
|
|
/>
|
|
{{/if}}
|
|
</B.Td>
|
|
</B.Tr>
|
|
</:body>
|
|
</Hds::Table>
|
|
|
|
{{else if
|
|
(has-resource-filter-selections 'scopes.scope.sessions' 'status')
|
|
}}
|
|
<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.session.messages.none.title'}}
|
|
as |message|
|
|
>
|
|
<message.description>
|
|
{{t 'resources.session.messages.none.description'}}
|
|
</message.description>
|
|
</Rose::Message>
|
|
</Rose::Layout::Centered>
|
|
{{/if}}
|
|
</page.body>
|
|
</Rose::Layout::Page> |