Browse Source

fix(gui-v2): log audit and reload audit list on row update

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3339/head
Pranav C 2 years ago
parent
commit
769f146b3e
  1. 12
      packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue
  2. 20
      packages/nc-gui-v2/composables/useExpandedFormStore.ts

12
packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue

@ -105,10 +105,16 @@ export default {
</script>
<template>
<a-drawer v-model:visible="isExpanded" :footer="null" width="min(90vw,1000px)" :body-style="{ padding: 0 }" :closable="false">
<a-drawer
v-model:visible="isExpanded"
:footer="null"
width="min(90vw,1000px)"
:body-style="{ 'padding': 0, 'display': 'flex', 'flex-direction': 'column' }"
:closable="false"
>
<Header @cancel="onClose" />
<div class="!bg-gray-100 rounded">
<div class="flex h-full nc-form-wrapper items-stretch min-h-[70vh]">
<div class="!bg-gray-100 rounded flex-1">
<div class="flex h-full nc-form-wrapper items-stretch min-h-[max(70vh,100%)]">
<div class="flex-1 overflow-auto scrollbar-thin-primary">
<div class="w-[500px] mx-auto">
<div v-for="col of fields" :key="col.title" class="mt-2 py-2" :class="`nc-expand-col-${col.title}`">

20
packages/nc-gui-v2/composables/useExpandedFormStore.ts

@ -125,24 +125,11 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
if (row.value.rowMeta?.new) {
data = await $api.dbTableRow.create('noco', project.value.title as string, meta.value.title, updateOrInsertObj)
/* todo:
// save hasmany and manytomany relations from local state
if (this.$refs.virtual && Array.isArray(this.$refs.virtual)) {
for (const vcell of this.$refs.virtual) {
if (vcell.save) {
await vcell.save(this.localState);
}
}
} */
Object.assign(row.value, {
row: data,
rowMeta: {},
oldRow: { ...data },
})
/// todo:
// await this.reload();
} else if (Object.keys(updateOrInsertObj).length) {
const id = extractPkFromRow(row.value.row, meta.value.columns as ColumnType[])
@ -160,7 +147,12 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
value: getHTMLEncodedText(updateOrInsertObj[key]),
prev_value: getHTMLEncodedText(row.value.oldRow[key]),
})
.then(() => {})
.then(async () => {
/** load latest comments/audit if right drawer is open*/
if (commentsDrawer.value) {
await loadCommentsAndLogs()
}
})
}
} else {
return message.info('No columns to update')

Loading…
Cancel
Save