Browse Source

Merge pull request #4120 from nocodb/fix/4093-webhook-bugs

Fix: Webhook related issues
pull/4114/head
Pranav C 2 years ago committed by GitHub
parent
commit
fcdfb7fd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/nc-gui/components/webhook/Editor.vue
  2. 4
      packages/nc-gui/composables/useViewData.ts
  3. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

7
packages/nc-gui/components/webhook/Editor.vue

@ -543,7 +543,12 @@ onMounted(loadPluginList)
<a-col :span="24">
<a-tabs v-model:activeKey="urlTabKey" type="card" closeable="false" class="shadow-sm">
<a-tab-pane key="body" tab="Body">
<LazyMonacoEditor v-model="hook.notification.payload.body" :validate="false" class="min-h-60 max-h-80" />
<LazyMonacoEditor
v-model="hook.notification.payload.body"
disable-deep-compare
:validate="false"
class="min-h-60 max-h-80"
/>
</a-tab-pane>
<a-tab-pane key="params" tab="Params" force-render>

4
packages/nc-gui/composables/useViewData.ts

@ -202,11 +202,11 @@ export function useViewData(
async function insertRow(
currentRow: Row,
rowIndex = formattedData.value?.length,
_rowIndex = formattedData.value?.length,
ltarState: Record<string, any> = {},
{ metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
) {
const row = currentRow.row;
const row = currentRow.row
if (currentRow.rowMeta) currentRow.rowMeta.saving = true
try {
const { missingRequiredColumns, insertObj } = await populateInsertObject({

12
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -1423,7 +1423,7 @@ class BaseModelSqlv2 {
// const driver = trx ? trx : this.dbDriver;
const query = this.dbDriver(this.tnPath).insert(insertObj);
if (this.isPg || this.isMssql) {
if ((this.isPg || this.isMssql) && this.model.primaryKey) {
query.returning(
`${this.model.primaryKey.column_name} as ${this.model.primaryKey.title}`
);
@ -1431,7 +1431,15 @@ class BaseModelSqlv2 {
}
const ai = this.model.columns.find((c) => c.ai);
if (
let ag: Column;
if (!ai) ag = this.model.columns.find((c) => c.meta?.ag);
// handle if autogenerated primary key is used
if (ag) {
if (!response) await this.extractRawQueryAndExec(query);
response = await this.readByPk(data[ag.title]);
} else if (
!response ||
(typeof response?.[0] !== 'object' && response?.[0] !== null)
) {

Loading…
Cancel
Save