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

Commit

Permalink
Changes to add metabase environment in admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzlamateen committed Aug 16, 2024
1 parent 3646b0b commit 663fa23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/client-core/i18n/en/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@
"subtitle": "Edit Metabase Settings",
"siteUrl": "Site Url",
"secretKey": "Secret Key",
"environment": "Environment",
"expiration": "Expiration",
"crashDashboardId": "Crash Dashboard Id"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR
const id = useHookstate<string | undefined>(undefined)
const siteUrl = useHookstate('')
const secretKey = useHookstate('')
const environment = useHookstate('')
const expiration = useHookstate(10)
const crashDashboardId = useHookstate('')
const metabaseSettingMutation = useMutation(metabaseSettingPath)
Expand All @@ -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 || '')
}
Expand All @@ -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
}

Expand All @@ -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 || '')
}
Expand All @@ -112,6 +116,13 @@ const MetabaseTab = forwardRef(({ open }: { open: boolean }, ref: React.MutableR
onChange={(e) => siteUrl.set(e.target.value)}
/>

<Input
className="col-span-1"
label={t('admin:components.setting.metabase.environment')}
value={environment?.value || ''}
onChange={(e) => environment.set(e.target.value)}
/>

<PasswordInput
className="col-span-1"
label={t('admin:components.setting.metabase.secretKey')}
Expand Down

0 comments on commit 663fa23

Please sign in to comment.