-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Metabase dashboard service and controller (re-pushed) #4157
Conversation
Removed vultr server and associated DNS entries |
api.planx.uk/modules/analytics/metabase/dashboard/controller.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/dashboard.test.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/generatePublicLink.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/getDashboard.ts
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.
Shaping up nicely! A few pointers for refactoring and type strengthening 💪
api.planx.uk/modules/analytics/metabase/dashboard/getDashboard.ts
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.
Nice one! Extremely minor nits but happy for you to change them and merge whenever suits :)
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.
Shaping up great! A few comments around types, error handling and snake_case.
Tests look great and descriptive, this is really very close just a few small things to iron out.
Very happy to catch up and talk through feedback if any of it is unclear - please just let me know.
api.planx.uk/modules/analytics/metabase/dashboard/controller.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/copyDashboard.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/copyDashboard.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/generatePublicLink.ts
Outdated
Show resolved
Hide resolved
export interface GetDashboardResponse { | ||
name: string; | ||
id: number; | ||
collection_id: number; | ||
} |
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.
We should find a good way of handling this issue of Metabase using snake_case but our API using camelCase.
All requests and responses to Metabase must be in snake_case, but any internal types passed around our API (as well as requests and response to our API) should be in camelCase.
There's a number of ways of handling this, one could be a Metabase types module so that we can type them as Metabase.GetDashboardResponse
(namespaces are sort of deprecated / not recommended in TS).
We can assign these types to our client (axios already supports these generics) -
const response = await $metabase.get<Metabase.GetDashboardResponse>(`/api/dashboard/${dashboardId}`);
Then, if we're returning from out internal functions, we should use camelCase types (map across).
I appreciate this is a bit tedious/repetative but it's worth doing and avoid a lot of confusion down the time. Happy to talk this one through if you'd like 👍
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 think I'm a little confused on this one and could do with talking it through!
I'm wondering if a.) since this PR is convoluted enough as it is (especially since I just rebased and added a bunch of other commits 😬) and b.) since this matter involves the collection/
folder as well, if it would make sense to talk about this next week and figure out a solution that will work across the Metabase module?
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.
Yep - on board with this, happy to park for now and we can catch up this week about it. Please send across a calendar invite for a time that works for you 👍
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
api.planx.uk/modules/analytics/metabase/dashboard/updateFilter.ts
Outdated
Show resolved
Hide resolved
1bbda5b
to
2d6993a
Compare
f94f08a
to
da42196
Compare
Re-pushed version of #4150 hopefully sidestepping the Vultr phishing issue (Slack thread here).