[ui] Pack metadata booleanified and added to the statuses endpoint (#23404)

* Pack metadata booleanified and added to the statuses endpoint

* Simplify job.IsPack declaration
This commit is contained in:
Phil Renaud
2024-07-19 11:16:43 -04:00
committed by GitHub
parent cf6ce224b3
commit 5df6fe6a57
7 changed files with 9 additions and 7 deletions

3
.changelog/23404.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:improvement
ui: added a Pack badge to the jobs index page for jobs run via Nomad Pack
```

View File

@@ -221,6 +221,8 @@ func jobStatusesJobFromJob(ws memdb.WatchSet, store *state.StateStore, job *stru
Status: job.Status,
}
_, jsj.IsPack = job.Meta["pack.name"]
// the GroupCountSum will map to how many allocations we expect to run
// (for service jobs)
for _, tg := range job.TaskGroups {

View File

@@ -98,6 +98,7 @@ type JobStatusesJob struct {
ParentID string
LatestDeployment *JobStatusesLatestDeployment
Stop bool // has the job been manually stopped?
IsPack bool // is pack metadata present?
Status string
}

View File

@@ -17,7 +17,7 @@
>
{{@job.name}}
{{#if @job.meta.structured.pack}}
{{#if @job.isPack}}
<span data-test-pack-tag class="tag is-pack">
{{x-icon "box" class= "test"}}
<span>Pack</span>

View File

@@ -302,9 +302,7 @@ export default class Job extends Model {
}
@fragment('structured-attributes') meta;
get isPack() {
return !!this.meta?.structured?.pack;
}
@attr('boolean') isPack;
/**
* A task with a schedule block can have execution paused at specific cron-based times.

View File

@@ -44,7 +44,6 @@ export default class JobRoute extends Route.extend(WithWatchers) {
const relatedModelsQueries = [
job.get('allocations'),
job.get('evaluations'),
// this.store.query('job', { namespace, meta: true }), // TODO: I think I am probably nuking the ability to get meta:pack info here. See https://github.com/hashicorp/nomad/pull/14833
this.store.findAll('namespace'),
];

View File

@@ -157,8 +157,7 @@
class="is-primary"
>
{{B.data.name}}
{{!-- TODO: going to lose .meta with statuses endpoint! --}}
{{#if B.data.meta.structured.pack}}
{{#if B.data.isPack}}
<span data-test-pack-tag class="tag is-pack">
{{x-icon "box" class= "test"}}
<span>Pack</span>