From c89365a66f7a0c66c19ca597223d4f72918dcd6c Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Fri, 15 Nov 2024 10:20:41 -0500 Subject: [PATCH] I was holding addToPath wrong; fixed --- .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) {