Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: [BUGFIX] Ensure we show the correct count of instances for each node #9749

Merged
merged 4 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/9749.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Exclude proxies when showing the total number of instances on a node.
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{#if (gt @items.length 0)}}
{{#if (eq this.healthCheck.check 'empty') }}
<dl class={{this.healthCheck.check}}>
<dt>
Expand Down Expand Up @@ -28,5 +27,4 @@
<dd>{{this.healthCheck.count}}/{{@items.length}} {{@type}} checks {{this.healthCheck.status}}</dd>
</dl>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ as |item index|>
<span class="leader" data-test-leader={{@leader.Address}}>Leader</span>
{{/if}}
<span>
{{format-number item.Services.length}} {{pluralize item.Services.length 'Service' without-count=true}}
{{format-number item.MeshServiceInstances.length}} {{pluralize item.MeshServiceInstances.length 'Service' without-count=true}}
</span>
<dl>
<dt>
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/consul-ui/app/models/node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Model, { attr, hasMany } from '@ember-data/model';
import { computed } from '@ember/object';
import { filter } from '@ember/object/computed';
import { fragmentArray } from 'ember-data-model-fragments/attributes';

export const PRIMARY_KEY = 'uid';
Expand All @@ -18,8 +19,13 @@ export default class Node extends Model {
@attr() meta; // {}
@attr() Meta; // {}
@attr() TaggedAddresses; // {lan, wan}
// Services are reshaped to a different shape to what you sometimes get from
// the response, see models/node.js
@hasMany('service-instance') Services; // TODO: Rename to ServiceInstances
@fragmentArray('health-check') Checks;
// MeshServiceInstances are all instances that aren't connect-proxies this
// currently includes gateways as these need to show up in listings
@filter('Services', item => item.Service.Kind !== 'connect-proxy') MeshServiceInstances;

@computed('Checks.[]', 'ChecksCritical', 'ChecksPassing', 'ChecksWarning')
get Status() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
)

(reject-by 'Service.Kind' 'connect-proxy' item.Services)
item.MeshServiceInstances

as |sort filters items|}}
<div class="tab-section">
Expand Down