Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Move Data Apps under data-apps-preview token feature (#78800)

Timofey Kachalov692f047b92a1
diff --git a/enterprise/backend/src/metabase_enterprise/api_routes/routes.clj b/enterprise/backend/src/metabase_enterprise/api_routes/routes.clj
index 608a7e8e7b4..b41fd85b8b6 100644
--- a/enterprise/backend/src/metabase_enterprise/api_routes/routes.clj
+++ b/enterprise/backend/src/metabase_enterprise/api_routes/routes.clj
@@ -61,7 +61,7 @@
:collection-cleanup (deferred-tru "Collection Cleanup")
:content-translation (deferred-tru "Content translation")
:custom-viz (deferred-tru "Custom Visualizations")
- :data-apps (deferred-tru "Data Apps")
+ :data-apps-preview (deferred-tru "Data Apps")
:library (deferred-tru "Library")
:dependencies (deferred-tru "Dependency Tracking")
:schema-viewer (deferred-tru "Schema Viewer")
@@ -97,7 +97,7 @@
;; Data-app bundle hosting. Naughty because the FE route lives at `/apps/:slug`
;; (and `/api/apps/...`), NOT `/api/ee/...` — `/app/*` is reserved for static
;; assets, so we keep the public path stable here. Superuser-only inside the handler.
- (str "/" request/data-app-url-segment) (premium-handler metabase-enterprise.data-apps.api/routes :data-apps)
+ (str "/" request/data-app-url-segment) (premium-handler metabase-enterprise.data-apps.api/routes :data-apps-preview)
"/mt" metabase-enterprise.sandbox.api.routes/sandbox-routes
"/table" metabase-enterprise.sandbox.api.routes/sandbox-table-routes})
diff --git a/enterprise/backend/src/metabase_enterprise/data_apps/csp.clj b/enterprise/backend/src/metabase_enterprise/data_apps/csp.clj
index 8abd25f4f04..f4db3e69539 100644
--- a/enterprise/backend/src/metabase_enterprise/data_apps/csp.clj
+++ b/enterprise/backend/src/metabase_enterprise/data_apps/csp.clj
@@ -10,7 +10,7 @@
"Origins the enabled data app with `slug` may reach (its `allowed_hosts`), or
`[]` when there is no such enabled app. Drives the data-app iframe document's
CSP `connect-src` so the sandboxed bundle can fetch/XHR those origins."
- :feature :data-apps
+ :feature :data-apps-preview
[slug]
(or (:allowed_hosts (data-app/select-one-non-blob :name slug :enabled true))
[]))
diff --git a/enterprise/backend/test/metabase_enterprise/api/session_test.clj b/enterprise/backend/test/metabase_enterprise/api/session_test.clj
index 0434725bd11..ccec273e565 100644
--- a/enterprise/backend/test/metabase_enterprise/api/session_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/api/session_test.clj
@@ -25,7 +25,7 @@
:config-text-file
:content-translation
:content-verification
- :data-apps
+ :data-apps-preview
:data-complexity-score
:dashboard-subscription-filters
:disable-password-login
diff --git a/enterprise/backend/test/metabase_enterprise/data_apps/api_test.clj b/enterprise/backend/test/metabase_enterprise/data_apps/api_test.clj
index 3e8dea64471..e819ef51735 100644
--- a/enterprise/backend/test/metabase_enterprise/data_apps/api_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/data_apps/api_test.clj
@@ -49,11 +49,11 @@
;;; ---------------------------------------------- Permissions ----------------------------------------------
(deftest non-superuser-can-view-and-list-but-not-manage-test
- ;; global mode so the `:data-apps` premium feature is visible to the real-HTTP
+ ;; global mode so the `:data-apps-preview` premium feature is visible to the real-HTTP
;; `user-real-request` calls below (which run on Jetty threads that don't inherit
;; a thread-local `binding`).
(mt/test-helpers-set-global-values!
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(create-app!)
(testing "a non-superuser can view (open) a data app"
@@ -72,7 +72,7 @@
(deftest superuser-can-manage-and-view-test
(mt/test-helpers-set-global-values!
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(create-app!)
(testing "a superuser can list, read metadata, and serve the bundle"
@@ -85,7 +85,7 @@
"BUNDLE")))))))
(deftest list-available-apps-test
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(t2/insert! :model/DataApp :name "ready" :display_name "Ready" :bundle_path "data_apps/ready/index.js")
(t2/insert! :model/DataApp :name "disabled" :display_name "Disabled" :bundle_path "data_apps/disabled/index.js"
@@ -96,7 +96,7 @@
(mt/user-http-request :rasta :get 200 "apps?available=true"))))))
(deftest bundle-includes-allowed-hosts-header-test
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(t2/insert! :model/DataApp
:name "demo"
@@ -116,7 +116,7 @@
(get-in resp [:headers "X-Metabase-Data-App-Allowed-Hosts"]))))))))
(deftest list-includes-allowed-hosts-test
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(t2/insert! :model/DataApp
:name "withhosts" :display_name "With"
@@ -180,7 +180,7 @@
(deftest delete-endpoint-test
(mt/test-helpers-set-global-values!
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(create-app!)
(testing "a non-superuser cannot remove an app"
@@ -262,7 +262,7 @@
(deftest list-and-bundle-endpoints-test
(mt/test-helpers-set-global-values!
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(data-app.sync/import-from-snapshot!
(snapshot (app-files "demo" {:name "Demo app" :path "dist/index.js" :bundle "DEMOBUNDLE"})))
@@ -276,7 +276,7 @@
"DEMOBUNDLE")))))))
(deftest repo-status-endpoint-test
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(testing "reports no repository when none is connected"
(mt/with-dynamic-fn-redefs [data-app.sync/repo-url (constantly nil)]
(is (=? {:configured false :url nil}
@@ -288,7 +288,7 @@
(deftest enable-disable-endpoint-test
(mt/test-helpers-set-global-values!
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-model-cleanup [:model/DataApp]
(data-app.sync/import-from-snapshot!
(snapshot (app-files "demo" {:name "Demo" :path "index.js" :bundle "BUNDLE"})))
diff --git a/enterprise/backend/test/metabase_enterprise/data_apps/csp_test.clj b/enterprise/backend/test/metabase_enterprise/data_apps/csp_test.clj
index 4427c7abc09..721c735eb52 100644
--- a/enterprise/backend/test/metabase_enterprise/data_apps/csp_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/data_apps/csp_test.clj
@@ -22,7 +22,7 @@
first))))
(deftest data-app-connect-src-allowed-hosts-test
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-temp [:model/DataApp _ {:name "boba"
:display_name "Boba"
:bundle_path "data_apps/boba/dist/index.js"
@@ -48,14 +48,14 @@
:bundle_path "x"
:enabled true
:allowed_hosts ["https://api.example.com"]}]
- (testing "with the :data-apps feature the EE impl returns the app's allowed_hosts"
- (mt/with-premium-features #{:data-apps}
+ (testing "with the :data-apps-preview feature the EE impl returns the app's allowed_hosts"
+ (mt/with-premium-features #{:data-apps-preview}
(is (= ["https://api.example.com"] (mw.security/data-app-connect-src-hosts "boba")))))
(testing "without the feature it falls back to []"
(mt/with-premium-features #{}
(is (= [] (mw.security/data-app-connect-src-hosts "boba")))))
(testing "a disabled app contributes nothing"
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-temp [:model/DataApp _ {:name "off"
:display_name "Off"
:bundle_path "x"
diff --git a/enterprise/backend/test/metabase_enterprise/remote_sync/data_app_pull_test.clj b/enterprise/backend/test/metabase_enterprise/remote_sync/data_app_pull_test.clj
index 5073ef3d727..c9f3ab94f81 100644
--- a/enterprise/backend/test/metabase_enterprise/remote_sync/data_app_pull_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/remote_sync/data_app_pull_test.clj
@@ -56,7 +56,7 @@
(deftest data-app-only-pull-counts-app-changes-test
(testing "a pull whose only change is a data app is reported as a real pull, not pull-skipped / 0 changes"
(search.tu/with-index-disabled
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-temporary-setting-values [remote-sync-type :read-write remote-sync-transforms false]
(mt/with-model-cleanup [:model/DataApp]
(let [outcome (pull-outcome! (app-tree "sales" "BUNDLE-V1")
@@ -67,7 +67,7 @@
(deftest data-only-pull-excludes-unchanged-apps-test
(testing "a serdes-only pull counts serdes content; unchanged data apps add nothing"
(search.tu/with-index-disabled
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-temporary-setting-values [remote-sync-type :read-write remote-sync-transforms false]
(mt/with-model-cleanup [:model/DataApp :model/Collection]
;; v1 adds a collection; the data app is byte-for-byte the same as v0.
@@ -79,7 +79,7 @@
(deftest mixed-pull-counts-serdes-and-apps-test
(testing "a mixed pull counts serdes content AND the changed data apps"
(search.tu/with-index-disabled
- (mt/with-premium-features #{:data-apps}
+ (mt/with-premium-features #{:data-apps-preview}
(mt/with-temporary-setting-values [remote-sync-type :read-write remote-sync-transforms false]
(mt/with-model-cleanup [:model/DataApp :model/Collection]
;; v1 adds a collection AND changes the data app's bundle.
diff --git a/src/metabase/premium_features/settings.clj b/src/metabase/premium_features/settings.clj
index f510e04565e..332c9715bd3 100644
--- a/src/metabase/premium_features/settings.clj
+++ b/src/metabase/premium_features/settings.clj
@@ -293,9 +293,9 @@
"Does this instance support remote syncing collections."
:remote-sync)
-(define-premium-feature ^{:added "0.57.0"} enable-data-apps?
+(define-premium-feature ^{:added "0.65.0"} enable-data-apps?
"Should we allow users to publish and run data apps?"
- :data-apps)
+ :data-apps-preview)
(define-premium-feature ^{:added "0.59.0"} enable-basic-transforms?
"Should we allow users to use transforms? Replacement for transforms"
diff --git a/src/metabase/server/middleware/security.clj b/src/metabase/server/middleware/security.clj
index be42472913f..6bb25173a21 100644
--- a/src/metabase/server/middleware/security.clj
+++ b/src/metabase/server/middleware/security.clj
@@ -227,8 +227,9 @@
(defenterprise data-app-connect-src-hosts
"Origins the data app identified by `slug` may reach (its `allowed_hosts`),
added to the data-app iframe document's CSP `connect-src` so the sandboxed
- bundle can `fetch`/XHR them. Returns `[]` in OSS, when the `:data-apps`
- feature is absent, or when there's no enabled app for `slug`. EE
+ bundle can `fetch`/XHR them. Returns `[]` in OSS, when the
+ `:data-apps-preview` feature is absent, or when there's no enabled app for
+ `slug`. EE
implementation: [[metabase-enterprise.data-apps.csp]]."
metabase-enterprise.data-apps.csp
[_slug]
diff --git a/test/metabase/analytics/stats_test.clj b/test/metabase/analytics/stats_test.clj
index 5335c9e5c14..da3d4a38e5d 100644
--- a/test/metabase/analytics/stats_test.clj
+++ b/test/metabase/analytics/stats_test.clj
@@ -546,7 +546,7 @@
or to this set, so that [[every-feature-is-accounted-for-test]] passes."
#{:audit-app ;; tracked under :mb-analytics
:collection-cleanup
- :data-apps
+ :data-apps-preview
:data-complexity-score
:development-mode
:library