Create a feature flag for dashboards v2 (#15601)
Prevent users from creating v2 chart types via the api. Only created unit tests and not integration tests (since it's not that important, and the v2 will be released soon), but tested via the api playground.
This commit is contained in:
+13
-8
@@ -1,6 +1,7 @@
|
||||
import { GRAPH_TYPE_INFORMATION } from '@/command-menu/pages/page-layout/constants/GraphTypeInformation';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import styled from '@emotion/styled';
|
||||
import { GraphType } from '~/generated-metadata/graphql';
|
||||
import { FeatureFlagKey, GraphType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { MenuPicker } from 'twenty-ui/navigation';
|
||||
@@ -14,12 +15,6 @@ const graphTypeOptions = [
|
||||
GraphType.GAUGE,
|
||||
];
|
||||
|
||||
const disabledGraphTypeOptions = [
|
||||
GraphType.PIE,
|
||||
GraphType.LINE,
|
||||
GraphType.GAUGE,
|
||||
];
|
||||
|
||||
const StyledChartTypeSelectionContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -35,10 +30,20 @@ export const ChartTypeSelectionSection = ({
|
||||
currentGraphType,
|
||||
setCurrentGraphType,
|
||||
}: ChartTypeSelectionSectionProps) => {
|
||||
const isDashboardV2Enabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_DASHBOARD_V2_ENABLED,
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledChartTypeSelectionContainer>
|
||||
{graphTypeOptions.map((graphType) => {
|
||||
const isDisabled = disabledGraphTypeOptions.includes(graphType);
|
||||
const isChartV2Type = [
|
||||
GraphType.PIE,
|
||||
GraphType.LINE,
|
||||
GraphType.GAUGE,
|
||||
].includes(graphType);
|
||||
|
||||
const isDisabled = isChartV2Type && !isDashboardV2Enabled;
|
||||
|
||||
return (
|
||||
<MenuPicker
|
||||
|
||||
Reference in New Issue
Block a user