Skip to content

Commit

Permalink
fix(JobDataService): API breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Dec 19, 2024
1 parent 9c9dbe3 commit a5ae50b
Showing 1 changed file with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import useSWR, { mutate } from "swr";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";

dayjs.extend(utc);
import { fetcher } from "../../hooks/utils";
import { Filter, SearchBody, Job, JobHistory } from "../../types";

Expand Down Expand Up @@ -91,8 +94,20 @@ export function killJobs(
accessToken: string,
): Promise<{ headers: Headers; data: number[] }> {
const queryString = selectedIds.map((id) => `job_ids=${id}`).join("&");
const killUrl = `/api/jobs/kill?${queryString}`;
return fetcher([killUrl, accessToken, "POST"]);
const killUrl = `/api/jobs/status?${queryString}`;

const currentDate = dayjs()
.utc()
.format("YYYY-MM-DDTHH:mm:ss[Z]SSSSSS[Z]")
.toString();
const body = {
[currentDate]: {
Status: "Killed",
MinorStatus: "Marked for termination",
Source: "JobManager",
},
};
return fetcher([killUrl, accessToken, "PATCH", body]);
}

/**
Expand Down Expand Up @@ -121,6 +136,12 @@ export function getJobHistory(
jobId: number,
accessToken: string,
): Promise<{ headers: Headers; data: { [key: number]: JobHistory[] } }> {
const historyUrl = `/api/jobs/${jobId}/status/history`;
return fetcher([historyUrl, accessToken]);
const historyUrl = `/api/jobs/search`;

const body = {
parameters: ["LoggingInfo"],
operator: "eq",
value: jobId,
};
return fetcher([historyUrl, accessToken, "POST", body]);
}

0 comments on commit a5ae50b

Please sign in to comment.