db widget UX

This commit is contained in:
SPRINX0\prochazka
2024-11-25 15:52:26 +01:00
parent a37b74f693
commit dfdb86de6f
8 changed files with 70 additions and 23 deletions

View File

@@ -50,7 +50,7 @@
<svelte:component
this={module.default}
{data}
on:click={handleExpand}
on:dblclick={handleExpand}
on:expand={handleExpandButton}
expandIcon={getExpandIcon(!isExpandedBySearch && expandable, subItemsComponent, isExpanded, expandIconFunc)}
{checkedObjectsStore}

View File

@@ -12,6 +12,16 @@
return filterName(filter, ...databases.map(x => x.name));
};
export function openConnection(connection) {
if (connection.singleDatabase) {
if (getOpenedSingleDatabaseConnections().includes(connection._id)) {
return;
}
} else {
if (getOpenedConnections().includes(connection._id)) {
return;
}
}
const config = getCurrentConfig();
if (connection.singleDatabase) {
switchCurrentDatabase({ connection, name: connection.defaultDatabase });
@@ -88,6 +98,7 @@
getCurrentDatabase,
getCurrentSettings,
getOpenedConnections,
getOpenedSingleDatabaseConnections,
getOpenedTabs,
openedConnections,
openedSingleDatabaseConnections,
@@ -159,8 +170,17 @@
}
};
const handleClick = async (e) => {
const handleClick = async e => {
focusedConnectionOrDatabase.set({ conid: data?._id });
openNewTab({
title: getConnectionLabel(data),
icon: 'img connection',
tabComponent: 'ConnectionTab',
tabPreviewMode: true,
props: {
conid: data._id,
},
});
};
const handleSqlRestore = () => {
@@ -333,9 +353,8 @@
{extInfo}
colorMark={passProps?.connectionColorFactory && passProps?.connectionColorFactory({ conid: data._id })}
menu={getContextMenu}
on:dblclick={handleDoubleClick}
on:click={handleClick}
on:click
on:dblclick
on:expand
on:dblclick={handleConnect}
on:middleclick={() => {

View File

@@ -515,9 +515,10 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify(
extractDbNameFromComposite($currentDatabase?.name) == data.name}
on:dblclick={() => {
switchCurrentDatabase(data);
passProps?.onFocusSqlObjectList?.();
// passProps?.onFocusSqlObjectList?.();
}}
on:click={() => {
// switchCurrentDatabase(data);
$focusedConnectionOrDatabase = { conid: data.connection?._id, database: data.name };
}}
on:dragstart