Browse Source

refactor(gui): code refactoring

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/865/head
Pranav C 3 years ago
parent
commit
29a577d231
  1. 4
      packages/nc-gui/components/ProjectTreeView.vue
  2. 8
      packages/nc-gui/components/project/spreadsheet/mixins/spreadsheet.js
  3. 8
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

4
packages/nc-gui/components/ProjectTreeView.vue

@ -170,11 +170,11 @@
<template
v-else
>
<span v-if="item.type === 'tableDir'" class="caption font-weight-regular" v-on="on">
<span v-if="item.type === 'tableDir'" class="caption font-weight-regular">
Tables<template v-if="item.children && item.children.length"> ({{
item.children.filter(child => !search || child.name.toLowerCase().includes(search.toLowerCase())).length
}})</template></span>
<span v-else class="caption font-weight-regular" v-on="on">
<span v-else class="caption font-weight-regular">
{{ item.name }}</span>
</template>
</v-list-item-title>

8
packages/nc-gui/components/project/spreadsheet/mixins/spreadsheet.js

@ -9,7 +9,10 @@ export default {
showFields: {},
// fieldList: [],
// meta: {},
data: []
data: [],
syncDataDebounce() {
// not implemented
}
}),
methods: {
mapFieldsAndShowFields() {
@ -19,9 +22,6 @@ export default {
return obj
}, {})
},
syncDataDebounce() {
// not implemented
},
onKeyDown(e) {
if (this.selected.col === null || this.selected.row === null) {
return

8
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -1040,14 +1040,14 @@ export default {
await this.api.delete(id)
}
this.data.splice(this.rowContextMenu.index, 1)
this.$toast.success('Deleted row successfully').goAway(3000)
// this.$toast.success('Deleted row successfully').goAway(3000)
} catch (e) {
this.$toast.error(`Failed to delete row : ${e.message}`).goAway(3000)
}
},
async deleteSelectedRows() {
let row = this.rowLength
let success = 0
// let success = 0
while (row--) {
try {
const { row: rowObj, rowMeta } = this.data[row]
@ -1064,12 +1064,12 @@ export default {
await this.api.delete(id)
}
this.data.splice(row, 1)
success++
// success++
} catch (e) {
return this.$toast.error(`Failed to delete row : ${e.message}`).goAway(3000)
}
}
if (success) { this.$toast.success(`Deleted ${success} selected row${success > 1 ? 's' : ''} successfully`).goAway(3000) }
// if (success) { this.$toast.success(`Deleted ${success} selected row${success > 1 ? 's' : ''} successfully`).goAway(3000) }
},
async clearCellValue() {

Loading…
Cancel
Save