open-nomad/ui/app/components/job-client-status-bar.js
Phil Renaud 15872cc2d4
[ui] Disconnected Clients: "Unknown" allocations in the UI (#12544)
* Unknown status for allocations accounted for

* Canary string removed

* Test cleanup

* Generate unknown in mirage

* aacidentally oovervoowled

* Update ui/app/components/allocation-status-bar.js

Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>

* Disconnected state on job status in client

* Renaming Disconnected to Unknown in the job-status-in-client

* Unknown accounted for on job rows filtering and testsfix

* Adding lostAllocs as a computed dependency

* Unknown client status within acceptance test

* Swatches updated and PR comments addressed

* Unknown and disconnected added to test fixtures

Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>
2022-04-22 11:25:02 -04:00

136 lines
3.4 KiB
JavaScript

import { computed } from '@ember/object';
import DistributionBar from './distribution-bar';
import { attributeBindings } from '@ember-decorators/component';
import classic from 'ember-classic-decorator';
@classic
@attributeBindings('data-test-job-client-status-bar')
export default class JobClientStatusBar extends DistributionBar {
layoutName = 'components/distribution-bar';
'data-test-job-client-status-bar' = true;
job = null;
jobClientStatus = null;
@computed('job.namespace', 'jobClientStatus.byStatus')
get data() {
const {
queued,
starting,
running,
complete,
degraded,
failed,
lost,
notScheduled,
unknown,
} = this.jobClientStatus.byStatus;
return [
{
label: 'Queued',
value: queued.length,
className: 'queued',
legendLink: {
queryParams: {
status: JSON.stringify(['queued']),
namespace: this.job.namespace.get('id'),
},
},
},
{
label: 'Starting',
value: starting.length,
className: 'starting',
legendLink: {
queryParams: {
status: JSON.stringify(['starting']),
namespace: this.job.namespace.get('id'),
},
},
layers: 2,
},
{
label: 'Running',
value: running.length,
className: 'running',
legendLink: {
queryParams: {
status: JSON.stringify(['running']),
namespace: this.job.namespace.get('id'),
},
},
},
{
label: 'Complete',
value: complete.length,
className: 'complete',
legendLink: {
queryParams: {
status: JSON.stringify(['complete']),
namespace: this.job.namespace.get('id'),
},
},
},
{
label: 'Unknown',
value: unknown.length,
className: 'unknown',
legendLink: {
queryParams: {
status: JSON.stringify(['unknown']),
namespace: this.job.namespace.get('id'),
},
},
help: 'Some allocations for this job were degraded or lost connectivity.',
},
{
label: 'Degraded',
value: degraded.length,
className: 'degraded',
legendLink: {
queryParams: {
status: JSON.stringify(['degraded']),
namespace: this.job.namespace.get('id'),
},
},
help: 'Some allocations for this job were not successfull or did not run.',
},
{
label: 'Failed',
value: failed.length,
className: 'failed',
legendLink: {
queryParams: {
status: JSON.stringify(['failed']),
namespace: this.job.namespace.get('id'),
},
},
},
{
label: 'Lost',
value: lost.length,
className: 'lost',
legendLink: {
queryParams: {
status: JSON.stringify(['lost']),
namespace: this.job.namespace.get('id'),
},
},
},
{
label: 'Not Scheduled',
value: notScheduled.length,
className: 'not-scheduled',
legendLink: {
queryParams: {
status: JSON.stringify(['notScheduled']),
namespace: this.job.namespace.get('id'),
},
},
help: 'No allocations for this job were scheduled into these clients.',
},
];
}
}