-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Metrics v2] Add new /metric/:id
and metric/:id/notebook
pages
#38554
Conversation
00bfbef
to
c5f9bd2
Compare
c5f9bd2
to
23fde47
Compare
|
/metric/:id
[WIP]/metric/:id
and metric/:id/notebook
pages
/metric/:id
and metric/:id/notebook
pages/metric/:id
and metric/:id/notebook
pages
frontend/src/metabase/query_builder/components/view/ViewHeader/ViewHeader.jsx
Outdated
Show resolved
Hide resolved
frontend/src/metabase/query_builder/components/view/ViewHeader/ViewHeader.jsx
Outdated
Show resolved
Hide resolved
...base/query_builder/components/view/ViewHeader/components/QuestionActions/QuestionActions.tsx
Outdated
Show resolved
Hide resolved
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.
URLs don't always work correctly for actions on /metric/:id
page
frontend/src/metabase/query_builder/components/view/ViewHeader/ViewHeader.jsx
Outdated
Show resolved
Hide resolved
@@ -497,18 +497,30 @@ class Question { | |||
} | |||
} | |||
|
|||
/** |
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.
- Open up a metric
- Select "Move" from "..." menu
- Move it to another collection
❌ URL changes from /metric/:id-slug
to /question/:id-slug
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 spent hours trying to figure this one out.
In the end, I'm not entirely sure if this is a bug in the existing implementation, or does it result from us hacking the question.type()
before the real backend implementation.
What I managed to determine is that, upon moving a metric, getQuestion
selector initially returns the question.type()
"question". This is why the composeDataset
doesn't apply.
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.
@kamilmielnik I finally realized what's going on. The hack for CRUD endpoints does not work for the PUT
request. The payload
does not have a type
unless you're literally converting the type itself.
For example, this is the payload when moving a metric from one collection to another:
{
"id": 82,
"collection_id": null
}
Unless you have a different idea, we might have to ignore this and call it a limitation until backend implements the card.type for real.
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.
Unless you have a different idea, we might have to ignore this and call it a limitation until backend implements the card.type for real.
All good, thanks for checking this ❤️
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.
Works well 👍 🚢
This PR introduces two new routes.
/metric/:id
that displays previously saved metric (which should open in the "chill mode")/metric/:id/notebook
that provides the option to switch to a notebook modeThings to look out for
/question/query...
indicating that we started a new ad-hoc question.Notebook mode should not show metric's underlying query, but rather a new ad-hoc query started from the metric as a source:
Demo
https://www.loom.com/share/cbfe1f8fc3b045798cabf46ac0d812e4?sid=486b17fb-525d-4d37-b584-c8904490e980
Resolves #37368