Skip to content

Commit 71a690e

Browse files
committed
fix(pages): fix page version deletion
1 parent 8dc7991 commit 71a690e

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/VersionHistory.vue

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,34 @@ async function saveCurrentSnapshot() {
178178
}
179179
}
180180
181-
async function deleteSnapshot(snapshotId: string) {
182-
await asyncDialog({
183-
title: 'Delete version',
184-
message: 'Are you sure you want to delete this version?',
181+
async function deleteSelectedSnapshots() {
182+
try {
183+
const multiple = finalSelectedSnapshotIds.value.length > 1;
185184
186-
focus: 'cancel',
185+
await asyncDialog({
186+
title: `Delete page version${multiple ? 's' : ''}`,
187+
message: `Are you sure you want to delete the selected page version${
188+
multiple ? 's' : ''
189+
}?`,
187190
188-
cancel: { label: 'No', flat: true, color: 'primary' },
189-
ok: { label: 'Yes', flat: true, color: 'negative' },
190-
});
191+
style: {
192+
maxWidth: '300px',
193+
},
191194
192-
await deletePageSnapshot(page.value.id, snapshotId);
193-
}
195+
focus: 'cancel',
196+
197+
cancel: { label: 'No', flat: true, color: 'primary' },
198+
ok: { label: 'Yes', flat: true, color: 'negative' },
199+
});
194200
195-
async function deleteSelectedSnapshots() {
196-
try {
197201
for (const selectedSnapshotId of finalSelectedSnapshotIds.value) {
198-
await deleteSnapshot(selectedSnapshotId);
202+
await deletePageSnapshot(page.value.id, selectedSnapshotId);
199203
}
204+
205+
$quasar().notify({
206+
message: `Page version${multiple ? 's' : ''} deleted successfully.`,
207+
color: 'positive',
208+
});
200209
} catch (error: any) {
201210
handleError(error);
202211
}

0 commit comments

Comments
 (0)