Simplify config
Summary: Project doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU Reviewed By: lblasa Differential Revision: D48600255 fbshipit-source-id: a57504519000fce4544f6875b2933cd5bcaedba3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e87ec62552
commit
380e99400f
@@ -7,11 +7,14 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Mostly mateches https://www.internalfb.com/code/www/html/intern/js/ui/PowerSearch/PowerSearchExampleConfig.js
|
// Mostly matches https://www.internalfb.com/code/www/html/intern/js/ui/PowerSearch/PowerSearchExampleConfig.js
|
||||||
|
|
||||||
export type SimpleFilterValueType = 'NESTED' | 'NO_VALUE' | 'INTEGER' | 'FLOAT';
|
export type SimpleFilterValueType =
|
||||||
|
| 'NO_VALUE'
|
||||||
export type StringFilterValueType = 'STRING_SET' | 'STRING';
|
| 'INTEGER'
|
||||||
|
| 'FLOAT'
|
||||||
|
| 'STRING_SET'
|
||||||
|
| 'STRING';
|
||||||
|
|
||||||
export type EnumFilterValueType = 'ENUM_SET' | 'ENUM';
|
export type EnumFilterValueType = 'ENUM_SET' | 'ENUM';
|
||||||
|
|
||||||
@@ -27,13 +30,6 @@ export type SimpleOperatorConfig = {
|
|||||||
label: string;
|
label: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StringOperatorConfig = {
|
|
||||||
valueType: StringFilterValueType;
|
|
||||||
key: string;
|
|
||||||
label: string;
|
|
||||||
allowArbitraryEntries?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type EnumOperatorConfig = {
|
export type EnumOperatorConfig = {
|
||||||
valueType: EnumFilterValueType;
|
valueType: EnumFilterValueType;
|
||||||
key: string;
|
key: string;
|
||||||
@@ -75,7 +71,6 @@ export type TimeOperatorConfig = {
|
|||||||
|
|
||||||
export type OperatorConfig =
|
export type OperatorConfig =
|
||||||
| SimpleOperatorConfig
|
| SimpleOperatorConfig
|
||||||
| StringOperatorConfig
|
|
||||||
| EnumOperatorConfig
|
| EnumOperatorConfig
|
||||||
| AbsoluteDateOperatorConfig
|
| AbsoluteDateOperatorConfig
|
||||||
| RelativeDateOperatorConfig
|
| RelativeDateOperatorConfig
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ const operators = {
|
|||||||
label: 'is any of (arbitrary allowed)',
|
label: 'is any of (arbitrary allowed)',
|
||||||
key: 'ent_class_any_with_arbitrary_strings',
|
key: 'ent_class_any_with_arbitrary_strings',
|
||||||
valueType: 'STRING_SET',
|
valueType: 'STRING_SET',
|
||||||
allowArbitraryEntries: true,
|
|
||||||
},
|
},
|
||||||
caller_is: {
|
caller_is: {
|
||||||
label: 'is',
|
label: 'is',
|
||||||
@@ -111,7 +110,6 @@ const operators = {
|
|||||||
label: 'does not contain',
|
label: 'does not contain',
|
||||||
key: 'predictive_not_contain',
|
key: 'predictive_not_contain',
|
||||||
valueType: 'STRING',
|
valueType: 'STRING',
|
||||||
allowArbitraryEntries: true,
|
|
||||||
},
|
},
|
||||||
newer_than_relative_date: {
|
newer_than_relative_date: {
|
||||||
key: 'newer_than_relative_date',
|
key: 'newer_than_relative_date',
|
||||||
@@ -260,37 +258,5 @@ export const powerSearchExampleConfig: PowerSearchConfig = {
|
|||||||
unread: operators.unread,
|
unread: operators.unread,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
NESTED_FIELD: {
|
|
||||||
key: 'NESTED_FIELD',
|
|
||||||
label: '',
|
|
||||||
operators: {
|
|
||||||
AND: {
|
|
||||||
key: 'AND',
|
|
||||||
label: 'All of',
|
|
||||||
valueType: 'NESTED',
|
|
||||||
},
|
|
||||||
NOT: {
|
|
||||||
key: 'NOT',
|
|
||||||
label: 'None of',
|
|
||||||
valueType: 'NESTED',
|
|
||||||
},
|
|
||||||
OR: {
|
|
||||||
key: 'OR',
|
|
||||||
label: 'Any of',
|
|
||||||
valueType: 'NESTED',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
CONTEXT_TOKEN: {
|
|
||||||
key: 'CONTEXT_TOKEN',
|
|
||||||
label: 'Context Token',
|
|
||||||
operators: {
|
|
||||||
CONTEXT_TOKEN: {
|
|
||||||
key: 'CONTEXT_TOKEN',
|
|
||||||
label: '',
|
|
||||||
valueType: 'NO_VALUE',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user