Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(orchestrator): label a Workflow assessment result as recommended #1705

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useRouteRef,
} from '@backstage/core-plugin-api';

import { Grid, makeStyles } from '@material-ui/core';
import { Chip, Grid, makeStyles } from '@material-ui/core';
import moment from 'moment';

import {
Expand Down Expand Up @@ -72,13 +72,24 @@ const useStyles = makeStyles(_ => ({
height: '100%',
},
autoOverflow: { overflow: 'auto' },
recommendedLabelContainer: {
display: 'flex',
alignItems: 'center',
whiteSpace: 'nowrap',
},
recommendedLabel: { margin: '0 0.25rem' },
}));

const getNextWorkflows = (
details: WorkflowRunDetail,
executeWorkflowLink: RouteFunc<PathParams<'/workflows/:workflowId/execute'>>,
) => {
const nextWorkflows: { title: string; link: string; id: string }[] = [];
const nextWorkflows: {
title: string;
link: string;
id: string;
isRecommended: boolean;
}[] = [];

if (details.nextWorkflowSuggestions) {
Object.entries(details.nextWorkflowSuggestions).forEach(([_, value]) => {
Expand All @@ -97,6 +108,11 @@ const getNextWorkflows = (
title: nextWorkflowSuggestion.name,
link: urlToNavigate,
id: nextWorkflowSuggestion.id,
isRecommended:
(
details.nextWorkflowSuggestions
?.currentVersion as WorkflowSuggestion
)?.id === nextWorkflowSuggestion.id,
});
});
});
Expand Down Expand Up @@ -187,15 +203,28 @@ export const WorkflowInstancePageContent: React.FC<{
<Grid container spacing={3}>
{nextWorkflows.map(item => (
<Grid item xs={4} key={item.title}>
<Link
color="primary"
to="#"
onClick={() => {
openWorkflowDescriptionModal(item.id);
}}
<div
className={styles.recommendedLabelContainer}
key={item.title}
>
{item.title}
</Link>
<Link
color="primary"
to="#"
onClick={() => {
openWorkflowDescriptionModal(item.id);
}}
>
{item.title}
</Link>
{item.isRecommended ? (
<Chip
size="small"
label="Recommended"
color="secondary"
className={styles.recommendedLabel}
/>
) : null}
</div>
<WorkflowDescriptionModal
workflow={currentWorkflow}
runWorkflowLink={item.link}
Expand Down
Loading