From 0466c49c587798714c4a1b9740294447e58857c3 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Thu, 16 Feb 2023 15:15:41 -0500 Subject: [PATCH] More sensible allocTypes listing --- .../components/job-status/allocation-row.hbs | 5 ++- .../job-status/allocation-status-block.hbs | 4 +-- ui/app/components/job-status/panel.hbs | 16 +++------ ui/app/components/job-status/panel.js | 35 +++++++++++++------ .../styles/components/job-status-panel.scss | 14 ++++---- ui/mirage/scenarios/default.js | 9 ----- 6 files changed, 39 insertions(+), 44 deletions(-) diff --git a/ui/app/components/job-status/allocation-row.hbs b/ui/app/components/job-status/allocation-row.hbs index 12179f54069a..1594090e2382 100644 --- a/ui/app/components/job-status/allocation-row.hbs +++ b/ui/app/components/job-status/allocation-row.hbs @@ -7,11 +7,10 @@ {{/each-in}} {{else}} -
+
{{#each-in @allocBlocks as |status count|}} - {{!-- {{log "eachin" status count}} --}} {{#if (gt count 0)}} - {{#each (range 0 count) as |alloc|}} + {{#each (range 0 count)}} {{/each}} {{/if}} diff --git a/ui/app/components/job-status/allocation-status-block.hbs b/ui/app/components/job-status/allocation-status-block.hbs index 2afcf19929a0..c53de338436f 100644 --- a/ui/app/components/job-status/allocation-status-block.hbs +++ b/ui/app/components/job-status/allocation-status-block.hbs @@ -3,9 +3,9 @@ style={{html-safe (concat "width: " @width "%")}} > {{#if this.countToShow}} -
+
{{#each (range 0 this.countToShow)}} - + {{/each}}
{{/if}} diff --git a/ui/app/components/job-status/panel.hbs b/ui/app/components/job-status/panel.hbs index 916803b406e4..f0f825958312 100644 --- a/ui/app/components/job-status/panel.hbs +++ b/ui/app/components/job-status/panel.hbs @@ -20,12 +20,12 @@
Manipulate mock data:
{{#each this.allocTypes as |type|}} {{/each}} @@ -35,15 +35,7 @@ {{#if (eq this.mode "current")}}

{{@job.runningAllocs}}/{{this.totalAllocs}} Allocations Running

{{/if}} {{#if (eq this.mode "historical")}} diff --git a/ui/app/components/job-status/panel.js b/ui/app/components/job-status/panel.js index c944ae06d67a..fa1a45d729a3 100644 --- a/ui/app/components/job-status/panel.js +++ b/ui/app/components/job-status/panel.js @@ -7,14 +7,27 @@ import { action } from '@ember/object'; export default class JobStatusPanelComponent extends Component { allocTypes = [ - "runningAllocs", - "failedAllocs", - "unknownAllocs", - "queuedAllocs", - "completeAllocs", - "startingAllocs", - "lostAllocs" - ] + "running", + "failed", + "unknown", + // "queued", + "complete", + // "starting", + "lost" + ].map((type) => { + return { + label: type, + property: `${type}Allocs` + } + }) + + get allocBlocks() { + return this.allocTypes.reduce((blocks, type) => { + blocks[type.label] = this.args.job[type.property]; + return blocks; + }, {}); + } + /** * @type {('current'|'historical')} */ @@ -27,11 +40,11 @@ export default class JobStatusPanelComponent extends Component { // TODO: eventually we will want this from a new property on a job. get totalAllocs() { - return this.allocTypes.reduce((sum, type) => sum + this.args.job[type], 0); + return this.allocTypes.reduce((sum, type) => sum + this.args.job[type.property], 0); } @action - modifyMockAllocs(type, { target: { value } }) { - this.args.job[type] = +value; + modifyMockAllocs(propName, { target: { value } }) { + this.args.job[propName] = +value; } } diff --git a/ui/app/styles/components/job-status-panel.scss b/ui/app/styles/components/job-status-panel.scss index e07cc540d968..a8b85de70275 100644 --- a/ui/app/styles/components/job-status-panel.scss +++ b/ui/app/styles/components/job-status-panel.scss @@ -31,7 +31,7 @@ } } - .alloc-representation { + .ungrouped-allocs { display: grid; gap: 10px; grid-auto-flow: column; @@ -55,19 +55,19 @@ grid-template-columns: auto; } - & > .allocs { + & > .ungrouped-allocs { display: grid; grid-auto-flow: column; gap: 10px; - } - - .represented-allocation { - text-align: center; - font-size: 0; + grid-auto-columns: unset; + & > .represented-allocation { + width: 32px; + } } .represented-allocation.rest { font-size: 0.8rem; + text-align: center; display: grid; align-content: center; font-weight: bold; diff --git a/ui/mirage/scenarios/default.js b/ui/mirage/scenarios/default.js index 520820806700..310de32f6471 100644 --- a/ui/mirage/scenarios/default.js +++ b/ui/mirage/scenarios/default.js @@ -68,15 +68,6 @@ function smallCluster(server) { id: 'service-haver', namespaceId: 'default', }); - server.create('job', { - withGroupServices: true, - withTaskServices: true, - name: 'mixed-alloc-job', - id: 'mixed-alloc-job', - namespaceId: 'default', - type: 'service', - activeDeployment: true, - }); server.createList('allocFile', 5); server.create('allocFile', 'dir', { depth: 2 }); server.createList('csi-plugin', 2);