Skip to content

Commit

Permalink
Revert "feat: new variants per env form (#3004)"
Browse files Browse the repository at this point in the history
This reverts commit cef3538.
  • Loading branch information
Gastón Fournier committed Jan 30, 2023
1 parent c1f809f commit a29ef8d
Show file tree
Hide file tree
Showing 16 changed files with 864 additions and 964 deletions.
1 change: 0 additions & 1 deletion frontend/package.json
Expand Up @@ -57,7 +57,6 @@
"@types/react-test-renderer": "17.0.2",
"@types/react-timeago": "4.1.3",
"@types/semver": "7.3.13",
"@types/uuid": "^9.0.0",
"@uiw/codemirror-theme-duotone": "4.19.6",
"@uiw/react-codemirror": "4.19.6",
"@vitejs/plugin-react": "3.0.1",
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/component/common/Input/Input.styles.ts
Expand Up @@ -4,9 +4,5 @@ export const useStyles = makeStyles()(theme => ({
helperText: {
position: 'absolute',
bottom: '-1rem',
whiteSpace: 'nowrap',
maxWidth: '100%',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
}));
1 change: 0 additions & 1 deletion frontend/src/component/common/Input/Input.tsx
Expand Up @@ -48,7 +48,6 @@ const Input = ({
onChange={onChange}
FormHelperTextProps={{
['data-testid']: INPUT_ERROR_TEXT,
title: errorText,
classes: {
root: styles.helperText,
},
Expand Down
35 changes: 0 additions & 35 deletions frontend/src/component/common/util.ts
Expand Up @@ -3,7 +3,6 @@ import { IUiConfig } from 'interfaces/uiConfig';
import { INavigationMenuItem } from 'interfaces/route';
import { IFeatureVariant } from 'interfaces/featureToggle';
import { format, isValid } from 'date-fns';
import { IFeatureVariantEdit } from 'component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsModal/EnvironmentVariantsModal';

export const filterByConfig =
(config: IUiConfig) => (r: INavigationMenuItem) => {
Expand Down Expand Up @@ -91,40 +90,6 @@ export function updateWeight(variants: IFeatureVariant[], totalWeight: number) {
});
}

export function updateWeightEdit(
variants: IFeatureVariantEdit[],
totalWeight: number
) {
if (variants.length === 0) {
return [];
}
const { remainingPercentage, variableVariantCount } = variants.reduce(
({ remainingPercentage, variableVariantCount }, variant) => {
if (variant.weight && variant.weightType === weightTypes.FIX) {
remainingPercentage -= Number(variant.weight);
} else {
variableVariantCount += 1;
}
return {
remainingPercentage,
variableVariantCount,
};
},
{ remainingPercentage: totalWeight, variableVariantCount: 0 }
);

const percentage = parseInt(
String(remainingPercentage / variableVariantCount)
);

return variants.map(variant => {
if (variant.weightType !== weightTypes.FIX) {
variant.weight = percentage;
}
return variant;
});
}

export const modalStyles = {
overlay: {
position: 'absolute',
Expand Down

0 comments on commit a29ef8d

Please sign in to comment.