Browse Source

feat: open first table by default in shared base

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/765/head
Pranav C 3 years ago
parent
commit
d6be21a549
  1. 2
      packages/nc-gui/pages/nc/base/_shared_base_id.vue
  2. 19
      packages/nc-gui/store/tabs.js
  3. 2
      packages/nocodb/src/lib/noco/rest/RestAuthCtrl.ts

2
packages/nc-gui/pages/nc/base/_shared_base_id.vue

@ -86,7 +86,7 @@ export default {
},
methods: {
showLargerVersion() {
window.open(location.href.replace(/embed&?/, ''), '_blank')
window.open(location.href.replace(/([?&])embed&?/, '$1'), '_blank')
},
tableCreate(table) {
if (this.$refs.treeview) {

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

@ -239,6 +239,25 @@ export const actions = {
type: 'roles'
}
})
} else {
await dispatch('project/_loadTables', {
dbKey: '0.projectJson.envs._noco.db.0',
key: '0.projectJson.envs._noco.db.0.tables',
_nodes: {
dbAlias: 'db',
// dbKey: "0.projectJson.envs._noco.db.0",
env: '_noco',
// key: "0.projectJson.envs._noco.db.0.tables",
type: 'tableDir'
}
}, { root: true })
const nodes = rootState.project
.list[0] // project
.children[0] // environment
.children[0] // db
.children.find(n => n.type === 'tableDir') // parent node
.children
if (nodes && nodes[0]) { tabs.push(nodes[0]) }
}
}
commit('list', tabs)

2
packages/nocodb/src/lib/noco/rest/RestAuthCtrl.ts

@ -222,7 +222,7 @@ export default class RestAuthCtrl {
'jwt',
{ session: false },
(_err, user, _info) => {
if (user) {
if (user && !req.headers['xc-shared-base-id']) {
if (
req.path.indexOf('/user/me') === -1 &&
req.header('xc-preview') &&

Loading…
Cancel
Save