mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
f33ca9db4b
* refactor: remove pre-CO constraints list * refactor: improve constraints dropdown order * refactor: simplify prop value * refactor: add missing space around parameter names * refactor: remove constraint accordion box shadow * refactor: show operator descriptions in constraints accordion * refactor: show operator descriptions in constraints dropdown * refactor: use ConstraintAccordionList in FeatureOverviewExecution * refactor: add separators between operators in constraints dropdown * refactor: remove unnecessary comment
25 lines
651 B
TypeScript
25 lines
651 B
TypeScript
import { allOperators, dateOperators, Operator } from 'constants/operators';
|
|
import { oneOf } from 'utils/oneOf';
|
|
|
|
export const CURRENT_TIME_CONTEXT_FIELD = 'currentTime';
|
|
|
|
export const operatorsForContext = (contextName: string): Operator[] => {
|
|
return allOperators.filter(operator => {
|
|
if (
|
|
oneOf(dateOperators, operator) &&
|
|
contextName !== CURRENT_TIME_CONTEXT_FIELD
|
|
) {
|
|
return false;
|
|
}
|
|
|
|
if (
|
|
!oneOf(dateOperators, operator) &&
|
|
contextName === CURRENT_TIME_CONTEXT_FIELD
|
|
) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
};
|