* refactor: 💡 Adopt HDS copy snippet
Adopt HDS copy snippet and delete usage of Copyable custom component
within Admin UI.
186 lines
5.9 KiB
Handlebars
186 lines
5.9 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.worker.title_plural'}}
|
|
<DocLink @doc='worker' @iconSize='large' />
|
|
</h2>
|
|
</page.header>
|
|
|
|
<page.actions>
|
|
{{#if (can 'create worker led worker' this.scope collection='workers')}}
|
|
{{#if @model}}
|
|
<Rose::LinkButton @route='scopes.scope.workers.new' @style='primary'>{{t
|
|
'titles.new'
|
|
}}</Rose::LinkButton>
|
|
{{/if}}
|
|
{{/if}}
|
|
</page.actions>
|
|
|
|
<page.body>
|
|
{{#if @model}}
|
|
<Rose::Toolbar as |toolbar|>
|
|
<toolbar.primary>
|
|
<Rose::Form as |form|>
|
|
{{#let
|
|
(resource-filter 'scopes.scope.workers.index' 'tags')
|
|
as |filter|
|
|
}}
|
|
{{#if filter.allowedValues}}
|
|
<Rose::Dropdown
|
|
@text={{t (concat 'form.' filter.name '.label')}}
|
|
@count={{filter.selectedValue.length}}
|
|
@ignoreClickInside={{true}}
|
|
as |dropdown|
|
|
>
|
|
{{#each-in
|
|
(group-by 'key' filter.allowedValues)
|
|
as |key tags|
|
|
}}
|
|
<dropdown.section
|
|
@title={{key}}
|
|
@icon='flight-icons/svg/tag-16'
|
|
/>
|
|
<form.checkboxGroup
|
|
@name={{key}}
|
|
@items={{tags}}
|
|
@selectedItems={{filter.selectedValue}}
|
|
@onChange={{route-action 'filterBy' filter.name}}
|
|
@itemEqualityFunc={{route-action 'isEqual'}}
|
|
as |group|
|
|
>
|
|
<dropdown.item class='indent-label-1'>
|
|
<group.checkbox
|
|
@label={{group.item.value}}
|
|
value={{group.item}}
|
|
/>
|
|
</dropdown.item>
|
|
</form.checkboxGroup>
|
|
{{/each-in}}
|
|
</Rose::Dropdown>
|
|
{{/if}}
|
|
{{/let}}
|
|
{{#if
|
|
(has-resource-filter-selections
|
|
'scopes.scope.workers.index' 'tags'
|
|
)
|
|
}}
|
|
<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 'refresh'}} />
|
|
</toolbar.secondary>
|
|
|
|
</Rose::Toolbar>
|
|
|
|
<Hds::Table
|
|
class='workers-list-table'
|
|
@model={{@model}}
|
|
@columns={{array
|
|
(hash label=(t 'resources.worker.title'))
|
|
(hash label=(t 'form.tags.label'))
|
|
(hash label=(t 'resources.session.title_plural'))
|
|
(hash label=(t 'resources.worker.table.release_version'))
|
|
(hash label=(t 'resources.worker.table.ip_address'))
|
|
(hash label=(t 'form.id.label'))
|
|
}}
|
|
@density='short'
|
|
@valign='middle'
|
|
>
|
|
<:body as |B|>
|
|
<B.Tr>
|
|
<B.Td>
|
|
{{#if (and (can 'read worker' B.data) B.data.isPki)}}
|
|
<LinkTo
|
|
@route='scopes.scope.workers.worker'
|
|
@model={{B.data.id}}
|
|
>
|
|
{{B.data.displayName}}
|
|
</LinkTo>
|
|
{{else}}
|
|
{{B.data.displayName}}
|
|
{{/if}}
|
|
{{#if B.data.description}}
|
|
<p>{{B.data.description}}</p>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>
|
|
{{#if B.data.tagCount}}
|
|
<Hds::Badge
|
|
@icon='tag'
|
|
@text={{t
|
|
'resources.worker.table.tag_count'
|
|
tagCount=B.data.tagCount
|
|
}}
|
|
/>
|
|
{{/if}}
|
|
</B.Td>
|
|
<B.Td>{{B.data.active_connection_count}}</B.Td>
|
|
<B.Td>{{B.data.release_version}}</B.Td>
|
|
<B.Td>{{B.data.address}} </B.Td>
|
|
<B.Td>
|
|
<Hds::Copy::Snippet
|
|
@textToCopy={{B.data.id}}
|
|
@color='secondary'
|
|
/>
|
|
</B.Td>
|
|
</B.Tr>
|
|
</:body>
|
|
</Hds::Table>
|
|
{{else}}
|
|
<Rose::Layout::Centered>
|
|
<Rose::Message
|
|
@title={{t 'resources.worker.messages.welcome.title'}}
|
|
as |message|
|
|
>
|
|
<message.description>
|
|
{{#if (can 'list worker' this.scope collection='workers')}}
|
|
{{! can list (at least): show default welcome message}}
|
|
{{t 'resources.worker.description'}}
|
|
{{else if
|
|
(can 'create worker led worker' this.scope collection='workers')
|
|
}}
|
|
{{! can create (only): show create-but-not-list welcome message}}
|
|
{{t
|
|
'descriptions.create-but-not-list'
|
|
resource=(t 'resources.worker.title_plural')
|
|
}}
|
|
{{else}}
|
|
{{! can neither list nor create }}
|
|
{{t
|
|
'descriptions.neither-list-nor-create'
|
|
resource=(t 'resources.worker.title_plural')
|
|
}}
|
|
{{/if}}
|
|
</message.description>
|
|
{{#if
|
|
(can 'create worker led worker' this.scope collection='workers')
|
|
}}
|
|
<message.link @route='scopes.scope.workers.new'>
|
|
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
|
|
{{t 'titles.new'}}
|
|
</message.link>
|
|
{{/if}}
|
|
</Rose::Message>
|
|
</Rose::Layout::Centered>
|
|
{{/if}}
|
|
|
|
</page.body>
|
|
</Rose::Layout::Page> |