Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/23404.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: added a Pack badge to the jobs index page for jobs run via Nomad Pack
```
2 changes: 2 additions & 0 deletions nomad/job_endpoint_statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions nomad/structs/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/child-job-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 1 addition & 3 deletions ui/app/models/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion ui/app/routes/jobs/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];

Expand Down
3 changes: 1 addition & 2 deletions ui/app/templates/jobs/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading