diff --git a/packages/diracx-web-components/src/components/JobMonitor/JobDataService.ts b/packages/diracx-web-components/src/components/JobMonitor/JobDataService.ts index b6b4424..1806e6b 100644 --- a/packages/diracx-web-components/src/components/JobMonitor/JobDataService.ts +++ b/packages/diracx-web-components/src/components/JobMonitor/JobDataService.ts @@ -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"; @@ -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]); } /** @@ -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]); }