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
8f23be70
Unverified
Commit
8f23be70
authored
1 year ago
by
Cal Herries
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Refactor: separate param-values from API endpoint usage (#35001)
parent
015327d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/dashboard.clj
+6
-6
6 additions, 6 deletions
src/metabase/api/dashboard.clj
src/metabase/api/public.clj
+4
-4
4 additions, 4 deletions
src/metabase/api/public.clj
with
10 additions
and
10 deletions
src/metabase/api/dashboard.clj
+
6
−
6
View file @
8f23be70
...
...
@@ -862,8 +862,8 @@
- static-list: user defined values list
- card: values is result of running a card
- nil: chain-filter"
([
dashboard
param-key
query-params
]
(
param-values
dashboard
param-key
query-params
nil
))
([
dashboard
param-key
constraint-param-key->value
]
(
param-values
dashboard
param-key
constraint-param-key->value
nil
))
([
dashboard
:-
:map
param-key
:-
ms/NonBlankString
...
...
@@ -883,12 +883,12 @@
;; fetch values for Dashboard 1 parameter 'abc' that are possible when parameter 'def' is set to 100
GET /api/dashboard/1/params/abc/values?def=100"
[
id
param-key
:as
{
:keys
[
query-params
]
}]
[
id
param-key
:as
{
constraint-param-key->value
:
query-params
}]
{
id
ms/PositiveInt
}
(
let
[
dashboard
(
api/read-check
:model/Dashboard
id
)]
;; If a user can read the dashboard, then they can lookup filters. This also works with sandboxing.
(
binding
[
qp.perms/*param-values-query*
true
]
(
param-values
dashboard
param-key
query-params
))))
(
param-values
dashboard
param-key
constraint-param-key->value
))))
(
api/defendpoint
GET
"/:id/params/:param-key/search/:query"
"Fetch possible values of the parameter whose ID is `:param-key` that contain `:query`. Optionally restrict
...
...
@@ -899,13 +899,13 @@
GET /api/dashboard/1/params/abc/search/Cam?def=100
Currently limited to first 1000 results."
[
id
param-key
query
:as
{
:keys
[
query-params
]
}]
[
id
param-key
query
:as
{
constraint-param-key->value
:
query-params
}]
{
id
ms/PositiveInt
query
ms/NonBlankString
}
(
let
[
dashboard
(
api/read-check
:model/Dashboard
id
)]
;; If a user can read the dashboard, then they can lookup filters. This also works with sandboxing.
(
binding
[
qp.perms/*param-values-query*
true
]
(
param-values
dashboard
param-key
query-params
query
))))
(
param-values
dashboard
param-key
constraint-param-key->value
query
))))
(
api/defendpoint
GET
"/params/valid-filter-fields"
"Utility endpoint for powering Dashboard UI. Given some set of `filtered` Field IDs (presumably Fields used in
...
...
This diff is collapsed.
Click to expand it.
src/metabase/api/public.clj
+
4
−
4
View file @
8f23be70
...
...
@@ -575,22 +575,22 @@
(
api/defendpoint
GET
"/dashboard/:uuid/params/:param-key/values"
"Fetch filter values for dashboard parameter `param-key`."
[
uuid
param-key
:as
{
:keys
[
query-params
]
}]
[
uuid
param-key
:as
{
constraint-param-key->value
:
query-params
}]
{
uuid
ms/UUIDString
param-key
ms/NonBlankString
}
(
let
[
dashboard
(
dashboard-with-uuid
uuid
)]
(
mw.session/as-admin
(
api.dashboard/param-values
dashboard
param-key
query-params
))))
(
api.dashboard/param-values
dashboard
param-key
constraint-param-key->value
))))
(
api/defendpoint
GET
"/dashboard/:uuid/params/:param-key/search/:query"
"Fetch filter values for dashboard parameter `param-key`, containing specified `query`."
[
uuid
param-key
query
:as
{
:keys
[
query-params
]
}]
[
uuid
param-key
query
:as
{
constraint-param-key->value
:
query-params
}]
{
uuid
ms/UUIDString
param-key
ms/NonBlankString
query
ms/NonBlankString
}
(
let
[
dashboard
(
dashboard-with-uuid
uuid
)]
(
mw.session/as-admin
(
api.dashboard/param-values
dashboard
param-key
query-params
query
))))
(
api.dashboard/param-values
dashboard
param-key
constraint-param-key->value
query
))))
;;; ----------------------------------------------------- Pivot Tables -----------------------------------------------
...
...
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