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

[MLv2] [FE] Migrate ViewHeader to MLv2 #37227

Closed
1 of 2 tasks
Tracked by #36108
ranquild opened this issue Jan 3, 2024 · 1 comment
Closed
1 of 2 tasks
Tracked by #36108

[MLv2] [FE] Migrate ViewHeader to MLv2 #37227

ranquild opened this issue Jan 3, 2024 · 1 comment

Comments

@ranquild
Copy link
Contributor

ranquild commented Jan 3, 2024

ViewHeader

Place 1

const filtersCount = question.query().filters().length;

In MLv2 it could be:

const query = question._getMLv2Query();
const previousQuery = usePrevious(query);

useEffect(() => {
  // existing code

  const filtersCount = Lib.filters(query, -1).length;
  const previousFiltersCount = Lib.filters(previousQuery, -1).length;

  // existing code
});

Place 2

isStructured && question.query().topLevelQuery().hasAggregations();

In MLv2 it could be:

Lib.aggregations(query, -1).length > 0

For non-mbql queries aggregations would be an empty list.

-1 means the last stage of the query.

Place 3

const isNewQuery = !question.query().hasData();

MLv2:

const isNewQuery = Lib.sourceTableOrCardId(query) == null;

Tasks

  1. .Team/QueryingComponents no-backport
    nemanjaglumac
@ranquild ranquild changed the title Legacy MBQL query usages [MLv2] Legacy MBQL query usages Jan 3, 2024
@ranquild ranquild changed the title [MLv2] Legacy MBQL query usages [MLv2] Legacy MBQL query cleanup Jan 3, 2024
@ranquild ranquild changed the title [MLv2] Legacy MBQL query cleanup [MLv2] Migrate remaining legacy query usages in QB simple mode to MLv2 Jan 3, 2024
@ranquild ranquild changed the title [MLv2] Migrate remaining legacy query usages in QB simple mode to MLv2 [MLv2] Migrate ViewHeader to MLv2 Jan 3, 2024
@ranquild ranquild changed the title [MLv2] Migrate ViewHeader to MLv2 [MLv2] [FE] Migrate ViewHeader to MLv2 Jan 8, 2024
@nemanjaglumac
Copy link
Member

Migrated steps 1 and 2 from the original issue description.
The only outstanding reference to the MLv1 in this file is (step 3):

const isNewQuery = !question.query().hasData();

but we cannot fully migrate it until we start supporting native queries with MLv2.

cc @NevRA

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

No branches or pull requests

2 participants