Versions returned as an array rather than an object now, pending changed to unknown, and sorted (#17150)
This commit is contained in:
parent
c60c5ace60
commit
681ea73913
|
@ -67,14 +67,18 @@
|
|||
<section class="versions">
|
||||
<h4>Versions</h4>
|
||||
<ul>
|
||||
{{#each-in this.versions as |version allocs|}}
|
||||
{{#each this.versions as |versionObj|}}
|
||||
<li>
|
||||
<LinkTo data-version={{version}} @route="jobs.job.allocations" @model={{@job}} @query={{hash version=(concat '[' version ']') status=(concat '["running", "pending", "failed"]') }}>
|
||||
<Hds::Badge @text={{concat "v" version}} />
|
||||
<Hds::BadgeCount @text={{allocs.length}} @type="inverted" />
|
||||
<LinkTo data-version={{versionObj.version}} @route="jobs.job.allocations" @model={{@job}} @query={{hash version=(concat '[' versionObj.version ']') status=(concat '["running", "pending", "failed"]') }}>
|
||||
{{#if (eq versionObj.version "unknown")}}
|
||||
<Hds::Badge @text="unknown" />
|
||||
{{else}}
|
||||
<Hds::Badge @text={{concat "v" versionObj.version}} />
|
||||
{{/if}}
|
||||
<Hds::BadgeCount @text={{versionObj.allocations.length}} @type="inverted" />
|
||||
</LinkTo>
|
||||
</li>
|
||||
{{/each-in}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -140,18 +140,22 @@ export default class JobStatusPanelSteadyComponent extends Component {
|
|||
}
|
||||
|
||||
get versions() {
|
||||
return Object.values(this.allocBlocks)
|
||||
const versions = Object.values(this.allocBlocks)
|
||||
.flatMap((allocType) => Object.values(allocType))
|
||||
.flatMap((allocHealth) => Object.values(allocHealth))
|
||||
.flatMap((allocCanary) => Object.values(allocCanary))
|
||||
.map((a) => (!isNaN(a?.jobVersion) ? a.jobVersion : 'pending')) // "starting" allocs, and possibly others, do not yet have a jobVersion
|
||||
.reduce(
|
||||
(result, item) => ({
|
||||
...result,
|
||||
[item]: [...(result[item] || []), item],
|
||||
}),
|
||||
[]
|
||||
);
|
||||
.map((a) => (!isNaN(a?.jobVersion) ? a.jobVersion : 'unknown')) // "starting" allocs, GC'd allocs, etc. do not have a jobVersion
|
||||
.sort((a, b) => a - b)
|
||||
.reduce((result, item) => {
|
||||
const existingVersion = result.find((v) => v.version === item);
|
||||
if (existingVersion) {
|
||||
existingVersion.allocations.push(item);
|
||||
} else {
|
||||
result.push({ version: item, allocations: [item] });
|
||||
}
|
||||
return result;
|
||||
}, []);
|
||||
return versions;
|
||||
}
|
||||
|
||||
get rescheduledAllocs() {
|
||||
|
|
Loading…
Reference in a new issue