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

Rework findColumnIndexForColumnSetting to MLv2 #37854

Merged
merged 18 commits into from
Feb 20, 2024

Conversation

uladzimirdev
Copy link
Contributor

@uladzimirdev uladzimirdev commented Jan 18, 2024

Closes #37677

This is an umbrella PR, other changes related to the problem will be merged here

Tasks

Edit tasklist title
Beta Give feedback Tasklist Tasks, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. .Team/QueryingComponents visual
    uladzimirdev
    Edit...
  2. .Team/QueryingComponents visual
    uladzimirdev
    Edit...
  3. .Team/QueryingComponents
    uladzimirdev
    Edit...
  4. .Team/QueryingComponents visual
    uladzimirdev
    Edit...
  5. .Team/QueryingComponents visual
    uladzimirdev
    Edit...
  6. Edit...

Description

Migrate findColumnIndexForColumnSetting to MLv2 with a fallback to the old method.
Throwing an error is added to find all places where query is not passed, temporary

Copy link

github-actions bot commented Jan 18, 2024

Codenotify: Notifying subscribers in CODENOTIFY files for diff 22684b8...5dbd7b5.

Notify File(s)
@alxnddr frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailBody.tsx
frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailView.tsx
frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailWrapper.tsx
frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailsTable.tsx
frontend/src/metabase/visualizations/components/ObjectDetail/types.ts
frontend/src/metabase/visualizations/components/settings/ChartSettingTableColumns/ChartSettingTableColumns.tsx
frontend/src/metabase/visualizations/components/settings/ChartSettingTableColumns/DatasetColumnSelector.tsx
frontend/src/metabase/visualizations/components/settings/ChartSettingTableColumns/utils.ts
frontend/src/metabase/visualizations/lib/settings/column.js
frontend/src/metabase/visualizations/lib/settings/visualization.js
frontend/src/metabase/visualizations/visualizations/Table.tsx

Copy link

replay-io bot commented Jan 22, 2024

Status Complete ↗︎
Commit 5dbd7b5
Results
⚠️ 2 Flaky
2315 Passed

@uladzimirdev uladzimirdev requested a review from a team January 29, 2024 07:21
* Add a comment why we can't use mlv2 in chart setting table

* Use mlv2 findColumnIndexForColumnSetting in ChartSettingTableColumns

* Tests completed, so revert throwing
* Use mlv2 findColumnIndexForColumnSetting in object detail

* Address review
* Use mlv2 findColumnIndexForColumnSetting in Question

* Update question tests
@uladzimirdev uladzimirdev added the no-backport Do not backport this PR to any branch label Feb 12, 2024
@uladzimirdev uladzimirdev requested review from kamilmielnik and a team February 20, 2024 10:39
Copy link
Contributor

@ranquild ranquild left a comment

Choose a reason for hiding this comment

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

Minor comments

@@ -1,7 +1,9 @@
import cloneDeep from "lodash.clonedeep";
Copy link
Contributor

Choose a reason for hiding this comment

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

structuredClone didn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially jest didn't have it. After adding cljs started raising an error for cloned arrays (fieldRefs). We can actually use structuredClone on FE and map it to deepClone at jest


// before we fully migrate from Audit v1
// it's possible to have internal query here, which throws
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could check for internal queries like this

const isInternalQuery = InternalQuery.isDatasetQueryType(
and it would be easy to find when audit V1 is removed

}: ObjectDetailProps) {
const [currentObjectIndex, setCurrentObjectIndex] = useState(0);

// only show modal if this object detail was triggered via an object detail zoom action
const shouldShowModal = isObjectDetail;
const getFallbackQuestion = () =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know where question is not passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the idea of having a public question without permissions, so dataset query could be empty. I'll try to remove the fallback

@uladzimirdev uladzimirdev merged commit e94ea96 into master Feb 20, 2024
108 checks passed
@uladzimirdev uladzimirdev deleted the mlv2-find-column-settings branch February 20, 2024 15:43
Copy link

@uladzimirdev Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryingComponents visual Run Percy visual testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MLv2] [FE] findColumnIndexForColumnSetting and findColumnSettingIndexForColumn
3 participants