mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
Add initial key name support in DbKeyTab and DbKeysTree components
This commit is contained in:
@@ -16,12 +16,13 @@
|
||||
export let conid;
|
||||
export let database;
|
||||
export let tabid;
|
||||
export let initialKeyName = '';
|
||||
|
||||
$: connection = useConnectionInfo({ conid });
|
||||
$: driver = $connection && findEngineDriver($connection, getExtensions());
|
||||
|
||||
let item = {};
|
||||
let keyName = '';
|
||||
let keyName = initialKeyName || '';
|
||||
$: type = driver?.supportedKeyTypes?.[0]?.name || '';
|
||||
|
||||
$: console.log('DbKeyTab debug:', { conid, database, connection: $connection, driver, hasTypes: driver?.supportedKeyTypes?.length });
|
||||
|
||||
@@ -51,6 +51,19 @@
|
||||
function handleAddKey() {
|
||||
const connection = $currentDatabase?.connection;
|
||||
const database = $currentDatabase?.name;
|
||||
const focusedKey = $focusedTreeDbKey;
|
||||
|
||||
let initialKeyName = '';
|
||||
if (focusedKey) {
|
||||
if (focusedKey.type === 'dir' && focusedKey.key) {
|
||||
initialKeyName = focusedKey.key + treeKeySeparator;
|
||||
} else if (focusedKey.key) {
|
||||
const lastSeparatorIndex = focusedKey.key.lastIndexOf(treeKeySeparator);
|
||||
if (lastSeparatorIndex !== -1) {
|
||||
initialKeyName = focusedKey.key.substring(0, lastSeparatorIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openNewTab({
|
||||
tabComponent: 'DbKeyTab',
|
||||
@@ -59,6 +72,7 @@
|
||||
props: {
|
||||
conid: connection?._id,
|
||||
database,
|
||||
initialKeyName,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user