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

Added unknown evaluation state to table

Moved playground.model.ts to Playground folder
This commit is contained in:
andreas-unleash 2022-08-09 17:41:43 +03:00
parent 781813fd05
commit a4c6ae2077
23 changed files with 40 additions and 25 deletions

View File

@ -8,7 +8,7 @@ import { formatUnknownError } from 'utils/formatUnknownError';
import { PlaygroundResultsTable } from './PlaygroundResultsTable/PlaygroundResultsTable';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { usePlaygroundApi } from 'hooks/api/actions/usePlayground/usePlayground';
import { PlaygroundResponseSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundResponseSchema } from 'component/playground/Playground/interfaces/playground.model';
import { useEnvironments } from 'hooks/api/getters/useEnvironments/useEnvironments';
import { PlaygroundForm } from './PlaygroundForm/PlaygroundForm';
import {

View File

@ -1,6 +1,6 @@
import { colors } from 'themes/colors';
import { Alert, styled } from '@mui/material';
import { SdkContextSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { SdkContextSchema } from 'component/playground/Playground/interfaces/playground.model';
interface IContextBannerProps {
environment: string;

View File

@ -1,7 +1,7 @@
import {
PlaygroundFeatureSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { Alert, IconButton, Typography, useTheme } from '@mui/material';
import { PlaygroundResultChip } from '../../PlaygroundResultChip/PlaygroundResultChip';
import { useStyles } from './FeatureDetails.styles';

View File

@ -1,4 +1,4 @@
import { PlaygroundFeatureSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundFeatureSchema } from 'component/playground/Playground/interfaces/playground.model';
export const DEFAULT_STRATEGIES = [
'default',

View File

@ -1,7 +1,7 @@
import {
PlaygroundFeatureSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { IconButton, Popover, styled } from '@mui/material';
import { InfoOutlined } from '@mui/icons-material';
import React, { useRef, useState } from 'react';

View File

@ -3,7 +3,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import {
PlaygroundFeatureSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { Alert } from '@mui/material';
interface PlaygroundResultFeatureStrategyListProps {

View File

@ -3,7 +3,7 @@ import { PlaygroundResultChip } from '../../../../PlaygroundResultChip/Playgroun
import {
PlaygroundStrategySchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { StrategyExecution } from './StrategyExecution/StrategyExecution';
import { useStyles } from './FeatureStrategyItem.styles';
import { StrategyItemContainer } from 'component/common/StrategyItemContainer/StrategyItemContainer';

View File

@ -18,7 +18,7 @@ import { useStyles } from './ConstraintAccordion.styles';
import {
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { ConstraintAccordionViewBody } from 'component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionViewBody/ConstraintAccordionViewBody';
interface IConstraintAccordionViewProps {

View File

@ -4,7 +4,7 @@ import { useStyles } from 'component/common/ConstraintAccordion/ConstraintAccord
import {
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
interface PlaygroundConstraintAccordionViewHeaderProps {
constraint: PlaygroundConstraintSchema;

View File

@ -8,7 +8,7 @@ import { CancelOutlined } from '@mui/icons-material';
import {
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { ConstraintViewHeaderOperator } from 'component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionViewHeader/ConstraintViewHeaderOperator/ConstraintViewHeaderOperator';
const StyledHeaderText = styled('span')(({ theme }) => ({

View File

@ -3,7 +3,7 @@ import { styled, Typography } from '@mui/material';
import React, { useEffect, useMemo, useState } from 'react';
import classnames from 'classnames';
import { useStyles } from '../../../ConstraintAccordion.styles';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundConstraintSchema } from 'component/playground/Playground/interfaces/playground.model';
const StyledValuesSpan = styled('span')(({ theme }) => ({
display: '-webkit-box',

View File

@ -3,7 +3,7 @@ import { Chip, styled, Typography } from '@mui/material';
import { formatConstraintValue } from 'utils/formatConstraintValue';
import { useStyles } from '../../../ConstraintAccordion.styles';
import { useLocationSettings } from 'hooks/useLocationSettings';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundConstraintSchema } from 'component/playground/Playground/interfaces/playground.model';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
const StyledSingleValueChip = styled(Chip)(({ theme }) => ({

View File

@ -2,7 +2,7 @@ import { Fragment, VFC } from 'react';
import {
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { objectId } from 'utils/objectId';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator';

View File

@ -9,7 +9,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator';
import { Chip } from '@mui/material';
import PercentageCircle from 'component/common/PercentageCircle/PercentageCircle';
import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundConstraintSchema } from 'component/playground/Playground/interfaces/playground.model';
import { useStrategies } from 'hooks/api/getters/useStrategies/useStrategies';
interface ICustomStrategyProps {

View File

@ -2,7 +2,7 @@ import { VFC } from 'react';
import {
PlaygroundSegmentSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { ConstraintExecution } from '../ConstraintExecution/ConstraintExecution';
import { CancelOutlined, DonutLarge } from '@mui/icons-material';
import { Link } from 'react-router-dom';

View File

@ -6,7 +6,7 @@ import { useStyles } from './StrategyExecution.styles';
import {
PlaygroundRequestSchema,
PlaygroundStrategySchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { ConstraintExecution } from './ConstraintExecution/ConstraintExecution';
import { SegmentExecution } from './SegmentExecution/SegmentExecution';

View File

@ -10,7 +10,7 @@ import { useStyles } from '../StrategyExecution.styles';
import {
PlaygroundConstraintSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { getMappedParam } from '../helpers';
export interface PlaygroundResultStrategyExecutionParametersProps {

View File

@ -4,7 +4,7 @@ import {
PlaygroundFeatureSchema,
PlaygroundStrategySchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { FeatureStrategyItem } from './StrategyItem/FeatureStrategyItem';
import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator';

View File

@ -1,9 +1,10 @@
import React from 'react';
import { Box, styled } from '@mui/material';
import { PlaygroundResultChip } from '../PlaygroundResultChip/PlaygroundResultChip';
import { PlaygroundFeatureSchema } from '../../interfaces/playground.model';
interface IFeatureStatusCellProps {
enabled: boolean;
feature: PlaygroundFeatureSchema;
}
const StyledCellBox = styled(Box)(({ theme }) => ({
@ -16,13 +17,25 @@ const StyledChipWrapper = styled(Box)(() => ({
marginRight: 'auto',
}));
export const FeatureStatusCell = ({ enabled }: IFeatureStatusCellProps) => {
export const FeatureStatusCell = ({ feature }: IFeatureStatusCellProps) => {
const enabled = feature.isEnabled
? true
: feature.strategies.result === false
? false
: 'unknown';
const label = feature.isEnabled
? 'True'
: feature.strategies.result === false
? 'False'
: 'Unknown';
return (
<StyledCellBox>
<StyledChipWrapper data-loading>
<PlaygroundResultChip
enabled={enabled}
label={enabled ? 'True' : 'False'}
label={label}
showIcon={enabled !== 'unknown'}
size={'medium'}
/>
</StyledChipWrapper>
</StyledCellBox>

View File

@ -22,7 +22,7 @@ import { FeatureStatusCell } from './FeatureStatusCell/FeatureStatusCell';
import {
PlaygroundFeatureSchema,
PlaygroundRequestSchema,
} from 'hooks/api/actions/usePlayground/playground.model';
} from 'component/playground/Playground/interfaces/playground.model';
import { Box, Typography, useMediaQuery, useTheme } from '@mui/material';
import useLoading from 'hooks/useLoading';
import { VariantCell } from './VariantCell/VariantCell';
@ -106,7 +106,9 @@ export const PlaygroundResultsTable = ({
accessor: 'isEnabled',
filterName: 'isEnabled',
filterParsing: (value: boolean) => (value ? 'true' : 'false'),
Cell: ({ value }: any) => <FeatureStatusCell enabled={value} />,
Cell: ({ row }: any) => (
<FeatureStatusCell feature={row.original} />
),
sortType: 'boolean',
sortInverted: true,
},

View File

@ -1,4 +1,4 @@
import { PlaygroundResponseSchema } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundResponseSchema } from 'component/playground/Playground/interfaces/playground.model';
import { IEnvironment } from 'interfaces/environments';
export const resolveProjects = (

View File

@ -2,7 +2,7 @@ import useAPI from '../useApi/useApi';
import {
PlaygroundRequestSchema,
PlaygroundResponseSchema,
} from './playground.model';
} from '../../../../component/playground/Playground/interfaces/playground.model';
export const usePlaygroundApi = () => {
const { makeRequest, createRequest, errors, loading } = useAPI({