Browse Source

refactor: form view api corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
8edde3dfc7
  1. 22
      packages/nc-gui/components/project/spreadsheet/views/formView.vue
  2. 2
      packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts

22
packages/nc-gui/components/project/spreadsheet/views/formView.vue

@ -575,13 +575,15 @@ export default {
get() { get() {
return this.fields.filter(f => !f.show && !this.systemFieldsIds.includes(f.fk_column_id)) return this.fields.filter(f => !f.show && !this.systemFieldsIds.includes(f.fk_column_id))
}, },
set(v) {} set(v) {
}
}, },
columns: { columns: {
get() { get() {
return this.fields.filter(f => f.show).sort((a, b) => a.order - b.order) return this.fields.filter(f => f.show).sort((a, b) => a.order - b.order)
}, },
set(v) {} set(v) {
}
} }
}, },
watch: { watch: {
@ -850,18 +852,16 @@ export default {
} }
this.loading = true this.loading = true
// const id = this.meta.columns.filter(c => c.pk).map(c => this.localState[c.title]).join('___')
// const updatedObj = Object.keys(this.changedColumns).reduce((obj, col) => {
// obj[col] = this.localState[col]
// return obj
// }, {})
// if (this.isNew) {
// todo: add params option in GraphQL // todo: add params option in GraphQL
// let data = await this.api.insert(this.localState, { params: { form: this.$route.query.view } }) // let data = await this.api.insert(this.localState, { params: { form: this.$route.query.view } })
let data = await this.$api.data.create(this.meta.id, this.localState, { query: { form: this.$route.query.view } }) let data = await this.$api.dbTableRow.create(
'noco',
this.projectName,
this.meta.title,
this.localState,
{ query: { form: this.$route.query.view } }
)
data = { ...this.localState, ...data } data = { ...this.localState, ...data }
// save hasmany and manytomany relations from local state // save hasmany and manytomany relations from local state

2
packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts

@ -10,7 +10,7 @@ export async function columnUpdate(req: Request, res: Response) {
const router = Router({ mergeParams: true }); const router = Router({ mergeParams: true });
router.patch( router.patch(
'/api/v1/db/meta/forms/columns/:formViewColumnId', '/api/v1/db/meta/form/columns/:formViewColumnId',
ncMetaAclMw(columnUpdate, 'columnUpdate') ncMetaAclMw(columnUpdate, 'columnUpdate')
); );
export default router; export default router;

Loading…
Cancel
Save