From 04ae1b11f37216b75defafafe14418ca0fcd3c73 Mon Sep 17 00:00:00 2001 From: Gage Krumbach Date: Thu, 7 Mar 2024 10:31:45 -0600 Subject: [PATCH] Add useIsAreaAvailable hook to check if experiments are available --- .../pipelines/content/createRun/RunPage.tsx | 15 ++++++++++----- .../concepts/pipelines/content/createRun/const.ts | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/concepts/pipelines/content/createRun/RunPage.tsx b/frontend/src/concepts/pipelines/content/createRun/RunPage.tsx index 97e3f11d85..308522b900 100644 --- a/frontend/src/concepts/pipelines/content/createRun/RunPage.tsx +++ b/frontend/src/concepts/pipelines/content/createRun/RunPage.tsx @@ -25,6 +25,7 @@ import { useGetSearchParamValues } from '~/utilities/useGetSearchParamValues'; import { PipelineRunSearchParam } from '~/concepts/pipelines/content/types'; import { PipelineRunType } from '~/pages/pipelines/global/runs'; import useExperimentById from '~/concepts/pipelines/apiHooks/useExperimentById'; +import { useIsAreaAvailable, SupportedArea } from '~/concepts/areas'; type RunPageProps = { cloneRun?: PipelineRunKFv2 | PipelineRunJobKFv2 | null; @@ -48,6 +49,14 @@ const RunPage: React.FC = ({ cloneRun, contextPath, testId }) => { const [cloneRunPipeline] = usePipelineById(cloneRunPipelineId); const [cloneRunExperiment] = useExperimentById(cloneRunExperimentId); + const isExperimentsAvailable = useIsAreaAvailable(SupportedArea.PIPELINE_EXPERIMENTS).status; + + const sections = isExperimentsAvailable + ? Object.values(CreateRunPageSections) + : Object.values(CreateRunPageSections).filter( + (section) => section !== CreateRunPageSections.EXPERIMENT, + ); + const [formData, setFormDataValue] = useRunFormData(cloneRun, { runType: { ...(runType === PipelineRunType.Scheduled @@ -73,11 +82,7 @@ const RunPage: React.FC = ({ cloneRun, contextPath, testId }) => { return (
- + = { [CreateRunPageSections.NAME_DESC]: 'Name and description', + [CreateRunPageSections.EXPERIMENT]: 'Experiment', [CreateRunPageSections.PIPELINE]: 'Pipeline', [CreateRunPageSections.PIPELINE_VERSION]: 'Pipeline version', - [CreateRunPageSections.EXPERIMENT]: 'Experiment', [CreateRunPageSections.PARAMS]: 'Pipeline input parameters', };