From 663fa23a21cc9990c30a05fb13ebd60990b881ff Mon Sep 17 00:00:00 2001 From: hanzlamateen Date: Fri, 16 Aug 2024 14:28:15 +0500 Subject: [PATCH] Changes to add metabase environment in admin panel --- packages/client-core/i18n/en/admin.json | 1 + .../src/admin/components/settings/tabs/metabase.tsx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/client-core/i18n/en/admin.json b/packages/client-core/i18n/en/admin.json index d40aa031d7..d4ca45826f 100755 --- a/packages/client-core/i18n/en/admin.json +++ b/packages/client-core/i18n/en/admin.json @@ -571,6 +571,7 @@ "subtitle": "Edit Metabase Settings", "siteUrl": "Site Url", "secretKey": "Secret Key", + "environment": "Environment", "expiration": "Expiration", "crashDashboardId": "Crash Dashboard Id" }, diff --git a/packages/client-core/src/admin/components/settings/tabs/metabase.tsx b/packages/client-core/src/admin/components/settings/tabs/metabase.tsx index 40b4fe6f52..ee76c62584 100644 --- a/packages/client-core/src/admin/components/settings/tabs/metabase.tsx +++ b/packages/client-core/src/admin/components/settings/tabs/metabase.tsx @@ -44,6 +44,7 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR const id = useHookstate(undefined) const siteUrl = useHookstate('') const secretKey = useHookstate('') + const environment = useHookstate('') const expiration = useHookstate(10) const crashDashboardId = useHookstate('') const metabaseSettingMutation = useMutation(metabaseSettingPath) @@ -55,6 +56,7 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR id.set(data[0].id) siteUrl.set(data[0].siteUrl) secretKey.set(data[0].secretKey) + environment.set(data[0].environment) expiration.set(data[0].expiration) crashDashboardId.set(data[0].crashDashboardId || '') } @@ -63,13 +65,14 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR const handleSubmit = (event) => { event.preventDefault() - if (!siteUrl.value || !secretKey.value) return + if (!siteUrl.value || !secretKey.value || !environment.value) return state.loading.set(true) const setting = { siteUrl: siteUrl.value, secretKey: secretKey.value, + environment: environment.value, crashDashboardId: crashDashboardId.value } @@ -90,6 +93,7 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR id.set(data[0].id) siteUrl.set(data[0].siteUrl) secretKey.set(data[0].secretKey) + environment.set(data[0].environment) expiration.set(data[0].expiration) crashDashboardId.set(data[0].crashDashboardId || '') } @@ -112,6 +116,13 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR onChange={(e) => siteUrl.set(e.target.value)} /> + environment.set(e.target.value)} + /> +