From 41e01c260d281dc1be482103c36d8522d5f9b75a Mon Sep 17 00:00:00 2001 From: Georgi2704 Date: Wed, 3 Dec 2025 16:53:56 +0100 Subject: [PATCH] Filter create workflows and ENV loading --- pages/_app.tsx | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index 6ae41ff8..20ccfa30 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; +import _ from 'lodash'; import { SessionProvider } from 'next-auth/react'; import { NextAdapter } from 'next-query-params'; import App, { AppContext, AppInitialProps, AppProps } from 'next/app'; @@ -13,17 +14,21 @@ import { EuiThemeAmsterdam } from '@elastic/eui'; import { ColorModes, ConfirmationDialogContextWrapper, + Environment, OrchestratorConfig, OrchestratorConfigProvider, + ProductLifecycleStatus, StoreProvider, WfoAuth, WfoErrorBoundary, WfoErrorMonitoring, WfoErrorMonitoringProvider, + WfoLogoSpinner, WfoMenuItemLink, WfoPageTemplate, WfoToastsList, defaultOrchestratorTheme, + emptyOrchestratorConfig, } from '@orchestrator-ui/orchestrator-ui-components'; import { getAppLogo } from '@/components/AppLogo/AppLogo'; @@ -44,6 +49,7 @@ function CustomApp({ const [themeMode, setThemeMode] = useState( ColorModes.LIGHT, ); + const [loadedConfig, setLoadedConfig] = useState(); const handleThemeSwitch = (newThemeMode: EuiThemeColorMode) => { setThemeMode(newThemeMode); @@ -62,6 +68,18 @@ function CustomApp({ } }, []); + useEffect(() => { + if (!_.isEqual(orchestratorConfig, emptyOrchestratorConfig)) { + setLoadedConfig(orchestratorConfig); + } + }, [orchestratorConfig]); + + if (!loadedConfig) { + return ; + } + + const { environmentName } = loadedConfig; + const addMenuItems = ( defaultMenuItems: EuiSideNavItemType[], ): EuiSideNavItemType[] => [ @@ -112,12 +130,21 @@ function CustomApp({ reportMessage: () => {}, }; + const startWorkflowFilters = + environmentName === Environment.PRODUCTION + ? [ProductLifecycleStatus.ACTIVE] + : [ + ProductLifecycleStatus.ACTIVE, + ProductLifecycleStatus.PRE_PRODUCTION, + ProductLifecycleStatus.PHASE_OUT, + ]; + return ( - +