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
Refactor editing dashboard's cards #29641
Conversation
No failed tests 🎉 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #29641 +/- ##
==========================================
+ Coverage 69.17% 69.47% +0.30%
==========================================
Files 2806 2847 +41
Lines 97346 98946 +1600
Branches 12444 12539 +95
==========================================
+ Hits 67336 68740 +1404
- Misses 24669 24853 +184
- Partials 5341 5353 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 199 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
You have successfully added a new CodeQL configuration |
a13541d
to
d7bd103
Compare
…tion end with exclaimation
…tion end with exclaimation
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.
Reviewed 26 of 26 files at r13, 2 of 2 files at r14, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @alxnddr, @calherries, @EmmadUsmani, and @qnkhuat)
src/metabase/api/dashboard.clj
line 521 at r5 (raw file):
Previously, calherries (Cal Herries) wrote…
How about
diff-by-id
, since it's basically doing aclojure.data.diff
on the ids
I wasn't discussing the name of the function or its output. I was discussing the names current-change-ids
and new-change-ids
. Those sound like as if "change" were an entity of our domain, but I don't think they are, and so I have no intuition what they ought to mean.
src/metabase/api/dashboard.clj
line 523 at r5 (raw file):
Previously, qnkhuat (Ngoc Khuat) wrote…
updated d894d8f
I would've used comp
for to-create
and to-update
too.
Previously, calherries (Cal Herries) wrote…
updated all create/update/delete functions to have Code quote: create-cards! |
Previously, calherries (Cal Herries) wrote…
later since it's not the scope of this PR. I think it's show up in the changes because I moved the fn. |
Previously, metamben wrote…
I see, can you review the new changes? I did a |
Previously, metamben wrote…
updated in a67ad0e |
Previously, calherries (Cal Herries) wrote…
I thought about this, but I like the idea of having things return as a map automatically so the caller side can just destruct the map and apply operation on it. |
Previously, calherries (Cal Herries) wrote…
yes! thanks for reminding me. I did a |
Previously, qnkhuat (Ngoc Khuat) wrote…
|
Previously, calherries (Cal Herries) wrote…
|
Previously, calherries (Cal Herries) wrote…
yes a67ad0e |
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.
Reviewable status: 48 of 50 files reviewed, 14 unresolved discussions (waiting on @alxnddr, @calherries, @EmmadUsmani, and @metamben)
src/metabase/util/malli/schema.clj
line 53 at r14 (raw file):
(def NegativeInt "Schema representing an integer than must also be greater than zero."
Done.
a67ad0e
to
e35cc07
Compare
src/metabase/api/dashboard.clj
Outdated
@@ -539,24 +513,72 @@ | |||
(assoc mapping :card-id (get dashcard-id->card-id dashcard-id)))] | |||
(check-parameter-mapping-permissions new-mappings))) | |||
|
|||
(mu/defn ^:private classify-changes :- [:map | |||
[:to-create [:sequential [:map [:id neg-int?]]]] |
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 so confused. We do have a nicer version of neg-int?
, don't we?
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.
Reviewed 1 of 3 files at r16, all commit messages.
Reviewable status: 48 of 50 files reviewed, 15 unresolved discussions (waiting on @alxnddr, @calherries, @EmmadUsmani, and @qnkhuat)
src/metabase/api/dashboard.clj
line 521 at r5 (raw file):
Previously, qnkhuat (Ngoc Khuat) wrote…
I see, can you review the new changes? I did a
/s/changes/items
and use thecomp + :id
pattern now.
I'm seeing older versions, have some changes got lost? The changes you describe are great, but I can't see them in GH.
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.
Reviewable status: 48 of 50 files reviewed, 15 unresolved discussions (waiting on @alxnddr, @calherries, @EmmadUsmani, @metamben, and @qnkhuat)
src/metabase/api/dashboard.clj
line 521 at r5 (raw file):
Previously, metamben wrote…
I'm seeing older versions, have some changes got lost? The changes you describe are great, but I can't see them in GH.
Oops I think that was my doing. I force pushed a new commit but I think I forgot to pull the updated branch with Ngoc's new changes before I did it. Ngoc should be able to just push that commit again on top of mine.
- update classify-changes to use items as name instead - update classify-changes to use remove + comp pattern - some docstring cleanup
@metamben I've re-pushed the lost commits |
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.
Reviewable status: 48 of 50 files reviewed, 14 unresolved discussions (waiting on @alxnddr, @calherries, @EmmadUsmani, and @qnkhuat)
src/metabase/api/dashboard.clj
line 523 at r5 (raw file):
Previously, qnkhuat (Ngoc Khuat) wrote…
updated in a67ad0e
Sorry, I wasn't clear. filter
is better than remove
unless you have to use not
. That is
to-create (filter (comp neg? :id) new-items)
to-update (filter (comp pos? :id) new-items)
are better, IMHO.
Milestone 0 of #29502
Motivation
Currently, the APIs we used to create and delete dashcards are not bulked, which means if you edit a dashboard and add 5 cards to it, FE will calls
POST /dashboard/cards
5 times.That's not cool and we want to do bulk operations instead. So to do that we'll Remove
DELETE /api/dashboard/:id/cards
POST /api/dashboard/:id/cards
Update
PUT /api/dashboard/:id/cards
to handle bulks create/update/delete at the same time.it takes a payload with keys
cards
FE PR (already merged onto this branch): #29762
Demo
Screen.Recording.2023-04-11.at.11.14.28.AM.mov
Adding and removing cards and confirming revision history is correct.
This change is