From 3a1ae24b149e38ab8b81bb26a829e17751cd1a12 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Tue, 19 Nov 2024 15:53:37 +0000 Subject: [PATCH] backport of commit 4708e06199d539292dd80eda331998e3d20871b8 --- .changelog/24466.txt | 3 +++ ui/app/adapters/job.js | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 .changelog/24466.txt 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) {