174 lines
5.8 KiB
Handlebars
174 lines
5.8 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: MPL-2.0
|
|
}}
|
|
|
|
{{#if (or @model.sessions @model.allSessions)}}
|
|
{{#if @model.isClientDaemonRunning}}
|
|
<div class='search-filtering-toolbar'>
|
|
<Hds::SegmentedGroup as |S|>
|
|
<S.Generic>
|
|
<Dropdown
|
|
@name={{t 'resources.target.title'}}
|
|
@itemOptions={{this.availableTargets}}
|
|
@checkedItems={{this.targets}}
|
|
@applyFilter={{fn this.applyFilter 'targets'}}
|
|
@isSearchable={{true}}
|
|
@listPosition='bottom-left'
|
|
/>
|
|
</S.Generic>
|
|
<S.Generic>
|
|
<Dropdown
|
|
@name={{t 'form.status.label'}}
|
|
@itemOptions={{this.sessionStatusOptions}}
|
|
@checkedItems={{this.status}}
|
|
@applyFilter={{fn this.applyFilter 'status'}}
|
|
/>
|
|
</S.Generic>
|
|
<S.Generic>
|
|
<Dropdown
|
|
@name={{t 'resources.scope.title'}}
|
|
@itemOptions={{this.availableScopes}}
|
|
@checkedItems={{this.scopes}}
|
|
@applyFilter={{fn this.applyFilter 'scopes'}}
|
|
@isSearchable={{true}}
|
|
as |FD selectItem itemOptions|
|
|
>
|
|
{{#let (group-by itemOptions 'scopeModel') as |orgs|}}
|
|
{{#each orgs as |org|}}
|
|
<FD.Generic>
|
|
<FlightIcon @name='org' />
|
|
{{org.key.displayName}}
|
|
</FD.Generic>
|
|
{{#each org.items as |project|}}
|
|
<FD.Checkbox
|
|
@value={{project.id}}
|
|
checked={{includes project.id this.scopes}}
|
|
{{on 'change' selectItem}}
|
|
>
|
|
{{project.displayName}}
|
|
</FD.Checkbox>
|
|
{{/each}}
|
|
{{/each}}
|
|
{{/let}}
|
|
</Dropdown>
|
|
</S.Generic>
|
|
</Hds::SegmentedGroup>
|
|
<span>
|
|
<ToolbarRefresher @onClick={{route-action 'refreshAll'}} />
|
|
</span>
|
|
</div>
|
|
|
|
<FilterTags @filters={{this.filters}} />
|
|
{{/if}}
|
|
{{#if @model.sessions}}
|
|
<Hds::Table
|
|
@model={{this.sortedSessions}}
|
|
@columns={{array
|
|
(hash label=(t 'form.id.label'))
|
|
(hash label=(t 'resources.target.title'))
|
|
(hash label=(t 'form.proxy_url.label'))
|
|
(hash label=(t 'form.started.label'))
|
|
(hash label=(t 'form.status.label'))
|
|
(hash label='')
|
|
}}
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr>
|
|
<B.Td>
|
|
{{#if B.data.isAvailable}}
|
|
<Copyable
|
|
@text={{B.data.id}}
|
|
@buttonText={{t 'actions.copy-to-clipboard'}}
|
|
@acknowledgeText={{t 'states.copied'}}
|
|
>
|
|
<LinkTo
|
|
@route='scopes.scope.projects.sessions.session.index'
|
|
@model={{B.data.id}}
|
|
data-test-session-detail-link={{B.data.id}}
|
|
>
|
|
<Hds::Text::Code>{{B.data.id}}</Hds::Text::Code>
|
|
</LinkTo>
|
|
</Copyable>
|
|
{{else}}
|
|
<Copyable
|
|
@text={{B.data.id}}
|
|
@buttonText={{t 'actions.copy-to-clipboard'}}
|
|
@acknowledgeText={{t 'states.copied'}}
|
|
>
|
|
<Hds::Text::Code
|
|
data-test-session-id-copy={{B.data.id}}
|
|
>{{B.data.id}}</Hds::Text::Code>
|
|
</Copyable>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
{{B.data.target.displayName}}
|
|
</B.Td>
|
|
{{!
|
|
Two if's here because:
|
|
1) Local proxy info is only relevant if the session is
|
|
active or pending (aka isAvailable). Once the session
|
|
is canceled or in the process thereof, the local proxy
|
|
may no longer be used.
|
|
2) The session actually has proxy information associated
|
|
with it. It's possible for the user to start sessions
|
|
from other devices (or even another tab), in which case we
|
|
won't have the local proxy info available here.
|
|
}}
|
|
<B.Td>
|
|
{{#if B.data.isAvailable}}
|
|
{{#if B.data.proxy}}
|
|
<Copyable
|
|
@text={{B.data.proxy}}
|
|
@buttonText={{t 'actions.copy-to-clipboard'}}
|
|
@acknowledgeText={{t 'states.copied'}}
|
|
>
|
|
<Hds::Text::Code>{{B.data.proxy}}</Hds::Text::Code>
|
|
</Copyable>
|
|
{{/if}}
|
|
{{/if}}
|
|
</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
|
|
@text={{t 'actions.cancel'}}
|
|
@color='secondary'
|
|
{{on 'click' (route-action 'cancelSession' B.data)}}
|
|
data-test-session-cancel-button={{B.data.id}}
|
|
/>
|
|
{{/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 'descriptions.no-filter-results' resource='sessions'}}
|
|
/>
|
|
</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}} |