From a8657075ba383ebe592420cefa137e04fb1eb038 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 31 May 2022 10:57:29 -0400 Subject: [PATCH 1/6] feat: support flyte deck #none Signed-off-by: James --- .../ExecutionDetailsActions.tsx | 76 ++++++++++++++++++- .../ExecutionDetails/ExecutionNodeDeck.tsx | 17 +++++ .../NodeExecutionDetailsPanelContent.tsx | 7 +- .../Executions/ExecutionDetails/strings.tsx | 1 + .../console/src/models/Execution/types.ts | 1 + 5 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx diff --git a/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions.tsx b/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions.tsx index e5251378f..d163a6ca2 100644 --- a/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions.tsx +++ b/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionDetailsActions.tsx @@ -1,23 +1,69 @@ -import { Button } from '@material-ui/core'; +import { Button, Dialog, DialogTitle, IconButton } from '@material-ui/core'; import * as React from 'react'; import { ResourceIdentifier, Identifier, Variable } from 'models/Common/types'; +import { makeStyles, Theme } from '@material-ui/core/styles'; import { getTask } from 'models/Task/api'; import { LaunchFormDialog } from 'components/Launch/LaunchForm/LaunchFormDialog'; import { NodeExecutionIdentifier } from 'models/Execution/types'; import { useNodeExecutionData } from 'components/hooks/useNodeExecution'; import { literalsToLiteralValueMap } from 'components/Launch/LaunchForm/utils'; import { TaskInitialLaunchParameters } from 'components/Launch/LaunchForm/types'; +import { NodeExecutionPhase } from 'models/Execution/enums'; +import Close from '@material-ui/icons/Close'; import { NodeExecutionDetails } from '../types'; import t from './strings'; +import { ExecutionNodeDeck } from './ExecutionNodeDeck'; + +const useStyles = makeStyles((theme: Theme) => { + return { + actionsContainer: { + borderTop: `1px solid ${theme.palette.divider}`, + marginTop: theme.spacing(2), + paddingTop: theme.spacing(2), + '& button': { + marginRight: theme.spacing(1), + }, + }, + dialog: { + maxWidth: `calc(100% - ${theme.spacing(12)}px)`, + maxHeight: `calc(100% - ${theme.spacing(12)}px)`, + height: theme.spacing(90), + width: theme.spacing(100), + '& iframe': { + border: 'none', + }, + }, + dialogTitle: { + display: 'flex', + alignItems: 'center', + padding: theme.spacing(2), + paddingBottom: theme.spacing(0), + }, + deckTitle: { + flexGrow: 1, + textAlign: 'center', + fontSize: '24px', + lineHeight: '28px', + marginBlock: 0, + paddingTop: theme.spacing(2), + paddingBottom: theme.spacing(2), + }, + close: { + position: 'absolute', + right: theme.spacing(2), + }, + }; +}); interface ExecutionDetailsActionsProps { - className?: string; details: NodeExecutionDetails; nodeExecutionId: NodeExecutionIdentifier; + phase?: NodeExecutionPhase; } export const ExecutionDetailsActions = (props: ExecutionDetailsActionsProps): JSX.Element => { - const { className, details, nodeExecutionId } = props; + const { details, nodeExecutionId, phase } = props; + const styles = useStyles(); const [showLaunchForm, setShowLaunchForm] = React.useState(false); const [taskInputsTypes, setTaskInputsTypes] = React.useState< @@ -36,6 +82,9 @@ export const ExecutionDetailsActions = (props: ExecutionDetailsActionsProps): JS if (id) fetchTask(); }, [id]); + const [showDeck, setShowDeck] = React.useState(false); + const onCloseDeck = () => setShowDeck(false); + if (!id) { return <>; } @@ -54,7 +103,15 @@ export const ExecutionDetailsActions = (props: ExecutionDetailsActionsProps): JS return ( <> -
+
+ @@ -65,6 +122,17 @@ export const ExecutionDetailsActions = (props: ExecutionDetailsActionsProps): JS showLaunchForm={showLaunchForm} setShowLaunchForm={setShowLaunchForm} /> + {nodeExecutionId && ( + +
+

{t('flyteDeck')}

+ + + +
+ +
+ )} ); }; diff --git a/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx b/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx new file mode 100644 index 000000000..0bed47765 --- /dev/null +++ b/packages/zapp/console/src/components/Executions/ExecutionDetails/ExecutionNodeDeck.tsx @@ -0,0 +1,17 @@ +import { useNodeExecutionData } from 'components/hooks/useNodeExecution'; +import { NodeExecutionIdentifier } from 'models/Execution/types'; +import * as React from 'react'; + +/** Fetches and renders the deck data for a given `NodeExecutionIdentifier` */ +export const ExecutionNodeDeck: React.FC<{ nodeExecutionId: NodeExecutionIdentifier }> = ({ + nodeExecutionId, +}) => { + const executionData = useNodeExecutionData(nodeExecutionId); + return ( +