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

Loading…
Cancel
Save