Fixed Accordion width problem and Edit Sequence Button render for No Visualizaed Graphs and minor css fixes (#2937)
Signed-off-by: Sayan Mondal <sayan@chaosnative.com>
This commit is contained in:
parent
c9ac99b947
commit
f693470827
|
@ -29,6 +29,7 @@ import { cronWorkflow, workflowOnce } from '../../utils/workflowTemplate';
|
||||||
import { fetchWorkflowNameFromManifest } from '../../utils/yamlUtils';
|
import { fetchWorkflowNameFromManifest } from '../../utils/yamlUtils';
|
||||||
import SetTime from '../../views/CreateWorkflow/ScheduleWorkflow/SetTime';
|
import SetTime from '../../views/CreateWorkflow/ScheduleWorkflow/SetTime';
|
||||||
import useStyles from '../../views/CreateWorkflow/ScheduleWorkflow/styles';
|
import useStyles from '../../views/CreateWorkflow/ScheduleWorkflow/styles';
|
||||||
|
import { externalStyles } from './styles';
|
||||||
|
|
||||||
interface ScheduleSyntax {
|
interface ScheduleSyntax {
|
||||||
minute: string | undefined;
|
minute: string | undefined;
|
||||||
|
@ -180,6 +181,7 @@ const ScheduleWorkflow = () => {
|
||||||
}, [cronValue]);
|
}, [cronValue]);
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const externalClass = externalStyles();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
// Sets individual minutes
|
// Sets individual minutes
|
||||||
|
@ -390,7 +392,7 @@ const ScheduleWorkflow = () => {
|
||||||
<Typography className={classes.title}>
|
<Typography className={classes.title}>
|
||||||
{t('editSchedule.title')}
|
{t('editSchedule.title')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className={classes.root}>
|
<div className={externalClass.root}>
|
||||||
<div className={classes.innerContainer}>
|
<div className={classes.innerContainer}>
|
||||||
<br />
|
<br />
|
||||||
{/* Upper segment */}
|
{/* Upper segment */}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import { history } from '../../redux/configureStore';
|
||||||
import { RootState } from '../../redux/reducers';
|
import { RootState } from '../../redux/reducers';
|
||||||
import { getProjectID, getProjectRole } from '../../utils/getSearchParams';
|
import { getProjectID, getProjectRole } from '../../utils/getSearchParams';
|
||||||
import { fetchWorkflowNameFromManifest } from '../../utils/yamlUtils';
|
import { fetchWorkflowNameFromManifest } from '../../utils/yamlUtils';
|
||||||
import useStyles from './styles';
|
import { useStyles } from './styles';
|
||||||
|
|
||||||
interface URLParams {
|
interface URLParams {
|
||||||
workflowName: string;
|
workflowName: string;
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => ({
|
export const externalStyles = makeStyles((theme: Theme) => ({
|
||||||
|
root: {
|
||||||
|
background: theme.palette.background.paper,
|
||||||
|
color: theme.palette.text.primary,
|
||||||
|
padding: theme.spacing(0, 2),
|
||||||
|
margin: '0 auto',
|
||||||
|
width: '100%',
|
||||||
|
flexDirection: 'column',
|
||||||
|
[theme.breakpoints.up('lg')]: {
|
||||||
|
width: '99%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const useStyles = makeStyles((theme: Theme) => ({
|
||||||
horizontalLine: {
|
horizontalLine: {
|
||||||
background: theme.palette.border.main,
|
background: theme.palette.border.main,
|
||||||
},
|
},
|
||||||
|
@ -214,4 +228,3 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
margin: theme.spacing(2, 0),
|
margin: theme.spacing(2, 0),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
export default useStyles;
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
|
||||||
variables: { data: templateData.template_id },
|
variables: { data: templateData.template_id },
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
className={classes.deleteButton}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="delete"
|
alt="delete"
|
||||||
|
|
|
@ -57,6 +57,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
accordion: {
|
accordion: {
|
||||||
border: 'none',
|
border: 'none',
|
||||||
boxShadow: 'none',
|
boxShadow: 'none',
|
||||||
|
width: '100%',
|
||||||
'& .MuiAccordionSummary-root': {
|
'& .MuiAccordionSummary-root': {
|
||||||
marginLeft: '-1rem',
|
marginLeft: '-1rem',
|
||||||
border: 'none',
|
border: 'none',
|
||||||
|
@ -117,31 +118,36 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
},
|
},
|
||||||
|
|
||||||
'& #left-div': {
|
'& #left-div': {
|
||||||
width: '15rem',
|
width: '15%',
|
||||||
margin: theme.spacing(2),
|
margin: theme.spacing(2),
|
||||||
},
|
},
|
||||||
|
|
||||||
'& #right-div': {
|
'& #right-div': {
|
||||||
width: '30rem',
|
width: '30%',
|
||||||
margin: theme.spacing(0, 4, 0, 4),
|
margin: theme.spacing(0, 4, 0, 4),
|
||||||
},
|
},
|
||||||
'& #last-div': {
|
'& #last-div': {
|
||||||
width: '15rem',
|
width: '45%',
|
||||||
margin: theme.spacing(0, 4, 0, 4),
|
display: 'flex',
|
||||||
|
margin: theme.spacing(0, 2, 0, 2),
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lastDivChildren: {
|
lastDivChildren: {
|
||||||
width: '60%',
|
width: '10rem',
|
||||||
position: 'absolute',
|
// position: 'absolute',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-evenly',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
top: 14,
|
// top: 14,
|
||||||
},
|
},
|
||||||
templateIconBg: {
|
templateIconBg: {
|
||||||
height: 70,
|
height: 70,
|
||||||
marginLeft: theme.spacing(15),
|
marginLeft: '5%',
|
||||||
|
},
|
||||||
|
deleteButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
right: 20,
|
||||||
},
|
},
|
||||||
experimentIcon: {
|
experimentIcon: {
|
||||||
width: '3rem',
|
width: '3rem',
|
||||||
|
|
|
@ -24,11 +24,13 @@ interface StepType {
|
||||||
interface WorkflowPreviewProps {
|
interface WorkflowPreviewProps {
|
||||||
isCustomWorkflow: boolean;
|
isCustomWorkflow: boolean;
|
||||||
SequenceSteps?: StepType;
|
SequenceSteps?: StepType;
|
||||||
|
editSequenceLoader: (state: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WorkflowPreview: React.FC<WorkflowPreviewProps> = ({
|
const WorkflowPreview: React.FC<WorkflowPreviewProps> = ({
|
||||||
isCustomWorkflow,
|
isCustomWorkflow,
|
||||||
SequenceSteps,
|
SequenceSteps,
|
||||||
|
editSequenceLoader,
|
||||||
}) => {
|
}) => {
|
||||||
let steps: Steps[][] = [];
|
let steps: Steps[][] = [];
|
||||||
const updatedSteps: Steps[][] = [];
|
const updatedSteps: Steps[][] = [];
|
||||||
|
@ -208,6 +210,12 @@ const WorkflowPreview: React.FC<WorkflowPreviewProps> = ({
|
||||||
});
|
});
|
||||||
}, [manifest, SequenceSteps]);
|
}, [manifest, SequenceSteps]);
|
||||||
|
|
||||||
|
if (graphData.nodes.length > 0) {
|
||||||
|
editSequenceLoader(false);
|
||||||
|
} else {
|
||||||
|
editSequenceLoader(true);
|
||||||
|
}
|
||||||
|
|
||||||
return graphData.nodes.length ? (
|
return graphData.nodes.length ? (
|
||||||
<DagreGraph
|
<DagreGraph
|
||||||
className={classes.dagreGraph}
|
className={classes.dagreGraph}
|
||||||
|
|
|
@ -109,6 +109,8 @@ const TuneWorkflow = forwardRef((_, ref) => {
|
||||||
const [isEditorSaveAlertOpen, setIsEditorSaveAlertOpen] = useState(false);
|
const [isEditorSaveAlertOpen, setIsEditorSaveAlertOpen] = useState(false);
|
||||||
const [yamlValid, setYamlValid] = useState(true);
|
const [yamlValid, setYamlValid] = useState(true);
|
||||||
const [editSequence, setEditSequence] = useState(false);
|
const [editSequence, setEditSequence] = useState(false);
|
||||||
|
const [isVisualizationComplete, setIsVisualizationComplete] =
|
||||||
|
useState<boolean>(false);
|
||||||
const [steps, setSteps] = useState<StepType>({});
|
const [steps, setSteps] = useState<StepType>({});
|
||||||
const [workflow, setWorkflow] = useState<WorkflowProps>({
|
const [workflow, setWorkflow] = useState<WorkflowProps>({
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -209,6 +211,10 @@ const TuneWorkflow = forwardRef((_, ref) => {
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleEditSequenceRender = (state: boolean) => {
|
||||||
|
setIsVisualizationComplete(state);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Manifest Template
|
* Default Manifest Template
|
||||||
*/
|
*/
|
||||||
|
@ -782,7 +788,10 @@ const TuneWorkflow = forwardRef((_, ref) => {
|
||||||
<div className={classes.experimentWrapper}>
|
<div className={classes.experimentWrapper}>
|
||||||
{/* Edit Button */}
|
{/* Edit Button */}
|
||||||
{manifest !== '' && (
|
{manifest !== '' && (
|
||||||
<ButtonOutlined onClick={() => setEditSequence(true)}>
|
<ButtonOutlined
|
||||||
|
disabled={isVisualizationComplete}
|
||||||
|
onClick={() => setEditSequence(true)}
|
||||||
|
>
|
||||||
<img src="./icons/editsequence.svg" alt="Edit Sequence" />{' '}
|
<img src="./icons/editsequence.svg" alt="Edit Sequence" />{' '}
|
||||||
<Width width="0.5rem" />
|
<Width width="0.5rem" />
|
||||||
{t('createWorkflow.tuneWorkflow.editSequence')}
|
{t('createWorkflow.tuneWorkflow.editSequence')}
|
||||||
|
@ -817,6 +826,7 @@ const TuneWorkflow = forwardRef((_, ref) => {
|
||||||
<Row>
|
<Row>
|
||||||
<Width width="40%">
|
<Width width="40%">
|
||||||
<WorkflowPreview
|
<WorkflowPreview
|
||||||
|
editSequenceLoader={handleEditSequenceRender}
|
||||||
SequenceSteps={steps}
|
SequenceSteps={steps}
|
||||||
isCustomWorkflow={isCustomWorkflow}
|
isCustomWorkflow={isCustomWorkflow}
|
||||||
/>
|
/>
|
||||||
|
@ -838,7 +848,10 @@ const TuneWorkflow = forwardRef((_, ref) => {
|
||||||
<Row>
|
<Row>
|
||||||
{/* Argo Workflow Graph */}
|
{/* Argo Workflow Graph */}
|
||||||
<Width width="30%">
|
<Width width="30%">
|
||||||
<WorkflowPreview isCustomWorkflow={isCustomWorkflow} />
|
<WorkflowPreview
|
||||||
|
editSequenceLoader={handleEditSequenceRender}
|
||||||
|
isCustomWorkflow={isCustomWorkflow}
|
||||||
|
/>
|
||||||
</Width>
|
</Width>
|
||||||
{/* Workflow Table */}
|
{/* Workflow Table */}
|
||||||
<Width width="70%">
|
<Width width="70%">
|
||||||
|
|
Loading…
Reference in New Issue