Skip to content

Commit

Permalink
Experimenting with a generic meta job-part component
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Dec 3, 2024
1 parent 4b91c17 commit 5c80ed0
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ui/app/models/task-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class TaskGroup extends Fragment {

@fragment('group-scaling') scaling;

@attr() meta;
@fragment('structured-attributes') meta;

@computed('job.meta.raw', 'meta')
get mergedMeta() {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class Task extends Fragment {
@fragmentArray('action', { defaultValue: () => [] })
actions;

@attr() meta;
@fragment('structured-attributes') meta;

@fragment('task-schedule') schedule;

Expand Down
5 changes: 5 additions & 0 deletions ui/app/templates/allocations/allocation/task/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,9 @@
</ListTable>
</div>
</div>
{{#if this.model.meta}}
<JobPage::Parts::Meta
@meta={{this.model.meta}}
/>
{{/if}}
</section>
4 changes: 2 additions & 2 deletions ui/app/templates/components/job-page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
PlacementFailures=(component "job-page/parts/placement-failures" job=@job)
TaskGroups=(component "job-page/parts/task-groups" job=@job)
RecentAllocations=(component "job-page/parts/recent-allocations" job=@job activeTask=@activeTask setActiveTaskQueryParam=@setActiveTaskQueryParam)
Meta=(component "job-page/parts/meta" job=@job)
Meta=(component "job-page/parts/meta" meta=@job.meta)
DasRecommendations=(component
"job-page/parts/das-recommendations" job=@job
)
Expand All @@ -35,4 +35,4 @@

)
)
}}
}}
17 changes: 16 additions & 1 deletion ui/app/templates/components/job-page/parts/meta.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: BUSL-1.1
~}}

{{#if @job.meta.structured}}
{{!-- {{#if @job.meta.structured}}
<div class="boxed-section">
<div class="boxed-section-head">
Meta
Expand All @@ -15,4 +15,19 @@
@class="attributes-table" />
</div>
</div>
{{/if}} --}}


{{#if @meta.structured}}
<div class="boxed-section">
<div class="boxed-section-head">
Meta
</div>
<div class="boxed-section-body is-full-bleed">
<AttributesTable
data-test-meta
@attributePairs={{@meta.structured.root}}
@class="attributes-table" />
</div>
</div>
{{/if}}
8 changes: 7 additions & 1 deletion ui/app/templates/jobs/job/task-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
</t.head>
<t.body @key="model.id" as |row|>
<AllocationRow
{{keyboard-shortcut
{{keyboard-shortcut
enumerated=true
action=(action "gotoAllocation" row.model)
}}
Expand Down Expand Up @@ -360,4 +360,10 @@
</div>
</div>
{{/if}}

{{#if this.model.meta}}
<JobPage::Parts::Meta
@meta={{this.model.meta}}
/>
{{/if}}
</section>
6 changes: 6 additions & 0 deletions ui/tests/acceptance/task-group-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ module('Acceptance | task group detail', function (hooks) {
assert.notOk(TaskGroup.hasVolumes);
});

test('when the task group has metadata, the metadata table is shown', async function (assert) {
await TaskGroup.visit({ id: job.id, name: taskGroup.name });

assert.ok(TaskGroup.hasMeta);
});

test('each row in the volumes table lists information about the volume', async function (assert) {
await TaskGroup.visit({ id: job.id, name: taskGroup.name });

Expand Down

0 comments on commit 5c80ed0

Please sign in to comment.