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
Add "Replace question" action to dashboard cards #36744
Conversation
No failed tests 🎉 |
e364299
to
94dd166
Compare
Previously, `card_id` in `update-dashboard-card!` only applied if the dashcard was an action card. There was a cryptic comment about this, but it also indicates that maybe it's ok to update. This unsticks FE work but still needs BE unit tests.
The new test checks the state of a dashboard with a GET then PUTs the update setting the new card id and verifies the result.
Under the old behavior, only action dashcards allowed changing their card ids. Now card ids can be changed for any dashcard type. This test captured the old behavior and has been updated to capture the new behavior.
…o 36497-replace-dashcard-card
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BE LGTM
If Case is cool with updating card IDs, you should change the logic in metabase/src/metabase/models/dashboard_card.clj Lines 182 to 184 in ffe0385
|
Isn't this addressed here? https://github.com/metabase/metabase/pull/36744/files#diff-b6abb82aa02f4647f6ac74d17bfa75dda523bf75c2eed11954c56127a6d7446dR180-R189 |
Ah, so sorry, I didn't see that was part of the PR. I just read the test. All clear then! |
@@ -5,6 +5,10 @@ export function getDashboardId(state: State) { | |||
return state.dashboard.dashboardId; | |||
} | |||
|
|||
export function getDashboardBeforeEditing(state: State) { | |||
return state.dashboard.isEditing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, isEditing
is a dashboard instead of a boolean 🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid you're right 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and clean! Please have a look at the suggestion about errored cards
Passing run #200 ↗︎
Details:
Review all test suite changes for PR #36744 ↗︎ |
If it is possible to show the "replace card" prompt directly on the error card, that will be helpful. So change "There was a problem displaying this card." by adding a "replace it" link or button at the end? This is more discoverable. |
For context, we figured we'd prefer to keep the action as is. People might prefer to fix the issue instead of replacing the card |
@kulyk Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
Part of #36497 ### Description In #36744 we tracked dashcard replacement with a new event name, but did not add this event name to the dashboard snowplow schema. In this PR we add the name to the schema, and update an e2e test to ensure the event is being tracked. ### How to verify Follow this [guide](https://www.notion.so/metabase/Snowplow-integration-5da1f874beda4153b4fccfa6c1e77caa) to run snowplow, then try replacing a dashcard locally, you should see the log in the console. ### Demo https://github.com/metabase/metabase/assets/37751258/e8566f09-b9b8-47de-b215-fe0e25c7d920 ### Checklist - [x] Tests have been added/updated to cover changes in this PR
Part of #36497 ### Description In #36744 we tracked dashcard replacement with a new event name, but did not add this event name to the dashboard snowplow schema. In this PR we add the name to the schema, and update an e2e test to ensure the event is being tracked. ### How to verify Follow this [guide](https://www.notion.so/metabase/Snowplow-integration-5da1f874beda4153b4fccfa6c1e77caa) to run snowplow, then try replacing a dashcard locally, you should see the log in the console. ### Demo https://github.com/metabase/metabase/assets/37751258/e8566f09-b9b8-47de-b215-fe0e25c7d920 ### Checklist - [x] Tests have been added/updated to cover changes in this PR
Closes #36497, closes #36586
Adds a "Replace" button to dashboard cards with questions or models. It makes it possible to swap the dashboard card's query while keeping the dashboard layout intact. It's important to call out that we would reset properties of a dash card that no longer makes sense with a new query: parameter mappings, click behavior, visualization settings, and added series.
How to verify
Demo
Basic
CleanShot.2023-12-13.at.11.25.41.mp4
Filters auto-wiring
CleanShot.2023-12-13.at.11.29.29.mp4
Checklist