Always transition to imported peers.edit

This commit is contained in:
Michael Klein 2022-10-11 16:53:09 +02:00
parent 1228b9a8a8
commit 2f19d4e97e
7 changed files with 123 additions and 100 deletions

View File

@ -5,11 +5,7 @@ import { action } from "@ember/object";
export default class DcPeersEditIndexController extends Controller { export default class DcPeersEditIndexController extends Controller {
@service router; @service router;
@action transitionToStartSubRouteByType(peerModel) { @action transitionToImported() {
if (peerModel.isDialer) {
this.router.replaceWith("dc.peers.edit.exported");
} else {
this.router.replaceWith("dc.peers.edit.imported"); this.router.replaceWith("dc.peers.edit.imported");
} }
}
} }

View File

@ -31,6 +31,7 @@
@type="search" @type="search"
@value={{this.search}} @value={{this.search}}
placeholder="Search" placeholder="Search"
class="rounded-sm border-hds-border-faint"
{{on "input" (pick "target.value" this.updateSearch)}} {{on "input" (pick "target.value" this.updateSearch)}}
/> />
</div> </div>

View File

@ -76,6 +76,7 @@
<Consul::Service::List <Consul::Service::List
@items={{collection.items}} @items={{collection.items}}
@partition={{partition}} @partition={{partition}}
@peer={{route.model.peer}}
/> />
</collection.Collection> </collection.Collection>
<collection.Empty> <collection.Empty>

View File

@ -1,3 +1,3 @@
<Route @name={{routeName}} as |route|> <Route @name={{routeName}} as |route|>
{{did-insert (fn this.transitionToStartSubRouteByType route.model.peer)}} {{did-insert this.transitionToImported}}
</Route> </Route>

View File

@ -1,18 +1,28 @@
<ListCollection <ListCollection
class="consul-service-list" class='consul-service-list'
...attributes ...attributes
@items={{@items}} @items={{@items}}
@linkable="linkable service" @linkable='linkable service'
as |item index| as |item index|
> >
<BlockSlot @name="header"> <BlockSlot @name='header'>
<dl class={{item.MeshStatus}}> {{#let
(eq @peer.State 'FAILING')
(and @peer (eq item.InstanceCount 0))
as |peerIsFailing peeredAndInstanceCountZero|
}}
<dl class={{if (or peerIsFailing peeredAndInstanceCountZero) 'help' item.MeshStatus}}>
<dt> <dt>
Health Health
</dt> </dt>
<dd> <dd>
<Tooltip @position="top-start"> <Tooltip @position='top-start'>
{{#if (eq 'critical' item.MeshStatus)}} {{#if peerIsFailing}}
This peer is out of sync, so the current health statuses of its services are unknown.
{{else if peeredAndInstanceCountZero}}
This service currently has 0 instances. Check with the operator of its peer to make
sure this is expected behavior.
{{else if (eq 'critical' item.MeshStatus)}}
At least one health check on one instance is failing. At least one health check on one instance is failing.
{{else if (eq 'warning' item.MeshStatus)}} {{else if (eq 'warning' item.MeshStatus)}}
At least one health check on one instance has a warning. At least one health check on one instance has a warning.
@ -24,60 +34,64 @@
</Tooltip> </Tooltip>
</dd> </dd>
</dl> </dl>
{{#if (gt item.InstanceCount 0)}} {{/let}}
{{#if (gt item.InstanceCount 0)}}
<a <a
data-test-service-name data-test-service-name
href={{href-to "dc.services.show.index" item.Name href={{href-to
params=(if (not-eq item.Partition @partition) 'dc.services.show.index'
(hash item.Name
partition=item.Partition params=(if
nspace=item.Namespace (not-eq item.Partition @partition)
peer=item.PeerName (hash partition=item.Partition nspace=item.Namespace peer=item.PeerName)
) (hash peer=item.PeerName)
(hash
peer=item.PeerName
)
) )
}} }}
> >
{{item.Name}} {{item.Name}}
</a> </a>
{{else}} {{else}}
<p data-test-service-name> <p data-test-service-name>
{{item.Name}} {{item.Name}}
</p> </p>
{{/if}} {{/if}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="details"> <BlockSlot @name='details'>
<Consul::Kind @item={{item}} /> <Consul::Kind @item={{item}} />
<Consul::ExternalSource @item={{item}} /> <Consul::ExternalSource @item={{item}} />
{{#if (and (not-eq item.InstanceCount 0) (and (not-eq item.Kind 'terminating-gateway') (not-eq item.Kind 'ingress-gateway'))) }} {{#if
(and
(not-eq item.InstanceCount 0)
(and (not-eq item.Kind 'terminating-gateway') (not-eq item.Kind 'ingress-gateway'))
)
}}
<span> <span>
{{format-number item.InstanceCount}} {{pluralize item.InstanceCount 'instance' without-count=true}} {{format-number item.InstanceCount}}
{{pluralize item.InstanceCount 'instance' without-count=true}}
</span> </span>
{{/if}} {{/if}}
<Consul::Bucket::List {{#unless @peer}}
@item={{item}} <Consul::Bucket::List @item={{item}} @nspace={{@nspace}} @partition={{@partition}} />
@nspace={{@nspace}} {{/unless}}
@partition={{@partition}}
/>
{{#if (eq item.Kind 'terminating-gateway')}} {{#if (eq item.Kind 'terminating-gateway')}}
<span data-test-associated-service-count> <span data-test-associated-service-count>
{{format-number item.GatewayConfig.AssociatedServiceCount}} {{pluralize item.GatewayConfig.AssociatedServiceCount 'linked service' without-count=true}} {{format-number item.GatewayConfig.AssociatedServiceCount}}
{{pluralize item.GatewayConfig.AssociatedServiceCount 'linked service' without-count=true}}
</span> </span>
{{else if (eq item.Kind 'ingress-gateway')}} {{else if (eq item.Kind 'ingress-gateway')}}
<span data-test-associated-service-count> <span data-test-associated-service-count>
{{format-number item.GatewayConfig.AssociatedServiceCount}} {{pluralize item.GatewayConfig.AssociatedServiceCount 'upstream' without-count=true}} {{format-number item.GatewayConfig.AssociatedServiceCount}}
{{pluralize item.GatewayConfig.AssociatedServiceCount 'upstream' without-count=true}}
</span> </span>
{{/if}} {{/if}}
{{#if (or item.ConnectedWithGateway item.ConnectedWithProxy)}} {{#if (or item.ConnectedWithGateway item.ConnectedWithProxy)}}
<dl class="mesh"> <dl class='mesh'>
<dt> <dt>
<Tooltip> <Tooltip>
This service uses a proxy for the Consul service mesh This service uses a proxy for the Consul service mesh
</Tooltip> </Tooltip>
</dt> </dt>
{{#if (and item.ConnectedWithGateway item.ConnectedWithProxy )}} {{#if (and item.ConnectedWithGateway item.ConnectedWithProxy)}}
<dd data-test-mesh> <dd data-test-mesh>
in service mesh with proxy and gateway in service mesh with proxy and gateway
</dd> </dd>

View File

@ -25,6 +25,11 @@
@extend %with-minus-square-fill-mask, %as-pseudo; @extend %with-minus-square-fill-mask, %as-pseudo;
color: rgb(var(--tone-gray-500)); color: rgb(var(--tone-gray-500));
} }
%icon-definition.empty dt::before,
%composite-row-header .help dd::before {
@extend %with-help-circle-outline-mask, %as-pseudo;
color: rgb(var(--tone-gray-500));
}
%composite-row-header [rel='me'] dd::before { %composite-row-header [rel='me'] dd::before {
@extend %with-check-circle-fill-mask, %as-pseudo; @extend %with-check-circle-fill-mask, %as-pseudo;

View File

@ -107,7 +107,11 @@ export default class PeerService extends RepositoryService {
}} }}
` `
)((headers, body, cache) => { )((headers, body, cache) => {
// we can't easily use fragments as we are working around the serializer
// layer
const { StreamStatus } = body; const { StreamStatus } = body;
if (StreamStatus) {
if (StreamStatus.LastHeartbeat) { if (StreamStatus.LastHeartbeat) {
StreamStatus.LastHeartbeat = new Date(StreamStatus.LastHeartbeat); StreamStatus.LastHeartbeat = new Date(StreamStatus.LastHeartbeat);
} }
@ -117,6 +121,8 @@ export default class PeerService extends RepositoryService {
if (StreamStatus.LastSend) { if (StreamStatus.LastSend) {
StreamStatus.LastSend = new Date(StreamStatus.LastSend); StreamStatus.LastSend = new Date(StreamStatus.LastSend);
} }
}
return { return {
meta: { meta: {
version: 2, version: 2,