2022-07-26 14:36:49 +00:00
<Route
@name= {{ routeName }}
as |route|>
2022-07-04 10:31:58 +00:00
<DataLoader
@src= {{
uri '/$ { partition}/$ { nspace}/$ { dc}/peers'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
)}}
as |loader|>
<BlockSlot @name="error">
<AppError
@error= {{ loader .error }}
@login= {{ route .model .app .login .open }}
/>
</BlockSlot>
<BlockSlot @name="loaded">
{{ # let
(hash
2022-07-07 17:23:26 +00:00
value=(or sortBy "State:asc")
2022-07-04 10:31:58 +00:00
change=(action (mut sortBy) value="target.selected")
)
(hash
2022-07-07 17:23:26 +00:00
state=(hash
value=(if state (split state ',') undefined)
change=(action (mut state) value="target.selectedItems")
)
2022-07-04 10:31:58 +00:00
searchproperty=(hash
value=(if (not-eq searchproperty undefined)
(split searchproperty ',')
searchProperties
)
change=(action (mut searchproperty) value="target.selectedItems")
default=searchProperties
)
)
loader.data
as |sort filters items|}}
2022-06-23 13:16:26 +00:00
<AppView>
<BlockSlot @name="header">
<h1>
2022-07-26 14:36:49 +00:00
<route.Title
@title="Peers"
/>
2022-06-23 13:16:26 +00:00
</h1>
</BlockSlot>
<BlockSlot @name="toolbar">
2022-07-26 14:36:49 +00:00
2022-07-04 10:31:58 +00:00
{{ # if ( gt items .length 0 ) }}
<Consul::Peer::SearchBar
@search= {{ search }}
@onsearch= {{ action ( mut search ) value = "target.value" }}
@sort= {{ sort }}
@filter= {{ filters }}
/>
{{ / if }}
2022-07-26 14:36:49 +00:00
</BlockSlot>
<BlockSlot @name="actions">
<ModalDialog
@aria= {{ hash
label="Add peer connection"
}}
2022-09-29 16:38:41 +00:00
class="peer-create-modal"
2022-07-26 14:36:49 +00:00
as |modal|>
<BlockSlot @name="header">
{{ did-insert ( set this 'create' modal ) }}
<h2>
Add peer connection
</h2>
</BlockSlot>
<BlockSlot @name="body">
{{ # if modal .opened }}
<Consul::Peer::Form
@params= {{ route .params }}
as |form|>
<form.Form
@onchange= {{ loader .invalidate }}
@onsubmit= {{ modal .close }}
as |form|>
{{ did-insert ( set this 'form' form ) }}
<form.Fieldsets />
</form.Form>
</Consul::Peer::Form>
{{ / if }}
</BlockSlot>
<BlockSlot @name="actions">
<this.form.Actions
@onclose= {{ this .create .close }}
/>
</BlockSlot>
</ModalDialog>
<Action
data-test-create
class="type-create"
{{ on "click" ( optional this .create .open ) }}
>
Add peer connection
</Action>
2022-06-23 13:16:26 +00:00
</BlockSlot>
<BlockSlot @name="content">
2022-07-26 14:36:49 +00:00
2022-07-07 17:23:26 +00:00
<DataWriter
@sink= {{ uri '/${partition}/${dc}/${nspace}/peer/'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
)
}}
2022-07-04 10:31:58 +00:00
@type="peer"
2022-07-07 17:23:26 +00:00
@label="Peer"
as |writer|>
2022-07-26 14:36:49 +00:00
2022-07-07 17:23:26 +00:00
<BlockSlot @name="removed" as |after|>
<Consul::Peer::Notifications
{{ notification
after=(action after)
}}
@type="remove"
/>
</BlockSlot>
<BlockSlot @name="content">
2022-07-26 14:36:49 +00:00
<ModalDialog
@aria= {{ hash
label="Regenerate token"
}}
@onclose= {{ set this 'item' undefined }}
as |modal|>
<BlockSlot @name="header">
{{ did-insert ( set this 'regenerate' modal ) }}
<h2>
Regenerate token
</h2>
</BlockSlot>
<BlockSlot @name="body">
{{ # if this .item }}
<Consul::Peer::Form::Generate
@item= {{ this .item }}
@onchange= {{ loader .invalidate }}
@regenerate= {{ true }}
as |form|>
{{ did-insert ( set this 'regenerateForm' form ) }}
<form.Fieldsets />
</Consul::Peer::Form::Generate>
{{ / if }}
</BlockSlot>
<BlockSlot @name="actions">
<this.regenerateForm.Actions
@onclose= {{ this .regenerate .close }}
/>
</BlockSlot>
</ModalDialog>
<DataCollection
@type="peer"
@sort= {{ sort .value }}
@filters= {{ filters }}
@search= {{ search }}
@items= {{ items }}
as |collection|>
<collection.Collection>
2022-07-07 17:23:26 +00:00
<Consul::Peer::List
@items= {{ collection .items }}
2022-07-26 14:36:49 +00:00
@onedit= {{ queue
(set this 'item')
this.regenerate.open
}}
2022-07-07 17:23:26 +00:00
@ondelete= {{ writer .delete }}
/>
</collection.Collection>
<collection.Empty>
2022-07-26 14:36:49 +00:00
{{!-- TODO: do we need to check permissions here or will we receive an error automatically? --}}
<EmptyState
@login= {{ route .model .app .login .open }}
>
<BlockSlot @name="header">
<h2>
{{ # if ( gt items .length 0 ) }}
No peers found
{{ else }}
Welcome to Peers
{{ / if }}
</h2>
</BlockSlot>
<BlockSlot @name="body">
2022-07-07 17:23:26 +00:00
{{ # if ( gt items .length 0 ) }}
2022-07-26 14:36:49 +00:00
<p>No peers where found matching that search, or you may not have access to view the peers you are searching for.</p>
2022-07-07 17:23:26 +00:00
{{ else }}
2022-07-26 14:36:49 +00:00
<p>
Cluster peering is the recommended way to connect services across or within Consul datacenters. Peering is a one-to-one relationship in which each peer is either a open-source Consul datacenter or a Consul enterprise admin partition. There don't seem to be any peers for this {{ if ( can "use partitions" ) "admin partition" "datacenter" }} , or you may not have the <code>peering:read</code> permissions to access this view.
</p>
2022-07-07 17:23:26 +00:00
{{ / if }}
2022-07-26 14:36:49 +00:00
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
{{!-- what's the docs for peering?--}}
2022-08-08 14:12:17 +00:00
<a href=" {{ env 'CONSUL_DOCS_URL' }} /connect/cluster-peering" rel="noopener noreferrer" target="_blank">
2022-07-26 14:36:49 +00:00
Documentation on Peers
</a>
</li>
<li class="learn-link">
2022-08-08 14:12:17 +00:00
<a href=" {{ env "CONSUL_DOCS_URL" }} /connect/cluster-peering/create-manage-peering" rel="noopener noreferrer" target="_blank">
2022-07-26 14:36:49 +00:00
Take the tutorial
</a>
</li>
</BlockSlot>
</EmptyState>
</collection.Empty>
</DataCollection>
2022-07-07 17:23:26 +00:00
</BlockSlot>
</DataWriter>
2022-06-23 13:16:26 +00:00
</BlockSlot>
</AppView>
2022-07-04 10:31:58 +00:00
{{ / let }}
</BlockSlot>
</DataLoader>
2022-06-23 13:16:26 +00:00
</Route>