[ui] Don't show a service as healthy when its parent alloc is not running (#17465)
* Fix: dont show a service as healthy when its parent alloc is not running * Test for Health Unknown
This commit is contained in:
parent
57dad0ca07
commit
6a9df6e3ab
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: dont show a service as healthy when its parent allocation stops running
|
||||||
|
```
|
|
@ -20,6 +20,11 @@
|
||||||
{{#if (eq this.aggregateStatus 'Unhealthy')}}
|
{{#if (eq this.aggregateStatus 'Unhealthy')}}
|
||||||
<FlightIcon @name="x-square-fill" @color="#c84034" />
|
<FlightIcon @name="x-square-fill" @color="#c84034" />
|
||||||
Unhealthy
|
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}}
|
{{else}}
|
||||||
<FlightIcon @name="check-square-fill" @color="#25ba81" />
|
<FlightIcon @name="check-square-fill" @color="#25ba81" />
|
||||||
Healthy
|
Healthy
|
||||||
|
|
|
@ -38,6 +38,7 @@ export default class AllocationServiceSidebarComponent extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
get aggregateStatus() {
|
get aggregateStatus() {
|
||||||
|
if (this.args.allocation?.clientStatus !== 'running') return 'Unknown';
|
||||||
return this.checks.any((check) => check.Status === 'failure')
|
return this.checks.any((check) => check.Status === 'failure')
|
||||||
? 'Unhealthy'
|
? 'Unhealthy'
|
||||||
: 'Healthy';
|
: 'Healthy';
|
||||||
|
|
|
@ -76,7 +76,7 @@ module(
|
||||||
};
|
};
|
||||||
|
|
||||||
this.set('closeSidebar', () => this.set('service', null));
|
this.set('closeSidebar', () => this.set('service', null));
|
||||||
this.set('allocation', { id: 'myAlloc' });
|
this.set('allocation', { id: 'myAlloc', clientStatus: 'running' });
|
||||||
this.set('service', healthyService);
|
this.set('service', healthyService);
|
||||||
await render(
|
await render(
|
||||||
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
|
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
|
||||||
|
@ -91,6 +91,13 @@ module(
|
||||||
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
|
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
|
||||||
);
|
);
|
||||||
assert.dom('h1 .aggregate-status').includesText('Unhealthy');
|
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) {
|
test('it handles Consul services with reduced functionality', async function (assert) {
|
||||||
|
|
Loading…
Reference in New Issue