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;
|
||||
subprocess: ChildProcess;
|
||||
}
|
||||
|
||||
export interface StoredConnection {
|
||||
engine: string;
|
||||
server: string;
|
||||
port?: number;
|
||||
user: string;
|
||||
password: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export * from "./engines";
|
||||
export * from "./dbinfo";
|
||||
export * from "./query";
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user