/* * Copyright 2021 The Kubeflow 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 * * https://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 CheckCircleIcon from '@material-ui/icons/CheckCircle'; import CloudDownloadIcon from '@material-ui/icons/CloudDownload'; import ErrorIcon from '@material-ui/icons/Error'; import ListAltIcon from '@material-ui/icons/ListAlt'; import PowerSettingsNewIcon from '@material-ui/icons/PowerSettingsNew'; import RefreshIcon from '@material-ui/icons/Refresh'; import RemoveCircleOutlineIcon from '@material-ui/icons/RemoveCircleOutline'; import React, { ReactElement } from 'react'; import { Handle, Position } from 'react-flow-renderer'; import StopCircle from 'src/icons/StopCircle'; import { Execution } from 'src/third_party/mlmd'; import { classes } from 'typestyle'; import { ExecutionFlowElementData } from './Constants'; import MoreHorizIcon from '@material-ui/icons/MoreHoriz'; export interface ExecutionNodeProps { id: string; data: ExecutionFlowElementData; // selected: boolean; // status: ExecutionNodeStatus; } function ExecutionNode({ id, data }: ExecutionNodeProps) { let icon = getIcon(data.state); let executionIcon = getExecutionIcon(data.state); const fullWidth = icon ? 'w-64' : 'w-56'; return ( <>
false} style={{ background: '#000', height: '1px', width: '1px', border: 0 }} /> false} style={{ background: '#000', height: '1px', width: '1px', border: 0 }} /> ); } export default ExecutionNode; export function getExecutionIcon(state: Execution.State | undefined) { if (state === undefined) { return ; } return ; } export function getIcon(state: Execution.State | undefined) { if (state === undefined) { return null; } switch (state) { case Execution.State.UNKNOWN: return getStateIconWrapper( , 'bg-mui-grey-200', ); case Execution.State.NEW: return getStateIconWrapper( , 'bg-mui-blue-50', ); case Execution.State.RUNNING: return getStateIconWrapper(, 'bg-mui-green-50'); case Execution.State.CACHED: return getStateIconWrapper( , 'bg-mui-green-50', ); case Execution.State.FAILED: return getStateIconWrapper(, 'bg-mui-red-50'); case Execution.State.CANCELED: return getStateIconWrapper( , 'bg-mui-grey-200', ); case Execution.State.COMPLETE: return getStateIconWrapper( , 'bg-mui-green-50', ); default: console.error('Unknown exeuction state: ' + state); return getStateIconWrapper(, 'bg-black'); } } function getStateIconWrapper(element: ReactElement, backgroundClasses: string) { return (
{element}
); } // The following code can be used for `canceling state` // return ( //
// // {/* */} //
// );