mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
connection workflow
This commit is contained in:
parent
566082d40f
commit
8e5584e90f
@ -71,6 +71,7 @@
|
|||||||
draggable={true}
|
draggable={true}
|
||||||
on:click={handleClick}
|
on:click={handleClick}
|
||||||
on:mouseup={handleMouseUp}
|
on:mouseup={handleMouseUp}
|
||||||
|
on:dblclick
|
||||||
use:contextMenu={disableContextMenu ? null : menu}
|
use:contextMenu={disableContextMenu ? null : menu}
|
||||||
on:dragstart={e => {
|
on:dragstart={e => {
|
||||||
e.dataTransfer.setData('app_object_drag_data', JSON.stringify(data));
|
e.dataTransfer.setData('app_object_drag_data', JSON.stringify(data));
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
});
|
});
|
||||||
expandedConnections.update(x => _.uniq([...x, connection._id]));
|
expandedConnections.update(x => _.uniq([...x, connection._id]));
|
||||||
}
|
}
|
||||||
|
closeMultipleTabs(x => x.tabComponent == 'ConnectionTab' && x.props?.conid == connection._id, true);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -46,7 +47,7 @@
|
|||||||
import ConnectionModal from '../modals/ConnectionModal.svelte';
|
import ConnectionModal from '../modals/ConnectionModal.svelte';
|
||||||
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
||||||
import InputTextModal from '../modals/InputTextModal.svelte';
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab, { closeTabWithNoHistory } from '../utility/openNewTab';
|
||||||
import { getDatabaseMenuItems } from './DatabaseAppObject.svelte';
|
import { getDatabaseMenuItems } from './DatabaseAppObject.svelte';
|
||||||
import getElectron from '../utility/getElectron';
|
import getElectron from '../utility/getElectron';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||||
@ -257,6 +258,7 @@
|
|||||||
on:click={handleOpenConnectionTab}
|
on:click={handleOpenConnectionTab}
|
||||||
on:click
|
on:click
|
||||||
on:expand
|
on:expand
|
||||||
|
on:dblclick={handleConnect}
|
||||||
on:middleclick={() => {
|
on:middleclick={() => {
|
||||||
_.flattenDeep(getContextMenu())
|
_.flattenDeep(getContextMenu())
|
||||||
.find(x => x.isNewQuery)
|
.find(x => x.isNewQuery)
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
import { changeTab } from '../utility/common';
|
import { changeTab } from '../utility/common';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { closeTabWithNoHistory } from '../utility/openNewTab';
|
|
||||||
import { openConnection } from '../appobj/ConnectionAppObject.svelte';
|
import { openConnection } from '../appobj/ConnectionAppObject.svelte';
|
||||||
|
|
||||||
export let connection;
|
export let connection;
|
||||||
@ -133,7 +132,6 @@
|
|||||||
unsaved: true,
|
unsaved: true,
|
||||||
};
|
};
|
||||||
const saved = await apiCall('connections/save', connection);
|
const saved = await apiCall('connections/save', connection);
|
||||||
closeTabWithNoHistory(tabid);
|
|
||||||
openConnection(saved);
|
openConnection(saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,14 +186,3 @@ export function groupTabs(tabs: any[]) {
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function closeTabWithNoHistory(tabid) {
|
|
||||||
openedTabs.update(tabs => {
|
|
||||||
const res = tabs.filter(x => x.tabid != tabid);
|
|
||||||
const selectedIndex = _.findLastIndex(res, x => x.closedTime == null);
|
|
||||||
return res.map((x, index) => ({
|
|
||||||
...x,
|
|
||||||
selected: index == selectedIndex,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -22,9 +22,11 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const closeMultipleTabs = closeCondition => {
|
export const closeMultipleTabs = (closeCondition, deleteFromHistory = false) => {
|
||||||
openedTabs.update(files => {
|
openedTabs.update(files => {
|
||||||
const newFiles = files.map(x => ({
|
const newFiles = deleteFromHistory
|
||||||
|
? files.filter(x => !closeCondition(x))
|
||||||
|
: files.map(x => ({
|
||||||
...x,
|
...x,
|
||||||
closedTime: x.closedTime || (closeCondition(x) ? new Date().getTime() : undefined),
|
closedTime: x.closedTime || (closeCondition(x) ? new Date().getTime() : undefined),
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user