Skip to content

Commit

Permalink
Backport of [ui] Don't show a service as healthy when its parent allo…
Browse files Browse the repository at this point in the history
…c is not running into release/1.4.x (#17477)

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core authored Jun 9, 2023
1 parent fe7d31a commit ddd2c6f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/17465.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: dont show a service as healthy when its parent allocation stops running
```
5 changes: 5 additions & 0 deletions ui/app/components/allocation-service-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
{{#if (eq this.aggregateStatus 'Unhealthy')}}
<FlightIcon @name="x-square-fill" @color="#c84034" />
Unhealthy
{{else if (eq this.aggregateStatus 'Unknown')}}
<Tooltip @text="The parent allocation for this service is not running" @isFullText={{true}}>
<FlightIcon @name="help" @color="#999999" />
Health Unknown
</Tooltip>
{{else}}
<FlightIcon @name="check-square-fill" @color="#25ba81" />
Healthy
Expand Down
1 change: 1 addition & 0 deletions ui/app/components/allocation-service-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class AllocationServiceSidebarComponent extends Component {
}

get aggregateStatus() {
if (this.args.allocation?.clientStatus !== 'running') return 'Unknown';
return this.checks.any((check) => check.Status === 'failure')
? 'Unhealthy'
: 'Healthy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module(
};

this.set('closeSidebar', () => this.set('service', null));
this.set('allocation', { id: 'myAlloc' });
this.set('allocation', { id: 'myAlloc', clientStatus: 'running' });
this.set('service', healthyService);
await render(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
Expand All @@ -86,6 +86,13 @@ module(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
);
assert.dom('h1 .aggregate-status').includesText('Unhealthy');

this.set('service', healthyService);
this.set('allocation', { id: 'myAlloc2', clientStatus: 'failed' });
await render(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
);
assert.dom('h1 .aggregate-status').includesText('Health Unknown');
});

test('it handles Consul services with reduced functionality', async function (assert) {
Expand Down

0 comments on commit ddd2c6f

Please sign in to comment.