open-consul/ui-v2/app/components/consul-service-instance-list/index.hbs

78 lines
2.5 KiB
Handlebars

{{#if (gt items.length 0)}}
<ListCollection @items={{items}} class="consul-service-instance-list" as |item index|>
<BlockSlot @name="header">
<a href={{href-to routeName item.Service.Service item.Node.Node (or item.Service.ID item.Service.Service)}}>
{{item.Service.ID}}
</a>
</BlockSlot>
<BlockSlot @name="details">
<ul>
<ConsulExternalSource @item={{item.Service}} as |ExternalSource|>
<li>
<ExternalSource />
</li>
</ConsulExternalSource>
{{#let (reject-by 'ServiceID' '' item.Checks) as |checks|}}
{{#let (service/instance-checks checks) as |serviceCheck| }}
{{#if (eq serviceCheck.check 'empty') }}
<li class={{serviceCheck.check}}>
No service checks
</li>
{{else}}
{{#if (eq serviceCheck.count checks.length)}}
<li class={{serviceCheck.check}}>
All service checks {{serviceCheck.status}}
</li>
{{else}}
<li class={{serviceCheck.check}}>
{{serviceCheck.count}}/{{checks.length}} service checks {{serviceCheck.status}}
</li>
{{/if}}
{{/if}}
{{/let}}
{{/let}}
{{#let (filter-by 'ServiceID' '' item.Checks) as |checks|}}
{{#let (service/instance-checks checks) as |nodeCheck| }}
{{#if (eq nodeCheck.check 'empty') }}
<li class={{nodeCheck.check}}>
No node checks
</li>
{{else}}
{{#if (eq nodeCheck.count checks.length)}}
<li class={{nodeCheck.check}}>
All node checks {{nodeCheck.status}}
</li>
{{else}}
<li class={{nodeCheck.check}}>
{{nodeCheck.count}}/{{checks.length}} node checks {{nodeCheck.status}}
</li>
{{/if}}
{{/if}}
{{/let}}
{{/let}}
{{#if (get proxies item.Service.ID)}}
<li class="proxy">
connected with proxy
</li>
{{/if}}
{{#if (gt item.Node.Node.length 0)}}
<li class="node">
<a href={{href-to 'dc.nodes.show' item.Node.Node}}>{{item.Node.Node}}</a>
</li>
{{/if}}
<li class="address" data-test-address>
{{#if (not-eq item.Service.Address '')}}
{{item.Service.Address}}:{{item.Service.Port}}
{{else}}
{{item.Node.Address}}:{{item.Service.Port}}
{{/if}}
</li>
<TagList @item={{item.Service}} as |Tags|>
<li>
<Tags />
</li>
</TagList>
</ul>
</BlockSlot>
</ListCollection>
{{/if}}