consul/ui/packages/consul-lock-sessions/app/templates/dc/nodes/show/sessions.hbs

125 lines
3.3 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Route
@name={{routeName}}
as |route|>
<DataLoader @src={{uri '/${partition}/${nspace}/${dc}/sessions/for-node/${node}'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
node=route.params.name
)
}} as |api|>
<BlockSlot @name="error">
<AppError
@error={{api.error}}
@login={{route.model.app.login.open}}
/>
</BlockSlot>
<BlockSlot @name="loaded">
{{#let api.data as |items|}}
<div class="tab-section">
<DataWriter
@sink={{uri '/${partition}/${dc}/${nspace}/session/'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
)
}}
@type="session"
@label="Lock Session"
@ondelete={{refresh-route}}
as |writer|>
<BlockSlot @name="removed" as |after|>
<Consul::LockSession::Notifications
{{notification
after=(action after)
}}
@type="remove"
/>
</BlockSlot>
<BlockSlot @name="error" as |after error|>
<Consul::LockSession::Notifications
{{notification
after=(action after)
}}
@type="remove"
@error={{error}}
/>
</BlockSlot>
<BlockSlot @name="content">
<DataCollection
@type="session"
@items={{items}}
as |collection|>
<collection.Collection>
<Consul::LockSession::List
@items={{collection.items}}
@ondelete={{writer.delete}}
/>
</collection.Collection>
<collection.Empty>
<EmptyState
@login={{route.model.app.login.open}}
>
<BlockSlot @name="header">
<h2>
{{t 'routes.dc.nodes.show.sessions.empty.header'
items=items.length
}}
</h2>
</BlockSlot>
<BlockSlot @name="body">
{{t 'routes.dc.nodes.show.sessions.empty.body'
canUseACLs=(can "use acls")
htmlSafe=true
}}
</BlockSlot>
<BlockSlot @name="actions">
<li>
<Hds::Link::Standalone
@text='Documentation on Lock Sessions'
@href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html"
@icon='docs-link'
@iconPosition='trailing'
@size='small'
/>
</li>
<li>
<Hds::Link::Standalone
@text='Take the tutorial'
@href='{{env 'CONSUL_DOCS_LEARN_URL'}}/tutorials/consul/distributed-semaphore'
@icon='learn-link'
@iconPosition='trailing'
@size='small'
/>
</li>
</BlockSlot>
</EmptyState>
</collection.Empty>
</DataCollection>
</BlockSlot>
</DataWriter>
</div>
{{/let}}
</BlockSlot>
</DataLoader>
</Route>