From 7490c2110d89d6dfb5f958db8def26a7dae89ac6 Mon Sep 17 00:00:00 2001 From: Gitar Date: Mon, 19 Aug 2024 17:10:44 +0000 Subject: [PATCH 1/2] [Gitar] Updating TypeScript files --- frontend/src/interfaces/uiConfig.ts | 1 - src/lib/__snapshots__/create-config.test.ts.snap | 1 - src/lib/types/experimental.ts | 5 ----- 3 files changed, 7 deletions(-) diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index c00a70a7cab6..70d6dce03371 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -54,7 +54,6 @@ export type UiFlags = { messageBanner?: Variant; banner?: Variant; featuresExportImport?: boolean; - caseInsensitiveInOperators?: boolean; notifications?: boolean; personalAccessTokensKillSwitch?: boolean; demo?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index d5f1617b9b68..7a9fc44f377c 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -78,7 +78,6 @@ exports[`should create default config 1`] = ` "anonymizeProjectOwners": false, "archiveProjects": false, "automatedActions": false, - "caseInsensitiveInOperators": false, "celebrateUnleash": false, "collectTrafficDataUsage": false, "demo": false, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index e6df34fecd5a..afe4e03df22f 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -14,7 +14,6 @@ export type IFlagKey = | 'maintenanceMode' | 'messageBanner' | 'featuresExportImport' - | 'caseInsensitiveInOperators' | 'strictSchemaValidation' | 'personalAccessTokensKillSwitch' | 'migrationLock' @@ -107,10 +106,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_FEATURES_EXPORT_IMPORT, true, ), - caseInsensitiveInOperators: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS, - false, - ), strictSchemaValidation: parseEnvVarBoolean( process.env.UNLEASH_STRICT_SCHEMA_VALIDTION, false, From 643ffefcd7d68a2f459d7c6ca844e29750a24ee0 Mon Sep 17 00:00:00 2001 From: Gitar Date: Mon, 19 Aug 2024 17:10:44 +0000 Subject: [PATCH 2/2] [Gitar] Updating TSX files --- .../ConstraintAccordionEditHeader.tsx | 25 +++---------------- .../ConstraintAccordionEditHeader.tsx | 25 +++---------------- .../ProjectActionsFilterItem.tsx | 23 +++-------------- 3 files changed, 10 insertions(+), 63 deletions(-) diff --git a/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx b/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx index 458f0750e1f1..0fcee2897867 100644 --- a/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx +++ b/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx @@ -9,7 +9,6 @@ import { DATE_AFTER, IN, stringOperators, - inOperators, } from 'constants/operators'; import { resolveText } from './helpers'; import { oneOf } from 'utils/oneOf'; @@ -25,7 +24,6 @@ import { InvertedOperatorButton } from '../StyledToggleButton/InvertedOperatorBu import { CaseSensitiveButton } from '../StyledToggleButton/CaseSensitiveButton/CaseSensitiveButton'; import { ConstraintAccordionHeaderActions } from '../../ConstraintAccordionHeaderActions/ConstraintAccordionHeaderActions'; import { styled } from '@mui/material'; -import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IConstraintAccordionViewHeader { localConstraint: IConstraint; @@ -103,11 +101,6 @@ export const ConstraintAccordionEditHeader = ({ const { contextName, operator } = localConstraint; const [showCaseSensitiveButton, setShowCaseSensitiveButton] = useState(false); - const { uiConfig } = useUiConfig(); - - const caseInsensitiveInOperators = Boolean( - uiConfig.flags.caseInsensitiveInOperators, - ); /* We need a special case to handle the currenTime context field. Since this field will be the only one to allow DATE_BEFORE and DATE_AFTER operators @@ -131,21 +124,12 @@ export const ConstraintAccordionEditHeader = ({ setOperator(IN); } - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false); } - }, [ - contextName, - setOperator, - operator, - setLocalConstraint, - caseInsensitiveInOperators, - ]); + }, [contextName, setOperator, operator, setLocalConstraint, false]); if (!context) { return null; @@ -156,10 +140,7 @@ export const ConstraintAccordionEditHeader = ({ }); const onOperatorChange = (operator: Operator) => { - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false); diff --git a/frontend/src/component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx b/frontend/src/component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx index c15987f58374..d7b04bee0b91 100644 --- a/frontend/src/component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx +++ b/frontend/src/component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditHeader/ConstraintAccordionEditHeader.tsx @@ -9,7 +9,6 @@ import { DATE_AFTER, IN, stringOperators, - inOperators, } from 'constants/operators'; import { resolveText } from './helpers'; import { oneOf } from 'utils/oneOf'; @@ -25,7 +24,6 @@ import { InvertedOperatorButton } from '../StyledToggleButton/InvertedOperatorBu import { CaseSensitiveButton } from '../StyledToggleButton/CaseSensitiveButton/CaseSensitiveButton'; import { ConstraintAccordionHeaderActions } from '../../ConstraintAccordionHeaderActions/ConstraintAccordionHeaderActions'; import { styled } from '@mui/material'; -import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IConstraintAccordionViewHeader { localConstraint: IConstraint; @@ -107,11 +105,6 @@ export const ConstraintAccordionEditHeader = ({ const { contextName, operator } = localConstraint; const [showCaseSensitiveButton, setShowCaseSensitiveButton] = useState(false); - const { uiConfig } = useUiConfig(); - - const caseInsensitiveInOperators = Boolean( - uiConfig.flags.caseInsensitiveInOperators, - ); /* We need a special case to handle the currenTime context field. Since this field will be the only one to allow DATE_BEFORE and DATE_AFTER operators @@ -135,21 +128,12 @@ export const ConstraintAccordionEditHeader = ({ setOperator(IN); } - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false); } - }, [ - contextName, - setOperator, - operator, - setLocalConstraint, - caseInsensitiveInOperators, - ]); + }, [contextName, setOperator, operator, setLocalConstraint, false]); if (!context) { return null; @@ -160,10 +144,7 @@ export const ConstraintAccordionEditHeader = ({ }); const onOperatorChange = (operator: Operator) => { - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false); diff --git a/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsFormStep/ProjectActionsFormStepSource/ProjectActionsFilterItem.tsx b/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsFormStep/ProjectActionsFormStepSource/ProjectActionsFilterItem.tsx index d1d4c7ebd216..229a3954d646 100644 --- a/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsFormStep/ProjectActionsFormStepSource/ProjectActionsFilterItem.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsFormStep/ProjectActionsFormStepSource/ProjectActionsFilterItem.tsx @@ -7,14 +7,12 @@ import { } from '@mui/material'; import type { ActionsFilterState } from '../../useProjectActionsForm'; import Delete from '@mui/icons-material/Delete'; -import Input from 'component/common/Input/Input'; import { ProjectActionsFormItem } from '../ProjectActionsFormItem'; import { ConstraintOperatorSelect } from 'component/common/ConstraintAccordion/ConstraintOperatorSelect'; import { type Operator, allOperators, dateOperators, - inOperators, stringOperators, } from 'constants/operators'; import { useEffect, useState } from 'react'; @@ -24,7 +22,6 @@ import { CaseSensitiveButton } from 'component/common/NewConstraintAccordion/Con import { InvertedOperatorButton } from 'component/common/NewConstraintAccordion/ConstraintAccordionEdit/StyledToggleButton/InvertedOperatorButton/InvertedOperatorButton'; import { ResolveInput } from 'component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditBody/ResolveInput/ResolveInput'; import { useConstraintInput } from 'component/common/NewConstraintAccordion/ConstraintAccordionEdit/ConstraintAccordionEditBody/useConstraintInput/useConstraintInput'; -import { useUiFlag } from 'hooks/useUiFlag'; const StyledDeleteButton = styled(IconButton)({ marginRight: '-6px', @@ -54,7 +51,7 @@ const StyledOperatorOptions = styled('div')(({ theme }) => ({ gap: theme.spacing(1), })); -const StyledOperatorSelectWrapper = styled('div')(({ theme }) => ({ +const StyledOperatorSelectWrapper = styled('div')(() => ({ width: '100%', '&&& > div': { width: '100%', @@ -77,10 +74,6 @@ const StyledInputContainer = styled('div')({ flex: 1, }); -const StyledInput = styled(Input)({ - width: '100%', -}); - const StyledResolveInputWrapper = styled('div')(({ theme }) => ({ '& > h3': { margin: theme.spacing(1, 0, 0, 0), @@ -136,8 +129,6 @@ export const ProjectActionsFilterItem = ({ const [showCaseSensitiveButton, setShowCaseSensitiveButton] = useState(false); - const caseInsensitiveInOperators = useUiFlag('caseInsensitiveInOperators'); - const validOperators = allOperators.filter( (operator) => !oneOf(dateOperators, operator), ); @@ -167,21 +158,15 @@ export const ProjectActionsFilterItem = ({ }, [value, error]); useEffect(() => { - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false); } - }, [operator, caseInsensitiveInOperators]); + }, [operator, false]); const onOperatorChange = (operator: Operator) => { - if ( - oneOf(stringOperators, operator) || - (oneOf(inOperators, operator) && caseInsensitiveInOperators) - ) { + if (oneOf(stringOperators, operator)) { setShowCaseSensitiveButton(true); } else { setShowCaseSensitiveButton(false);