Browse Source

Merge branch 'master' of https://github.com/nocodb/nocodb

pull/764/head
Raju Udava 3 years ago
parent
commit
847c1a0f2a
  1. 79
      packages/nc-gui/components/ProjectTreeView.vue
  2. 10
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  3. 4
      packages/nc-gui/components/project/table.vue
  4. 2
      packages/nc-gui/components/projectTabs.vue
  5. 4
      packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

79
packages/nc-gui/components/ProjectTreeView.vue

@ -26,16 +26,24 @@
&lt;!&ndash; <v-icon v-else>mdi-arrow-expand-horizontal</v-icon>&ndash;&gt; &lt;!&ndash; <v-icon v-else>mdi-arrow-expand-horizontal</v-icon>&ndash;&gt;
</v-btn>--> </v-btn>-->
<!-- <v-text-field--> <v-text-field
<!-- v-model="search"--> v-model="search"
<!-- label="Search Project"--> placeholder="Search tables"
<!-- dense--> dense
<!-- solo--> hide-details
<!-- hide-details--> class="elevation-0 mr-2 pl-3 pr-1 caption nc-table-list-filter"
<!-- clearable--> >
<!-- clear-icon="mdi-close-circle-outline"--> <template #prepend-inner>
<!-- class="pa-2"--> <v-icon small class="mt-2 ml-2 mr-1 ">
<!-- ></v-text-field>--> mdi-magnify
</v-icon>
</template>
<template #append>
<v-icon v-if="search" class="mt-3 mr-3" color="grey" x-small @click="search=''">
mdi-close
</v-icon>
</template>
</v-text-field>
<v-skeleton-loader <v-skeleton-loader
v-if="!projects || !projects.length" v-if="!projects || !projects.length"
@ -108,7 +116,7 @@
</v-tooltip> </v-tooltip>
</template> </template>
</v-treeview> </v-treeview>
<v-container v-else fluid class="px-1"> <v-container v-else fluid class="px-1 pt-0">
<v-list dense expand class="nc-project-tree nc-single-env-project-tree"> <v-list dense expand class="nc-project-tree nc-single-env-project-tree">
<template v-for="item in listViewArr"> <template v-for="item in listViewArr">
<!-- v-if="item.children && item.children.length"--> <!-- v-if="item.children && item.children.length"-->
@ -116,7 +124,7 @@
v-if="isNested(item) && showNode(item)" v-if="isNested(item) && showNode(item)"
:key="item.type" :key="item.type"
color="textColor" color="textColor"
:value="isActiveList(item)" :value="isActiveList(item) || search"
@click=" @click="
!(item.children && item.children.length) && addTab({ ...item }, false, false) !(item.children && item.children.length) && addTab({ ...item }, false, false)
" "
@ -131,7 +139,7 @@
<v-list-item-icon> <v-list-item-icon>
<v-icon <v-icon
v-if="open && icons[item._nodes.type].openIcon" v-if="open && icons[item._nodes.type].openIcon"
x-small small
style="cursor: auto" style="cursor: auto"
:color="icons[item._nodes.type].openColor" :color="icons[item._nodes.type].openColor"
> >
@ -139,7 +147,7 @@
</v-icon> </v-icon>
<v-icon <v-icon
v-else v-else
x-small small
style="cursor: auto" style="cursor: auto"
:color="icons[item._nodes.type].color" :color="icons[item._nodes.type].color"
> >
@ -149,17 +157,25 @@
<v-list-item-title> <v-list-item-title>
<v-tooltip v-if="!isNonAdminAccessAllowed(item)" top> <v-tooltip v-if="!isNonAdminAccessAllowed(item)" top>
<template #activator="{ on }"> <template #activator="{ on }">
<span class="caption font-weight-regular" v-on="on"> <span v-if="item.type === 'tableDir'" class="caption font-weight-regular" v-on="on">
Tables<template v-if="item.children && item.children.length"> ({{
item.children.filter(child => !search || child.name.toLowerCase().includes(search.toLowerCase())).length
}})</template></span>
<span v-else class="caption font-weight-regular" v-on="on">
{{ item.name }}</span> {{ item.name }}</span>
</template> </template>
<span class="caption">Only visible to Creator</span> <span class="caption">Only visible to Creator</span>
</v-tooltip> </v-tooltip>
<span <template
v-else v-else
class="caption font-weight-regular"
@dblclick="showSqlClient = true"
> >
{{ item.name }}</span> <span v-if="item.type === 'tableDir'" class="caption font-weight-regular" v-on="on">
Tables<template v-if="item.children && item.children.length"> ({{
item.children.filter(child => !search || child.name.toLowerCase().includes(search.toLowerCase())).length
}})</template></span>
<span v-else class="caption font-weight-regular" v-on="on">
{{ item.name }}</span>
</template>
</v-list-item-title> </v-list-item-title>
<v-spacer /> <v-spacer />
@ -186,6 +202,7 @@
<v-list-item-group :value="selectedItem"> <v-list-item-group :value="selectedItem">
<v-list-item <v-list-item
v-for="child in item.children || []" v-for="child in item.children || []"
v-show="!search || child.name.toLowerCase().includes(search.toLowerCase())"
:key="child.key" :key="child.key"
color="x-active" color="x-active"
active-class="font-weight-bold" active-class="font-weight-bold"
@ -713,7 +730,7 @@ export default {
open: [], open: [],
search: null, search: null,
menuVisible: false, menuVisible: false,
excelImportDialog:false, excelImportDialog: false,
x: 0, x: 0,
y: 0, y: 0,
menuItem: null, menuItem: null,
@ -934,7 +951,7 @@ export default {
this.miniExpanded = false; this.miniExpanded = false;
} }
}, },
onExcelImport(){ onExcelImport() {
if (!this.menuItem || this.menuItem.type !== 'tableDir') { if (!this.menuItem || this.menuItem.type !== 'tableDir') {
this.menuItem = this.listViewArr.find(n => n.type === 'tableDir'); this.menuItem = this.listViewArr.find(n => n.type === 'tableDir');
} }
@ -1165,7 +1182,7 @@ export default {
await this.loadViews(this.menuItem); await this.loadViews(this.menuItem);
this.$toast.success('Views refreshed').goAway(1000); this.$toast.success('Views refreshed').goAway(1000);
} else if (action === 'IMPORT_EXCEL') { } else if (action === 'IMPORT_EXCEL') {
this.excelImportDialog=true this.excelImportDialog = true
} else if (action === 'ENV_DB_FUNCTIONS_REFRESH') { } else if (action === 'ENV_DB_FUNCTIONS_REFRESH') {
await this.loadFunctions(this.menuItem); await this.loadFunctions(this.menuItem);
this.$toast.success('Functions refreshed').goAway(1000); this.$toast.success('Functions refreshed').goAway(1000);
@ -1768,6 +1785,24 @@ export default {
.nested:hover .action { .nested:hover .action {
opacity: 1; opacity: 1;
} }
/deep/ .nc-table-list-filter .v-input__slot {
min-height: 30px !important;
}
/deep/ .nc-table-list-filter .v-input__slot label {
top: 6px;
}
/deep/ .nc-table-list-filter.theme--light.v-text-field > .v-input__control > .v-input__slot:before {
border-top-color: rgba(0, 0, 0, 0.12) !important;
}
/deep/ .nc-table-list-filter.theme--dark.v-text-field > .v-input__control > .v-input__slot:before {
border-top-color: rgba(255, 255, 255, 0.12) !important;
}
</style> </style>
<!-- <!--

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

@ -583,6 +583,7 @@ export default {
}, },
mixins: [spreadsheet], mixins: [spreadsheet],
props: { props: {
isActive: Boolean,
tabId: String, tabId: String,
env: String, env: String,
nodes: Object, nodes: Object,
@ -670,6 +671,11 @@ export default {
rowContextMenu: null rowContextMenu: null
}), }),
watch: { watch: {
isActive(n, o) {
if (!o && n) {
this.reload()
}
},
page(p) { page(p) {
this.$store.commit('tabs/MutSetTabState', { this.$store.commit('tabs/MutSetTabState', {
id: this.uniqueId, id: this.uniqueId,
@ -1159,7 +1165,9 @@ export default {
} }
}, },
computed: { computed: {
tabsState() { return this.$store.state.tabs.tabsState || {} }, tabsState() {
return this.$store.state.tabs.tabsState || {}
},
uniqueId() { uniqueId() {
return `${this.tabId}_${this.selectedViewId}` return `${this.tabId}_${this.selectedViewId}`
}, },

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

@ -317,6 +317,7 @@
> >
<rows-xc-data-table <rows-xc-data-table
ref="tabs7" ref="tabs7"
:is-active="isActive"
:tab-id="tabId" :tab-id="tabId"
:show-tabs="relationTabs && relationTabs.length" :show-tabs="relationTabs && relationTabs.length"
:table="nodes.tn" :table="nodes.tn"
@ -384,6 +385,7 @@
<template> <template>
<rows-xc-data-table <rows-xc-data-table
ref="tabs7" ref="tabs7"
:is-active="isActive"
:show-tabs="relationTabs && relationTabs.length" :show-tabs="relationTabs && relationTabs.length"
:table="nodes.tn" :table="nodes.tn"
:nodes="nodes" :nodes="nodes"
@ -639,7 +641,7 @@ export default {
head() { head() {
return {} return {}
}, },
props: ['nodes', 'hideLogWindows', 'tabId'] props: ['nodes', 'hideLogWindows', 'tabId', 'isActive']
} }
</script> </script>

2
packages/nc-gui/components/projectTabs.vue

@ -61,8 +61,8 @@
> >
<!-- <sqlLogAndOutput :hide="hideLogWindows">--> <!-- <sqlLogAndOutput :hide="hideLogWindows">-->
<TableView <TableView
v-if="activeTab === `${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:ref="'tabs'+index" :ref="'tabs'+index"
:is-active="activeTab === `${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:tab-id="`${pid}||${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`" :tab-id="`${pid}||${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:hide-log-windows.sync="hideLogWindows" :hide-log-windows.sync="hideLogWindows"
:nodes="tab._nodes" :nodes="tab._nodes"

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

@ -4568,7 +4568,9 @@ export default class NcMetaMgr {
result[d.title].disabled[d.role] = !!d.disabled; result[d.title].disabled[d.role] = !!d.disabled;
} }
return Object.values(result); return Object.values(result)?.sort((a: any, b: any) =>
(a?._tn || a?.tn)?.localeCompare(b?._tn || b?.tn)
);
} }
break; break;
case 'view': case 'view':

Loading…
Cancel
Save