mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
table tab tooltip
This commit is contained in:
parent
e2e46ec398
commit
a4a470de45
10
packages/types/index.d.ts
vendored
10
packages/types/index.d.ts
vendored
@ -6,6 +6,16 @@ export interface OpenedDatabaseConnection {
|
|||||||
structure: DatabaseInfo;
|
structure: DatabaseInfo;
|
||||||
subprocess: ChildProcess;
|
subprocess: ChildProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StoredConnection {
|
||||||
|
engine: string;
|
||||||
|
server: string;
|
||||||
|
port?: number;
|
||||||
|
user: string;
|
||||||
|
password: string;
|
||||||
|
displayName: string;
|
||||||
|
}
|
||||||
|
|
||||||
export * from "./engines";
|
export * from "./engines";
|
||||||
export * from "./dbinfo";
|
export * from "./dbinfo";
|
||||||
export * from "./query";
|
export * from "./query";
|
||||||
|
@ -47,11 +47,17 @@ export default function TabsPanel() {
|
|||||||
setOpenedTabs(files => files.filter(x => x.tabid != tabid));
|
setOpenedTabs(files => files.filter(x => x.tabid != tabid));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
console.log(
|
||||||
|
't',
|
||||||
|
tabs.map(x => x.tooltip)
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{tabs.map(tab => (
|
{tabs.map(tab => (
|
||||||
<FileTabItem
|
<FileTabItem
|
||||||
{...tab}
|
{...tab}
|
||||||
|
title={tab.tooltip}
|
||||||
key={tab.tabid}
|
key={tab.tabid}
|
||||||
onClick={() => handleTabClick(tab.tabid)}
|
onClick={() => handleTabClick(tab.tabid)}
|
||||||
onMouseUp={e => handleMouseUp(e, tab.tabid)}
|
onMouseUp={e => handleMouseUp(e, tab.tabid)}
|
||||||
|
@ -6,10 +6,16 @@ import ConnectionModal from '../modals/ConnectionModal';
|
|||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
import { useSetOpenedTabs } from '../utility/globalState';
|
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, {
|
openNewTab(setOpenedTabs, {
|
||||||
title: pureName,
|
title: pureName,
|
||||||
|
tooltip,
|
||||||
icon: 'table2.svg',
|
icon: 'table2.svg',
|
||||||
tabComponent,
|
tabComponent,
|
||||||
props: {
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user