Skip to content

Commit

Permalink
[ui] Fixes double-namespace-query-param when getting versions (#24466)
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud authored Nov 19, 2024
1 parent a420732 commit 4708e06
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 @@ -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');
}

/**
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4708e06

Please sign in to comment.