Skip to content

Commit

Permalink
filter out dimension names that do not have dimension values when req…
Browse files Browse the repository at this point in the history
…uesting updated data
  • Loading branch information
briangregoryholmes committed Dec 19, 2023
1 parent 57a27f8 commit d02c021
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
],
timeStart: $timeControlsStore.timeStart,
timeEnd,
filter: $dashboardStore?.filters,
filter: {
exclude: $dashboardStore.filters.exclude?.filter((f) => f.in?.length),
include: $dashboardStore.filters.include?.filter((f) => f.in?.length),
},
},
{
query: {
Expand Down
12 changes: 10 additions & 2 deletions web-common/src/features/dashboards/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,22 @@ export const getFiltersForOtherDimensions = (
const filter: V1MetricsViewFilter = {
include:
filters.include
?.filter((dimensionValues) => dimensionName !== dimensionValues.name)
?.filter((dimensionValues) => {
return (
dimensionName !== dimensionValues.name && dimensionValues.in?.length
);
})
.map((dimensionValues) => ({
name: dimensionValues.name,
in: dimensionValues.in,
})) ?? [],
exclude:
filters.exclude
?.filter((dimensionValues) => dimensionName !== dimensionValues.name)
?.filter((dimensionValues) => {
return (
dimensionName !== dimensionValues.name && dimensionValues.in?.length
);
})
.map((dimensionValues) => ({
name: dimensionValues.name,
in: dimensionValues.in,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ function createMetricsViewTimeSeries(
metricViewName,
{
measureNames: measures,
filter: dashboardStore?.filters,
filter: {
exclude: dashboardStore.filters.exclude?.filter(
(f) => f.in?.length
),
include: dashboardStore.filters.include?.filter(
(f) => f.in?.length
),
},
timeStart: isComparison
? timeControls.comparisonAdjustedStart
: timeControls.adjustedStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export function createTotalsForMeasure(
metricsViewName,
{
measures: measures.map((measure) => ({ name: measure })),
filter: noFilter ? { include: [], exclude: [] } : dashboard?.filters,
filter: noFilter
? { include: [], exclude: [] }
: {
exclude: dashboard.filters.exclude?.filter((f) => f.in?.length),
include: dashboard.filters.include?.filter((f) => f.in?.length),
},
timeStart: isComparison
? timeControls?.comparisonTimeStart
: timeControls.timeStart,
Expand Down

0 comments on commit d02c021

Please sign in to comment.