Kaizen
Browse modulesInsightsinsights/sharedFunctions

Function: applyDashboardFilters()

function applyDashboardFilters(base: FilterNode | undefined, leaves: readonly (
  | {
  field: string;
  kind: "condition";
  operator: "eq";
  value: string | number | boolean;
}
  | {
  field: string;
  kind: "condition";
  operator: "neq";
  value: string | number | boolean;
}
  | {
  field: string;
  kind: "condition";
  operator: "gt";
  value: string | number;
}
  | {
  field: string;
  kind: "condition";
  operator: "lt";
  value: string | number;
}
  | {
  field: string;
  kind: "condition";
  operator: "gte";
  value: string | number;
}
  | {
  field: string;
  kind: "condition";
  operator: "lte";
  value: string | number;
}
  | {
  field: string;
  kind: "condition";
  operator: "contains";
  value: string;
}
  | {
  field: string;
  kind: "condition";
  operator: "in";
  value: (string | number | boolean)[];
}
  | {
  field: string;
  kind: "condition";
  operator: "between";
  value: {
     from: string | number;
     to: string | number;
  };
}
  | {
  field: string;
  kind: "condition";
  operator: "isNull";
}
  | {
  field: string;
  kind: "condition";
  operator: "isNotNull";
})[]): FilterNode | undefined;

Defined in: shared/insights/types/dashboard-filter.ts:342

AND-merge dashboard-filter leaves into a tile's existing filter. An existing and is flattened, so merging never spends an avoidable nesting level. A single leaf stays bare; multiple nodes become one flat and group.

The merge is all-or-nothing: if the candidate would exceed filterNodeSchema's depth or leaf caps, the valid base is returned unchanged. Runtime dashboard input can therefore never turn a registered definition into one QueryService.run rejects. No leaves also returns the base by reference, preserving the unfiltered identity-stable path.

Parameters

ParameterType
baseFilterNode | undefined
leavesreadonly ( | { field: string; kind: "condition"; operator: "eq"; value: string | number | boolean; } | { field: string; kind: "condition"; operator: "neq"; value: string | number | boolean; } | { field: string; kind: "condition"; operator: "gt"; value: string | number; } | { field: string; kind: "condition"; operator: "lt"; value: string | number; } | { field: string; kind: "condition"; operator: "gte"; value: string | number; } | { field: string; kind: "condition"; operator: "lte"; value: string | number; } | { field: string; kind: "condition"; operator: "contains"; value: string; } | { field: string; kind: "condition"; operator: "in"; value: (string | number | boolean)[]; } | { field: string; kind: "condition"; operator: "between"; value: { from: string | number; to: string | number; }; } | { field: string; kind: "condition"; operator: "isNull"; } | { field: string; kind: "condition"; operator: "isNotNull"; })[]

Returns

FilterNode | undefined

On this page