mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 12:16:01 +00:00
table tab tooltip
This commit is contained in:
@@ -47,11 +47,17 @@ export default function TabsPanel() {
|
||||
setOpenedTabs(files => files.filter(x => x.tabid != tabid));
|
||||
}
|
||||
};
|
||||
console.log(
|
||||
't',
|
||||
tabs.map(x => x.tooltip)
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{tabs.map(tab => (
|
||||
<FileTabItem
|
||||
{...tab}
|
||||
title={tab.tooltip}
|
||||
key={tab.tabid}
|
||||
onClick={() => handleTabClick(tab.tabid)}
|
||||
onMouseUp={e => handleMouseUp(e, tab.tabid)}
|
||||
|
||||
@@ -6,10 +6,16 @@ import ConnectionModal from '../modals/ConnectionModal';
|
||||
import axios from '../utility/axios';
|
||||
import { openNewTab } from '../utility/common';
|
||||
import { useSetOpenedTabs } from '../utility/globalState';
|
||||
import getConnectionInfo from '../utility/getConnectionInfo';
|
||||
import fullDisplayName from '../utility/fullDisplayName';
|
||||
|
||||
async function openTableDetail(setOpenedTabs, tabComponent, { schemaName, pureName, conid, database }) {
|
||||
const connection = await getConnectionInfo(conid);
|
||||
const tooltip = `${connection.displayName || connection.server}\n${database}\n${fullDisplayName({schemaName, pureName})}`;
|
||||
|
||||
function openTableDetail(setOpenedTabs, tabComponent, { schemaName, pureName, conid, database }) {
|
||||
openNewTab(setOpenedTabs, {
|
||||
title: pureName,
|
||||
tooltip,
|
||||
icon: 'table2.svg',
|
||||
tabComponent,
|
||||
props: {
|
||||
|
||||
4
packages/web/src/utility/fullDisplayName.js
Normal file
4
packages/web/src/utility/fullDisplayName.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function fullDisplayName({ schemaName, pureName }) {
|
||||
if (schemaName) return `${schemaName}.${pureName}`;
|
||||
return pureName;
|
||||
}
|
||||
12
packages/web/src/utility/getConnectionInfo.js
Normal file
12
packages/web/src/utility/getConnectionInfo.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import axios from './axios';
|
||||
|
||||
export default async function getConnectionInfo(conid) {
|
||||
const resp = await axios.request({
|
||||
method: 'get',
|
||||
params: { conid },
|
||||
url: 'connections/get',
|
||||
});
|
||||
/** @type {import('@dbgate/types').StoredConnection} */
|
||||
const res = resp.data;
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user