Skip to content

Commit

Permalink
backport of commit 4708e06 (#24490)
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Renaud <[email protected]>
  • Loading branch information
hc-github-team-nomad-core and philrenaud authored Dec 3, 2024
1 parent 5299501 commit 9bcbf82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .changelog/24466.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix a bug where namespaced jobs wouldn't show diffs on the versions page
```
29 changes: 13 additions & 16 deletions ui/app/adapters/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,8 @@ export default class JobAdapter extends WatchableNamespaceIDs {
}

getVersions(job, diffVersion) {
const url = addToPath(
this.urlForFindRecord(job.get('id'), 'job'),
'/versions'
);

const namespace = job.get('namespace.name') || 'default';

const query = {
namespace,
diffs: true,
};

if (diffVersion) {
query.diff_version = diffVersion;
}
return this.ajax(url, 'GET', { data: query });
let url = this.urlForVersions(job, diffVersion);
return this.ajax(url, 'GET');
}

/**
Expand Down Expand Up @@ -308,6 +294,17 @@ export default class JobAdapter extends WatchableNamespaceIDs {
return result;
}

urlForVersions(job, diffVersion) {
let url = this.urlForFindRecord(job.get('id'), 'job', null, 'versions');

let paramString = 'diffs=true';
if (diffVersion) {
paramString += `&diff_version=${diffVersion}`;
}
url = addToPath(url, '', paramString);
return url;
}

urlForQuery(query, modelName, method) {
let baseUrl = `/${this.namespace}/jobs/statuses`;
if (method === 'POST' && query.index) {
Expand Down

0 comments on commit 9bcbf82

Please sign in to comment.