Add link to peers.edit to peerings list

This commit is contained in:
Michael Klein 2022-10-05 12:08:32 +02:00
parent e2ca73ecbe
commit ef83c0799f
1 changed files with 60 additions and 47 deletions

View File

@ -2,13 +2,21 @@
class="consul-peer-list"
...attributes
@items={{@items}}
as |item index|>
as |item index|
>
<BlockSlot @name="header">
<p
data-test-peer={{item.Name}}
>
{{item.Name}}
</p>
{{#if (can "delete peer" item=item)}}
<a
data-test-peer={{item.Name}}
href={{href-to "dc.peers.edit" item.Name}}
>
{{item.Name}}
</a>
{{else}}
<p data-test-peer={{item.Name}}>
{{item.Name}}
</p>
{{/if}}
</BlockSlot>
<BlockSlot @name="details">
<div class="peers__list__peer-detail">
@ -16,24 +24,22 @@ as |item index|>
<div
{{tooltip
(t 'routes.dc.peers.index.detail.imported.tooltip'
name=item.Name
)
(t "routes.dc.peers.index.detail.imported.tooltip" name=item.Name)
}}
>
{{t 'routes.dc.peers.index.detail.imported.count'
{{t
"routes.dc.peers.index.detail.imported.count"
count=(format-number item.ImportedServiceCount)
}}
</div>
<div
{{tooltip
(t 'routes.dc.peers.index.detail.exported.tooltip'
name=item.Name
)
(t "routes.dc.peers.index.detail.exported.tooltip" name=item.Name)
}}
>
{{t 'routes.dc.peers.index.detail.exported.count'
{{t
"routes.dc.peers.index.detail.exported.count"
count=(format-number item.ExportedServiceCount)
}}
</div>
@ -43,42 +49,49 @@ as |item index|>
<BlockSlot @name="actions" as |Actions|>
{{#if (can "delete peer" item=item)}}
<Actions as |Action|>
<Actions as |Action|>
{{#if (and (can "write peer" item=item) item.isDialer)}}
<Action data-test-regenerate-action {{on "click" (fn @onedit item)}}>
<BlockSlot @name="label">
Regenerate token
</BlockSlot>
</Action>
{{/if}}
<Action
data-test-edit-action
@href={{href-to "dc.peers.edit" item.Name}}
>
<BlockSlot @name="label">
Regenerate token
View
</BlockSlot>
</Action>
{{/if}}
<Action
data-test-delete-action
@onclick={{fn @ondelete item}}
class="dangerous"
>
<BlockSlot @name="label">
Delete
</BlockSlot>
<BlockSlot @name="confirmation" as |Confirmation|>
<Confirmation class="warning">
<BlockSlot @name="header">
Confirm delete
</BlockSlot>
<BlockSlot @name="body">
<p>
Are you sure you want to delete this peer?
</p>
</BlockSlot>
<BlockSlot @name="confirm" as |Confirm|>
<Confirm>
Delete
</Confirm>
</BlockSlot>
</Confirmation>
</BlockSlot>
</Action>
</Actions>
{{/if}}
<Action
data-test-delete-action
@onclick={{fn @ondelete item}}
class="dangerous"
>
<BlockSlot @name="label">
Delete
</BlockSlot>
<BlockSlot @name="confirmation" as |Confirmation|>
<Confirmation class="warning">
<BlockSlot @name="header">
Confirm delete
</BlockSlot>
<BlockSlot @name="body">
<p>
Are you sure you want to delete this peer?
</p>
</BlockSlot>
<BlockSlot @name="confirm" as |Confirm|>
<Confirm>
Delete
</Confirm>
</BlockSlot>
</Confirmation>
</BlockSlot>
</Action>
</Actions>
{{/if}}
</BlockSlot>
</ListCollection>
</ListCollection>