mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 02:36:00 +00:00
delete branch operation
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
|
||||
import AppObjectCore from '../appobj/AppObjectCore.svelte';
|
||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
@@ -24,7 +26,9 @@
|
||||
{#await apiCall('database-connections/load-keys', { conid, database, root, reloadToken, reloadToken2 })}
|
||||
<LoadingInfo message="Loading key list" wrapper />
|
||||
{:then items}
|
||||
{#each (items || []).slice(0, maxShowCount) as item}
|
||||
{@const itemsSorted = _.sortBy(items || [], 'text')}
|
||||
|
||||
{#each itemsSorted.slice(0, maxShowCount) as item}
|
||||
<DbKeysTreeNode
|
||||
{conid}
|
||||
{database}
|
||||
@@ -37,7 +41,7 @@
|
||||
/>
|
||||
{/each}
|
||||
|
||||
{#if (items || []).length > maxShowCount}
|
||||
{#if itemsSorted.length > maxShowCount}
|
||||
<AppObjectCore
|
||||
{indentLevel}
|
||||
title="Show more..."
|
||||
|
||||
@@ -48,12 +48,35 @@
|
||||
});
|
||||
},
|
||||
},
|
||||
item.type == 'dir' && {
|
||||
label: 'Reload',
|
||||
onClick: () => {
|
||||
reloadToken += 1;
|
||||
item.type == 'dir' && [
|
||||
{
|
||||
label: 'Reload',
|
||||
onClick: () => {
|
||||
reloadToken += 1;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Delete branch',
|
||||
onClick: () => {
|
||||
const branch = `${item.root}:*`;
|
||||
showModal(ConfirmModal, {
|
||||
message: `Really delete branch ${branch} with all keys?`,
|
||||
onConfirm: async () => {
|
||||
await apiCall('database-connections/call-method', {
|
||||
conid,
|
||||
database,
|
||||
method: 'mdel',
|
||||
args: [branch],
|
||||
});
|
||||
|
||||
if (onRefreshParent) {
|
||||
onRefreshParent();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user