diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue index b53f2d70af..617b909998 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue @@ -147,11 +147,11 @@ export default { if (this.type === 'mm') return !(this.meta.manyToMany || []) .some(mm => mm.tn === v && mm.rtn === this.meta.tn || mm.rtn === v && mm.tn === this.meta.tn) - || 'Duplicate relation is not allowed at the moment'; + || 'Duplicate many to many relation is not allowed at the moment'; if (this.type === 'hm') return !(this.meta.hasMany || []) .some(hm => hm.tn === v) - || 'Duplicate relation is not allowed at the moment'; + || 'Duplicate has many relation is not allowed at the moment'; }, ] } diff --git a/packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue b/packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue index a26aafc698..e7b09fa25c 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue @@ -77,7 +77,7 @@ v-if="col.virtual" :disabledColumns="disabledColumns" :column="col" - :row="value" + :row="localState" :nodes="nodes" :meta="meta" :api="api" @@ -87,7 +87,7 @@ :is-form="true" :breadcrumbs="localBreadcrumbs" @updateCol="updateCol" - @newRecordsSaved="$listeners.loadTableData || (() => {})" + @newRecordsSaved="$listeners.loadTableData|| reload" >
c.pk).map(c => this.localState[c._cn]).join('___'); - const where = this.meta.columns.filter((c) => c.pk).map(c => `(${c._cn},eq,${this.localState[c._cn]})`).join('~and'); + const where = this.meta.columns.filter((c) => c.pk).map(c => `(${c._cn},eq,${this.value[c._cn]})`).join('~and'); this.$set(this, 'changedColumns', {}); // this.localState = await this.api.read(id); const data = await this.api.list({...(this.queryParams || {}), where}) || [{}]; diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue index 5b75c36352..574a14fcf8 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue @@ -21,6 +21,7 @@
@@ -52,7 +53,7 @@ @new-record="showNewRecordModal" @edit="editParent" @unlink="unlink" - :bt="true" + :bt="value" /> c.pk).map(c => child[c._cn]).join('___'); await this.parentApi.delete(id) + this.pid = null; this.dialogShow = false; this.$emit('loadTableData') if (this.isForm && this.$refs.childList) { @@ -222,7 +225,7 @@ export default { await this.loadParentMeta(); this.newRecordModal = true; }, - async addParentToChild(parent) { + async addChildToParent(parent) { const pid = this.parentMeta.columns.filter((c) => c.pk).map(c => parent[c._cn]).join('___'); const id = this.meta.columns.filter((c) => c.pk).map(c => this.row[c._cn]).join('___'); @@ -238,8 +241,9 @@ export default { await this.api.update(id, { [_cn]: +pid }, { - [_cn]: parent[this.parentPrimaryKey] + [_cn]: this.value && this.value[this.parentPrimaryKey] }); + this.pid = pid; this.newRecordModal = false; @@ -268,7 +272,7 @@ export default { this.parentMeta && this.parentMeta._tn, this.parentMeta && this.parentMeta.columns, this, this.parentMeta) : null; }, parentId() { - return this.value && this.parentMeta && this.parentMeta.columns.filter((c) => c.pk).map(c => this.value[c._cn]).join('___') + return this.pid ?? (this.value && this.parentMeta && this.parentMeta.columns.filter((c) => c.pk).map(c => this.value[c._cn]).join('___')) }, parentPrimaryCol() { return this.parentMeta && (this.parentMeta.columns.find(c => c.pv) || {})._cn diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue index 879710db20..8f9a960de1 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue @@ -108,7 +108,7 @@ export default { components: {Pagination}, props: { isForm: Boolean, - bt: Boolean, + bt: Object, localState: [Array], isNew: Boolean, value: Boolean, diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue index 851cb92862..098d48ea53 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue @@ -163,9 +163,7 @@ export default { localState: [] }), async mounted() { - if (this.isForm) { - await this.loadChildMeta() - } + await this.loadChildMeta() }, methods: { async showChildListModal() { diff --git a/packages/nc-gui/nuxt.config.js b/packages/nc-gui/nuxt.config.js index 7478450d31..c4c5205f79 100644 --- a/packages/nc-gui/nuxt.config.js +++ b/packages/nc-gui/nuxt.config.js @@ -127,6 +127,9 @@ export default { publicPath: process.env.NODE_ENV === 'production' ? `./_nuxt/` : undefined, extend(config, {isDev, isClient}) { + if (isDev) { + config.devtool = isClient ? 'source-map' : 'inline-source-map' + } config.externals = config.externals || {}; config.externals ['@microsoft/typescript-etw'] = 'FakeModule'; diff --git a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts index f317b73200..72e6aba6f6 100644 --- a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts +++ b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts @@ -1886,6 +1886,38 @@ export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr { await this.reInitializeGraphqlEndpoint(); } + + + protected async ncUpManyToMany(): Promise { + const metas = await super.ncUpManyToMany(); + + if (!metas) { + return; + } + for (const meta of metas) { + const ctx = this.generateContextForTable(meta.tn, meta.columns, [], meta.hasMany, meta.belongsTo, meta.type, meta._tn); + + /* generate gql schema of the table */ + const schema = GqlXcSchemaFactory.create(this.connectionConfig, { + dir: '', + ctx, + filename: '' + }).getString(); + + /* update schema in metadb */ + await this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_models', { + schema + }, { + title: meta.tn + }) + + // todo : add loaders + + } + + } + + } /**