Browse Source

feat: Add option to show m2m tables

re #388

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/401/head
Pranav C 3 years ago
parent
commit
8074c7b6e5
  1. 2
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableTables.vue
  2. 26
      packages/nc-gui/components/project/settings/appearance.vue
  3. 2
      packages/nc-gui/components/project/spreadsheet/components/editableCell/dateTimePickerCell.vue
  4. 5
      packages/nc-gui/store/project.js
  5. 6
      packages/nc-gui/store/windows.js
  6. 2
      packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

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

@ -270,7 +270,7 @@ export default {
this.tables = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'tableList', { force: true }])).data.list
}, 'tableList', { force: true, includeM2M: true }])).data.list
},
async saveModels() {

26
packages/nc-gui/components/project/settings/appearance.vue

@ -60,6 +60,24 @@
</v-tooltip>
</td>
</tr>
<tr>
<td>Show M2M Tables</td>
<td>
<v-tooltip bottom>
<template #activator="{ on }">
<v-checkbox
v-model="includeM2M"
x-large
color="primary"
v-on="on"
>
mdi-table-network
</v-checkbox>
</template>
Include/Exclude M2M tables
</v-tooltip>
</td>
</tr>
<tr>
<td>Language</td>
<td>
@ -220,6 +238,14 @@ export default {
set(show) {
this.$store.commit('windows/MutScreensaver', show)
}
},
includeM2M: {
get() {
return this.$store.state.windows.includeM2M
},
set(show) {
this.$store.commit('windows/MutIncludeM2M', show)
}
}
},
created() {

2
packages/nc-gui/components/project/spreadsheet/components/editableCell/dateTimePickerCell.vue

@ -31,7 +31,7 @@ export default {
return new Date(+this.value)
}
return /\dT\d/.test(this.value) ? new Date(this.value.replace(/(\d)T(?=\d)/, '$1 ')) : (this.value && new Date(this.value))
return /\dT\d/.test(this.value) ? new Date(this.value.replace(/(\d)T(?=\d)/, '$1 ')) : ((this.value && new Date(this.value)))
},
set(val) {
const uVal = val && new Date(val).toISOString().slice(0, 19).replace('T', ' ').replace(/(\d{1,2}:\d{1,2}):\d{1,2}$/, '$1')

5
packages/nc-gui/store/project.js

@ -292,13 +292,12 @@ export const actions = {
// dbAlias: data._nodes.dbAlias
// });
// const result = await client.tableList();
const result = await dispatch('sqlMgr/ActSqlOpPlus', [
{
env: data._nodes.env,
dbAlias: data._nodes.dbAlias
},
"tableList"
"tableList", {includeM2M: rootState.windows.includeM2M}
], {root: true});
@ -307,7 +306,7 @@ export const actions = {
}
result.data.list = result.data.list.filter(t => rootState.windows.metatables || !isMetaTable(t.tn));
console.log("tablelist debufg", result.data.list);
console.log("tablelist", result.data.list);
deepSet(state.unserializedList, result.data.list, `${key}`);
commit("list", state.unserializedList);
} else {

6
packages/nc-gui/store/windows.js

@ -37,7 +37,8 @@ export const state = () => ({
miniSponsorCard: 0,
screensaver: true,
autoApplyFilter: true,
apiLoading: false
apiLoading: false,
includeM2M: false
})
export const mutations = {
@ -150,6 +151,9 @@ export const mutations = {
},
MutMiniSponsorCard(state, miniSponsorCard) {
state.miniSponsorCard = miniSponsorCard
},
MutIncludeM2M(state, includeM2M) {
state.includeM2M = includeM2M
}
}

2
packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

@ -2942,7 +2942,7 @@ export default class NcMetaMgr {
let tables = await this.xcMeta.metaList(this.getProjectId(args), this.getDbAlias(args), 'nc_models', {
condition: {
type: 'table',
mm: null
...(args?.args?.includeM2M ? {} : {mm: null})
}
});

Loading…
Cancel
Save