diff --git a/.changelog/17465.txt b/.changelog/17465.txt new file mode 100644 index 000000000000..63977d8260c3 --- /dev/null +++ b/.changelog/17465.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: dont show a service as healthy when its parent allocation stops running +``` diff --git a/ui/app/components/allocation-service-sidebar.hbs b/ui/app/components/allocation-service-sidebar.hbs index c91bab1f9e0d..4c0881bd7050 100644 --- a/ui/app/components/allocation-service-sidebar.hbs +++ b/ui/app/components/allocation-service-sidebar.hbs @@ -20,6 +20,11 @@ {{#if (eq this.aggregateStatus 'Unhealthy')}} Unhealthy + {{else if (eq this.aggregateStatus 'Unknown')}} + + + Health Unknown + {{else}} Healthy diff --git a/ui/app/components/allocation-service-sidebar.js b/ui/app/components/allocation-service-sidebar.js index 3f84a9f50e53..7ed9aff066d3 100644 --- a/ui/app/components/allocation-service-sidebar.js +++ b/ui/app/components/allocation-service-sidebar.js @@ -38,6 +38,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'; diff --git a/ui/tests/integration/components/allocation-service-sidebar-test.js b/ui/tests/integration/components/allocation-service-sidebar-test.js index fa6145b3a739..0267b7cacf7f 100644 --- a/ui/tests/integration/components/allocation-service-sidebar-test.js +++ b/ui/tests/integration/components/allocation-service-sidebar-test.js @@ -76,7 +76,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`` @@ -91,6 +91,13 @@ module( hbs`` ); assert.dom('h1 .aggregate-status').includesText('Unhealthy'); + + this.set('service', healthyService); + this.set('allocation', { id: 'myAlloc2', clientStatus: 'failed' }); + await render( + hbs`` + ); + assert.dom('h1 .aggregate-status').includesText('Health Unknown'); }); test('it handles Consul services with reduced functionality', async function (assert) {