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 { useStyles } from 'component/common/ConstraintAccordion/ConstraintAccordion.styles';
import {
PlaygroundFeatureStrategyConstraintResult,
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from '../../../../../hooks/api/actions/usePlayground/playground.model';
} from 'hooks/api/actions/usePlayground/playground.model';
interface IConstraintAccordionViewHeaderProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult;
constraint: IConstraint | PlaygroundConstraintSchema;
onDelete?: () => void;
onEdit?: () => void;
singleValue: boolean;

View File

@ -4,7 +4,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import classnames from 'classnames';
import { IConstraint } from '../../../../../../interfaces/strategy';
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 }) => ({
display: '-webkit-box',
@ -21,7 +21,7 @@ const StyledValuesSpan = styled('span')(({ theme }) => ({
}));
interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult;
constraint: IConstraint | PlaygroundConstraintSchema;
expanded: boolean;
maxLength: number;
allowExpand: (shouldExpand: boolean) => void;

View File

@ -1,10 +1,10 @@
import React, { useEffect } from 'react';
import { Chip, styled, Typography } from '@mui/material';
import { formatConstraintValue } from '../../../../../../utils/formatConstraintValue';
import { formatConstraintValue } from 'utils/formatConstraintValue';
import { useStyles } from '../../../ConstraintAccordion.styles';
import { IConstraint } from '../../../../../../interfaces/strategy';
import { useLocationSettings } from '../../../../../../hooks/useLocationSettings';
import { PlaygroundFeatureStrategyConstraintResult } from '../../../../../../hooks/api/actions/usePlayground/playground.model';
import { useLocationSettings } from 'hooks/useLocationSettings';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { ConditionallyRender } from '../../../../ConditionallyRender/ConditionallyRender';
const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
@ -15,7 +15,7 @@ const StyledSingleValueChip = styled(Chip)(({ theme }) => ({
}));
interface ConstraintSingleValueProps {
constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult;
constraint: IConstraint | PlaygroundConstraintSchema;
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 { useStyles } from './PlaygroundConstraintItem.styles';
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
import { CancelOutlined } from "@mui/icons-material";
import { CancelOutlined } from '@mui/icons-material';
interface IConstraintItemProps {
value: string[];

View File

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

View File

@ -1,24 +1,5 @@
import { VariantSchema } from '../../../../openapi';
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];
import { VariantSchema } from 'openapi';
import { Operator } from 'constants/operators';
export interface PlaygroundConstraintSchema {
/**
@ -32,7 +13,7 @@ export interface PlaygroundConstraintSchema {
* @type {string}
* @memberof PlaygroundConstraintSchema
*/
operator: PlaygroundConstraintSchemaOperatorEnum;
operator: Operator;
/**
* Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).
* @type {boolean}
@ -92,7 +73,7 @@ export interface PlaygroundFeatureSchema {
isEnabledInCurrentEnvironment: boolean;
/**
*
* @type {PlaygroundFeatureSchemaIsEnabled}
* @type {boolean | 'unevaluated'}
* @memberof PlaygroundFeatureSchema
*/
isEnabled: boolean | 'unevaluated';
@ -146,13 +127,13 @@ export interface PlaygroundFeatureSchemaVariantPayload {
value: string;
}
export const PlaygroundFeatureSchemaVariantPayloadTypeEnum = {
export const playgroundFeatureSchemaVariantPayloadTypeEnum = {
Json: 'json',
Csv: 'csv',
String: 'string',
} as const;
export type PlaygroundFeatureSchemaVariantPayloadTypeEnum =
typeof PlaygroundFeatureSchemaVariantPayloadTypeEnum[keyof typeof PlaygroundFeatureSchemaVariantPayloadTypeEnum];
typeof playgroundFeatureSchemaVariantPayloadTypeEnum[keyof typeof playgroundFeatureSchemaVariantPayloadTypeEnum];
export interface PlaygroundRequestSchema {
/**
@ -258,11 +239,10 @@ export interface PlaygroundStrategySchema {
parameters: { [key: string]: string };
}
export const PlaygroundStrategySchemaResultEvaluationStatusEnum = {
Complete: 'complete',
} as const;
export type PlaygroundStrategySchemaResultEvaluationStatusEnum =
typeof PlaygroundStrategySchemaResultEvaluationStatusEnum[keyof typeof PlaygroundStrategySchemaResultEvaluationStatusEnum];
export enum PlaygroundStrategyResultEvaluationStatusEnum {
complete = 'complete',
incomplete = 'incomplete',
}
export interface PlaygroundStrategySchemaResult {
/**
@ -270,7 +250,7 @@ export interface PlaygroundStrategySchemaResult {
* @type {string}
* @memberof PlaygroundStrategySchemaResult
*/
evaluationStatus?: PlaygroundStrategySchemaResultEvaluationStatusEnum;
evaluationStatus?: PlaygroundStrategyResultEvaluationStatusEnum;
/**
* Whether this strategy evaluates to true or not.
* @type {boolean}