Skip to content
Snippets Groups Projects
user avatar
dpsutton authored
* Fix click through behavior (#15014)

* formatting

* Safer get's, author metadata and correct added

* Don't return anything if we didn't modify it

* Make private and add a docstring

* Generate json strings rather than long in-line versions

* Docstrings and prevent migrating ones that may already be migrated

* Noisier as it now merges click_behavior on top of existing

* update docstring with new nesting

* always keep column settings

previously the script was only looking for column settings which
included view_as or link_template. Now we always keep those columns
and merge in the new click_behavior when those keys are present

* linkTemplateText -> linkTextTemplate

* Ensure dashcard goes on top of card viz settings

* Update expected now that dash merges on top of card

* drop columns that don't have view_as

so we don't overwrite the top level stuff if there is already a
click_behavior. That signifies that either this migration has run, or
perhaps already has had manual intervention. An open question is if we
extend this to the columns: if there's manual intervention do we
really want to be mucking about in here?

Also, go back to the dropping columns style.

```clojure
(if (and ...)
    (assoc m col (merge field-settings click-behavior))
    m) ;; here we omit the column again in our reduce-kv
```

* Fundamentally: scour card for click and merge them into dashcard

reshape all click behaviors in both and merge them in.

Still some broken tests at the moment

* Remove old style click behavior no longer expected

* fixed

* Some more comments and remove some silly select keys and when-lets

just compute both keys and then u/select-non-nil-keys and be done with
it

* Docstrinc additions about nil

* Remove niles, test scenario #5 from flamber

* Handle empties and nil _AFTER_ merging

previously had taken care to punt things down to nil, collapse empty
maps, etc. but this is a value that will merge on top of a map rather
than with the map

```clojure
(m/deep-merge {:a {:b :c}} {:a nil})
{:a nil}
;; vs
(m/deep-merge {:a {:b :c}} {:a {}})
{:a {:b :c}}
```

so let the postwalk after the merge clean up empty collections and nil
values and let them blend as normal

* Deep merge and prioritize new shape in card and dashcard

```clojure
(m/deep-merge fixed-card
              fixed-dashcard
              (existing-fixed card)
              (existing-fixed dashcard))
```

This is the change here essentially. Fix the card and dashcard, look
for existing new shapes on the card and dashcard as well

* Don't merge existing fix from card. can't happen

this change though did help out. we want to resolve when there are old
style and new style on the same dashcard. In this case, the new style
should persist:

```clojure
(testing "If there is migration eligible on dash but also new style on dash, new style wins"
  (let [dash {"column_settings"
              {"[\"ref\",[\"field-id\",4]]"
               {"view_as"       "link"
                "link_template" "http://old" ;; this stuff could be migrated
                "link_text"     "old"
                "column_title"  "column title"
                "click_behavior"
                {"type" "link",
                 "linkType" "url", ;; but there is already a new style and it wins
                 "linkTemplate" "http://new",
                 "linkTextTemplate" "new"}}}}]
    (is (= {"column_settings"
            {"[\"ref\",[\"field-id\",4]]"
             {"click_behavior"
              {"type" "link",
               "linkType" "url",
               "linkTemplate" "http://new",
               "linkTextTemplate" "new"},
              "column_title" "column title"}}}
           (migrate nil dash)))))
```

note the column settings for field-id 4 have the old style and the new
style but the result is that the new style survives. This happens from
the `(m/deep-merge fixed-card fixed-dashcard (existing-fixed
dashcard))` as the existing is put on top

* Don't strip original values

* propagate old info in migration test
dae904d6
History

Metabase

Metabase is the easy, open source way for everyone in your company to ask questions and learn from data.

Metabase Product Screenshot

Latest Release Circle CI codecov

Features

  • 5 minute setup (We're not kidding)
  • Let anyone on your team ask questions without knowing SQL
  • Rich beautiful dashboards with auto refresh and fullscreen
  • SQL Mode for analysts and data pros
  • Create canonical segments and metrics for your team to use
  • Send data to Slack or email on a schedule with Pulses
  • View data in Slack anytime with MetaBot
  • Humanize data for your team by renaming, annotating and hiding fields
  • See changes in your data with alerts

For more information check out metabase.com

Supported databases

  • Amazon Redshift
  • Druid
  • Google Analytics
  • Google BigQuery
  • H2
  • MongoDB
  • MySQL
  • Oracle
  • PostgreSQL
  • Presto
  • Snowflake
  • SparkSQL
  • SQL Server
  • SQLite
  • Vertica

Don't see your favorite database? Check the list of community supported drivers.

Installation

Metabase can be run just about anywhere so checkout our Installation Guides for detailed instructions for various deployments. Here's the TLDR:

Docker

To run Metabase via Docker, just type

docker run -d -p 3000:3000 --name metabase metabase/metabase

JAR file

To run Metabase via a JAR file, you will need to have a Java Runtime Environment installed on your system.

We recommend the latest LTS version of JRE from AdoptOpenJDK with HotSpot JVM and x64 architecture, but other Java versions might work too.

Go to the Metabase download page and download the latest release. Place the downloaded JAR file into a newly created directory (as it will create some files when it is run), and run it with the following command:

java -jar metabase.jar

Now, open a browser and go to http://localhost:3000 , and you will be asked a set of questions that will set up a user account, and then you can add a database connection. For this to work you will need to get some information about which database you want to connect to, such as the Host Name and Port that it is running on, the Database Name and the User and Password that you will be using.

Once you have added this connection, you will be taken into the app and you'll be ready to ask your first question.

For a more detailed walkthrough, check out our Getting Started guide.

Frequently Asked Questions

Some questions come up over and over again. Check here first: FAQ

Security Disclosure

See SECURITY.md for details.

Contributing

To get started with a development installation of the Metabase, follow the instructions at our Developers Guide.

Then take a look at our Contribution Guide for information about our process and where you can fit in!

Internationalization

We want Metabase to be available in as many languages as possible. See which translations are available and help contribute to internationalization using our project over at POEditor. You can also check out our policies on translations.

Extending and Deep Integrations

Metabase also allows you to hit our Query API directly from Javascript to integrate the simple analytics we provide with your own application or third party services to do things like:

  • Build moderation interfaces
  • Export subsets of your users to third party marketing automation software
  • Provide a specialized customer lookup application for the people in your company

License

This repository contains the source code for both the Open Source edition of Metabase, released under the AGPL, as well as the commercial edition of Metabase Enterprise, released under the Metabase Commercial Software License.

See LICENSE.txt for details.

Unless otherwise noted, all files © 2021 Metabase, Inc.