Skip to content

Commit 28c900b

Browse files
authored
fix(orchestrator): fix responsiveness of the WorkflowPage (#554)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent c64c3a5 commit 28c900b

6 files changed

Lines changed: 41 additions & 48 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+
fixing responsiveness of the WorkflowPage

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowPage/WorkflowPageTabContent.tsx renamed to workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowPage/RunButton.tsx

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { ReactNode } from 'react';
17+
import React from 'react';
1818
import { useNavigate } from 'react-router-dom';
1919

2020
import { useRouteRef, useRouteRefParams } from '@backstage/core-plugin-api';
@@ -30,11 +30,7 @@ import {
3030
import { usePermissionArrayDecision } from '../../hooks/usePermissionArray';
3131
import { executeWorkflowRouteRef, workflowRouteRef } from '../../routes';
3232

33-
interface Props {
34-
children: ReactNode;
35-
}
36-
37-
export const WorkflowPageTabContent = ({ children }: Props) => {
33+
export const RunButton = () => {
3834
const { workflowId } = useRouteRefParams(workflowRouteRef);
3935
const navigate = useNavigate();
4036
const executeWorkflowLink = useRouteRef(executeWorkflowRouteRef);
@@ -49,35 +45,26 @@ export const WorkflowPageTabContent = ({ children }: Props) => {
4945
]);
5046

5147
return (
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">
60-
<Grid item>
61-
{loadingPermission ? (
62-
<Skeleton variant="text" width="5rem" />
63-
) : (
64-
<Tooltip
65-
title="user not authorized to execute workflow"
66-
disableHoverListener={canRun}
48+
<Grid item container justifyContent="flex-end" xs={12} spacing={2}>
49+
<Grid item>
50+
{loadingPermission ? (
51+
<Skeleton variant="text" width="5rem" />
52+
) : (
53+
<Tooltip
54+
title="user not authorized to execute workflow"
55+
disableHoverListener={canRun}
56+
>
57+
<Button
58+
variant="contained"
59+
color="primary"
60+
onClick={handleExecute}
61+
disabled={!canRun}
6762
>
68-
<Button
69-
variant="contained"
70-
color="primary"
71-
onClick={handleExecute}
72-
disabled={!canRun}
73-
>
74-
Run
75-
</Button>
76-
</Tooltip>
77-
)}
78-
</Grid>
63+
Run
64+
</Button>
65+
</Tooltip>
66+
)}
7967
</Grid>
80-
{children}
8168
</Grid>
8269
);
8370
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const WorkflowDetailsTabContent = ({
4545
});
4646

4747
return (
48-
<>
48+
<Grid container item direction="column" xs={12} spacing={2}>
4949
{errorWorkflowOverview && (
5050
<Grid item>
5151
<ResponseErrorPanel error={errorWorkflowOverview} />
@@ -70,6 +70,6 @@ export const WorkflowDetailsTabContent = ({
7070
</InfoCard>
7171
</Grid>
7272
)}
73-
</>
73+
</Grid>
7474
);
7575
};

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import { orchestratorApiRef } from '../../api';
2626
import { workflowRouteRef, workflowRunsRoutePath } from '../../routes';
2727
import { BaseOrchestratorPage } from '../BaseOrchestratorPage';
2828
import { WorkflowRunsTabContent } from '../WorkflowRunsTabContent';
29+
import { RunButton } from './RunButton';
2930
import { WorkflowDetailsTabContent } from './WorkflowDetailsTabContent';
30-
import { WorkflowPageTabContent } from './WorkflowPageTabContent';
3131

3232
export const WorkflowPage = () => {
3333
const { workflowId } = useRouteRefParams(workflowRouteRef);
@@ -50,20 +50,20 @@ export const WorkflowPage = () => {
5050
>
5151
<TabbedLayout>
5252
<TabbedLayout.Route path="/" title="Workflow details">
53-
<WorkflowPageTabContent>
53+
<Grid container spacing={2}>
54+
<RunButton />
5455
<WorkflowDetailsTabContent
5556
loading={loadingWorkflowOverview}
5657
workflowOverviewDTO={workflowOverviewDTO?.data}
5758
errorWorkflowOverview={errorWorkflowOverview}
5859
/>
59-
</WorkflowPageTabContent>
60+
</Grid>
6061
</TabbedLayout.Route>
6162
<TabbedLayout.Route path={workflowRunsRoutePath} title="Workflow runs">
62-
<WorkflowPageTabContent>
63-
<Grid item>
64-
<WorkflowRunsTabContent />
65-
</Grid>
66-
</WorkflowPageTabContent>
63+
<Grid container spacing={2}>
64+
<RunButton />
65+
<WorkflowRunsTabContent />
66+
</Grid>
6767
</TabbedLayout.Route>
6868
</TabbedLayout>
6969
</BaseOrchestratorPage>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ export const WorkflowRunsTabContent = () => {
301301
return error ? (
302302
<ErrorPanel error={error} />
303303
) : (
304-
<Grid container item justifyContent="flex-end" spacing={1}>
305-
<Grid item xs={2}>
304+
<Grid container item xs={12} spacing={2}>
305+
<Grid item>
306306
<Selector
307307
label="Status"
308308
items={statuses}
@@ -322,7 +322,7 @@ export const WorkflowRunsTabContent = () => {
322322
selected={startedSelectorValue}
323323
/>
324324
</Grid>
325-
<Grid item xs={10}>
325+
<Grid item xs style={{ flexGrow: 1 }}>
326326
<InfoCard
327327
noPadding
328328
title={

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

Lines changed: 3 additions & 2 deletions
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, { useCallback } from 'react';
1718

1819
import {
@@ -51,7 +52,7 @@ export const WorkflowsTabContent = () => {
5152
{loading ? <Progress /> : null}
5253
{error ? <ResponseErrorPanel error={error} /> : null}
5354
{isReady ? (
54-
<Grid container direction="column">
55+
<Grid container direction="column" xs={12}>
5556
<Grid item>
5657
<WorkflowsTable items={value ?? []} />
5758
</Grid>

0 commit comments

Comments
 (0)