diff --git a/.changelog/24466.txt b/.changelog/24466.txt new file mode 100644 index 00000000000..97942b5de01 --- /dev/null +++ b/.changelog/24466.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix a bug where namespaced jobs wouldn't show diffs on the versions page +``` diff --git a/ui/app/adapters/job.js b/ui/app/adapters/job.js index 1d195876cdd..731724c0862 100644 --- a/ui/app/adapters/job.js +++ b/ui/app/adapters/job.js @@ -172,22 +172,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'); } /** @@ -276,6 +262,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) {