From 66948f1a99dd676ad0f602de66b9f96e8f1308e2 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 25 Jan 2023 14:19:50 +0100 Subject: [PATCH] chore: make a little clearer when a task has failed Signed-off-by: blam --- .../src/next/TaskPage/TaskBorder.tsx | 51 +++++++++++++++++++ .../scaffolder/src/next/TaskPage/TaskPage.tsx | 8 ++- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 plugins/scaffolder/src/next/TaskPage/TaskBorder.tsx diff --git a/plugins/scaffolder/src/next/TaskPage/TaskBorder.tsx b/plugins/scaffolder/src/next/TaskPage/TaskBorder.tsx new file mode 100644 index 0000000000..1bf09bf207 --- /dev/null +++ b/plugins/scaffolder/src/next/TaskPage/TaskBorder.tsx @@ -0,0 +1,51 @@ +/* + * Copyright 2023 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 { LinearProgress, makeStyles } from '@material-ui/core'; +import { BackstageTheme } from '@backstage/theme'; + +const useStyles = makeStyles((theme: BackstageTheme) => ({ + failed: { + backgroundColor: theme.palette.error.main, + }, + success: { + backgroundColor: theme.palette.success.main, + }, +})); + +export const TaskBorder = ({ + isComplete, + isError, +}: { + isComplete: boolean; + isError: boolean; +}) => { + const styles = useStyles(); + + if (!isComplete) { + return ; + } + + if (isError) { + return ( + + ); + } + + return ( + + ); +}; diff --git a/plugins/scaffolder/src/next/TaskPage/TaskPage.tsx b/plugins/scaffolder/src/next/TaskPage/TaskPage.tsx index 138c6ac24e..87d5d35453 100644 --- a/plugins/scaffolder/src/next/TaskPage/TaskPage.tsx +++ b/plugins/scaffolder/src/next/TaskPage/TaskPage.tsx @@ -17,8 +17,9 @@ import React, { useMemo } from 'react'; import { Page, Header, Content } from '@backstage/core-components'; import { useTaskEventStream } from '../../components/hooks/useEventStream'; import { useParams } from 'react-router-dom'; -import { Box, LinearProgress, Paper } from '@material-ui/core'; +import { Box, Paper } from '@material-ui/core'; import { TaskSteps } from './TaskSteps'; +import { TaskBorder } from './TaskBorder'; export const TaskPage = () => { const { taskId } = useParams(); @@ -52,7 +53,10 @@ export const TaskPage = () => { /> - {!taskStream.completed && } + {/* */}