duplicate cloud connection

This commit is contained in:
SPRINX0\prochazka
2025-05-26 17:59:03 +02:00
parent f94bf3f8ce
commit 74560c3289
4 changed files with 55 additions and 10 deletions

View File

@@ -13,23 +13,47 @@
<script lang="ts">
import { filterName } from 'dbgate-tools';
import ConnectionAppObject, { openConnection } from './ConnectionAppObject.svelte';
import { _t } from '../translations';
export let data;
export let passProps;
function createMenu() {
return [];
const res = [];
switch (data.type) {
case 'connection':
res.push({
text: _t('connection.connect', { defaultMessage: 'Connect' }),
onClick: handleConnect,
isBold: true,
});
res.push({ divider: true });
res.push({
text: _t('connection.duplicate', { defaultMessage: 'Duplicate' }),
onClick: handleDuplicateConnection,
});
}
return res;
}
async function handleDuplicateConnection() {
await apiCall('cloud/duplicate-connection', { conid: data.conid });
}
async function handleConnect() {
const conn = await apiCall('connections/get', { conid: data.conid });
$cloudConnectionsStore = {
...$cloudConnectionsStore,
[data.conid]: conn,
};
openConnection(conn);
}
async function handleOpenContent() {
switch (data.type) {
case 'connection':
const conn = await apiCall('connections/get', { conid: data.conid });
$cloudConnectionsStore = {
...$cloudConnectionsStore,
[data.conid]: conn,
};
openConnection(conn);
await handleConnect();
break;
}
}