fix(UI): table icon in view data tabs

This commit is contained in:
Fabio Di Stasio 2021-07-14 12:33:26 +02:00
parent 5bb4e496f2
commit f0fa7c81b7
3 changed files with 13 additions and 12 deletions

View File

@ -96,7 +96,7 @@
class="tab-link"
@dblclick="openAsDataTab(tab)"
>
<i class="mdi mdi-18px mr-1" :class="workspace.breadcrumbs.table ? 'mdi-table' : 'mdi-table-eye'" />
<i class="mdi mdi-18px mr-1" :class="tab.element === 'view' ? 'mdi-table-eye' : 'mdi-table'" />
<span :title="`${$t('word.data').toUpperCase()}: ${tab.table}`">
<span class=" text-italic">{{ tab.table }}</span>
<span
@ -108,7 +108,7 @@
</a>
<a v-if="tab.type === 'data'" class="tab-link">
<i class="mdi mdi-18px mr-1" :class="workspace.breadcrumbs.table ? 'mdi-table' : 'mdi-table-eye'" />
<i class="mdi mdi-18px mr-1" :class="tab.element === 'view' ? 'mdi-table-eye' : 'mdi-table'" />
<span :title="`${$t('word.data').toUpperCase()}: ${tab.table}`">
{{ tab.table }}
<span
@ -326,7 +326,7 @@ export default {
this.addWheelEvent();
},
openAsDataTab (tab) {
this.newTab({ uid: this.connection.uid, schema: tab.schema, table: tab.table, type: 'data' });
this.newTab({ uid: this.connection.uid, schema: tab.schema, table: tab.table, type: 'data', element: tab.element });
this.addWheelEvent();
},
closeTab (tab) {

View File

@ -282,11 +282,11 @@ export default {
this.changeBreadcrumbs({ schema, table: null });
},
selectTable ({ schema, table }) {
this.newTab({ uid: this.connection.uid, table: table.name, schema: this.database.name, type: 'temp-data' });
this.newTab({ uid: this.connection.uid, table: table.name, schema: this.database.name, type: 'temp-data', element: table.type });
this.setBreadcrumbs({ schema, [table.type]: table.name });
},
openDataTab ({ schema, table }) {
this.newTab({ uid: this.connection.uid, table: table.name, schema: this.database.name, type: 'data' });
this.newTab({ uid: this.connection.uid, table: table.name, schema: this.database.name, type: 'data', element: table.type });
this.setBreadcrumbs({ schema, [table.type]: table.name });
},
showSchemaContext (event, schema) {

View File

@ -178,7 +178,7 @@ export default {
}
: workspace);
},
NEW_TAB (state, { uid, tab, content, type, autorun, schema, table }) {
NEW_TAB (state, { uid, tab, content, type, autorun, schema, table, element }) {
if (type === 'query')
tabIndex[uid] = tabIndex[uid] ? ++tabIndex[uid] : 1;
@ -189,6 +189,7 @@ export default {
type,
schema,
table,
element,
fields: [],
keyUsage: [],
content: content || '',
@ -217,14 +218,14 @@ export default {
return workspace;
});
},
REPLACE_TAB (state, { uid, tab: tUid, type, schema, table }) {
REPLACE_TAB (state, { uid, tab: tUid, type, schema, table, element }) {
state.workspaces = state.workspaces.map(workspace => {
if (workspace.uid === uid) {
return {
...workspace,
tabs: workspace.tabs.map(tab => {
if (tab.uid === tUid)
return { ...tab, type, schema, table };
return { ...tab, type, schema, table, element };
return tab;
})
@ -491,7 +492,7 @@ export default {
setSearchTerm ({ commit, getters }, term) {
commit('SET_SEARCH_TERM', { uid: getters.getSelected, term });
},
newTab ({ state, commit }, { uid, content, type, autorun, schema, table }) {
newTab ({ state, commit }, { uid, content, type, autorun, schema, table, element }) {
let tabUid;
const workspaceTabs = state.workspaces.find(workspace => workspace.uid === uid);
@ -510,13 +511,13 @@ export default {
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type === 'temp-data') : false;
if (tempTabs && tempTabs.length) { // if temp table already opened
for (const tab of tempTabs) {
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, table });
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, table, element });
tabUid = tab.uid;
}
}
else {
tabUid = uidGen('T');
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, table });
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, table, element });
}
}
}
@ -529,7 +530,7 @@ export default {
: false;
if (existentTab) {
commit('REPLACE_TAB', { uid, tab: existentTab.uid, type, schema, table });
commit('REPLACE_TAB', { uid, tab: existentTab.uid, type, schema, table, element });
tabUid = existentTab.uid;
}
else {