Skip to content
Snippets Groups Projects
Commit 7ced989a authored by Sameer Al-Sakran's avatar Sameer Al-Sakran
Browse files

add links in

parent 4652a8b1
No related merge requests found
......@@ -44,6 +44,13 @@ const FieldSidebar = ({
icon="document"
name={t`Details`}
/>
<SidebarItem
key={`/auto/dashboard/field/${field.id}`}
href={`/auto/dashboard/field/${field.id}`}
icon="beaker"
name={t`Generate a dashboard based on this field`}
/>
{showXray && (
<SidebarItem
key={`/xray/field/${field.id}/approximate`}
......
......@@ -44,6 +44,12 @@ const TableSidebar = ({ database, table, style, className, showXray }) => (
icon="all"
name={t`Questions about this table`}
/>
<SidebarItem
key={`/auto/dashboard/table/${table.id}`}
href={`/auto/dashboard/table/${table.id}`}
icon="beaker"
name={t`Generate a dashboard based on this table`}
/>
{showXray && (
<SidebarItem
key={`/xray/table/${table.id}/approximate`}
......
......@@ -32,6 +32,12 @@ const MetricSidebar = ({ metric, user, style, className }) => (
icon="all"
name={t`Questions about ${metric.name}`}
/>
<SidebarItem
key={`/auto/dashboard/metric/${metric.id}`}
href={`/auto/dashboard/metric/${metric.id}`}
icon="beaker"
name={t`Generate a dashboard based on this metric`}
/>
{user &&
user.is_superuser && (
<SidebarItem
......
......@@ -38,6 +38,13 @@ const SegmentSidebar = ({ segment, user, style, className }) => (
icon="all"
name={t`Questions about this segment`}
/>
<SidebarItem
key={`/auto/dashboard/segment/${segment.id}`}
href={`/auto/dashboard/segment/${segment.id}`}
icon="beaker"
name={t`Create a dashboard based on this segment`}
/>
<SidebarItem
key={`/xray/segment/${segment.id}/approximate`}
href={`/xray/segment/${segment.id}/approximate`}
......
......@@ -8,7 +8,8 @@
[dashboard :refer [Dashboard] :as dashboard]
[metric :refer [Metric]]
[segment :refer [Segment]]
[table :refer [Table]]]
[table :refer [Table]]
[field :refer [Field]]]
[toucan
[db :as db]
[hydrate :refer [hydrate]]]))
......@@ -18,11 +19,22 @@
[id]
(first (magic/automagic-dashboard (Table id))))
(api/defendpoint GET "/analize/metric/:id"
(api/defendpoint GET "/metric/:id"
"Return an automagic dashboard analyzing metric with id `id`."
[id]
(magic/automagic-analysis (Metric id)))
(api/defendpoint GET "/segment/:id"
"Return an automagic dashboard analyzing segment with id `id`."
[id]
(magic/automagic-analysis (Metric id)))
(api/defendpoint GET "/field/:id"
"Return an automagic dashboard analyzing field with id `id`."
[id]
(magic/automagic-analysis (Field id)))
(def ^:private valid-comparison-pair?
#{["segment" "segment"]
["segment" "table"]
......@@ -84,13 +96,29 @@
(->> (magic/automagic-dashboard (Table id))
(map (comp :id dashboard/save-transient-dashboard!))))
(api/defendpoint GET "/analize/metric/:id/save"
(api/defendpoint GET "/metric/:id/save"
"Create an automagic dashboard analyzing metric with id `id`."
[id]
[(-> (magic/automagic-analysis (Metric id))
dashboard/save-transient-dashboard!
:id)])
(api/defendpoint GET "/segment/:id/save"
"TODO: Code me"
[id]
[(-> (magic/automagic-analysis (Segment id))
dashboard/save-transient-dashboard!
:id)])
(api/defendpoint GET "/field/:id/save"
"TODO: Code me"
[id]
[(-> (magic/automagic-analysis (Field id))
dashboard/save-transient-dashboard!
:id)])
(api/defendpoint GET "/compare/dashboard/:dashboard-id/segments/:left-id/:right-id/save"
"Create an automagic comparison dashboard based on dashboard with ID
`dashboard-id`, comparing segments with IDs `left-id` and `right-id`."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment