Skip to content

Commit

Permalink
fix(orchestrator): add runs button (#213)
Browse files Browse the repository at this point in the history
* fix(orchestrator): add runs button

Signed-off-by: Lior Soffer <[email protected]>

* fix

Signed-off-by: Lior Soffer <[email protected]>

* fix 2

Signed-off-by: Lior Soffer <[email protected]>

---------

Signed-off-by: Lior Soffer <[email protected]>
Co-authored-by: Lior Soffer <[email protected]>
  • Loading branch information
LiorSoffer and Lior Soffer authored Dec 22, 2024
1 parent d6e5b1a commit be7b8c9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions workspaces/orchestrator/.changeset/moody-rivers-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
---

"Add runs button"
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const OrchestratorPage = () => {
</TabbedLayout.Route>
<TabbedLayout.Route
path={workflowInstancesRouteRef.path}
title="Workflow runs"
title="All runs"
>
<WorkflowRunsTabContent />
</TabbedLayout.Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const WorkflowInstancePage = ({
return (
<BaseOrchestratorPage
title={value?.instance.processId ?? value?.instance.id ?? instanceId}
type="Workflow runs"
type="All runs"
typeLink="/orchestrator/instances"
>
{loading ? <Progress /> : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Link, TableColumn, TableProps } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
import { usePermission } from '@backstage/plugin-permission-react';

import Pageview from '@material-ui/icons/Pageview';
import FormatListBulleted from '@material-ui/icons/FormatListBulleted';
import PlayArrow from '@material-ui/icons/PlayArrow';

import {
Expand All @@ -38,7 +38,11 @@ import WorkflowOverviewFormatter, {
FormattedWorkflowOverview,
} from '../dataFormatters/WorkflowOverviewFormatter';
import { usePermissionArray } from '../hooks/usePermissionArray';
import { executeWorkflowRouteRef, workflowRouteRef } from '../routes';
import {
executeWorkflowRouteRef,
workflowRouteRef,
workflowRunsRouteRef,
} from '../routes';
import OverrideBackstageTable from './ui/OverrideBackstageTable';
import { WorkflowInstanceStatusIndicator } from './WorkflowInstanceStatusIndicator';

Expand Down Expand Up @@ -96,6 +100,7 @@ const usePermittedToViewBatch = (
export const WorkflowsTable = ({ items }: WorkflowsTableProps) => {
const navigate = useNavigate();
const definitionLink = useRouteRef(workflowRouteRef);
const definitionRunsLink = useRouteRef(workflowRunsRouteRef);
const executeWorkflowLink = useRouteRef(executeWorkflowRouteRef);
const [data, setData] = useState<FormattedWorkflowOverview[]>([]);

Expand All @@ -114,10 +119,10 @@ export const WorkflowsTable = ({ items }: WorkflowsTableProps) => {
const handleView = useCallback(
(rowData: FormattedWorkflowOverview) => {
navigate(
definitionLink({ workflowId: rowData.id, format: rowData.format }),
definitionRunsLink({ workflowId: rowData.id, format: rowData.format }),
);
},
[definitionLink, navigate],
[definitionRunsLink, navigate],
);

const handleExecute = useCallback(
Expand Down Expand Up @@ -169,8 +174,8 @@ export const WorkflowsTable = ({ items }: WorkflowsTableProps) => {
onClick: () => handleExecute(rowData),
}),
rowData => ({
icon: Pageview,
tooltip: 'View',
icon: FormatListBulleted,
tooltip: 'View runs',
disabled: !canViewWorkflow(rowData.id),
onClick: () => handleView(rowData),
}),
Expand Down

0 comments on commit be7b8c9

Please sign in to comment.