1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-22 01:16:07 +02:00

bug fixes and linting

This commit is contained in:
andreas-unleash 2022-08-03 14:54:13 +03:00
parent 0d083231a3
commit 76b33cdd11
6 changed files with 25 additions and 46 deletions

View File

@ -4,12 +4,12 @@ import { ConstraintAccordionViewHeaderInfo } from './ConstraintAccordionViewHead
import { ConstraintAccordionHeaderActions } from '../../ConstraintAccordionHeaderActions/ConstraintAccordionHeaderActions'; import { ConstraintAccordionHeaderActions } from '../../ConstraintAccordionHeaderActions/ConstraintAccordionHeaderActions';
import { useStyles } from 'component/common/ConstraintAccordion/ConstraintAccordion.styles'; import { useStyles } from 'component/common/ConstraintAccordion/ConstraintAccordion.styles';
import { import {
PlaygroundFeatureStrategyConstraintResult, PlaygroundConstraintSchema,
PlaygroundRequestSchema, PlaygroundRequestSchema,
} from '../../../../../hooks/api/actions/usePlayground/playground.model'; } from 'hooks/api/actions/usePlayground/playground.model';
interface IConstraintAccordionViewHeaderProps { interface IConstraintAccordionViewHeaderProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult; constraint: IConstraint | PlaygroundConstraintSchema;
onDelete?: () => void; onDelete?: () => void;
onEdit?: () => void; onEdit?: () => void;
singleValue: boolean; singleValue: boolean;

View File

@ -4,7 +4,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { IConstraint } from '../../../../../../interfaces/strategy'; import { IConstraint } from '../../../../../../interfaces/strategy';
import { useStyles } from '../../../ConstraintAccordion.styles'; import { useStyles } from '../../../ConstraintAccordion.styles';
import { PlaygroundFeatureStrategyConstraintResult } from '../../../../../../hooks/api/actions/usePlayground/playground.model'; import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
const StyledValuesSpan = styled('span')(({ theme }) => ({ const StyledValuesSpan = styled('span')(({ theme }) => ({
display: '-webkit-box', display: '-webkit-box',
@ -21,7 +21,7 @@ const StyledValuesSpan = styled('span')(({ theme }) => ({
})); }));
interface ConstraintSingleValueProps { interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult; constraint: IConstraint | PlaygroundConstraintSchema;
expanded: boolean; expanded: boolean;
maxLength: number; maxLength: number;
allowExpand: (shouldExpand: boolean) => void; allowExpand: (shouldExpand: boolean) => void;

View File

@ -1,10 +1,10 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Chip, styled, Typography } from '@mui/material'; import { Chip, styled, Typography } from '@mui/material';
import { formatConstraintValue } from '../../../../../../utils/formatConstraintValue'; import { formatConstraintValue } from 'utils/formatConstraintValue';
import { useStyles } from '../../../ConstraintAccordion.styles'; import { useStyles } from '../../../ConstraintAccordion.styles';
import { IConstraint } from '../../../../../../interfaces/strategy'; import { IConstraint } from '../../../../../../interfaces/strategy';
import { useLocationSettings } from '../../../../../../hooks/useLocationSettings'; import { useLocationSettings } from 'hooks/useLocationSettings';
import { PlaygroundFeatureStrategyConstraintResult } from '../../../../../../hooks/api/actions/usePlayground/playground.model'; import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender';
const StyledSingleValueChip = styled(Chip)(({ theme }) => ({ const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
@ -15,7 +15,7 @@ const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
})); }));
interface ConstraintSingleValueProps { interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult; constraint: IConstraint | PlaygroundConstraintSchema;
allowExpand: (shouldExpand: boolean) => void; allowExpand: (shouldExpand: boolean) => void;
} }

View File

@ -2,7 +2,7 @@ import { Chip, Typography, useTheme } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { useStyles } from './PlaygroundConstraintItem.styles'; import { useStyles } from './PlaygroundConstraintItem.styles';
import StringTruncator from 'component/common/StringTruncator/StringTruncator'; import StringTruncator from 'component/common/StringTruncator/StringTruncator';
import { CancelOutlined } from "@mui/icons-material"; import { CancelOutlined } from '@mui/icons-material';
interface IConstraintItemProps { interface IConstraintItemProps {
value: string[]; value: string[];

View File

@ -19,9 +19,7 @@ import PercentageCircle from '../../../../../../../../common/PercentageCircle/Pe
import StringTruncator from '../../../../../../../../common/StringTruncator/StringTruncator'; import StringTruncator from '../../../../../../../../common/StringTruncator/StringTruncator';
import { useStrategies } from '../../../../../../../../../hooks/api/getters/useStrategies/useStrategies'; import { useStrategies } from '../../../../../../../../../hooks/api/getters/useStrategies/useStrategies';
import { PlaygroundConstraintItem } from '../PlaygroundConstraintItem/PlaygroundConstraintItem'; import { PlaygroundConstraintItem } from '../PlaygroundConstraintItem/PlaygroundConstraintItem';
import { import { ConstraintItem } from '../../../../../../../../feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/ConstraintItem/ConstraintItem';
ConstraintItem
} from "../../../../../../../../feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/ConstraintItem/ConstraintItem";
interface PlaygroundResultStrategyExecutionProps { interface PlaygroundResultStrategyExecutionProps {
strategyResult: PlaygroundStrategySchema; strategyResult: PlaygroundStrategySchema;
@ -217,8 +215,9 @@ export const PlaygroundResultStrategyExecution = ({
</p> </p>
<ConditionallyRender <ConditionallyRender
condition={ condition={
typeof strategyResult.parameters[param.name] !== typeof strategyResult.parameters[
'undefined' param.name
] !== 'undefined'
} }
show={ show={
<ConditionallyRender <ConditionallyRender

View File

@ -1,24 +1,5 @@
import { VariantSchema } from '../../../../openapi'; import { VariantSchema } from 'openapi';
import { Operator } from 'constants/operators';
export const PlaygroundConstraintSchemaOperatorEnum = {
NotIn: 'NOT_IN',
In: 'IN',
StrEndsWith: 'STR_ENDS_WITH',
StrStartsWith: 'STR_STARTS_WITH',
StrContains: 'STR_CONTAINS',
NumEq: 'NUM_EQ',
NumGt: 'NUM_GT',
NumGte: 'NUM_GTE',
NumLt: 'NUM_LT',
NumLte: 'NUM_LTE',
DateAfter: 'DATE_AFTER',
DateBefore: 'DATE_BEFORE',
SemverEq: 'SEMVER_EQ',
SemverGt: 'SEMVER_GT',
SemverLt: 'SEMVER_LT',
} as const;
export type PlaygroundConstraintSchemaOperatorEnum =
typeof PlaygroundConstraintSchemaOperatorEnum[keyof typeof PlaygroundConstraintSchemaOperatorEnum];
export interface PlaygroundConstraintSchema { export interface PlaygroundConstraintSchema {
/** /**
@ -32,7 +13,7 @@ export interface PlaygroundConstraintSchema {
* @type {string} * @type {string}
* @memberof PlaygroundConstraintSchema * @memberof PlaygroundConstraintSchema
*/ */
operator: PlaygroundConstraintSchemaOperatorEnum; operator: Operator;
/** /**
* Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive). * Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).
* @type {boolean} * @type {boolean}
@ -92,7 +73,7 @@ export interface PlaygroundFeatureSchema {
isEnabledInCurrentEnvironment: boolean; isEnabledInCurrentEnvironment: boolean;
/** /**
* *
* @type {PlaygroundFeatureSchemaIsEnabled} * @type {boolean | 'unevaluated'}
* @memberof PlaygroundFeatureSchema * @memberof PlaygroundFeatureSchema
*/ */
isEnabled: boolean | 'unevaluated'; isEnabled: boolean | 'unevaluated';
@ -146,13 +127,13 @@ export interface PlaygroundFeatureSchemaVariantPayload {
value: string; value: string;
} }
export const PlaygroundFeatureSchemaVariantPayloadTypeEnum = { export const playgroundFeatureSchemaVariantPayloadTypeEnum = {
Json: 'json', Json: 'json',
Csv: 'csv', Csv: 'csv',
String: 'string', String: 'string',
} as const; } as const;
export type PlaygroundFeatureSchemaVariantPayloadTypeEnum = export type PlaygroundFeatureSchemaVariantPayloadTypeEnum =
typeof PlaygroundFeatureSchemaVariantPayloadTypeEnum[keyof typeof PlaygroundFeatureSchemaVariantPayloadTypeEnum]; typeof playgroundFeatureSchemaVariantPayloadTypeEnum[keyof typeof playgroundFeatureSchemaVariantPayloadTypeEnum];
export interface PlaygroundRequestSchema { export interface PlaygroundRequestSchema {
/** /**
@ -258,11 +239,10 @@ export interface PlaygroundStrategySchema {
parameters: { [key: string]: string }; parameters: { [key: string]: string };
} }
export const PlaygroundStrategySchemaResultEvaluationStatusEnum = { export enum PlaygroundStrategyResultEvaluationStatusEnum {
Complete: 'complete', complete = 'complete',
} as const; incomplete = 'incomplete',
export type PlaygroundStrategySchemaResultEvaluationStatusEnum = }
typeof PlaygroundStrategySchemaResultEvaluationStatusEnum[keyof typeof PlaygroundStrategySchemaResultEvaluationStatusEnum];
export interface PlaygroundStrategySchemaResult { export interface PlaygroundStrategySchemaResult {
/** /**
@ -270,7 +250,7 @@ export interface PlaygroundStrategySchemaResult {
* @type {string} * @type {string}
* @memberof PlaygroundStrategySchemaResult * @memberof PlaygroundStrategySchemaResult
*/ */
evaluationStatus?: PlaygroundStrategySchemaResultEvaluationStatusEnum; evaluationStatus?: PlaygroundStrategyResultEvaluationStatusEnum;
/** /**
* Whether this strategy evaluates to true or not. * Whether this strategy evaluates to true or not.
* @type {boolean} * @type {boolean}