Skip to content

Commit 7032c17

Browse files
authored
fix(orchestrator):[UI] Layout errors with workflow details screen (#403)
* fix(orchestrator):[UI] Layout errors with workflow details screen Signed-off-by: Lior Soffer <[email protected]> * fix spaces Signed-off-by: Lior Soffer <[email protected]> * fix Signed-off-by: Lior Soffer <[email protected]> --------- Signed-off-by: Lior Soffer <[email protected]>
1 parent 94dbaf8 commit 7032c17

File tree

6 files changed

+59
-57
lines changed

6 files changed

+59
-57
lines changed
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+
Update the workflow details screen to match the latest Figma design

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

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export const WorkflowInstancePage = ({
200200
const handleAbort = React.useCallback(async () => {
201201
if (value) {
202202
setIsAborting(true);
203+
203204
try {
204205
await orchestratorApi.abortWorkflowInstance(value.instance.id);
205206
restart();

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowPage/WorkflowDetailsCard.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
import React from 'react';
1718

1819
import { InfoCard } from '@backstage/core-components';
@@ -33,7 +34,8 @@ import { WorkflowInstanceStatusIndicator } from '../WorkflowInstanceStatusIndica
3334
const useStyles = makeStyles({
3435
details: {
3536
overflowY: 'auto',
36-
height: '15rem',
37+
minHeight: '10rem',
38+
maxHeight: '15rem',
3739
},
3840
});
3941

@@ -86,16 +88,16 @@ const WorkflowDefinitionDetailsCard = ({
8688

8789
return (
8890
<InfoCard title="Details" className={classes.details}>
89-
<Grid container spacing={3} alignContent="flex-start">
91+
<Grid container spacing={7} alignContent="flex-start" wrap="nowrap">
9092
{details?.map(({ label, value, children }) => (
91-
<Grid item md={3} key={label}>
93+
<Grid item key={label}>
9294
{/* AboutField requires the value to be defined as a prop as well */}
9395
<AboutField label={label} value={value}>
9496
{loading ? <Skeleton variant="text" /> : children || value}
9597
</AboutField>
9698
</Grid>
9799
))}
98-
<Grid item md={3}>
100+
<Grid item md={7}>
99101
<AboutField
100102
label="description"
101103
value={formattedWorkflowOverview?.description}

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowPage/WorkflowDetailsTabContent.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,9 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
import React from 'react';
1718

18-
import { InfoCard } from '@backstage/core-components';
19+
import { InfoCard, ResponseErrorPanel } from '@backstage/core-components';
1920

2021
import { Grid } from '@material-ui/core';
2122

@@ -27,14 +28,21 @@ import WorkflowDefinitionDetailsCard from './WorkflowDetailsCard';
2728
interface Props {
2829
loading: boolean;
2930
workflowOverviewDTO: WorkflowOverviewDTO | undefined;
31+
errorWorkflowOverview: Error | undefined;
3032
}
3133

3234
export const WorkflowDetailsTabContent = ({
3335
loading,
3436
workflowOverviewDTO,
37+
errorWorkflowOverview,
3538
}: Props) => {
3639
return (
3740
<>
41+
{errorWorkflowOverview && (
42+
<Grid item>
43+
<ResponseErrorPanel error={errorWorkflowOverview} />
44+
</Grid>
45+
)}
3846
<Grid item>
3947
<WorkflowDefinitionDetailsCard
4048
workflowOverview={workflowOverviewDTO}

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

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,13 +20,9 @@ import { useAsync } from 'react-use';
2020
import { TabbedLayout } from '@backstage/core-components';
2121
import { useApi, useRouteRefParams } from '@backstage/core-plugin-api';
2222

23-
import {
24-
orchestratorWorkflowUsePermission,
25-
orchestratorWorkflowUseSpecificPermission,
26-
} from '@red-hat-developer-hub/backstage-plugin-orchestrator-common';
23+
import { Grid } from '@material-ui/core';
2724

2825
import { orchestratorApiRef } from '../../api';
29-
import { usePermissionArrayDecision } from '../../hooks/usePermissionArray';
3026
import { workflowRouteRef, workflowRunsRoutePath } from '../../routes';
3127
import { BaseOrchestratorPage } from '../BaseOrchestratorPage';
3228
import { WorkflowRunsTabContent } from '../WorkflowRunsTabContent';
@@ -37,16 +33,10 @@ export const WorkflowPage = () => {
3733
const { workflowId } = useRouteRefParams(workflowRouteRef);
3834
const orchestratorApi = useApi(orchestratorApiRef);
3935

40-
const { loading: loadingPermission, allowed: canRun } =
41-
usePermissionArrayDecision([
42-
orchestratorWorkflowUsePermission,
43-
orchestratorWorkflowUseSpecificPermission(workflowId),
44-
]);
45-
4636
const {
4737
value: workflowOverviewDTO,
48-
loading,
49-
error,
38+
loading: loadingWorkflowOverview,
39+
error: errorWorkflowOverview,
5040
} = useAsync(() => {
5141
return orchestratorApi.getWorkflowOverview(workflowId);
5242
}, []);
@@ -60,26 +50,19 @@ export const WorkflowPage = () => {
6050
>
6151
<TabbedLayout>
6252
<TabbedLayout.Route path="/" title="Workflow details">
63-
<WorkflowPageTabContent
64-
error={error}
65-
loadingPermission={loadingPermission}
66-
loading={loading}
67-
canRun={canRun}
68-
>
53+
<WorkflowPageTabContent>
6954
<WorkflowDetailsTabContent
70-
loading={loading}
55+
loading={loadingWorkflowOverview}
7156
workflowOverviewDTO={workflowOverviewDTO?.data}
57+
errorWorkflowOverview={errorWorkflowOverview}
7258
/>
7359
</WorkflowPageTabContent>
7460
</TabbedLayout.Route>
7561
<TabbedLayout.Route path={workflowRunsRoutePath} title="Workflow runs">
76-
<WorkflowPageTabContent
77-
error={error}
78-
loadingPermission={loadingPermission}
79-
loading={loading}
80-
canRun={canRun}
81-
>
82-
<WorkflowRunsTabContent />
62+
<WorkflowPageTabContent>
63+
<Grid item>
64+
<WorkflowRunsTabContent />
65+
</Grid>
8366
</WorkflowPageTabContent>
8467
</TabbedLayout.Route>
8568
</TabbedLayout>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,49 +13,52 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
import React, { ReactNode } from 'react';
1718
import { useNavigate } from 'react-router-dom';
1819

19-
import { ResponseErrorPanel } from '@backstage/core-components';
2020
import { useRouteRef, useRouteRefParams } from '@backstage/core-plugin-api';
2121

2222
import { Button, Grid, Tooltip } from '@material-ui/core';
2323
import { Skeleton } from '@material-ui/lab';
2424

25+
import {
26+
orchestratorWorkflowUsePermission,
27+
orchestratorWorkflowUseSpecificPermission,
28+
} from '@red-hat-developer-hub/backstage-plugin-orchestrator-common';
29+
30+
import { usePermissionArrayDecision } from '../../hooks/usePermissionArray';
2531
import { executeWorkflowRouteRef, workflowRouteRef } from '../../routes';
2632

2733
interface Props {
28-
error: Error | undefined;
29-
loadingPermission: boolean;
30-
loading: boolean;
31-
canRun: boolean;
3234
children: ReactNode;
3335
}
3436

35-
export const WorkflowPageTabContent = ({
36-
error,
37-
loadingPermission,
38-
loading,
39-
canRun,
40-
children,
41-
}: Props) => {
37+
export const WorkflowPageTabContent = ({ children }: Props) => {
4238
const { workflowId } = useRouteRefParams(workflowRouteRef);
4339
const navigate = useNavigate();
4440
const executeWorkflowLink = useRouteRef(executeWorkflowRouteRef);
4541
const handleExecute = () => {
4642
navigate(executeWorkflowLink({ workflowId }));
4743
};
4844

45+
const { loading: loadingPermission, allowed: canRun } =
46+
usePermissionArrayDecision([
47+
orchestratorWorkflowUsePermission,
48+
orchestratorWorkflowUseSpecificPermission(workflowId),
49+
]);
50+
4951
return (
50-
<Grid container spacing={2} direction="column" wrap="nowrap">
51-
{error && (
52-
<Grid item>
53-
<ResponseErrorPanel error={error} />
54-
</Grid>
55-
)}
56-
<Grid container item justifyContent="flex-end" spacing={1}>
52+
<Grid
53+
container
54+
spacing={2}
55+
direction="column"
56+
wrap="nowrap"
57+
justifyContent="flex-end"
58+
>
59+
<Grid item container justifyContent="flex-end">
5760
<Grid item>
58-
{loading || loadingPermission ? (
61+
{loadingPermission ? (
5962
<Skeleton variant="text" width="5rem" />
6063
) : (
6164
<Tooltip
@@ -74,7 +77,7 @@ export const WorkflowPageTabContent = ({
7477
)}
7578
</Grid>
7679
</Grid>
77-
<Grid item>{children}</Grid>
80+
{children}
7881
</Grid>
7982
);
8083
};

0 commit comments

Comments
 (0)