mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 05:43:58 +00:00
implemented middle click in connection tree
This commit is contained in:
@@ -38,6 +38,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleMouseUp(e) {
|
||||||
|
if (e.button == 1) {
|
||||||
|
dispatch('middleclick');
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setChecked(value) {
|
function setChecked(value) {
|
||||||
if (!value && isChecked) {
|
if (!value && isChecked) {
|
||||||
checkedObjectsStore.update(x => x.filter(y => module.extractKey(data) != module.extractKey(y)));
|
checkedObjectsStore.update(x => x.filter(y => module.extractKey(data) != module.extractKey(y)));
|
||||||
@@ -53,6 +61,7 @@
|
|||||||
class:isBold
|
class:isBold
|
||||||
draggable={true}
|
draggable={true}
|
||||||
on:click={handleClick}
|
on:click={handleClick}
|
||||||
|
on:mouseup={handleMouseUp}
|
||||||
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));
|
||||||
|
|||||||
@@ -190,4 +190,11 @@
|
|||||||
on:click={handleConnect}
|
on:click={handleConnect}
|
||||||
on:click
|
on:click
|
||||||
on:expand
|
on:expand
|
||||||
|
on:middleclick={() => {
|
||||||
|
if (data.singleDatabase) {
|
||||||
|
getDatabaseMenuItems(data, data.defaultDatabase, $extensions, $currentDatabase)
|
||||||
|
.find(x => x.isNewQuery)
|
||||||
|
.onClick();
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ onClick: handleNewQuery, text: 'New query' },
|
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||||
{ onClick: handleImport, text: 'Import' },
|
{ onClick: handleImport, text: 'Import' },
|
||||||
{ onClick: handleExport, text: 'Export' },
|
{ onClick: handleExport, text: 'Export' },
|
||||||
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _, { find } from 'lodash';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||||
@@ -93,5 +93,10 @@
|
|||||||
isBold={_.get($currentDatabase, 'connection._id') == _.get(data.connection, '_id') &&
|
isBold={_.get($currentDatabase, 'connection._id') == _.get(data.connection, '_id') &&
|
||||||
_.get($currentDatabase, 'name') == data.name}
|
_.get($currentDatabase, 'name') == data.name}
|
||||||
on:click={() => ($currentDatabase = data)}
|
on:click={() => ($currentDatabase = data)}
|
||||||
|
on:middleclick={() => {
|
||||||
|
createMenu()
|
||||||
|
.find(x => x.isNewQuery)
|
||||||
|
.onClick();
|
||||||
|
}}
|
||||||
menu={createMenu}
|
menu={createMenu}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -328,7 +328,6 @@
|
|||||||
{ forceNewTab }
|
{ forceNewTab }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -351,7 +350,7 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
function handleClick() {
|
function handleClick(forceNewTab = false) {
|
||||||
const { schemaName, pureName, conid, database, objectTypeField } = data;
|
const { schemaName, pureName, conid, database, objectTypeField } = data;
|
||||||
|
|
||||||
openDatabaseObjectDetail(
|
openDatabaseObjectDetail(
|
||||||
@@ -364,7 +363,7 @@
|
|||||||
database,
|
database,
|
||||||
objectTypeField,
|
objectTypeField,
|
||||||
},
|
},
|
||||||
false,
|
forceNewTab,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -508,7 +507,6 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppObjectCore
|
<AppObjectCore
|
||||||
@@ -518,6 +516,7 @@
|
|||||||
title={data.schemaName ? `${data.schemaName}.${data.pureName}` : data.pureName}
|
title={data.schemaName ? `${data.schemaName}.${data.pureName}` : data.pureName}
|
||||||
icon={icons[data.objectTypeField]}
|
icon={icons[data.objectTypeField]}
|
||||||
menu={createMenu}
|
menu={createMenu}
|
||||||
on:click={handleClick}
|
on:click={() => handleClick()}
|
||||||
|
on:middleclick={() => handleClick(true)}
|
||||||
on:expand
|
on:expand
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user