mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
[ui] Show "Scaled Down" as a valid job status when task groups' counts are set to zero (#23829)
* Scaled Down as a status * Scaled Down as a steady-state job panel status as well * Test for badge status and changelog
This commit is contained in:
3
.changelog/23829.txt
Normal file
3
.changelog/23829.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:improvement
|
||||
ui: Badge added for Scaled Down jobs
|
||||
```
|
||||
@@ -205,7 +205,7 @@ export default class JobStatusPanelSteadyComponent extends Component {
|
||||
|
||||
/**
|
||||
* @typedef {Object} CurrentStatus
|
||||
* @property {"Healthy"|"Failed"|"Degraded"|"Recovering"|"Complete"|"Running"|"Stopped"} label - The current status of the job
|
||||
* @property {"Healthy"|"Failed"|"Degraded"|"Recovering"|"Complete"|"Running"|"Stopped"|"Scaled Down"} label - The current status of the job
|
||||
* @property {"highlight"|"success"|"warning"|"critical"|"neutral"} state -
|
||||
*/
|
||||
|
||||
@@ -224,6 +224,13 @@ export default class JobStatusPanelSteadyComponent extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
if (this.totalAllocs === 0) {
|
||||
return {
|
||||
label: 'Scaled Down',
|
||||
state: 'neutral',
|
||||
};
|
||||
}
|
||||
|
||||
if (this.job.type === 'batch' || this.job.type === 'sysbatch') {
|
||||
// If all the allocs are complete, the job is Complete
|
||||
const completeAllocs = this.allocBlocks.complete?.healthy?.nonCanary;
|
||||
|
||||
@@ -90,7 +90,7 @@ export default class Job extends Model {
|
||||
|
||||
/**
|
||||
* @typedef {Object} CurrentStatus
|
||||
* @property {"Healthy"|"Failed"|"Deploying"|"Degraded"|"Recovering"|"Complete"|"Running"|"Removed"|"Stopped"} label - The current status of the job
|
||||
* @property {"Healthy"|"Failed"|"Deploying"|"Degraded"|"Recovering"|"Complete"|"Running"|"Removed"|"Stopped"|"Scaled Down"} label - The current status of the job
|
||||
* @property {"highlight"|"success"|"warning"|"critical"|"neutral"} state -
|
||||
*/
|
||||
|
||||
@@ -226,6 +226,7 @@ export default class Job extends Model {
|
||||
* - Failed: All allocations are failed, lost, or unplaced
|
||||
* - Removed: The job appeared in our initial query, but has since been garbage collected
|
||||
* - Stopped: The job has been manually stopped (and not purged or yet garbage collected) by a user
|
||||
* - Scaled Down: The job is intentionally scaled down to 0 desired allocations (all task groups have count=0)
|
||||
* @returns {CurrentStatus}
|
||||
*/
|
||||
/**
|
||||
@@ -248,6 +249,12 @@ export default class Job extends Model {
|
||||
};
|
||||
}
|
||||
|
||||
// If the job is scaled down to 0 desired allocations, we shouldn't call it "failed";
|
||||
// we should indicate that it is deliberately set to not have any running parts.
|
||||
if (totalAllocs === 0) {
|
||||
return { label: 'Scaled Down', state: 'neutral' };
|
||||
}
|
||||
|
||||
// If the job was requested initially, but a subsequent request for it was
|
||||
// not found, we can remove links to it but maintain its presence in the list
|
||||
// until the user specifies they want a refresh
|
||||
|
||||
@@ -250,7 +250,7 @@ export default Factory.extend({
|
||||
groupProps.taskCount = job.groupTaskCount;
|
||||
}
|
||||
|
||||
if (job.groupAllocCount) {
|
||||
if (job.groupAllocCount !== undefined) {
|
||||
groupProps.count = job.groupAllocCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -700,6 +700,13 @@ module('Acceptance | jobs list', function (hooks) {
|
||||
activeDeployment: true,
|
||||
});
|
||||
|
||||
server.create('job', {
|
||||
...defaultJobParams,
|
||||
id: 'scaled-down-job',
|
||||
groupAllocCount: 0,
|
||||
status: 'dead',
|
||||
});
|
||||
|
||||
await JobsList.visit();
|
||||
|
||||
assert
|
||||
@@ -732,6 +739,9 @@ module('Acceptance | jobs list', function (hooks) {
|
||||
assert
|
||||
.dom('[data-test-job-row="deploying-job"] [data-test-job-status]')
|
||||
.hasText('Deploying', 'Deploying job is deploying');
|
||||
assert
|
||||
.dom('[data-test-job-row="scaled-down-job"] [data-test-job-status]')
|
||||
.hasText('Scaled Down', 'Scaled down job is scaled down');
|
||||
|
||||
await percySnapshot(assert);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user