ui: hide node name and meta on agentless instances (#14921)

* [NET-950] hide node name and meta on agentless instances

* Fix linting issues and set synthetic-node value

* ui: changelog entry
This commit is contained in:
Tyler Wendlandt 2022-10-11 09:59:53 -06:00 committed by GitHub
parent 0f95b266be
commit f8dab48cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 177 additions and 11 deletions

3
.changelog/14921.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:feature
ui: Remove node meta on service instances when using agentless and consolidate external-source labels on service instances page if they all match.
```

View File

@ -45,18 +45,24 @@ as |proxy|}}
@items={{filter-by 'ServiceID' '' checks}} @items={{filter-by 'ServiceID' '' checks}}
/> />
{{else}} {{else}}
{{#unless this.areAllExternalSourcesMatching}}
<Consul::ExternalSource <Consul::ExternalSource
@item={{item.Service}} @item={{item.Service}}
/> />
{{/unless}}
<Consul::InstanceChecks <Consul::InstanceChecks
@type="service" @type="service"
@items={{filter-by 'ServiceID' '' checks}} @items={{filter-by 'ServiceID' '' checks}}
/> />
{{#unless item.Node.Meta.synthetic-node}}
<Consul::InstanceChecks <Consul::InstanceChecks
@type="node" @type="node"
@items={{reject-by 'ServiceID' '' checks}} @items={{reject-by 'ServiceID' '' checks}}
data-test-node-health-checks
/> />
{{/unless}}
{{/if}} {{/if}}
{{#if proxy}} {{#if proxy}}
<dl class="mesh"> <dl class="mesh">
@ -70,7 +76,7 @@ as |proxy|}}
</dd> </dd>
</dl> </dl>
{{/if}} {{/if}}
{{#if (not @node)}} {{#if (and (not @node) (not item.Node.Meta.synthetic-node))}}
<dl class="node"> <dl class="node">
<dt> <dt>
<Tooltip> <Tooltip>
@ -78,7 +84,7 @@ as |proxy|}}
</Tooltip> </Tooltip>
</dt> </dt>
<dd> <dd>
<a href={{href-to 'dc.nodes.show' item.Node.Node}}>{{item.Node.Node}}</a> <a data-test-node-name href={{href-to 'dc.nodes.show' item.Node.Node}}>{{item.Node.Node}}</a>
</dd> </dd>
</dl> </dl>
{{/if}} {{/if}}

View File

@ -0,0 +1,12 @@
import Component from '@glimmer/component';
export default class ServiceInstanceList extends Component {
get areAllExternalSourcesMatching() {
const firstSource = this.args.items[0]?.Service?.Meta?.['external-source'];
const matching = this.args.items.every(
(instance) => instance.Service?.Meta?.['external-source'] === firstSource
);
return matching;
}
}

View File

@ -105,6 +105,148 @@ Feature: dc / services / show: Show Service
- "2.2.2.2:8000" - "2.2.2.2:8000"
- "3.3.3.3:8888" - "3.3.3.3:8888"
--- ---
Scenario: Given a combination of sources I should see them all on the instances
Given 1 datacenter model with the value "dc1"
And 3 node models
And 1 service model from yaml
---
- Checks:
- Status: critical
Service:
Kind: ~
ID: passing-service-8080
Port: 8080
Address: 1.1.1.1
Meta:
external-source: kubernetes
Node:
Address: 1.2.2.2
Meta:
synthetic-node: false
- Checks:
- Status: passing
Service:
Kind: ~
ID: service-8000
Port: 8000
Address: 2.2.2.2
Meta:
external-source: kubernetes
Node:
Address: 2.3.3.3
Meta:
synthetic-node: false
- Checks:
- Status: passing
Service:
Kind: ~
ID: service-8888
Port: 8888
Address: 3.3.3.3
Meta:
external-source: vault
Node:
Address: 3.4.4.4
Meta:
synthetic-node: false
---
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And I click instances on the tabs
Then I see externalSource on the instances vertically like yaml
---
- "kubernetes"
- "kubernetes"
- "vault"
---
And I see nodeName on the instances like yaml
---
- "node-0"
- "node-1"
- "node-2"
---
And I see nodeChecks on the instances
Scenario: Given instances share the same external source, only show it at the top
Given 1 datacenter model with the value "dc1"
And 3 node models
And 1 service model from yaml
---
- Checks:
- Status: critical
Service:
Kind: ~
ID: passing-service-8080
Port: 8080
Address: 1.1.1.1
Meta:
external-source: kubernetes
Node:
Address: 1.2.2.2
Meta:
synthetic-node: true
- Checks:
- Status: passing
Service:
Kind: ~
ID: service-8000
Port: 8000
Address: 2.2.2.2
Meta:
external-source: kubernetes
Node:
Address: 2.3.3.3
Meta:
synthetic-node: true
- Checks:
- Status: passing
Service:
Kind: ~
ID: service-8888
Port: 8888
Address: 3.3.3.3
Meta:
external-source: kubernetes
Node:
Address: 3.4.4.4
---
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And I click instances on the tabs
Then I see externalSource like "kubernetes"
And I don't see externalSource on the instances
Scenario: Given one agentless instance, it should not show node health checks or node name
Given 1 datacenter model with the value "dc1"
And 1 node models
And 1 service model from yaml
---
- Checks:
- Status: critical
Service:
Kind: ~
ID: passing-service-8080
Port: 8080
Address: 1.1.1.1
Meta:
external-source: kubernetes
Node:
Address: 1.2.2.2
Meta:
synthetic-node: true
---
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And I click instances on the tabs
And I don't see nodeChecks on the instances
And I don't see nodeName on the instances
Scenario: Given a dashboard template has been set Scenario: Given a dashboard template has been set
Given 1 datacenter model with the value "dc1" Given 1 datacenter model with the value "dc1"
And ui_config from yaml And ui_config from yaml

View File

@ -32,7 +32,10 @@ export default function (
// TODO: These need to somehow move to subpages // TODO: These need to somehow move to subpages
instances: collection('.consul-service-instance-list > ul > li:not(:first-child)', { instances: collection('.consul-service-instance-list > ul > li:not(:first-child)', {
address: text('[data-test-address]'), address: text('[data-test-address]'),
externalSource: attribute('data-test-external-source', '[data-test-external-source]'),
instance: clickable('a'), instance: clickable('a'),
nodeChecks: text('[data-test-node-health-checks]'),
nodeName: text('[data-test-node-name]'),
}), }),
intentionList: intentions(), intentionList: intentions(),
}; };