Skip to content

Commit

Permalink
feat: show launchplan in execution table
Browse files Browse the repository at this point in the history
Signed-off-by: Pradithya Aria Pura <[email protected]>
  • Loading branch information
pradithya committed Mar 31, 2023
1 parent c82e755 commit 8f5eac6
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import classnames from 'classnames';
import { useCommonStyles } from 'components/common/styles';
import { LaunchPlanId } from 'models/Launch/types';
import * as React from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { Routes } from 'routes/routes';

/** A simple component to render a link to a specific LaunchPlan */
export const LaunchPlanLink: React.FC<{
className?: string;
color?: 'primary' | 'disabled';
id: LaunchPlanId;
}> = ({ className, color = 'primary', id }) => {
const commonStyles = useCommonStyles();
const linkColor =
color === 'disabled'
? commonStyles.secondaryLink
: commonStyles.primaryLink;
return (
<RouterLink
className={classnames(linkColor, className)}
to={`${Routes.LaunchPlanDetails.makeUrl(id.project, id.domain, id.name)}`}
>
{id.name}
</RouterLink>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { ExecutionState, WorkflowExecutionPhase } from 'models/Execution/enums';
import classnames from 'classnames';
import { WorkflowExecutionsTableState } from '../types';
import { WorkflowExecutionLink } from '../WorkflowExecutionLink';
import { LaunchPlanLink } from '../LaunchPlanLink';
import { getWorkflowExecutionTimingMS, isExecutionArchived } from '../../utils';
import { useStyles } from './styles';
import t from './strings';
Expand Down Expand Up @@ -99,6 +100,13 @@ export function getDurationCell(execution: Execution): React.ReactNode {
);
}

export function getLaunchPlanName(execution: Execution): React.ReactNode {
const isArchived = isExecutionArchived(execution);
const lp = execution.spec.launchPlan;

return <LaunchPlanLink id={lp} color={isArchived ? 'disabled' : 'primary'} />;
}

export const showOnHoverClass = 'showOnHover';
export function getActionsCell(
execution: Execution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Protobuf } from '@flyteorg/flyteidl-types';

const str = {
tableLabel_name: 'execution id',
tableLabel_launchPlan: 'launch plan',
tableLabel_phase: 'status',
tableLabel_startedAt: 'start time',
tableLabel_duration: 'duration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const useStyles = makeStyles((theme: Theme) => ({
flexBasis: workflowExecutionsTableColumnWidths.name,
whiteSpace: 'normal',
},
columnLaunchPlan: {
flexGrow: 1,
flexBasis: workflowExecutionsTableColumnWidths.launchPlan,
},
columnLastRun: {
flexBasis: workflowExecutionsTableColumnWidths.lastRun,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getExecutionIdCell,
getStartTimeCell,
getStatusCell,
getLaunchPlanName,
} from './cells';
import { useStyles } from './styles';
import t, { patternKey } from './strings';
Expand Down Expand Up @@ -44,6 +45,12 @@ export function useWorkflowExecutionsTableColumns(
key: 'name',
label: t(patternKey('tableLabel', 'name')),
},
{
cellRenderer: ({ execution }) => getLaunchPlanName(execution),
className: styles.columnLaunchPlan,
key: 'launchPlan',
label: t(patternKey('tableLabel', 'launchPlan')),
},
{
cellRenderer: ({ execution }) => getStatusCell(execution),
className: styles.columnStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const workflowExecutionsTableColumnWidths = {
duration: 100,
actions: 130,
lastRun: 130,
name: 360,
name: 240,
launchPlan: 120,
phase: 120,
startedAt: 200,
};
Expand Down

0 comments on commit 8f5eac6

Please sign in to comment.