Browse Source

refactor: code cleanup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
e52a4420ab
  1. 1
      packages/nc-gui/components/project/spreadsheet/public/xcKanban.vue
  2. 1
      packages/nc-gui/components/project/spreadsheet/public/xcTable.vue
  3. 36
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  4. 5
      packages/nc-gui/components/project/spreadsheet/views/formView.vue
  5. 3
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue
  6. 1
      packages/nc-gui/components/project/table.vue

1
packages/nc-gui/components/project/spreadsheet/public/xcKanban.vue

@ -74,7 +74,6 @@ export default {
props: {
env: String,
nodes: Object,
addNewRelationTab: Function,
relationType: String,
relation: Object,
relationIdValue: [String, Number],

1
packages/nc-gui/components/project/spreadsheet/public/xcTable.vue

@ -147,7 +147,6 @@ export default {
props: {
env: String,
nodes: Object,
addNewRelationTab: Function,
relationType: String,
relation: Object,
relationIdValue: [String, Number],

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

@ -357,7 +357,6 @@
@onCellValueChange="onCellValueChange"
@insertNewRow="insertNewRow"
@showRowContextMenu="showRowContextMenu"
@addNewRelationTab="addNewRelationTab"
@expandRow="expandRow"
@onRelationDelete="loadMeta"
@loadTableData="loadTableData"
@ -602,24 +601,6 @@
<span class="caption">Set column value to <strong>null</strong></span>
</v-tooltip>
</template>
<!-- <template v-if="meta.hasMany && meta.hasMany.length">
<v-divider v-if="isEditable && !isLocked" />
<span class="ml-3 grey&#45;&#45;text " style="font-size: 9px">Has Many</span>
<v-list-item v-for="(hm,i) in meta.hasMany" :key="i" @click="addNewRelationTabCtxMenu(hm,'hm')">
<span class="caption text-capitalize">{{ hm.title }}</span>
</v-list-item>
</template>
<template v-if="meta.belongsTo && meta.belongsTo.length">
<v-divider />
<span class="ml-3 grey&#45;&#45;text " style="font-size: 9px">Belongs To</span>
<v-list-item v-for="(bt,i) in belongsTo" :key="i" @click="addNewRelationTabCtxMenu(bt,'bt')">
<span class="caption text-capitalize">{{ bt._rtn }}</span>
</v-list-item>
</template>-->
</v-list>
</v-menu>
<v-dialog
@ -752,7 +733,6 @@ export default {
tabId: String,
env: String,
nodes: Object,
addNewRelationTab: Function,
relationType: String,
relation: Object,
relationIdValue: [String, Number],
@ -996,22 +976,6 @@ export default {
comingSoon() {
this.$toast.info('Coming soon!').goAway(3000)
},
addNewRelationTabCtxMenu(obj, type) {
const rowObj = this.rowContextMenu.row
this.addNewRelationTab(
obj,
this.table,
this.meta.title || this.table,
type === 'hm' ? obj.table_name : obj.rtn,
type === 'hm' ? obj.title : obj._rtn,
// todo: column name alias
rowObj[type === 'hm' ? obj.rcn : obj.title],
type,
rowObj,
rowObj[this.primaryValueColumn]
)
},
changed(col, row) {
this.$set(this.data[row].rowMeta, 'changed', this.data[row].rowMeta.changed || {})
if (this.data[row].rowMeta) {

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

@ -228,7 +228,7 @@
</div>
<!--placeholder=" Enter form input label"-->
<editable
v-model="col.label"
v-model.lazy="col.label"
style="width:300px;white-space: pre-wrap"
:placeholder="$t('msg.info.formInput')"
class="caption pa-1 backgroundColor darken-1 mb-2 "
@ -236,7 +236,7 @@
/>
<!--placeholder=" Add some help text"-->
<editable
v-model="col.description"
v-model.lazy="col.description"
style="width:300px;white-space: pre-wrap"
:placeholder="$t('msg.info.formHelpText')"
class="caption pa-1 backgroundColor darken-1 mb-2"
@ -682,6 +682,7 @@ export default {
this.$emit('update:fieldsOrder', this.fields.map(c => c.title))
},
async updateColMeta(col, i) {
// todo: introduce debounce to avoid consecutive api call
if (col.id) {
await this.$api.dbView.formColumnUpdate(col.id, col)
}

3
packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

@ -659,9 +659,6 @@ export default {
this.selected.row--
}
},
addNewRelationTab(...args) {
this.$emit('addNewRelationTab', ...args)
},
makeSelected(col, row) {
if (this.selected.col !== col || this.selected.row !== row) {
this.selected = {

1
packages/nc-gui/components/project/table.vue

@ -35,7 +35,6 @@
:mtd-new-table-update="mtdNewTableUpdate"
:delete-table="deleteTable"
:is-meta-table="isMetaTable"
:add-new-relation-tab="addNewRelationTab"
/>
</v-tab-item>
</template>

Loading…
Cancel
Save