Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gitar] Cleaning up stale flag: caseInsensitiveInOperators with value false #836

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DATE_AFTER,
IN,
stringOperators,
inOperators,
} from 'constants/operators';
import { resolveText } from './helpers';
import { oneOf } from 'utils/oneOf';
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DATE_AFTER,
IN,
stringOperators,
inOperators,
} from 'constants/operators';
import { resolveText } from './helpers';
import { oneOf } from 'utils/oneOf';
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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',
Expand Down Expand Up @@ -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%',
Expand All @@ -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),
Expand Down Expand Up @@ -136,8 +129,6 @@ export const ProjectActionsFilterItem = ({
const [showCaseSensitiveButton, setShowCaseSensitiveButton] =
useState(false);

const caseInsensitiveInOperators = useUiFlag('caseInsensitiveInOperators');

const validOperators = allOperators.filter(
(operator) => !oneOf(dateOperators, operator),
);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/interfaces/uiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type UiFlags = {
messageBanner?: Variant;
banner?: Variant;
featuresExportImport?: boolean;
caseInsensitiveInOperators?: boolean;
notifications?: boolean;
personalAccessTokensKillSwitch?: boolean;
demo?: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/lib/__snapshots__/create-config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ exports[`should create default config 1`] = `
"anonymizeProjectOwners": false,
"archiveProjects": false,
"automatedActions": false,
"caseInsensitiveInOperators": false,
"celebrateUnleash": false,
"collectTrafficDataUsage": false,
"demo": false,
Expand Down
5 changes: 0 additions & 5 deletions src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type IFlagKey =
| 'maintenanceMode'
| 'messageBanner'
| 'featuresExportImport'
| 'caseInsensitiveInOperators'
| 'strictSchemaValidation'
| 'personalAccessTokensKillSwitch'
| 'migrationLock'
Expand Down Expand Up @@ -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,
Expand Down
Loading