Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Update backend docs on Wed Jan 17 17:24:27 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jan 17, 2024
1 parent cc9f258 commit 35ebe0f
Showing 1 changed file with 72 additions and 23 deletions.
95 changes: 72 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7544,26 +7544,41 @@ <h2>Important Libraries</h2>
(cond
(config/config-str :rds-hostname) :elastic-beanstalk
(config/config-str :database-url) :heroku ;; Putting this last as 'database-url' seems least specific
:else :unknown))</pre></td></tr><tr><td class="docs"><p>Figure out global info about this instance</p>
:else :unknown))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(def ^:private ui-colors #{:brand :filter :summarize})</pre></td></tr><tr><td class="docs"><p>Returns true if the 'User Interface Colors' have been customized</p>
</td><td class="codes"><pre class="brush: clojure">(defn appearance-ui-colors-changed?
[]
(boolean (seq (select-keys (public-settings/application-colors) ui-colors))))</pre></td></tr><tr><td class="docs"><p>Returns true if the 'Chart Colors' have been customized</p>
</td><td class="codes"><pre class="brush: clojure">(defn appearance-chart-colors-changed?
[]
(boolean (seq (apply dissoc (public-settings/application-colors) ui-colors))))</pre></td></tr><tr><td class="docs"><p>Figure out global info about this instance</p>
</td><td class="codes"><pre class="brush: clojure">(defn- instance-settings
[]
{:version (config/mb-version-info :tag)
:running_on (environment-type)
:startup_time_millis (public-settings/startup-time-millis)
:application_database (config/config-str :mb-db-type)
:check_for_updates (public-settings/check-for-updates)
:site_name (not= (public-settings/site-name) &quot;Metabase&quot;)
:report_timezone (driver/report-timezone)
{:version (config/mb-version-info :tag)
:running_on (environment-type)
:startup_time_millis (public-settings/startup-time-millis)
:application_database (config/config-str :mb-db-type)
:check_for_updates (public-settings/check-for-updates)
:report_timezone (driver/report-timezone)
; We deprecated advanced humanization but have this here anyways
:friendly_names (= (humanization/humanization-strategy) &quot;advanced&quot;)
:email_configured (email/email-configured?)
:slack_configured (slack/slack-configured?)
:sso_configured (google/google-auth-enabled)
:instance_started (snowplow/instance-creation)
:has_sample_data (t2/exists? Database, :is_sample true)
:help_link (public-settings/help-link)
:enable_embedding (embed.settings/enable-embedding)
:embedding_app_origin_set (boolean (embed.settings/embedding-app-origin))})</pre></td></tr><tr><td class="docs"><p>Get metrics based on user records.
:friendly_names (= (humanization/humanization-strategy) &quot;advanced&quot;)
:email_configured (email/email-configured?)
:slack_configured (slack/slack-configured?)
:sso_configured (google/google-auth-enabled)
:instance_started (snowplow/instance-creation)
:has_sample_data (t2/exists? Database, :is_sample true)
:enable_embedding (embed.settings/enable-embedding)
:embedding_app_origin_set (boolean (embed.settings/embedding-app-origin))
:appearance_site_name (not= (public-settings/site-name) &quot;Metabase&quot;)
:appearance_help_link (public-settings/help-link)
:appearance_logo (not= (public-settings/application-logo-url) &quot;app/assets/img/logo.svg&quot;)
:appareance_favicon (not= (public-settings/application-favicon-url) &quot;app/assets/img/favicon.ico&quot;)
:apperance_loading_message (not= (public-settings/loading-message) :doing-science)
:appearance_metabot_greeting (not (public-settings/show-metabot))
:apparerance_lighthouse_illustration (not (public-settings/show-lighthouse-illustration))
:appearance_ui_colors (appearance-ui-colors-changed?)
:appearance_chart_colors (appearance-chart-colors-changed?)
:appearance_show_mb_links (not (public-settings/show-metabase-links))})</pre></td></tr><tr><td class="docs"><p>Get metrics based on user records.
TODO: get activity in terms of created questions, pulses and dashboards</p>
</td><td class="codes"><pre class="brush: clojure">(defn- user-metrics
[]
Expand Down Expand Up @@ -76781,7 +76796,6 @@ <h6>`:fallback`</h6>
(= @col-sample-count @row-sample-count 1))
(chart-type :scalar &quot;result has one row and one column&quot;)
(#{:scalar
:smartscalar
:line
:area
:bar
Expand All @@ -76793,6 +76807,8 @@ <h6>`:fallback`</h6>
:table
:waterfall} display-type)
(chart-type display-type &quot;display-type is %s&quot; display-type)
(#{:smartscalar} display-type)
(chart-type :javascript_visualization &quot;display-type is javascript_visualization&quot;)
(= display-type :pie)
(chart-type :categorical/donut &quot;result has two cols (%s and %s (number))&quot; (col-description @col-1) (col-description @col-2))
:else
Expand Down Expand Up @@ -77664,6 +77680,28 @@ <h6>`:fallback`</h6>
[:div {:style (style/style (style/scalar-style))}
(h value)]
:render/text (str value)}))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(s/defmethod render :javascript_visualization :- formatter/RenderedPulseCard
[_ render-type _timezone-id card dashcard data]
(let [combined-cards-results (pu/execute-multi-card card dashcard)
cards-with-data (map (fn [c d] {:card c :data d})
(cons card (map :card combined-cards-results))
(cons data (map #(get-in % [:result :data]) combined-cards-results)))
dashcard-viz-settings (get dashcard :visualization_settings)
{rendered-type :type content :content} (js-svg/javascript-visualization cards-with-data dashcard-viz-settings)]
(case rendered-type
:svg
(let [image-bundle (image-bundle/make-image-bundle
render-type
(js-svg/svg-string-&gt;bytes content))]
{:attachments
(when image-bundle
(image-bundle/image-bundle-&gt;attachment image-bundle))
:content
[:div
[:img {:style (style/style {:display :block :width :100%})
:src (:image-src image-bundle)}]]})
:html
{:content [:div content] :attachments nil})))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(s/defmethod render :smartscalar :- formatter/RenderedPulseCard
[_chart-type _render-type timezone-id _card _dashcard {:keys [cols insights viz-settings]}]
(letfn [(col-of-type [t c] (or (isa? (:effective_type c) t)
Expand Down Expand Up @@ -78095,8 +78133,9 @@ <h6>`:fallback`</h6>
(when *svg-render-height*
(.addTranscodingHint transcoder PNGTranscoder/KEY_HEIGHT *svg-render-height*))
(.transcode transcoder in out))
(.toByteArray os)))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(defn- svg-string-&gt;bytes [s]
(.toByteArray os)))</pre></td></tr><tr><td class="docs"><p>Convert a string (from svg rendering) an svg document then return the bytes</p>
</td><td class="codes"><pre class="brush: clojure">(defn svg-string-&gt;bytes
[s]
(-&gt; s parse-svg-string render-svg))</pre></td></tr><tr><td class="docs"><p>Clojure entrypoint to render a timeseries or categorical waterfall chart. Rows should be tuples of [datetime numeric-value]. Labels is
a map of {:left "left-label" :botton "bottom-label". Returns a byte array of a png file.</p>
</td><td class="codes"><pre class="brush: clojure">(defn waterfall
Expand All @@ -78112,7 +78151,16 @@ <h6>`:fallback`</h6>
[data settings]
(let [svg-string (.asString (js/execute-fn-name (context) &quot;funnel&quot; (json/generate-string data)
(json/generate-string settings)))]
(svg-string-&gt;bytes svg-string)))</pre></td></tr><tr><td class="docs"><p>Clojure entrypoint to render a combo or multiple chart.
(svg-string-&gt;bytes svg-string)))</pre></td></tr><tr><td class="docs"><p>Clojure entrypoint to render javascript visualizations.</p>
</td><td class="codes"><pre class="brush: clojure">(defn javascript-visualization
[cards-with-data dashcard-viz-settings]
(let [response (.asString (js/execute-fn-name (context) &quot;javascript_visualization&quot;
(json/generate-string cards-with-data)
(json/generate-string dashcard-viz-settings)
(json/generate-string (public-settings/application-colors))))]
(-&gt; response
(json/parse-string true)
(update :type (fnil keyword &quot;unknown&quot;)))))</pre></td></tr><tr><td class="docs"><p>Clojure entrypoint to render a combo or multiple chart.
These are different conceptions in the BE but being smushed together
because they're supposed to display similarly.
Series should be list of dicts of {rows: rows, cols: cols, type: type}, where types is 'line' or 'bar' or 'area'.
Expand Down Expand Up @@ -88075,11 +88123,12 @@ <h3>`::position`</h3>
:bookmark :boolean
;; returned for everything except Collection
:updated_at :timestamp
;; returned for Card only, used for scoring
;; returned for Card only, used for scoring and displays
:dashboardcard_count :integer
:last_edited_at :timestamp
:last_editor_id :integer
:moderated_status :text
:display :text
;; returned for Metric and Segment
:table_id :integer
:table_schema :text
Expand Down Expand Up @@ -88168,7 +88217,7 @@ <h3>`::position`</h3>
[:query_action.dataset_query :dataset_query]))</pre></td></tr><tr><td class="docs">
</td><td class="codes"><pre class="brush: clojure">(defmethod columns-for-model &quot;card&quot;
[_]
(conj default-columns :collection_id :collection_position :dataset_query :creator_id
(conj default-columns :collection_id :collection_position :dataset_query :display :creator_id
[:collection.name :collection_name]
[:collection.authority_level :collection_authority_level]
bookmark-col dashboardcard-count-col))</pre></td></tr><tr><td class="docs">
Expand Down

0 comments on commit 35ebe0f

Please sign in to comment.