Browse Source

fix: update meta get and api get syntax in view component

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/852/head
Pranav C 3 years ago
parent
commit
b9a7636ab8
  1. 31
      packages/nc-gui/components/project/viewTabs/viewSpreadsheet.vue

31
packages/nc-gui/components/project/viewTabs/viewSpreadsheet.vue

@ -297,7 +297,7 @@ export default {
showExpandModal: false, showExpandModal: false,
selectedExpandRowIndex: null, selectedExpandRowIndex: null,
selectedExpandRowMeta: null, selectedExpandRowMeta: null,
meta: null, // meta: null,
navDrawer: true, navDrawer: true,
selected: { selected: {
row: null, row: null,
@ -343,12 +343,19 @@ export default {
modelName: null modelName: null
}), }),
computed: { computed: {
meta() {
return this.$store.state.meta.metas[this.table]
},
sqlUi() { sqlUi() {
// todo: replace with correct client // todo: replace with correct client
return SqlUI.create(this.nodes.dbConnection) return SqlUI.create(this.nodes.dbConnection)
}, },
api() { api() {
return ApiFactory.create(this.$store.getters['project/GtrProjectType'], (this.meta && this.meta._tn) || this.table, this.meta && this.meta.columns, this, this.meta) return this.meta && this.$ncApis.get({
env: this.nodes.env,
dbAlias: this.nodes.dbAlias,
table: this.meta.tn
})
}, },
edited() { edited() {
return this.data && this.data.some(r => r.rowMeta && (r.rowMeta.new || r.rowMeta.changed)) return this.data && this.data.some(r => r.rowMeta && (r.rowMeta.new || r.rowMeta.changed))
@ -532,13 +539,21 @@ export default {
async loadMeta() { async loadMeta() {
this.loadingMeta = true this.loadingMeta = true
const tableMeta = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
await this.$store.dispatch('meta/ActLoadMeta', {
env: this.nodes.env, env: this.nodes.env,
dbAlias: this.nodes.dbAlias dbAlias: this.nodes.dbAlias,
}, 'tableXcModelGet', { tn: this.table,
tn: this.table force: true
}]) })
this.meta = JSON.parse(tableMeta.meta)
// const tableMeta = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
// env: this.nodes.env,
// dbAlias: this.nodes.dbAlias
// }, 'tableXcModelGet', {
// tn: this.table
// }])
// this.meta = JSON.parse(tableMeta.meta)
this.loadingMeta = false this.loadingMeta = false
}, },
async loadTableData() { async loadTableData() {

Loading…
Cancel
Save