From 1ceb3ac3ce43ca4f3e45bd81bb077fadef5a6368 Mon Sep 17 00:00:00 2001 From: Marco Salazar Date: Mon, 9 Oct 2023 07:56:38 -0400 Subject: [PATCH] client side feature flag instead --- .../packages/ui-core/src/app/CloudFeatureFlag.tsx | 11 ----------- .../dagster-ui/packages/ui-core/src/app/Flags.tsx | 1 + .../ui-core/src/app/getVisibleFeatureFlagRows.tsx | 4 ++++ .../packages/ui-core/src/overview/OverviewRoot.tsx | 6 +++--- .../packages/ui-core/src/overview/OverviewTabs.tsx | 6 +++--- 5 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 js_modules/dagster-ui/packages/ui-core/src/app/CloudFeatureFlag.tsx diff --git a/js_modules/dagster-ui/packages/ui-core/src/app/CloudFeatureFlag.tsx b/js_modules/dagster-ui/packages/ui-core/src/app/CloudFeatureFlag.tsx deleted file mode 100644 index 323aba12915dd..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/app/CloudFeatureFlag.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -type CloudFeatureFlagContextType = { - enableAMPTimeline: boolean; -}; -export const CloudFeatureFlagContext = React.createContext({ - enableAMPTimeline: true, -}); -export const useCloudFeatureFlag = () => { - return React.useContext(CloudFeatureFlagContext); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/app/Flags.tsx b/js_modules/dagster-ui/packages/ui-core/src/app/Flags.tsx index ea16da10e130d..38b4eb975652f 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/app/Flags.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/app/Flags.tsx @@ -16,6 +16,7 @@ export const FeatureFlag = { flagDisableAutoLoadDefaults: 'flagDisableAutoLoadDefaults' as const, flagDAGSidebar: 'flagDAGSidebar' as const, flagDisableDAGCache: 'flagDisableDAGCache' as const, + flagEnableAMPTimeline: 'flagEnableAMPTimeline' as const, }; export type FeatureFlagType = keyof typeof FeatureFlag; diff --git a/js_modules/dagster-ui/packages/ui-core/src/app/getVisibleFeatureFlagRows.tsx b/js_modules/dagster-ui/packages/ui-core/src/app/getVisibleFeatureFlagRows.tsx index 3c0821c0eb486..38b63729ec46e 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/app/getVisibleFeatureFlagRows.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/app/getVisibleFeatureFlagRows.tsx @@ -57,4 +57,8 @@ export const getVisibleFeatureFlagRows = () => [ key: 'Disable Asset Graph caching', flagType: FeatureFlag.flagDisableDAGCache, }, + { + key: 'Experimental Auto-materialize policy timeline page', + flagType: FeatureFlag.flagEnableAMPTimeline, + }, ]; diff --git a/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewRoot.tsx b/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewRoot.tsx index c45bdb7b6c368..d647cf5ed5d55 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewRoot.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewRoot.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import {Redirect, Route, Switch} from 'react-router-dom'; -import {useCloudFeatureFlag} from '../app/CloudFeatureFlag'; +import {useFeatureFlags} from '../app/Flags'; import {AutomaterializationRoot} from '../assets/auto-materialization/AutomaterializationRoot'; import {InstanceBackfills} from '../instance/InstanceBackfills'; import {BackfillPage} from '../instance/backfill/BackfillPage'; @@ -13,7 +13,7 @@ import {OverviewSchedulesRoot} from './OverviewSchedulesRoot'; import {OverviewSensorsRoot} from './OverviewSensorsRoot'; export const OverviewRoot = () => { - const {enableAMPTimeline} = useCloudFeatureFlag(); + const {flagEnableAMPTimeline} = useFeatureFlags(); return ( @@ -28,7 +28,7 @@ export const OverviewRoot = () => { - {enableAMPTimeline ? ( + {flagEnableAMPTimeline ? ( diff --git a/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewTabs.tsx b/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewTabs.tsx index 3f5dc11f081f5..8bfd4e1488ebd 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewTabs.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/overview/OverviewTabs.tsx @@ -2,7 +2,7 @@ import {QueryResult} from '@apollo/client'; import {Box, Colors, Spinner, Tabs} from '@dagster-io/ui-components'; import * as React from 'react'; -import {useCloudFeatureFlag} from '../app/CloudFeatureFlag'; +import {useFeatureFlags} from '../app/Flags'; import {QueryRefreshCountdown, QueryRefreshState} from '../app/QueryRefresh'; import {useAutomaterializeDaemonStatus} from '../assets/AutomaterializeDaemonStatusTag'; import {TabLink} from '../ui/TabLink'; @@ -17,7 +17,7 @@ export const OverviewTabs = >(props: Props @@ -26,7 +26,7 @@ export const OverviewTabs = >(props: Props - {enableAMPTimeline ? ( + {flagEnableAMPTimeline ? (