Add PowerSearch basic types
Summary: Project doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU Reviewed By: lblasa Differential Revision: D48467956 fbshipit-source-id: 7f5303d981831c261bf5e4fe0027883fd1e7d873
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3bfe9a1f98
commit
d54bd8938a
@@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Mostly mateches https://www.internalfb.com/code/www/html/intern/js/ui/PowerSearch/PowerSearchExampleConfig.js
|
||||||
|
|
||||||
|
export type SimpleFilterValueType = 'NESTED' | 'NO_VALUE' | 'INTEGER' | 'FLOAT';
|
||||||
|
|
||||||
|
export type StringFilterValueType = 'STRING_SET' | 'STRING';
|
||||||
|
|
||||||
|
export type EnumFilterValueType = 'ENUM_SET' | 'ENUM';
|
||||||
|
|
||||||
|
export type RelativeDateFilterValueType = 'RELATIVE_DATE';
|
||||||
|
|
||||||
|
export type AbsoluteDateFilterValueType = 'ABSOLUTE_DATE';
|
||||||
|
|
||||||
|
export type TimeFilterValueType = 'TIME';
|
||||||
|
|
||||||
|
export type SimpleOperatorConfig = {
|
||||||
|
valueType: SimpleFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type StringOperatorConfig = {
|
||||||
|
valueType: StringFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EnumOperatorConfig = {
|
||||||
|
valueType: EnumFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
enumLabels: {[key: string]: string};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type InternPowerSearchRelativeDateAllowableTensesType =
|
||||||
|
| 'PAST_ONLY'
|
||||||
|
| 'FUTURE_ONLY'
|
||||||
|
| 'PAST_AND_FUTURE';
|
||||||
|
|
||||||
|
export type RelativeDateOperatorConfig = {
|
||||||
|
valueType: RelativeDateFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
allowableTenses: InternPowerSearchRelativeDateAllowableTensesType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AbsoluteDateOperatorConfig = {
|
||||||
|
valueType: AbsoluteDateFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
dateOnly?: boolean;
|
||||||
|
minValue?: Date;
|
||||||
|
maxValue?: Date;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TimeOperatorConfig = {
|
||||||
|
valueType: TimeFilterValueType;
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
minValue?: Date;
|
||||||
|
maxValue?: Date;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OperatorConfig =
|
||||||
|
| SimpleOperatorConfig
|
||||||
|
| StringOperatorConfig
|
||||||
|
| EnumOperatorConfig
|
||||||
|
| AbsoluteDateOperatorConfig
|
||||||
|
| RelativeDateOperatorConfig
|
||||||
|
| TimeOperatorConfig;
|
||||||
|
|
||||||
|
export type FieldConfig = {
|
||||||
|
key: string;
|
||||||
|
label: string;
|
||||||
|
operators: {[key: string]: OperatorConfig};
|
||||||
|
operatorMenuDisplayOrder: string[];
|
||||||
|
typeaheadOperators: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PowerSearchConfig = {
|
||||||
|
name: string;
|
||||||
|
fields: {[key: string]: FieldConfig};
|
||||||
|
fieldKeyTypeaheadOrder?: string[];
|
||||||
|
};
|
||||||
14
desktop/flipper-plugin/src/ui/PowerSearch/index.tsx
Normal file
14
desktop/flipper-plugin/src/ui/PowerSearch/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export const PowerSearch: React.FC = () => {
|
||||||
|
return <></>;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user