Skip to content

Commit 7d15bdf

Browse files
authored
fix(orchestrator):UI enhancement (#1363)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent b75eb0d commit 7d15bdf

7 files changed

Lines changed: 50 additions & 24 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
3+
---
4+
5+
UI fixes

workspaces/orchestrator/plugins/orchestrator/src/components/InfoDialog.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,34 @@ export type InfoDialogProps = {
3939
export type ParentComponentRef = HTMLDivElement;
4040

4141
const useStyles = makeStyles()(theme => ({
42+
dialogTitle: {
43+
display: 'flex',
44+
alignItems: 'center',
45+
justifyContent: 'space-between',
46+
},
47+
titleContent: {
48+
display: 'flex',
49+
alignItems: 'center',
50+
gap: theme.spacing(1),
51+
},
52+
titleText: {
53+
lineHeight: 1,
54+
margin: 0,
55+
},
4256
closeBtn: {
4357
flexShrink: 0,
4458
},
4559
dialogActions: {
4660
justifyContent: 'flex-start',
4761
paddingLeft: theme.spacing(3),
48-
paddingBottom: theme.spacing(2),
62+
paddingTop: 0,
63+
paddingBottom: theme.spacing(4),
4964
},
5065
dialogContent: {
5166
'& > div': {
5267
backgroundColor: 'transparent',
5368
},
5469
},
55-
titleContainer: {
56-
display: 'flex',
57-
},
58-
title: {
59-
width: '100%',
60-
},
61-
titleIcon: {
62-
marginRight: theme.spacing(1),
63-
},
6470
}));
6571

6672
export const RefForwardingInfoDialog: ForwardRefRenderFunction<
@@ -89,12 +95,13 @@ export const RefForwardingInfoDialog: ForwardRefRenderFunction<
8995
}}
9096
>
9197
<DialogTitle>
92-
<Box className={classes.titleContainer}>
93-
{titleIcon && <Box className={classes.titleIcon}>{titleIcon}</Box>}
94-
95-
<Typography variant="h4" className={classes.title}>
96-
<b>{title}</b>
97-
</Typography>
98+
<Box className={classes.dialogTitle}>
99+
<Box className={classes.titleContent}>
100+
{titleIcon}
101+
<Typography variant="h4" className={classes.titleText}>
102+
<b>{title}</b>
103+
</Typography>
104+
</Box>
98105

99106
<IconButton
100107
className={classes.closeBtn}

workspaces/orchestrator/plugins/orchestrator/src/components/OrchestratorPage/InputSchemaDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const InputSchemaDialogContent = ({
5858
) : (
5959
<JsonCodeBlock
6060
isDarkMode={isDarkMode}
61+
maxHeight={400}
6162
value={inputSchema?.inputSchema}
6263
/>
6364
)}

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowInstancePage/VariablesDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const VariablesDialog = ({
5353
>
5454
{hasVariables ? (
5555
Object.entries(instanceVariables).map(([key, value]) => (
56-
<Box key={key} m={2}>
56+
<Box key={key} mt={2} mb={2}>
5757
<Typography variant="h6" mb={1}>
5858
{capitalize(key)}
5959
</Typography>

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowInstancePage/WorkflowInstancePage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ export const WorkflowInstancePage = () => {
446446
<ArrowDropDown />
447447
) : null
448448
}
449-
style={{ color: 'white' }}
450449
>
451450
{value.state === ProcessInstanceStatusDTO.Active ? (
452451
<>

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowInstancePage/WorkflowInstancePageContent.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ const useStyles = makeStyles()(() => ({
8080
cardClassName: {
8181
overflow: 'auto',
8282
},
83+
titleContainer: {
84+
display: 'flex',
85+
justifyContent: 'space-between',
86+
alignItems: 'center',
87+
},
8388
}));
8489

8590
export const WorkflowInstancePageContent: React.FC<{
@@ -156,11 +161,15 @@ export const WorkflowInstancePageContent: React.FC<{
156161
<Grid container spacing={2}>
157162
<Grid item xs={6}>
158163
<InfoCard
159-
title="Details"
164+
title={
165+
<div className={classes.titleContainer}>
166+
<span>Details</span>
167+
{viewVariables}
168+
</div>
169+
}
160170
divider={false}
161171
className={classes.topRowCard}
162172
cardClassName={classes.cardClassName}
163-
icon={viewVariables}
164173
>
165174
<WorkflowRunDetails details={details} />
166175
</InfoCard>

workspaces/orchestrator/plugins/orchestrator/src/components/ui/JsonCodeBlock.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import Paper from '@mui/material/Paper';
2323
import Tooltip from '@mui/material/Tooltip';
2424
import { makeStyles } from 'tss-react/mui';
2525

26-
const useStyles = makeStyles<{ isDarkMode: boolean }>()(
27-
(theme, { isDarkMode }) => ({
26+
const useStyles = makeStyles<{ isDarkMode: boolean; maxHeight?: number }>()(
27+
(theme, { isDarkMode, maxHeight }) => ({
2828
root: {
2929
position: 'relative',
3030
paddingTop: theme.spacing(2),
@@ -36,7 +36,7 @@ const useStyles = makeStyles<{ isDarkMode: boolean }>()(
3636
iconButton: {
3737
position: 'absolute',
3838
top: 8,
39-
right: 8,
39+
right: maxHeight ? 24 : 8,
4040
},
4141
copyIcon: {
4242
color: isDarkMode ? '#B0B0B0' : '#4D4D4D',
@@ -48,20 +48,25 @@ const useStyles = makeStyles<{ isDarkMode: boolean }>()(
4848
whiteSpace: 'pre-wrap',
4949
wordBreak: 'break-word',
5050
color: isDarkMode ? '#B0B0B0' : '#4D4D4D',
51+
maxHeight: maxHeight || 'none',
52+
overflowY: maxHeight ? 'auto' : 'visible',
53+
overflowX: 'hidden',
5154
},
5255
}),
5356
);
5457

5558
export const JsonCodeBlock = ({
5659
value,
5760
isDarkMode,
61+
maxHeight,
5862
}: {
5963
value: object;
6064
isDarkMode: boolean;
65+
maxHeight?: number;
6166
}) => {
6267
const jsonString = JSON.stringify(value, null, 2);
6368
const [copied, setCopied] = React.useState(false);
64-
const { classes } = useStyles({ isDarkMode });
69+
const { classes } = useStyles({ isDarkMode, maxHeight });
6570

6671
const handleCopy = async () => {
6772
await window.navigator.clipboard.writeText(jsonString);

0 commit comments

Comments
 (0)