Skip to content

Commit

Permalink
HARMONY-398: Only send disallowUser for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnyinverso committed Oct 11, 2023
1 parent ebc2f4f commit 2b1cc67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions public/js/workflow-ui/jobs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ import JobsStatusChangeLinks from './jobs-status-change-links.js';
import toasts from '../toasts.js';

const params = {};
params.disallowStatus = document.getElementsByName('disallowStatus')[0].checked ? 'on' : '';
params.disallowService = document.getElementsByName('disallowService')[0].checked ? 'on' : '';
params.disallowUser = document.getElementsByName('disallowUser')[0].checked ? 'on' : '';

const tableFilter = document.querySelector('input[name="tableFilter"]');
const isAdminRoute = tableFilter.getAttribute('data-is-admin-route') === 'true';
params.isAdminRoute = isAdminRoute;
params.tableFilter = tableFilter.getAttribute('data-value');
params.currentUser = tableFilter.getAttribute('data-current-user');
params.services = JSON.parse(tableFilter.getAttribute('data-services'));
params.isAdminRoute = tableFilter.getAttribute('data-is-admin-route') === 'true';

params.disallowStatus = document.getElementsByName('disallowStatus')[0].checked ? 'on' : '';
params.disallowService = document.getElementsByName('disallowService')[0].checked ? 'on' : '';
if (isAdminRoute) {
params.disallowUser = document.getElementsByName('disallowUser')[0].checked ? 'on' : '';
}
jobsTable.init(params);

const jobStatusLinks = new JobsStatusChangeLinks();
Expand Down
6 changes: 4 additions & 2 deletions public/js/workflow-ui/jobs/jobs-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ async function loadRows(params) {
let tableUrl = './workflow-ui/jobs';
tableUrl += `?tableFilter=${encodeURIComponent(params.tableFilter)}`
+ `&disallowStatus=${params.disallowStatus}`
+ `&disallowService=${params.disallowService}`
+ `&disallowUser=${params.disallowUser}`;
+ `&disallowService=${params.disallowService}`;
if (params.disallowUser) {
tableUrl += `&disallowUser=${params.disallowUser}`;
}
const res = await fetch(tableUrl, {
method: 'POST',
headers: {
Expand Down

0 comments on commit 2b1cc67

Please sign in to comment.