Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

feat: auto-test-config

Hemant M Mehta873218a1d603
diff --git a/packages/nc-gui/composables/useAccountSetupStore.ts b/packages/nc-gui/composables/useAccountSetupStore.ts
index c592de982c..3dafd22fd6 100644
--- a/packages/nc-gui/composables/useAccountSetupStore.ts
+++ b/packages/nc-gui/composables/useAccountSetupStore.ts
@@ -56,6 +56,19 @@ const [useProvideAccountSetupStore, useAccountSetupStore] = createInjectionState
loadingAction.value = Action.Save
try {
+ if (activePlugin.value) {
+ const testRes = await $api.plugin.test({
+ input: JSON.stringify(activePluginFormData.value),
+ title: activePlugin.value.title,
+ category: activePlugin.value.category,
+ } as PluginTestReqType)
+
+ if (!testRes) {
+ message.error(t('msg.info.invalidCredentials'))
+ return
+ }
+ }
+
await $api.plugin.update(activePlugin.value?.id, {
input: JSON.stringify(activePluginFormData.value),
active: true,
diff --git a/packages/nocodb/src/services/plugins.service.ts b/packages/nocodb/src/services/plugins.service.ts
index 43f69900e1..60009d0e4f 100644
--- a/packages/nocodb/src/services/plugins.service.ts
+++ b/packages/nocodb/src/services/plugins.service.ts
@@ -38,6 +38,15 @@ export class PluginsService {
}) {
validatePayload('swagger.json#/components/schemas/PluginReq', param.plugin);
+ const pluginInfo = await Plugin.get(param.pluginId);
+ if (pluginInfo?.title && pluginInfo.category) {
+ await NcPluginMgrv2.test({
+ title: pluginInfo.title,
+ category: pluginInfo.category,
+ input: param.plugin.input,
+ });
+ }
+
const plugin = await Plugin.update(param.pluginId, param.plugin);
this.appHooksService.emit(