delete conn on cloud, save file to cloud WIP

This commit is contained in:
SPRINX0\prochazka
2025-05-27 16:46:53 +02:00
parent 74560c3289
commit d3a5df0007
3 changed files with 91 additions and 5 deletions

View File

@@ -11,9 +11,12 @@
</script>
<script lang="ts">
import { filterName } from 'dbgate-tools';
import { filterName, getConnectionLabel } from 'dbgate-tools';
import ConnectionAppObject, { openConnection } from './ConnectionAppObject.svelte';
import { _t } from '../translations';
import openNewTab from '../utility/openNewTab';
import { showModal } from '../modals/modalTools';
import ConfirmModal from '../modals/ConfirmModal.svelte';
export let data;
export let passProps;
@@ -28,15 +31,44 @@
isBold: true,
});
res.push({ divider: true });
res.push({
text: _t('connection.edit', { defaultMessage: 'Edit' }),
onClick: handleEditConnection,
});
res.push({
text: _t('connection.delete', { defaultMessage: 'Delete' }),
onClick: handleDeleteConnection,
});
res.push({
text: _t('connection.duplicate', { defaultMessage: 'Duplicate' }),
onClick: handleDuplicateConnection,
});
break;
}
return res;
}
function handleEditConnection() {
openNewTab({
title: data.name,
icon: 'img cloud-connection',
tabComponent: 'ConnectionTab',
props: {
conid: data.conid,
},
});
}
async function handleDeleteConnection() {
showModal(ConfirmModal, {
message: `Really delete connection ${data.name}?`,
onConfirm: () => {
apiCall('cloud/delete-connection', { conid: data.conid });
},
});
}
async function handleDuplicateConnection() {
await apiCall('cloud/duplicate-connection', { conid: data.conid });
}