-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(orchestrator): add workflow runs tab * fix filter * v1 Signed-off-by: Lior Soffer <[email protected]> * fix Signed-off-by: Lior Soffer <[email protected]> * fixes Signed-off-by: Lior Soffer <[email protected]> * show full ID Signed-off-by: Lior Soffer <[email protected]> * fix type Signed-off-by: Lior Soffer <[email protected]> --------- Signed-off-by: Lior Soffer <[email protected]>
- Loading branch information
1 parent
4cf968f
commit f3ace9e
Showing
12 changed files
with
305 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch | ||
--- | ||
|
||
add workflow tabs - details and runs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 0 additions & 126 deletions
126
...orchestrator/src/components/WorkflowDefinitionViewerPage/WorkflowDefinitionViewerPage.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
65 changes: 65 additions & 0 deletions
65
...chestrator/plugins/orchestrator/src/components/WorkflowPage/WorkflowDetailsTabContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import React, { useMemo } from 'react'; | ||
|
||
import { InfoCard } from '@backstage/core-components'; | ||
import { useRouteRefParams } from '@backstage/core-plugin-api'; | ||
|
||
import { Grid } from '@material-ui/core'; | ||
|
||
import { WorkflowOverviewDTO } from '@red-hat-developer-hub/backstage-plugin-orchestrator-common'; | ||
|
||
import { workflowRouteRef } from '../../routes'; | ||
import { EditorViewKind, WorkflowEditor } from '../WorkflowEditor'; | ||
import WorkflowDefinitionDetailsCard from './WorkflowDetailsCard'; | ||
|
||
interface Props { | ||
loading: boolean; | ||
workflowOverviewDTO: WorkflowOverviewDTO | undefined; | ||
} | ||
|
||
export const WorkflowDetailsTabContent = ({ | ||
loading, | ||
workflowOverviewDTO, | ||
}: Props) => { | ||
const { workflowId, format } = useRouteRefParams(workflowRouteRef); | ||
const workflowFormat = useMemo( | ||
() => (format === 'json' ? 'json' : 'yaml'), | ||
[format], | ||
); | ||
|
||
return ( | ||
<> | ||
<Grid item> | ||
<WorkflowDefinitionDetailsCard | ||
workflowOverview={workflowOverviewDTO} | ||
loading={loading} | ||
/> | ||
</Grid> | ||
<Grid item> | ||
<InfoCard title="Workflow definition"> | ||
<div style={{ height: '600px' }}> | ||
<WorkflowEditor | ||
kind={EditorViewKind.EXTENDED_DIAGRAM_VIEWER} | ||
workflowId={workflowId} | ||
format={workflowFormat} | ||
/> | ||
</div> | ||
</InfoCard> | ||
</Grid> | ||
</> | ||
); | ||
}; |
88 changes: 88 additions & 0 deletions
88
workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowPage/WorkflowPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useAsync } from 'react-use'; | ||
|
||
import { TabbedLayout } from '@backstage/core-components'; | ||
import { useApi, useRouteRefParams } from '@backstage/core-plugin-api'; | ||
|
||
import { | ||
orchestratorWorkflowUsePermission, | ||
orchestratorWorkflowUseSpecificPermission, | ||
} from '@red-hat-developer-hub/backstage-plugin-orchestrator-common'; | ||
|
||
import { orchestratorApiRef } from '../../api'; | ||
import { usePermissionArrayDecision } from '../../hooks/usePermissionArray'; | ||
import { workflowRouteRef, workflowRunsRoutePath } from '../../routes'; | ||
import { BaseOrchestratorPage } from '../BaseOrchestratorPage'; | ||
import { WorkflowRunsTabContent } from '../WorkflowRunsTabContent'; | ||
import { WorkflowDetailsTabContent } from './WorkflowDetailsTabContent'; | ||
import { WorkflowPageTabContent } from './WorkflowPageTabContent'; | ||
|
||
export const WorkflowPage = () => { | ||
const { workflowId } = useRouteRefParams(workflowRouteRef); | ||
const orchestratorApi = useApi(orchestratorApiRef); | ||
|
||
const { loading: loadingPermission, allowed: canRun } = | ||
usePermissionArrayDecision([ | ||
orchestratorWorkflowUsePermission, | ||
orchestratorWorkflowUseSpecificPermission(workflowId), | ||
]); | ||
|
||
const { | ||
value: workflowOverviewDTO, | ||
loading, | ||
error, | ||
} = useAsync(() => { | ||
return orchestratorApi.getWorkflowOverview(workflowId); | ||
}, []); | ||
|
||
return ( | ||
<BaseOrchestratorPage | ||
title={workflowOverviewDTO?.data.name || workflowId} | ||
type="Workflows" | ||
typeLink="/orchestrator" | ||
noPadding | ||
> | ||
<TabbedLayout> | ||
<TabbedLayout.Route path="/" title="Workflow details"> | ||
<WorkflowPageTabContent | ||
error={error} | ||
loadingPermission={loadingPermission} | ||
loading={loading} | ||
canRun={canRun} | ||
> | ||
<WorkflowDetailsTabContent | ||
loading={loading} | ||
workflowOverviewDTO={workflowOverviewDTO?.data} | ||
/> | ||
</WorkflowPageTabContent> | ||
</TabbedLayout.Route> | ||
<TabbedLayout.Route path={workflowRunsRoutePath} title="Workflow runs"> | ||
<WorkflowPageTabContent | ||
error={error} | ||
loadingPermission={loadingPermission} | ||
loading={loading} | ||
canRun={canRun} | ||
> | ||
<WorkflowRunsTabContent /> | ||
</WorkflowPageTabContent> | ||
</TabbedLayout.Route> | ||
</TabbedLayout> | ||
</BaseOrchestratorPage> | ||
); | ||
}; |
Oops, something went wrong.