Skip to content

Commit

Permalink
fix: usage of metrics view name instead of explore name in pivots (#5925
Browse files Browse the repository at this point in the history
)

* Fix usage of metrics view name instead of explore name in pivot

* Fix lint
  • Loading branch information
AdityaHegde committed Oct 17, 2024
1 parent d18f6a9 commit 1b49dbb
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
},
metricsViewName,
exploreName,
runtime,
} = stateManagers;
Expand Down Expand Up @@ -103,7 +104,7 @@
function toggleComparisonDimension(dimensionName, isBeingCompared) {
metricsExplorerStore.setComparisonDimension(
$metricsViewName,
$exploreName,
isBeingCompared ? undefined : dimensionName,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
dimensionsFilter: { toggleDimensionFilterMode },
},
dashboardStore,
metricsViewName,
exploreName,
} = stateManagers;
const { adminServer, exports } = featureFlags;
Expand Down Expand Up @@ -131,7 +131,7 @@
});
metricsExplorerStore.createPivot(
$metricsViewName,
$exploreName,
{ dimension: rowDimensions },
{
dimension: [],
Expand Down
4 changes: 2 additions & 2 deletions web-common/src/features/dashboards/pivot/AddField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
selectors: {
pivot: { dimensions, measures },
},
metricsViewName,
exploreName,
} = getStateManagers();
let open = false;
function handleSelectValue(data: PivotChipData) {
metricsExplorerStore.addPivotField($metricsViewName, data, zone === "rows");
metricsExplorerStore.addPivotField($exploreName, data, zone === "rows");
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions web-common/src/features/dashboards/pivot/PivotDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
$: ({ isFetching, assembled } = $pivotDataStore);
$: ({ metricsViewName, dashboardStore } = stateManagers);
$: ({ exploreName, dashboardStore } = stateManagers);
function removeActiveCell() {
if (!$dashboardStore.pivot.activeCell) return;
metricsExplorerStore.removePivotActiveCell($metricsViewName);
metricsExplorerStore.removePivotActiveCell($exploreName);
}
</script>

Expand Down
6 changes: 3 additions & 3 deletions web-common/src/features/dashboards/pivot/PivotHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
selectors: {
pivot: { rows, columns },
},
metricsViewName,
exploreName,
} = stateManagers;
$: ({ dimension: columnsDimensions, measure: columnsMeasures } = $columns);
$: ({ dimension: rowsDimensions } = $rows);
function updateColumn(e: CustomEvent<PivotChipData[]>) {
metricsExplorerStore.setPivotColumns($metricsViewName, e.detail);
metricsExplorerStore.setPivotColumns($exploreName, e.detail);
}
function updateRows(e: CustomEvent<PivotChipData[]>) {
const filtered = e.detail.filter(
(item) => item.type !== PivotChipType.Measure,
);
metricsExplorerStore.setPivotRows($metricsViewName, filtered);
metricsExplorerStore.setPivotRows($exploreName, filtered);
}
</script>

Expand Down
10 changes: 5 additions & 5 deletions web-common/src/features/dashboards/pivot/PivotTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
const stateManagers = getStateManagers();
const { dashboardStore, metricsViewName } = stateManagers;
const { dashboardStore, exploreName } = stateManagers;
const config = getPivotConfig(stateManagers);
Expand Down Expand Up @@ -214,7 +214,7 @@
//@ts-expect-error-free
//eslint-disable-next-line
expanded = updater(expanded);
metricsExplorerStore.setPivotExpanded($metricsViewName, expanded);
metricsExplorerStore.setPivotExpanded($exploreName, expanded);
}
function onSortingChange(updater: Updater<SortingState>) {
Expand All @@ -223,7 +223,7 @@
} else {
sorting = updater;
}
metricsExplorerStore.setPivotSort($metricsViewName, sorting);
metricsExplorerStore.setPivotSort($exploreName, sorting);
}
const handleScroll = (containerRefElement?: HTMLDivElement | null) => {
Expand All @@ -240,7 +240,7 @@
!$pivotDataStore.isFetching &&
!reachedEndForRows
) {
metricsExplorerStore.setPivotRowPage($metricsViewName, rowPage + 1);
metricsExplorerStore.setPivotRowPage($exploreName, rowPage + 1);
}
}
};
Expand Down Expand Up @@ -298,7 +298,7 @@
const rowId = cell.row.id;
const columnId = cell.column.id;
metricsExplorerStore.setPivotActiveCell($metricsViewName, rowId, columnId);
metricsExplorerStore.setPivotActiveCell($exploreName, rowId, columnId);
}
function handleHover(
Expand Down
6 changes: 3 additions & 3 deletions web-common/src/features/dashboards/pivot/PivotToolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const { adminServer, exports } = featureFlags;
const stateManagers = getStateManagers();
const { metricsViewName, dashboardStore } = stateManagers;
const { exploreName, dashboardStore } = stateManagers;
$: expanded = $dashboardStore?.pivot?.expanded ?? {};
Expand Down Expand Up @@ -44,7 +44,7 @@
// expandRow(i.toString(), 1); // Start from level 1
// }
// metricsExplorerStore.setPivotExpanded($metricsViewName, expanded);
// metricsExplorerStore.setPivotExpanded($exploreName, expanded);
// }
</script>

Expand Down Expand Up @@ -75,7 +75,7 @@
compact
type="text"
on:click={() => {
metricsExplorerStore.setPivotExpanded($metricsViewName, {});
metricsExplorerStore.setPivotExpanded($exploreName, {});
}}
>
Collapse All
Expand Down

2 comments on commit 1b49dbb

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://ui.rilldata.com as production
🚀 Deployed on https://6710a37b7d9bda91d091de75--rill-ui.netlify.app

Please sign in to comment.