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
1592a53d
Commit
1592a53d
authored
7 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Add cell analysis dashboard
parent
3904717b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/automagic_dashboards.clj
+26
-2
26 additions, 2 deletions
src/metabase/api/automagic_dashboards.clj
src/metabase/automagic_dashboards/core.clj
+10
-3
10 additions, 3 deletions
src/metabase/automagic_dashboards/core.clj
with
36 additions
and
5 deletions
src/metabase/api/automagic_dashboards.clj
+
26
−
2
View file @
1592a53d
(
ns
metabase.api.automagic-dashboards
(
:require
[
compojure.core
:refer
[
GET
POST
]]
(
:require
[
cheshire.core
:as
json
]
[
compojure.core
:refer
[
GET
POST
]]
[
metabase.api
[
card
:as
card.api
]
[
common
:as
api
]]
...
...
@@ -12,6 +13,7 @@
[
database
:refer
[
Database
]]
[
field
:refer
[
Field
]]
[
metric
:refer
[
Metric
]]
[
query
:refer
[
Query
]]
[
segment
:refer
[
Segment
]]
[
table
:refer
[
Table
]]]
[
ring.util.codec
:as
codec
]
...
...
@@ -46,11 +48,33 @@
[
id
]
(
->
id
Segment
api/check-404
magic/automagic-dashboard
))
(
api/defendpoint
GET
"/segment/:id/:prefix/:rule"
"Return an automagic dashboard analyzing segment with id `id`. using rule `rule`."
[
id
prefix
rule
]
(
->
id
Segment
api/check-404
(
magic/automagic-dashboard
(
str
prefix
"/"
rule
".yaml"
))))
(
api/defendpoint
GET
"/question/:id/:cell-query"
"Return an automagic dashboard analyzing cell in question with id `id` defined by
query `cell-querry`."
[
id
cell-query
]
(
->
id
Card
api/check-404
:table_id
Table
magic/automagic-dashboard
))
(
->
(
card.api/adhoc-query
{
:query
{
:filter
(
->
cell-query
codec/base64-decode
json/decode
)}})
(
magic/inject-segment
(
->
id
Card
api/check-404
))
magic/automagic-dashboard
))
(
api/defendpoint
GET
"/question/:id/: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
)}})
(
magic/inject-segment
(
->
id
Card
api/check-404
))
(
magic/automagic-dashboard
(
str
prefix
"/"
rule
".yaml"
))))
(
api/defendpoint
GET
"/metric/:id"
"Return an automagic dashboard analyzing metric with id `id`."
...
...
This diff is collapsed.
Click to expand it.
src/metabase/automagic_dashboards/core.clj
+
10
−
3
View file @
1592a53d
...
...
@@ -49,12 +49,19 @@
metabase.models.query.QueryInstance
(
table
[
query
]
(
->
query
:table_id
Table
))
(
database
[
query
]
(
->
query
:database_id
d
atabase
))
(
database
[
query
]
(
->
query
:database_id
D
atabase
))
(
query-filter
[
query
]
(
->
query
:dataset_query
:query
:filter
))
(
full-name
[
query
]
(
str
"ad-hoc question "
(
:name
query
)))
(
url
[
query
]
(
format
"%sadhoc/%s"
public-endpoint
(
->
query
json/encode
codec/base64-encode
))))
codec/base64-encode
)))
metabase.models.card.CardInstance
(
table
[
card
]
(
->
card
:table_id
Table
))
(
database
[
card
]
(
->
card
:database_id
Database
))
(
query-filter
[
card
]
(
->
card
:dataset_query
:query
:filter
))
(
full-name
[
card
]
(
str
"question "
(
:name
card
)))
(
url
[
card
]
(
format
"%squestion/%s"
public-endpoint
(
:id
card
))))
(
defmulti
^
{
:doc
"Get a reference for a given model to be injected into a template
...
...
@@ -470,7 +477,7 @@
(
matching-rules
rules
)
(
keep
(
partial
apply-rule
table
))
first
)]
{
:url
(
str
public-endpoint
"table/"
(
:id
table
)
)
{
:url
(
url
table
)
:title
(
:title
dashboard
)
:score
(
rule-specificity
rule
)
:description
(
:description
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