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

moved ACTION TYPES from jobData to jobUtils

parent c5721f2c
No related branches found
No related tags found
2 merge requests!612Release 5.0.0,!594CE-3447: Improve batch presentation
export const ACTION_TYPES = {
DEPLOY: "DEPLOY",
UNDEPLOY: "UNDEPLOY",
BATCH_DEPLOY: "BATCH_DEPLOY",
BATCH_UNDEPLOY: "BATCH_UNDEPLOY",
START: "START",
STOP: "STOP"
};
import { useMemo } from "react"; import { useMemo } from "react";
import { Stack, Typography } from "@mui/material"; import { Stack, Typography } from "@mui/material";
import { InternalLink } from "@ess-ics/ce-ui-common"; import { InternalLink } from "@ess-ics/ce-ui-common";
import { getNoOfIOCs, getNoOfHosts, isBatchJob } from "../JobUtils"; import {
ACTION_TYPES,
getNoOfIOCs,
getNoOfHosts,
isBatchJob
} from "../JobUtils";
import { ActionTypeIconText } from "../JobIcons"; import { ActionTypeIconText } from "../JobIcons";
import { ACTION_TYPES } from "../JobData";
import { JobRevisionChip } from "../JobRevisionChip"; import { JobRevisionChip } from "../JobRevisionChip";
import { Job } from "../../../store/deployApi"; import { Job } from "../../../store/deployApi";
......
import { EllipsisText, InternalLink } from "@ess-ics/ce-ui-common";
import { Typography } from "@mui/material";
export const ACTION_TYPES = {
DEPLOY: "DEPLOY",
UNDEPLOY: "UNDEPLOY",
BATCH_DEPLOY: "BATCH_DEPLOY",
BATCH_UNDEPLOY: "BATCH_UNDEPLOY",
START: "START",
STOP: "STOP"
};
export const isBatchJob = (action) =>
action === ACTION_TYPES.BATCH_DEPLOY ||
action === ACTION_TYPES.BATCH_UNDEPLOY;
export const isDeploymentJob = (action) =>
action === ACTION_TYPES.BATCH_DEPLOY || action === ACTION_TYPES.DEPLOY;
export const getNoOfIOCs = (jobs) =>
[...new Set(jobs.map((job) => job.iocId))].length;
export const getNoOfHosts = (jobs) =>
[...new Set(jobs.map((job) => job.host.hostId))].length;
export const calculateHostText = (job) => {
// host is resolvable => show link for users
if (job?.host?.hostId && job?.host?.externalIdValid) {
return (
<InternalLink
to={`/hosts/${job.host.hostId}`}
label={`Host Details, ${job.host.fqdn}`}
width="100%"
>
<EllipsisText>{job.host.fqdn}</EllipsisText>
</InternalLink>
);
}
// gray out hostname if it is from cache
return (
<Typography color="gray">
<EllipsisText>{job?.host?.fqdn}</EllipsisText>
</Typography>
);
};
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