From fb977f8dfae8b1f2c1a62e910b2107f05fb13824 Mon Sep 17 00:00:00 2001 From: Jeff Puzzo Date: Wed, 10 Apr 2024 15:32:45 -0400 Subject: [PATCH] [RHOAIENG-4648] UX content updates --- .../content/DeletePipelineRunsModal.tsx | 6 +- .../pipelines/content/createRun/RunForm.tsx | 59 ++++------ .../pipelines/content/createRun/RunPage.tsx | 5 +- .../pipelines/content/createRun/const.ts | 10 +- .../contentSections/ExperimentSection.tsx | 2 +- .../ParamsSection/ParamsSection.tsx | 9 +- .../contentSections/PipelineSection.tsx | 108 +++++++++++++----- .../PipelineVersionSection.tsx | 51 --------- .../pipeline/SelectedTaskDrawerContent.tsx | 2 +- .../PipelineRunDrawerRightContent.tsx | 2 +- .../PipelineRunDrawerRightTabs.tsx | 4 +- .../pipelineRun/PipelineRunTabDetails.tsx | 4 +- .../pipelineRun/SelectedNodeDetailsTab.tsx | 7 +- .../pipelines/content/tables/columns.ts | 2 +- .../tables/pipelineRun/PipelineRunTable.tsx | 2 +- .../GlobalPipelineExperimentsRoutes.tsx | 2 +- .../compareRuns/ManageRunsTable.tsx | 2 +- .../pages/pipelines/global/pipelines/const.ts | 2 +- 18 files changed, 129 insertions(+), 150 deletions(-) delete mode 100644 frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineVersionSection.tsx diff --git a/frontend/src/concepts/pipelines/content/DeletePipelineRunsModal.tsx b/frontend/src/concepts/pipelines/content/DeletePipelineRunsModal.tsx index f65941e531..d69f43f1a0 100644 --- a/frontend/src/concepts/pipelines/content/DeletePipelineRunsModal.tsx +++ b/frontend/src/concepts/pipelines/content/DeletePipelineRunsModal.tsx @@ -102,8 +102,10 @@ const DeletePipelineRunsModal: React.FC = ({ } testId={`delete-${typeCategory}-modal`} > - {resourceCount <= 1 ? ( - <>This action cannot be undone. + {resourceCount === 1 ? ( + <> + {toDeleteResources[0].display_name} and all of its resources will be deleted. + ) : ( diff --git a/frontend/src/concepts/pipelines/content/createRun/RunForm.tsx b/frontend/src/concepts/pipelines/content/createRun/RunForm.tsx index 644c615fbb..d7e2906fde 100644 --- a/frontend/src/concepts/pipelines/content/createRun/RunForm.tsx +++ b/frontend/src/concepts/pipelines/content/createRun/RunForm.tsx @@ -5,7 +5,6 @@ import { RunFormData, RunTypeOption } from '~/concepts/pipelines/content/createR import { ValueOf } from '~/typeHelpers'; import { ParamsSection } from '~/concepts/pipelines/content/createRun/contentSections/ParamsSection'; import { getProjectDisplayName } from '~/pages/projects/utils'; -import PipelineVersionSection from '~/concepts/pipelines/content/createRun/contentSections/PipelineVersionSection'; import { useLatestPipelineVersion } from '~/concepts/pipelines/apiHooks/useLatestPipelineVersion'; import RunTypeSectionScheduled from '~/concepts/pipelines/content/createRun/contentSections/RunTypeSectionScheduled'; import { PipelineVersionKFv2, RuntimeConfigParameters } from '~/concepts/pipelines/kfTypes'; @@ -28,6 +27,7 @@ const RunForm: React.FC = ({ data, runType, onValueChange }) => { const selectedVersion = data.version || latestVersion; const paramsRef = React.useRef(data.params); const isExperimentsAvailable = useIsAreaAvailable(SupportedArea.PIPELINE_EXPERIMENTS).status; + const isSchedule = runType === PipelineRunType.Scheduled; const updateInputParams = React.useCallback( (version: PipelineVersionKFv2 | undefined) => @@ -62,9 +62,20 @@ const RunForm: React.FC = ({ data, runType, onValueChange }) => { {getProjectDisplayName(data.project)} + {isExperimentsAvailable && ( + onValueChange('experiment', experiment)} + /> + )} + = ({ data, runType, onValueChange }) => { data={data.nameDesc} setData={(nameDesc) => onValueChange('nameDesc', nameDesc)} /> - - - {isExperimentsAvailable && ( - onValueChange('experiment', experiment)} - /> - )} - - { - onValueChange('pipeline', pipeline); - onValueChange('version', undefined); - }} - /> - - { - onValueChange('version', version); - updateInputParams(version); - }} - /> - {runType === PipelineRunType.Scheduled && data.runType.type === RunTypeOption.SCHEDULED && ( - + {isSchedule && data.runType.type === RunTypeOption.SCHEDULED && ( onValueChange('runType', { type: RunTypeOption.SCHEDULED, data: scheduleData }) } /> - - )} + )} + + + = ({ cloneRun, contextPath, testId }) => { PipelineRunSearchParam.TriggerType, ]); const triggerType = asEnumMember(triggerTypeString, ScheduledType); + const isSchedule = runType === PipelineRunType.Scheduled; const cloneRunPipelineId = cloneRun?.pipeline_version_reference?.pipeline_id || ''; const cloneRunVersionId = cloneRun?.pipeline_version_reference?.pipeline_version_id || ''; @@ -59,8 +60,8 @@ const RunPage: React.FC = ({ cloneRun, contextPath, testId }) => { (section) => !( (section === CreateRunPageSections.EXPERIMENT && !isExperimentsAvailable) || - (section === CreateRunPageSections.SCHEDULE_SETTINGS && - runType !== PipelineRunType.Scheduled) + (section === CreateRunPageSections.SCHEDULE_DETAILS && !isSchedule) || + (section === CreateRunPageSections.RUN_DETAILS && isSchedule) ), ); diff --git a/frontend/src/concepts/pipelines/content/createRun/const.ts b/frontend/src/concepts/pipelines/content/createRun/const.ts index 409531e427..0fb21101c0 100644 --- a/frontend/src/concepts/pipelines/content/createRun/const.ts +++ b/frontend/src/concepts/pipelines/content/createRun/const.ts @@ -20,21 +20,19 @@ export const RUN_OPTION_LABEL_SIZE = 100; export enum CreateRunPageSections { RUN_TYPE = 'run-section-run-type', PROJECT = 'run-section-project', - NAME_DESC = 'run-section-name-desc', EXPERIMENT = 'run-section-experiment', + RUN_DETAILS = 'run-section-details', + SCHEDULE_DETAILS = 'run-section-schedule-details', PIPELINE = 'run-section-pipeline', - PIPELINE_VERSION = 'run-section-pipeline-version', - SCHEDULE_SETTINGS = 'run-section-schedule-settings', PARAMS = 'run-section-params', } export const runPageSectionTitles: Record = { [CreateRunPageSections.RUN_TYPE]: 'Run type', [CreateRunPageSections.PROJECT]: 'Project', - [CreateRunPageSections.NAME_DESC]: 'Name and description', [CreateRunPageSections.EXPERIMENT]: 'Experiment', + [CreateRunPageSections.RUN_DETAILS]: 'Run details', + [CreateRunPageSections.SCHEDULE_DETAILS]: 'Schedule details', [CreateRunPageSections.PIPELINE]: 'Pipeline', - [CreateRunPageSections.PIPELINE_VERSION]: 'Pipeline version', - [CreateRunPageSections.SCHEDULE_SETTINGS]: 'Schedule settings', [CreateRunPageSections.PARAMS]: 'Parameters', }; diff --git a/frontend/src/concepts/pipelines/content/createRun/contentSections/ExperimentSection.tsx b/frontend/src/concepts/pipelines/content/createRun/contentSections/ExperimentSection.tsx index 1f66b01c3c..2e7e8b4340 100644 --- a/frontend/src/concepts/pipelines/content/createRun/contentSections/ExperimentSection.tsx +++ b/frontend/src/concepts/pipelines/content/createRun/contentSections/ExperimentSection.tsx @@ -19,7 +19,7 @@ const ExperimentSection: React.FC = ({ value, onChange } id={CreateRunPageSections.EXPERIMENT} title={runPageSectionTitles[CreateRunPageSections.EXPERIMENT]} > - + diff --git a/frontend/src/concepts/pipelines/content/createRun/contentSections/ParamsSection/ParamsSection.tsx b/frontend/src/concepts/pipelines/content/createRun/contentSections/ParamsSection/ParamsSection.tsx index 57698494f1..93b84f9919 100644 --- a/frontend/src/concepts/pipelines/content/createRun/contentSections/ParamsSection/ParamsSection.tsx +++ b/frontend/src/concepts/pipelines/content/createRun/contentSections/ParamsSection/ParamsSection.tsx @@ -49,7 +49,7 @@ export const ParamsSection: React.FC = ({ return ; } - const formGroups = Object.entries(runParams).map(([label, value]) => { + return Object.entries(runParams).map(([label, value]) => { const inputDefinitionParams = getInputDefinitionParams(version); const { parameterType, isOptional, description } = inputDefinitionParams?.[label] || {}; const inputProps = { @@ -100,13 +100,6 @@ export const ParamsSection: React.FC = ({ ); }); - - return ( - <> - Specify parameters required by the pipeline. - {formGroups} - - ); }; return ( diff --git a/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineSection.tsx b/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineSection.tsx index bd2b749976..6aa2fedaf0 100644 --- a/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineSection.tsx +++ b/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineSection.tsx @@ -1,44 +1,90 @@ -import * as React from 'react'; +import React from 'react'; + import { FormGroup, FormSection, Stack, StackItem } from '@patternfly/react-core'; import { PlusCircleIcon } from '@patternfly/react-icons'; + import { CreateRunPageSections, runPageSectionTitles, } from '~/concepts/pipelines/content/createRun/const'; -import { PipelineKFv2 } from '~/concepts/pipelines/kfTypes'; +import { PipelineKFv2, PipelineVersionKFv2 } from '~/concepts/pipelines/kfTypes'; import PipelineSelector from '~/concepts/pipelines/content/pipelineSelector/PipelineSelector'; import ImportPipelineButton from '~/concepts/pipelines/content/import/ImportPipelineButton'; +import PipelineVersionSelector from '~/concepts/pipelines/content/pipelineSelector/PipelineVersionSelector'; +import RunForm from '~/concepts/pipelines/content/createRun/RunForm'; +import ImportPipelineVersionButton from '~/concepts/pipelines/content/import/ImportPipelineVersionButton'; -type PipelineSectionProps = { - value: PipelineKFv2 | null; - onChange: (pipeline: PipelineKFv2) => void; +type PipelineSectionProps = Pick, 'onValueChange'> & { + pipeline: PipelineKFv2 | null; + version: PipelineVersionKFv2 | null; + updateInputParams: (version: PipelineVersionKFv2 | undefined) => void; }; -const PipelineSection: React.FC = ({ value, onChange }) => ( - - - - - onChange(pipeline)} - /> - - - } - onCreate={(pipeline) => onChange(pipeline)} - > - Create new pipeline - - - - - -); +const PipelineSection: React.FC = ({ + pipeline, + version, + onValueChange, + updateInputParams, +}) => { + const onPipelineChange = React.useCallback( + (value: PipelineKFv2) => { + onValueChange('pipeline', value); + onValueChange('version', undefined); + }, + [onValueChange], + ); + + const onVersionChange = React.useCallback( + (value: PipelineVersionKFv2) => { + onValueChange('version', value); + updateInputParams(value); + }, + [onValueChange, updateInputParams], + ); + + return ( + + + + + + + + } + onCreate={onPipelineChange} + > + Create new pipeline + + + + + + + + + + + + } + onCreate={onVersionChange} + /> + + + + + ); +}; export default PipelineSection; diff --git a/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineVersionSection.tsx b/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineVersionSection.tsx deleted file mode 100644 index 865ae8c561..0000000000 --- a/frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineVersionSection.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import * as React from 'react'; -import { FormGroup, FormSection, Stack, StackItem } from '@patternfly/react-core'; -import { PlusCircleIcon } from '@patternfly/react-icons'; -import { - CreateRunPageSections, - runPageSectionTitles, -} from '~/concepts/pipelines/content/createRun/const'; -import { PipelineKFv2, PipelineVersionKFv2 } from '~/concepts/pipelines/kfTypes'; -import ImportPipelineVersionButton from '~/concepts/pipelines/content/import/ImportPipelineVersionButton'; -import PipelineVersionSelector from '~/concepts/pipelines/content/pipelineSelector/PipelineVersionSelector'; - -type PipelineVersionSectionProps = { - selectedPipeline: PipelineKFv2 | null; - value: PipelineVersionKFv2 | null; - onChange: (version: PipelineVersionKFv2, pipeline?: PipelineKFv2 | null) => void; -}; - -const PipelineVersionSection: React.FC = ({ - selectedPipeline, - value, - onChange, -}) => ( - - - - - { - onChange(version); - }} - /> - - - } - onCreate={(pipelineVersion, pipeline) => onChange(pipelineVersion, pipeline)} - /> - - - - -); - -export default PipelineVersionSection; diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipeline/SelectedTaskDrawerContent.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipeline/SelectedTaskDrawerContent.tsx index 4cc4eaa75d..3f630498ea 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipeline/SelectedTaskDrawerContent.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipeline/SelectedTaskDrawerContent.tsx @@ -29,7 +29,7 @@ const SelectedTaskDrawerContent: React.FC = ({ t > - {task.name} {task.type === 'artifact' ? 'artifact details' : ''} + {task.name} {task.type === 'artifact' ? 'Artifact details' : ''} diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightContent.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightContent.tsx index 56b5f30859..6240bb6b87 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightContent.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightContent.tsx @@ -34,7 +34,7 @@ const PipelineRunDrawerRightContent: React.FC - {task.name} {task.type === 'artifact' ? 'artifact details' : ''} + {task.name} {task.type === 'artifact' ? 'Artifact details' : ''} {task.status?.podName && {task.status.podName}} diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightTabs.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightTabs.tsx index e7087d5755..655ce72af6 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightTabs.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunDrawerRightTabs.tsx @@ -19,8 +19,8 @@ enum PipelineRunNodeTabs { } const PipelineRunNodeTabsTitles = { - [PipelineRunNodeTabs.INPUT_OUTPUT]: 'Input / Output', - [PipelineRunNodeTabs.DETAILS]: 'Details', + [PipelineRunNodeTabs.INPUT_OUTPUT]: 'Input/Output', + [PipelineRunNodeTabs.DETAILS]: 'Task details', [PipelineRunNodeTabs.VOLUMES]: 'Volumes', [PipelineRunNodeTabs.LOGS]: 'Logs', }; diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx index 4d2f24712f..3cbb90490f 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx @@ -76,9 +76,9 @@ const PipelineRunTabDetails: React.FC = ({ { key: 'Workflow name', value: workflowName }, ...(!isPipelineRunJob(pipelineRunKF) ? [ - { key: 'Created at', value: asTimestamp(new Date(pipelineRunKF.created_at)) }, + { key: 'Started', value: asTimestamp(new Date(pipelineRunKF.created_at)) }, { - key: 'Finished at', + key: 'Finished', value: isEmptyDateKF(pipelineRunKF.finished_at) ? 'N/A' : asTimestamp(new Date(pipelineRunKF.finished_at)), diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/SelectedNodeDetailsTab.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/SelectedNodeDetailsTab.tsx index 80930fdc4a..c43f6a3bf9 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/SelectedNodeDetailsTab.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/SelectedNodeDetailsTab.tsx @@ -7,6 +7,7 @@ import { import { relativeDuration } from '~/utilities/time'; import { RuntimeStateKF } from '~/concepts/pipelines/kfTypes'; import { PipelineTask } from '~/concepts/pipelines/topology'; +import { translateStatusForNode } from '~/concepts/pipelines/topology/parseUtils'; type SelectedNodeDetailsTabProps = { task: PipelineTask; @@ -35,14 +36,14 @@ const SelectedNodeDetailsTab: React.FC = ({ task }) taskName, { key: 'Status', - value: state ?? '-', + value: translateStatusForNode(state) ?? '-', }, { - key: 'Started at', + key: 'Started', value: startDate ? asTimestamp(startDate) : '-', }, { - key: 'Finished at', + key: 'Finished', value: endDate ? asTimestamp(endDate) : '-', }, { diff --git a/frontend/src/concepts/pipelines/content/tables/columns.ts b/frontend/src/concepts/pipelines/content/tables/columns.ts index 060cc5c73d..b232fc6e4a 100644 --- a/frontend/src/concepts/pipelines/content/tables/columns.ts +++ b/frontend/src/concepts/pipelines/content/tables/columns.ts @@ -22,7 +22,7 @@ export const pipelineColumns: SortableData[] = [ width: 40, }, { - label: 'Versions', + label: 'Total versions', field: 'versions', sortable: false, width: 20, diff --git a/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx b/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx index 02994b4880..826e58c869 100644 --- a/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx +++ b/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx @@ -104,7 +104,7 @@ const PipelineRunTable: React.FC = ({ const compareRunsAction = isExperimentsAvailable && experimentId ? ( - +