Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas: Rewrite table state manangement #6499

Open
wants to merge 2 commits into
base: feat/canvas-toggle-filter-bar
Choose a base branch
from

Conversation

djbarnwal
Copy link
Member

Merge after #6493

  • Remove usage of explore state manager from canvas
  • Use canvas entity spec methods for queries
  • Use schema validator to validate table schema to avoid app crash when metrics_view is changed.
  • Integrate time and filter store with table selector

@djbarnwal djbarnwal self-assigned this Jan 24, 2025
@djbarnwal djbarnwal changed the base branch from main to feat/canvas-toggle-filter-bar January 24, 2025 15:34
@@ -66,6 +70,13 @@ export class CanvasResolvedSpec {
Object.keys($validSpecStore?.data?.metricsViews || {}),
);

this.getMetricsViewFromName = (metricViewName: string) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd rename to getMetricsViewValidSpecFromName, since it returns a validSpec, not the whole metricsView resource

Comment on lines 71 to +89
export function getTableConfig(
instanceId: string,
tableProperties: TableProperties,
ctx: StateManagers,
tableSpec: TableSpec,
pivotState: PivotState,
): Readable<PivotDataStoreConfig> {
const { metrics_view, time_range, comparison_range } = tableProperties;
const { metrics_view, time_range, comparison_range, dimension_filters } =
tableSpec;
const {
canvasEntity: {
createTimeAndFilterStore,
spec: { getMetricsViewFromName },
},
} = ctx;

const timeAndFilterStore = createTimeAndFilterStore(metrics_view, {
componentTimeRange: time_range,
componentComparisonRange: comparison_range,
componentFilter: dimension_filters,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as here, namely we should not instantiate a new Canvas-level timeAndFilterStore for every Component.

tableProperties: TableProperties,
) {
export function validateTableSchema(
ctx: StateManagers,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally this weren't coupled to a Canvas ctx and rather accepted a metricsView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants