1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

custom strategies adjustments

This commit is contained in:
andreas-unleash 2022-08-04 16:25:45 +03:00
parent 44f77c46c2
commit 3c5c855fc5
2 changed files with 14 additions and 2 deletions

View File

@ -8,7 +8,11 @@ import { useStyles } from './PlaygroundResultFeatureDetails.styles';
import { CloseOutlined } from '@mui/icons-material'; import { CloseOutlined } from '@mui/icons-material';
import React from 'react'; import React from 'react';
import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender';
import { checkForEmptyValues, hasCustomStrategies } from './helpers'; import {
checkForEmptyValues,
hasCustomStrategies,
hasOnlyCustomStrategies,
} from './helpers';
interface PlaygroundFeatureResultDetailsProps { interface PlaygroundFeatureResultDetailsProps {
feature: PlaygroundFeatureSchema; feature: PlaygroundFeatureSchema;
@ -31,7 +35,9 @@ export const PlaygroundResultFeatureDetails = ({
? 'at least one strategy is True' ? 'at least one strategy is True'
: !feature.isEnabledInCurrentEnvironment : !feature.isEnabledInCurrentEnvironment
? 'the environment is disabled' ? 'the environment is disabled'
: 'all strategies are False'; : hasOnlyCustomStrategies(feature)
? 'all strategies are Unevaluated'
: 'all strategies are False or Uneavaluated';
const color = feature.isEnabled const color = feature.isEnabled
? theme.palette.success.main ? theme.palette.success.main

View File

@ -25,3 +25,9 @@ export const hasCustomStrategies = (feature: PlaygroundFeatureSchema) => {
strategy => !DEFAULT_STRATEGIES.includes(strategy.name) strategy => !DEFAULT_STRATEGIES.includes(strategy.name)
); );
}; };
export const hasOnlyCustomStrategies = (feature: PlaygroundFeatureSchema) => {
return !feature.strategies?.data?.find(strategy =>
DEFAULT_STRATEGIES.includes(strategy.name)
);
};