Skip to content
Snippets Groups Projects
Commit a50b6540 authored by Simon Belak's avatar Simon Belak
Browse files

Add comparison_title

parent 26f2ec79
No related branches found
No related tags found
No related merge requests found
......@@ -94,10 +94,13 @@ groups:
title: These are the same for all your [[this]]
- ByTime:
title: "[[this]] across time"
comparison_title: How they compare across time
- Geographical:
title: Where your [[this]] are
comparison_title: How they compare acrosss location
- General:
title: How [[this]] are distributed
comparison_title: How they differ in distributions
dashboard_filters:
- Timestamp
- Date
......
......@@ -147,7 +147,8 @@
(let [left ((->entity entity) entity-id-or-query)
right ((->entity comparison-entity) comparison-entity-id-or-query)
dashboard (automagic-analysis left {:show (keyword show)
:query-filter nil})]
:query-filter nil
:comparison? true})]
(comparison-dashboard dashboard left right {})))
(api/defendpoint GET "/:entity/:entity-id-or-query/rule/:prefix/:rule/compare/:comparison-entity/:comparison-entity-id-or-query"
......@@ -163,7 +164,8 @@
right ((->entity comparison-entity) comparison-entity-id-or-query)
dashboard (automagic-analysis left {:show (keyword show)
:rule ["table" prefix rule]
:query-filter nil})]
:query-filter nil
:comparison? true})]
(comparison-dashboard dashboard left right {})))
(api/defendpoint GET "/:entity/:entity-id-or-query/cell/:cell-query/compare/:comparison-entity/:comparison-entity-id-or-query"
......@@ -178,7 +180,8 @@
(let [left ((->entity entity) entity-id-or-query)
right ((->entity comparison-entity) comparison-entity-id-or-query)
dashboard (automagic-analysis left {:show (keyword show)
:query-filter nil})]
:query-filter nil
:comparison? true})]
(comparison-dashboard dashboard left right {:left {:cell-query (decode-base64-json cell-query)}})))
(api/defendpoint GET "/:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:rule/compare/:comparison-entity/:comparison-entity-id-or-query"
......
......@@ -766,7 +766,7 @@
(defn- automagic-dashboard
"Create dashboards for table `root` using the best matching heuristics."
[{:keys [rule show rules-prefix query-filter cell-query full-name] :as root}]
[{:keys [rule show rules-prefix query-filter cell-query full-name comparison?] :as root}]
(if-let [[dashboard rule] (if rule
(apply-rule root (rules/get-rule rule))
(->> root
......@@ -787,6 +787,9 @@
(-> dashboard :context :metrics u/pprint-to-str)
(-> dashboard :context :filters u/pprint-to-str))
(-> (cond-> dashboard
comparison?
(update :groups (partial m/map-vals (fn [{:keys [title comparison_title] :as group}]
(update group :title #(or comparison_title %)))))
(or query-filter cell-query)
(assoc :title (tru "A closer look at {0}" full-name)))
(populate/create-dashboard (or show max-cards))
......
......@@ -104,8 +104,9 @@
(s/optional-key :series_labels) [s/Str]}})
(def ^:private Groups
{Identifier {(s/required-key :title) s/Str
(s/optional-key :description) s/Str}})
{Identifier {(s/required-key :title) s/Str
(s/optional-key :comparison_title) s/Str
(s/optional-key :description) s/Str}})
(def ^{:arglists '([definition])} identifier
"Return `key` in `{key {}}`."
......
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