Show Service.ID's throughout the app, allow searching by Service.ID

1. In the Services > Services detail page for both healthy and unhealthy
nodes, also add searching by Service.ID here
2. In the Nodes > Node detail > [Services] tab only if its different
from the Service name, add searching by Service.ID here
This commit is contained in:
John Cowen 2018-07-12 13:36:47 +01:00
parent 40a270a492
commit 310a038f87
9 changed files with 39 additions and 10 deletions

View File

@ -15,6 +15,9 @@ export default Component.extend({
}), }),
gridRowEnd: computed('UnhealthyChecks', function() { gridRowEnd: computed('UnhealthyChecks', function() {
let spans = 3; let spans = 3;
if (get(this, 'service')) {
spans++;
}
if (get(this, 'healthy.length') > 0) { if (get(this, 'healthy.length') > 0) {
spans++; spans++;
} }

View File

@ -23,6 +23,9 @@ export default Controller.extend(WithFiltering, {
get(item, 'Service') get(item, 'Service')
.toLowerCase() .toLowerCase()
.indexOf(term) !== -1 || .indexOf(term) !== -1 ||
get(item, 'ID')
.toLowerCase()
.indexOf(term) !== -1 ||
get(item, 'Port') get(item, 'Port')
.toString() .toString()
.toLowerCase() .toLowerCase()

View File

@ -20,10 +20,16 @@ export default Controller.extend(WithHealthFiltering, {
}); });
}), }),
filter: function(item, { s = '', status = '' }) { filter: function(item, { s = '', status = '' }) {
const term = s.toLowerCase();
return ( return (
get(item, 'Node.Node') get(item, 'Node.Node')
.toLowerCase() .toLowerCase()
.indexOf(s.toLowerCase()) !== -1 && hasStatus(get(item, 'Checks'), status) .indexOf(term) !== -1 ||
(get(item, 'Service.ID')
.toLowerCase()
.indexOf(term) !== -1 &&
hasStatus(get(item, 'Checks'), status))
); );
}, },
}); });

View File

@ -14,6 +14,7 @@
border-top: 1px solid; border-top: 1px solid;
} }
%healthchecked-resource header span, %healthchecked-resource header span,
%healthchecked-resource header em,
%healthchecked-resource li:not(:last-child) span { %healthchecked-resource li:not(:last-child) span {
overflow: hidden; overflow: hidden;
display: inline-block; display: inline-block;
@ -34,14 +35,11 @@
border-radius: $radius-small; border-radius: $radius-small;
} }
%healthchecked-resource header { %healthchecked-resource header {
margin-bottom: 2em;
position: relative; position: relative;
} }
%healthchecked-resource header strong { %healthchecked-resource header strong {
position: absolute; position: absolute;
bottom: -0.6em;
left: 15px;
} }
%healthchecked-resource a, %healthchecked-resource a,
%healthchecked-resource header a > * { %healthchecked-resource header a > * {
@ -85,12 +83,25 @@
.healthy .healthchecked-resource li a { .healthy .healthchecked-resource li a {
padding-left: 0; padding-left: 0;
} }
%healthchecked-resource header strong {
top: 2.8em;
left: 15px;
}
%healthchecked-resource header span {
margin-bottom: 1.75em;
}
%healthchecked-resource header a { %healthchecked-resource header a {
padding: 12px 15px; padding: 12px 15px;
} }
.unhealthy .healthchecked-resource header a {
padding-bottom: 15px;
}
.unhealthy .healthchecked-resource header.with-service a {
padding-bottom: 25px;
}
%healthchecked-resource li a { %healthchecked-resource li a {
padding: 3px 15px; padding: 3px 15px;
padding-top: 5px; padding-top: 4px;
padding-left: 39px; padding-left: 39px;
height: 31px; height: 31px;
} }

View File

@ -41,10 +41,13 @@ th,
font-weight: $weight-medium; font-weight: $weight-medium;
} }
main label a[rel*='help'], main label a[rel*='help'],
td:first-child em,
%healthchecked-resource strong { %healthchecked-resource strong {
font-weight: $weight-normal; font-weight: $weight-normal;
} }
%form-element > em { %form-element > em,
td:first-child em,
%healthchecked-resource header em {
font-style: normal; font-style: normal;
} }
%form-element > span { %form-element > span {

View File

@ -1,7 +1,8 @@
<header> <header class={{if service 'with-service' }}>
<strong>{{address}}</strong> <strong>{{address}}</strong>
<a href={{href}}> <a href={{href}}>
<span>{{name}}</span> <span>{{name}}</span>
<em>{{service}}</em>
</a> </a>
</header> </header>
<ul> <ul>

View File

@ -15,7 +15,7 @@
{{/block-slot}} {{/block-slot}}
{{#block-slot 'row'}} {{#block-slot 'row'}}
<td data-test-service-name="{{item.Service}}"> <td data-test-service-name="{{item.Service}}">
<a href={{href-to 'dc.services.show' item.Service }}>{{item.Service}}</a> <a href={{href-to 'dc.services.show' item.Service }}>{{item.Service}}{{#if (not-eq item.ID item.Service) }} <em data-test-service-id="{{item.ID}}">({{item.ID}})</em>{{/if}}</a>
</td> </td>
<td data-test-service-port="{{item.Port}}" class="port"> <td data-test-service-port="{{item.Port}}" class="port">
{{item.Port}} {{item.Port}}

View File

@ -35,7 +35,7 @@
<h2>Healthy Nodes</h2> <h2>Healthy Nodes</h2>
{{#list-collection {{#list-collection
items=healthy items=healthy
cell-layout=(percentage-columns-layout healthy.length columns 100) as |item index| cell-layout=(percentage-columns-layout healthy.length columns 92) as |item index|
}} }}
{{healthchecked-resource {{healthchecked-resource
data-test-node=item.Node data-test-node=item.Node

View File

@ -36,6 +36,7 @@
data-test-node=item.Node.Node data-test-node=item.Node.Node
href=(href-to 'dc.nodes.show' item.Node.Node) href=(href-to 'dc.nodes.show' item.Node.Node)
name=item.Node.Node name=item.Node.Node
service=item.Service.ID
address=(concat item.Node.Address ':' item.Service.Port) address=(concat item.Node.Address ':' item.Service.Port)
checks=item.Checks checks=item.Checks
}} }}
@ -49,12 +50,13 @@
<h2>Healthy Nodes</h2> <h2>Healthy Nodes</h2>
{{#list-collection {{#list-collection
items=healthy items=healthy
cell-layout=(percentage-columns-layout healthy.length columns 100) as |item index| cell-layout=(percentage-columns-layout healthy.length columns 113) as |item index|
}} }}
{{healthchecked-resource {{healthchecked-resource
href=(href-to 'dc.nodes.show' item.Node.Node) href=(href-to 'dc.nodes.show' item.Node.Node)
data-test-node=item.Node.Node data-test-node=item.Node.Node
name=item.Node.Node name=item.Node.Node
service=item.Service.ID
address=(concat item.Node.Address ':' item.Service.Port) address=(concat item.Node.Address ':' item.Service.Port)
checks=item.Checks checks=item.Checks
status=item.Checks.[0].Status status=item.Checks.[0].Status