Skip to content
Snippets Groups Projects
Commit 25454fb2 authored by Johanna Szepanski's avatar Johanna Szepanski
Browse files

Merge branch 'CE-2889-modify-ioc-endpoints' into 'develop'

CE-2889: Modify ioc endpoints

See merge request !490
parents 5dea1915 74d7a036
No related branches found
No related tags found
2 merge requests!497CE-2790: Prepare for 4.0.0,!490CE-2889: Modify ioc endpoints
Pipeline #192422 waiting for manual action
...@@ -22,7 +22,7 @@ export function DeployIOC({ ...@@ -22,7 +22,7 @@ export function DeployIOC({
wrapper: action, wrapper: action,
error: deployError error: deployError
} = useAPIMethod({ } = useAPIMethod({
fcn: client.apis.IOCs.updateAndDeployIoc, fcn: client.apis.IOCs.startOperation,
call: false call: false
}); });
...@@ -56,7 +56,7 @@ export function DeployIOC({ ...@@ -56,7 +56,7 @@ export function DeployIOC({
submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix. submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix.
return ( return (
<Navigate <Navigate
to={`/jobs/${deployment.operationId}`} to={`/jobs/${deployment.id}`}
push push
/> />
); );
......
...@@ -107,7 +107,8 @@ export function IOCDeployDialog({ ...@@ -107,7 +107,8 @@ export function IOCDeployDialog({
requestBody: { requestBody: {
sourceUrl: git, sourceUrl: git,
sourceVersion: revision.reference, sourceVersion: revision.reference,
hostId: host.hostId hostId: host.hostId,
type: "DEPLOY"
} }
} }
); );
......
...@@ -5,13 +5,7 @@ import { ...@@ -5,13 +5,7 @@ import {
Typography, Typography,
Tooltip Tooltip
} from "@mui/material"; } from "@mui/material";
import React, { import React, { useState, useEffect, useContext, useCallback } from "react";
useState,
useEffect,
useContext,
useCallback,
useMemo
} from "react";
import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common"; import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common";
import Alert from "@mui/material/Alert"; import Alert from "@mui/material/Alert";
import { initRequestParams } from "../../common/Helper"; import { initRequestParams } from "../../common/Helper";
...@@ -36,21 +30,13 @@ export function IOCService({ ...@@ -36,21 +30,13 @@ export function IOCService({
const client = useContext(apiContext); const client = useContext(apiContext);
const params = useMemo(
() => ({
ioc_id: ioc?.id
}),
[ioc?.id]
);
const { const {
value: startJob, value: startJob,
wrapper: startIOC, wrapper: startIOC,
error: startJobError error: startJobError
} = useAPIMethod({ } = useAPIMethod({
fcn: client.apis.IOCs.startIoc, fcn: client.apis.IOCs.startOperation,
call: false, call: false
params
}); });
const { const {
...@@ -58,9 +44,8 @@ export function IOCService({ ...@@ -58,9 +44,8 @@ export function IOCService({
wrapper: stopIOC, wrapper: stopIOC,
error: stopJobError error: stopJobError
} = useAPIMethod({ } = useAPIMethod({
fcn: client.apis.IOCs.stopIoc, fcn: client.apis.IOCs.startOperation,
call: false, call: false
params
}); });
useEffect(() => { useEffect(() => {
...@@ -93,7 +78,16 @@ export function IOCService({ ...@@ -93,7 +78,16 @@ export function IOCService({
setInProgress(true); setInProgress(true);
setButtonDisabled(true); setButtonDisabled(true);
startIOC(); startIOC(
{
ioc_id: ioc.id
},
{
requestBody: {
type: "START"
}
}
);
let requestParams = initRequestParams(jobLazyParams); let requestParams = initRequestParams(jobLazyParams);
...@@ -113,7 +107,16 @@ export function IOCService({ ...@@ -113,7 +107,16 @@ export function IOCService({
setInProgress(true); setInProgress(true);
setButtonDisabled(true); setButtonDisabled(true);
stopIOC(); stopIOC(
{
ioc_id: ioc.id
},
{
requestBody: {
type: "STOP"
}
}
);
let requestParams = initRequestParams(jobLazyParams); let requestParams = initRequestParams(jobLazyParams);
......
...@@ -25,9 +25,16 @@ export function IOCUndeployDialog({ ...@@ -25,9 +25,16 @@ export function IOCUndeployDialog({
}; };
const onConfirm = () => { const onConfirm = () => {
submitCallback({ submitCallback(
ioc_id: ioc.id {
}); ioc_id: ioc.id
},
{
requestBody: {
type: "UNDEPLOY"
}
}
);
}; };
return ( return (
......
...@@ -20,7 +20,7 @@ export function UndeployIOC({ ...@@ -20,7 +20,7 @@ export function UndeployIOC({
wrapper: action, wrapper: action,
error: deploymentError error: deploymentError
} = useAPIMethod({ } = useAPIMethod({
fcn: client.apis.IOCs.createUndeployment, fcn: client.apis.IOCs.startOperation,
call: false call: false
}); });
...@@ -47,7 +47,7 @@ export function UndeployIOC({ ...@@ -47,7 +47,7 @@ export function UndeployIOC({
submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix. submitCallback(); // This works but throws a warning because I am changing state in the parent while the child is rerendering. Not sure yet how to fix.
return ( return (
<Navigate <Navigate
to={`/jobs/${deployment.operationId}`} to={`/jobs/${deployment.id}`}
push push
/> />
); );
......
...@@ -103,7 +103,8 @@ export const JobDetails = ({ operation, job }) => { ...@@ -103,7 +103,8 @@ export const JobDetails = ({ operation, job }) => {
); );
useEffect(() => { useEffect(() => {
setAlerts([createAlert(jobOperation, job), ...operation.alerts]); const operationAlerts = operation.alerts ? operation.alerts : [];
setAlerts([createAlert(jobOperation, job), ...operationAlerts]);
}, [operation, job, jobOperation]); }, [operation, job, jobOperation]);
return ( return (
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment