fix: add UID filter to /insights/routing (#20356)
This commit is contained in:
1 parent
a9ddea9184
commit
f699fd1732
8 files changed
+78
-14
No files matched your search
@@ -6,7 +6,7 @@ import {
|
||||
isNumberFilterValue,
|
||||
} from "./utils";
|
||||
|
||||
type makeWhereClauseProps = {
|
||||
type MakeWhereClauseProps = {
|
||||
columnName: string;
|
||||
filterValue: FilterValue;
|
||||
json?: true | { path: string[] };
|
||||
@@ -20,7 +20,7 @@ export function makeOrderBy(sorting: SortingState) {
|
||||
}));
|
||||
}
|
||||
|
||||
export function makeWhereClause(props: makeWhereClauseProps) {
|
||||
export function makeWhereClause(props: MakeWhereClauseProps) {
|
||||
const { columnName, filterValue } = props;
|
||||
const isJson = props.json === true || (typeof props.json === "object" && props.json.path?.length > 0);
|
||||
const jsonPath = isJson && typeof props.json === "object" ? props.json.path : undefined;
|
||||
|
||||
@@ -10,7 +10,7 @@ export enum ColumnFilterType {
|
||||
DATE_RANGE = "dr",
|
||||
}
|
||||
|
||||
const textFilterOperators = [
|
||||
export const textFilterOperators = [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
@@ -113,14 +113,24 @@ export type DateRangeFilterOptions = {
|
||||
range: "past" | "custom";
|
||||
};
|
||||
|
||||
export type TextFilterOptions = {
|
||||
allowedOperators?: TextFilterOperator[];
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export type ColumnFilterMeta =
|
||||
| {
|
||||
type: ColumnFilterType.DATE_RANGE;
|
||||
icon?: IconName;
|
||||
dateRangeOptions: DateRangeFilterOptions;
|
||||
dateRangeOptions?: DateRangeFilterOptions;
|
||||
}
|
||||
| {
|
||||
type?: Exclude<ColumnFilterType, ColumnFilterType.DATE_RANGE>;
|
||||
type: ColumnFilterType.TEXT;
|
||||
icon?: IconName;
|
||||
textOptions?: TextFilterOptions;
|
||||
}
|
||||
| {
|
||||
type?: Exclude<ColumnFilterType, ColumnFilterType.DATE_RANGE | ColumnFilterType.TEXT>;
|
||||
icon?: IconName;
|
||||
};
|
||||
|
||||
@@ -139,6 +149,7 @@ export type FilterableColumn = {
|
||||
}
|
||||
| {
|
||||
type: ColumnFilterType.TEXT;
|
||||
textOptions?: TextFilterOptions;
|
||||
}
|
||||
| {
|
||||
type: ColumnFilterType.NUMBER;
|
||||
|
||||
Reference in new issue
Block a user