Browse Source

feat: clear meta from state and close all table/view tabs

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/894/head
Pranav C 3 years ago
parent
commit
87e3ed7b11
  1. 2
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableTables.vue
  2. 10
      packages/nc-gui/components/project/spreadsheet/mixins/spreadsheet.js
  3. 3
      packages/nc-gui/store/tabs.js

2
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableTables.vue

@ -351,6 +351,8 @@ export default {
this.$toast.success('Table metadata recreated successfully').goAway(3000)
await this.loadXcDiff()
this.$store.commit('tabs/removeTableOrViewTabs')
await this.$nextTick()
await this.$store.dispatch('project/_loadTables', {
dbKey: '0.projectJson.envs._noco.db.0',
key: '0.projectJson.envs._noco.db.0.tables',

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

@ -85,7 +85,9 @@ export default {
},
allColumns() {
if (!this.meta) { return [] }
if (!this.meta) {
return []
}
let columns = this.meta.columns
if (this.meta && this.meta.v) {
@ -109,6 +111,9 @@ export default {
}
return columns
},
// allColumnsNames() {
// return this.allColumns && this.allColumns.length ? this.allColumns.reduce((a, c) => [...a, c.cn, c._cn], []) : []
// },
availableColumns() {
let columns = []
@ -350,6 +355,7 @@ export default {
}
condition += (i ? `~${filt.logicOp}` : '')
// if (this.allColumnsNames.includes(filt.field)) {
switch (filt.op) {
case 'is equal':
return condition + `(${filt.field},eq,${filt.value})`
@ -376,6 +382,7 @@ export default {
case '>=':
return condition + `(${filt.field},ge,${filt.value})`
}
// }
return condition
}, '')
@ -393,6 +400,7 @@ export default {
sortList: {
async handler(sortList) {
const sort = sortList.map((sort) => {
// && this.allColumnsNames.includes(sort.field)
return sort.field ? `${sort.order}${sort.field}` : ''
}).filter(Boolean).join(',')
this.sort = sort

3
packages/nc-gui/store/tabs.js

@ -19,8 +19,7 @@ export const mutations = {
state.list.splice(index, 1)
},
removeTableOrViewTabs(state) {
debugger
// state.list.splice(index, 1)
state.list = state.list.filter(t => !['table', 'view'].includes(t.type))
},
clear(state, index) {
state.list = []

Loading…
Cancel
Save