Skip to content
Snippets Groups Projects
Unverified Commit aee53810 authored by Stefan Freudenberg's avatar Stefan Freudenberg Committed by GitHub
Browse files

Merge pull request #259 from knot-dots/delete-recursively-follow-up

Delete recursively follow-up
parents c5fcbe76 faa12714
Branches
No related tags found
No related merge requests found
......@@ -16,7 +16,6 @@
dialog {
border: none;
padding: 1.5rem;
position: relative;
width: 100%;
}
......
......@@ -77,7 +77,14 @@
type TaskContainer,
type User
} from '$lib/models';
import { ability, addEffectState, mayDeleteContainer, overlayWidth, user } from '$lib/stores';
import {
ability,
addEffectState,
mayDeleteContainer,
overlayHistory,
overlayWidth,
user
} from '$lib/stores';
export let containersWithObjectives: ContainerWithObjective[] = [];
export let indicators: IndicatorContainer[] | undefined = undefined;
......@@ -189,9 +196,15 @@
async function handleDelete(c: AnyContainer) {
const response = await deleteContainer(c);
if (response.ok) {
await invalidateAll();
await goto(closeURL());
if ($overlayHistory.length > 1) {
$overlayHistory = $overlayHistory.slice(0, $overlayHistory.length - 1);
const newParams = $overlayHistory[$overlayHistory.length - 1] as URLSearchParams;
await goto(`#${newParams.toString()}`, { invalidateAll: true });
} else {
await goto(closeURL(), { invalidateAll: true });
}
}
confirmDeleteDialog.close();
}
function saveIndicatorAsTemplate(c: IndicatorContainer) {
......
......@@ -299,6 +299,8 @@ export function deleteContainerRecursively(container: AnyContainer) {
''
)(txConnection);
await deleteContainer(container)(txConnection);
for (const part of findDescendants(container, parts)) {
await deleteContainer({ ...part, user: container.user })(txConnection);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.