Skip to content
Snippets Groups Projects
Commit 349074cb authored by Zoltan Runyo's avatar Zoltan Runyo
Browse files

ICSHWI-7456: Modify deployment stepper and date time handling/presentation

parent 5dc53257
No related branches found
No related tags found
1 merge request!44ICSHWI-7456
...@@ -26,7 +26,7 @@ export function searchInArray(array, searchText) { ...@@ -26,7 +26,7 @@ export function searchInArray(array, searchText) {
export const formatDate = (value) => { export const formatDate = (value) => {
if (value) { if (value) {
return moment(value).format('YYYY.MM.DD HH:mm:ss'); return moment(value).format('DD/MM/YYYY HH:mm:ss');
} }
return null; return null;
} }
......
...@@ -48,8 +48,8 @@ export function DeploymentDetails({ deployment, getDeployment, onDeploymentStart ...@@ -48,8 +48,8 @@ export function DeploymentDetails({ deployment, getDeployment, onDeploymentStart
"Git reference": deployment.version.sourceVersion, "Git reference": deployment.version.sourceVersion,
host: <Typography><Link to={`/hosts/${deployment.host.csEntryId}`}>{deployment.host.host}</Link></Typography>, host: <Typography><Link to={`/hosts/${deployment.host.csEntryId}`}>{deployment.host.host}</Link></Typography>,
repository: deployment.version.sourceUrl, repository: deployment.version.sourceUrl,
"start time": formatDate(deployment.startDate), "start time": deployment.startDate ? formatDate(deployment.startDate) : "-",
duration: deployment.duration + " s" "end time": deployment.endDate ? formatDate(deployment.endDate) : "-"
} }
const theme = createMuiTheme(); const theme = createMuiTheme();
...@@ -67,7 +67,7 @@ export function DeploymentDetails({ deployment, getDeployment, onDeploymentStart ...@@ -67,7 +67,7 @@ export function DeploymentDetails({ deployment, getDeployment, onDeploymentStart
<CardContent> <CardContent>
<div className={classes.stepperContainer}> <div className={classes.stepperContainer}>
<DeploymentStepper activeStep={["created", "pending", "running", "successful"].indexOf(deployment.status.toLowerCase())} deploymentStatus={deployment.status} <DeploymentStepper activeStep={["created", "pending", "running", "successful"].indexOf(deployment.status.toLowerCase())} deploymentStatus={deployment.status}
deploymentJob={deploymentJob} /> deploymentStart={deployment.startDate} />
</div> </div>
</CardContent> </CardContent>
{deployment.manual && {deployment.manual &&
......
import React, { useRef, useState, useEffect } from 'react'; import React, { useRef, useState, useEffect } from 'react';
import { LinearProgress } from '@material-ui/core'; import { LinearProgress, Typography } from '@material-ui/core';
import { useDeploymentJob } from '../../api/SwaggerApi'; import { useDeploymentJob } from '../../api/SwaggerApi';
export function DeploymentJobOutput({ awxJobId, update }) { export function DeploymentJobOutput({ awxJobId, update }) {
...@@ -31,19 +31,36 @@ export function DeploymentJobOutput({ awxJobId, update }) { ...@@ -31,19 +31,36 @@ export function DeploymentJobOutput({ awxJobId, update }) {
}, [deploymentJob, firstTime]); }, [deploymentJob, firstTime]);
return deploymentJob?.job.started ? return deploymentJob?.job.started ?
<div <div style={{
ref={stdoutRef} minHeight: "520px",
style={{ maxHeight: "520px",
overflow: "auto",
minHeight: "500px",
maxHeight: "500px",
width: "100%", width: "100%",
color: "white", }}>
backgroundColor: "black", <div style={{
paddingLeft: "10px", display: "flex",
paddingRight: "10px", alignItems: "center"
}} }}>
dangerouslySetInnerHTML={{ __html: deploymentJob.stdout }} <Typography variant="overline">DURATION: </Typography>
/> <Typography style={{
marginLeft: "6px",
}}>
{deploymentJob?.job.elapsed.toFixed(0)} s
</Typography>
</div>
<div
ref={stdoutRef}
style={{
overflow: "auto",
minHeight: "500px",
maxHeight: "500px",
width: "100%",
color: "white",
backgroundColor: "black",
paddingLeft: "10px",
paddingRight: "10px",
}}
dangerouslySetInnerHTML={{ __html: deploymentJob.stdout }}
/>
</div>
: <div style={{ width: "100%" }}><LinearProgress color="primary" /></div> : <div style={{ width: "100%" }}><LinearProgress color="primary" /></div>
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; ...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { makeStyles, withStyles } from '@material-ui/core/styles'; import { makeStyles, withStyles } from '@material-ui/core/styles';
import clsx from 'clsx'; import clsx from 'clsx';
import {Stepper, Step, StepLabel, StepConnector, Hidden} from '@material-ui/core'; import {Stepper, Step, StepLabel, StepConnector, Hidden} from '@material-ui/core';
import { PlayArrow, Check, ErrorOutline } from "@material-ui/icons"; import { Person, ScheduleOutlined, RotateRightOutlined, CheckCircleOutline } from "@material-ui/icons";
import { theme } from "../../Theme"; import { theme } from "../../Theme";
const useStyles = makeStyles({ const useStyles = makeStyles({
...@@ -89,9 +89,10 @@ function ColorlibStepIcon(props) { ...@@ -89,9 +89,10 @@ function ColorlibStepIcon(props) {
const { active, completed, error } = props; const { active, completed, error } = props;
const icons = { const icons = {
"active": <PlayArrow />, 1: <Person />,
"completed": <Check />, 2: <ScheduleOutlined />,
"error": <ErrorOutline />, 3: <RotateRightOutlined />,
4: <CheckCircleOutline />,
}; };
return ( return (
...@@ -102,7 +103,7 @@ function ColorlibStepIcon(props) { ...@@ -102,7 +103,7 @@ function ColorlibStepIcon(props) {
[classes.error]: error, [classes.error]: error,
})} })}
> >
{error ? icons["error"] : (completed ? icons["completed"] : active ? icons["active"] : <></>)} {icons[String(props.icon)]}
</div> </div>
); );
} }
...@@ -124,7 +125,7 @@ ColorlibStepIcon.propTypes = { ...@@ -124,7 +125,7 @@ ColorlibStepIcon.propTypes = {
export function DeploymentStepper(props) { export function DeploymentStepper(props) {
const classes = useStyles(theme); const classes = useStyles(theme);
let {activeStep, deploymentStatus, deploymentJob} = props; let {activeStep, deploymentStatus, deploymentStart } = props;
const isStepFailed = (step) => { const isStepFailed = (step) => {
if (deploymentStatus === "FAILED") { if (deploymentStatus === "FAILED") {
...@@ -135,7 +136,7 @@ export function DeploymentStepper(props) { ...@@ -135,7 +136,7 @@ export function DeploymentStepper(props) {
console.log(activeStep); console.log(activeStep);
if (deploymentStatus === "FAILED") { if (deploymentStatus === "FAILED") {
activeStep = deploymentJob?.job.started ? 2 : 1; activeStep = deploymentStart ? 2 : 1;
} }
activeStep = activeStep === 3 ? 4 : activeStep; activeStep = activeStep === 3 ? 4 : activeStep;
......
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