Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
878290b4
Unverified
Commit
878290b4
authored
1 year ago
by
Cal Herries
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Deprecate PUT /api/dashboard/:id/cards endpoint (#35499)
parent
d756bd36
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/api/dashboard.clj
+7
-5
7 additions, 5 deletions
src/metabase/api/dashboard.clj
with
7 additions
and
5 deletions
src/metabase/api/dashboard.clj
+
7
−
5
View file @
878290b4
...
...
@@ -557,7 +557,8 @@
[
id
{
:keys
[
dashcards
tabs
]
:as
dash-updates
}]
(
let
[
current-dash
(
api/write-check
Dashboard
id
)
changes-stats
(
atom
nil
)
;; tabs are sent in production as well, but there are lots of tests that exclude it. so this only checks for dashcards
;; tabs are always sent in production as well when dashcards are updated, but there are lots of
;; tests that exclude it. so this only checks for dashcards
update-dashcards-and-tabs?
(
contains?
dash-updates
:dashcards
)]
(
collection/check-allowed-to-change-collection
current-dash
dash-updates
)
(
check-allowed-to-change-embedding
current-dash
dash-updates
)
...
...
@@ -607,9 +608,7 @@
true
))
(
let
[
dashboard
(
t2/select-one
:model/Dashboard
id
)]
(
events/publish-event!
:event/dashboard-update
{
:object
dashboard
:user-id
api/*current-user-id*
})
(
when
update-dashcards-and-tabs?
;; execute these events for old PUT /api/dashboard/:id/cards calls and new PUT /api/dashboard/:id calls, and not for old PUT /api/dashboard/:id calls
(
track-dashcard-and-tab-events!
dashboard
@
changes-stats
))
(
track-dashcard-and-tab-events!
dashboard
@
changes-stats
)
(
->
(
t2/hydrate
dashboard
[
:collection
:is_personal
]
[
:dashcards
:series
]
:tabs
)
(
assoc
:last-edit-info
(
last-edit/edit-information-for-user
@
api/*current-user*
))))))
...
...
@@ -638,7 +637,8 @@
(
update-dashboard
id
dash-updates
))
(
api/defendpoint
PUT
"/:id/cards"
"Update `Cards` and `Tabs` on a Dashboard. Request body should have the form:
"(DEPRECATED -- Use the `PUT /api/dashboard/:id` endpoint instead.)
Update `Cards` and `Tabs` on a Dashboard. Request body should have the form:
{:cards [{:id ... ; DashboardCard ID
:size_x ...
...
...
@@ -657,6 +657,8 @@
;; tabs should be required in production, making it optional because lots of
;; e2e tests curerntly doesn't include it
tabs
[
:maybe
(
ms/maps-with-unique-key
[
:sequential
UpdatedDashboardTab
]
:id
)]}
(
log/warn
"DELETE /api/dashboard/:id/cards is deprecated. Use PUT /api/dashboard/:id instead."
)
(
let
[
dashboard
(
update-dashboard
id
{
:dashcards
cards
:tabs
tabs
})]
{
:cards
(
:dashcards
dashboard
)
:tabs
(
:tabs
dashboard
)}))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment