Skip to content
Snippets Groups Projects
Commit 0d30328b authored by Imre Toth's avatar Imre Toth
Browse files

Icshwi 11561 removing some async calls

parent 154f6968
No related branches found
No related tags found
2 merge requests!270Merging develop branch to master in order to create RC,!247Icshwi 11561 removing some async calls
import { useEffect } from "react";
import {
useTagsAndCommitIds,
useCSentryHost,
useIocStatus
} from "../../api/SwaggerApi";
import { useTagsAndCommitIds, useIocStatus } from "../../api/SwaggerApi";
function onError(message) {
console.warn(message);
......@@ -11,18 +7,15 @@ function onError(message) {
export function IOCDetailFetcher({ ioc, index, setIocs }) {
const [tagOrCommitId, getTagOrCommitId] = useTagsAndCommitIds(onError);
const [host, getHost] = useCSentryHost(onError);
const [iocStatus, getIocStatus] = useIocStatus();
useEffect(() => {
if (ioc.sourceVersion) {
getTagOrCommitId(ioc.gitProjectId, ioc.sourceVersion);
}
if (ioc.activeDeployment) {
getHost(ioc.activeDeployment.host.externalHostId);
}
getIocStatus(ioc.id);
}, [ioc, getTagOrCommitId, getHost, getIocStatus]);
}, [ioc, getTagOrCommitId, getIocStatus]);
useEffect(() => {
setIocs((iocs) => {
......@@ -30,12 +23,12 @@ export function IOCDetailFetcher({ ioc, index, setIocs }) {
tagOrCommitId?.length === 1
? tagOrCommitId[0].shortReference
: iocs[index].sourceVersionShort;
iocs[index].host = host ?? iocs[index].host;
iocs[index].host = iocs[index].activeDeployment?.host;
iocs[index].alert = iocStatus?.alertSeverity ?? iocs[index].alert;
iocs[index].active = iocStatus?.active ?? iocs[index].active;
return [...iocs];
});
}, [index, setIocs, tagOrCommitId, host, iocStatus]);
}, [index, setIocs, tagOrCommitId, iocStatus]);
return null;
}
import React, { useEffect } from "react";
import { useTagsAndCommitIds, useCSentryHost } from "../../api/SwaggerApi";
import { useTagsAndCommitIds } from "../../api/SwaggerApi";
import { JobTable } from "./JobTable";
export function JobAsyncList({
......@@ -45,7 +45,6 @@ function onError(message) {
export function JobDetailFetcher({ deployment, index, setDeployments }) {
const [tagOrCommitId, getTagOrCommitId] = useTagsAndCommitIds(onError);
const [host, getHost] = useCSentryHost(onError);
useEffect(() => {
getTagOrCommitId(
......@@ -54,8 +53,7 @@ export function JobDetailFetcher({ deployment, index, setDeployments }) {
false,
"EQUALS"
);
getHost(deployment.host.externalHostId);
}, [deployment, getTagOrCommitId, getHost]);
}, [deployment, getTagOrCommitId]);
useEffect(() => {
setDeployments((deployments) => {
......@@ -63,11 +61,10 @@ export function JobDetailFetcher({ deployment, index, setDeployments }) {
tagOrCommitId?.length === 1
? tagOrCommitId[0].shortReference
: deployments[index].gitReference;
deployments[index].host = host ?? deployments[index].host;
deployments[index].host.hostInfoFromCache = !host;
deployments[index].host.hostInfoFromCache = false;
return [...deployments];
});
}, [index, setDeployments, tagOrCommitId, host]);
}, [index, setDeployments, tagOrCommitId]);
return null;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment