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
33d5828b
Commit
33d5828b
authored
7 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Redo cell api, fix decoding bug
parent
d7ff03aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/automagic_dashboards.clj
+10
-11
10 additions, 11 deletions
src/metabase/api/automagic_dashboards.clj
src/metabase/automagic_dashboards/populate.clj
+1
-1
1 addition, 1 deletion
src/metabase/automagic_dashboards/populate.clj
with
11 additions
and
12 deletions
src/metabase/api/automagic_dashboards.clj
+
10
−
11
View file @
33d5828b
(
ns
metabase.api.automagic-dashboards
(
:require
[
cheshire.core
:as
json
]
(
:require
[
buddy.core.codecs
:as
codecs
]
[
cheshire.core
:as
json
]
[
compojure.core
:refer
[
GET
POST
]]
[
metabase.api
[
card
:as
card.api
]
...
...
@@ -22,6 +23,9 @@
[
db
:as
db
]
[
hydrate
:refer
[
hydrate
]]]))
(
def
^
:private
^
{
:arglists
'
([
s
])}
decode-base64-json
(
comp
json/decode
codecs/bytes->str
codec/base64-decode
))
(
api/defendpoint
GET
"/database/:id/candidates"
"Return a list of candidates for automagic dashboards orderd by interestingness."
[
id
]
...
...
@@ -57,23 +61,19 @@
api/check-404
(
magic/automagic-dashboard
(
rules/load-rule
(
str
prefix
"/"
rule
".yaml"
)))))
(
api/defendpoint
GET
"/question/:id/:cell-query"
(
api/defendpoint
GET
"/question/:id/
cell/
:cell-query"
"Return an automagic dashboard analyzing cell in question with id `id` defined by
query `cell-querry`."
[
id
cell-query
]
(
->
(
card.api/adhoc-query
{
:query
{
:filter
(
->
cell-query
codec/base64-decode
json/decode
)}})
(
->
(
card.api/adhoc-query
{
:query
{
:filter
(
decode-base64-json
cell-query
)}})
(
magic/inject-segment
(
->
id
Card
api/check-404
))
magic/automagic-dashboard
))
(
api/defendpoint
GET
"/question/:id/:cell-query/:prefix/:rule"
(
api/defendpoint
GET
"/question/:id/
cell/
:cell-query/:prefix/:rule"
"Return an automagic dashboard analyzing cell in question with id `id` defined by
query `cell-querry` using rule `rule`."
[
id
cell-query
prefix
rule
]
(
->
(
card.api/adhoc-query
{
:query
{
:filter
(
->
cell-query
codec/base64-decode
json/decode
)}})
(
->
(
card.api/adhoc-query
{
:query
{
:filter
(
decode-base64-json
cell-query
)}})
(
magic/inject-segment
(
->
id
Card
api/check-404
))
(
magic/automagic-dashboard
(
rules/load-rule
(
str
prefix
"/"
rule
".yaml"
)))))
...
...
@@ -96,8 +96,7 @@
"Return an automagic dashboard analyzing ad hoc query."
[
query
]
(
->
query
codec/base64-decode
json/decode
decode-base64-json
card.api/adhoc-query
magic/automagic-analysis
))
...
...
This diff is collapsed.
Click to expand it.
src/metabase/automagic_dashboards/populate.clj
+
1
−
1
View file @
33d5828b
...
...
@@ -32,7 +32,7 @@
(
or
(
db/select-one
'Collection
:name
"Automatically Generated Questions"
)
(
create-collection!
"Automatically Generated Questions"
"#
000000
"
"#
509EE3
"
"Cards used in automatically generated dashboards."
))))
(
defn-
add-card
...
...
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