Browse Source

fix(nc-gui): plugin test type and plugin input

pull/5307/head
Wing-Kam Wong 2 years ago
parent
commit
1e2f640f61
  1. 14
      packages/nc-gui/components/dashboard/settings/app-store/AppInstall.vue

14
packages/nc-gui/components/dashboard/settings/app-store/AppInstall.vue

@ -1,6 +1,7 @@
<script setup lang="ts">
import type { PluginType } from 'nocodb-sdk'
import { extractSdkResponseErrorMsg, message, onMounted, ref, useI18n, useNuxtApp } from '#imports'
import { PluginTestReqType } from 'nocodb-sdk'
const { id } = defineProps<{
id: string
@ -64,12 +65,12 @@ const testSettings = async () => {
loadingAction = Action.Test
try {
if (plugin) {
const res = await $api.plugin.test({
input: pluginFormData,
id: plugin?.id,
category: plugin?.category,
title: plugin?.title,
})
input: JSON.stringify(pluginFormData),
title: plugin.title,
category: plugin.category,
} as PluginTestReqType)
if (res) {
// Successfully tested plugin settings
@ -78,6 +79,7 @@ const testSettings = async () => {
// Invalid credentials
message.info(t('msg.info.invalidCredentials'))
}
}
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {
@ -106,7 +108,7 @@ const readPluginDetails = async () => {
const res = await $api.plugin.read(id)
const formDetails = JSON.parse(res.input_schema ?? '{}')
const emptyParsedInput = formDetails.array ? [{}] : {}
const parsedInput = res.input ? JSON.parse(res.input) : emptyParsedInput
const parsedInput = typeof res.input === 'string' ? JSON.parse(res.input) : emptyParsedInput
// the type of 'secure' was XcType.SingleLineText in 0.0.1
// and it has been changed to XcType.Checkbox, since 0.0.2

Loading…
Cancel
Save