refactor(views/table): move bulk action implementation in service

This commit is contained in:
Elian Doran
2025-07-19 12:46:38 +03:00
parent 5d619131ec
commit 0d3de92890
2 changed files with 21 additions and 23 deletions

View File

@@ -15,6 +15,7 @@ import AddRelationBulkAction from "../widgets/bulk_actions/relation/add_relation
import RenameNoteBulkAction from "../widgets/bulk_actions/note/rename_note.js";
import { t } from "./i18n.js";
import type FNote from "../entities/fnote.js";
import toast from "./toast.js";
const ACTION_GROUPS = [
{
@@ -89,6 +90,17 @@ function parseActions(note: FNote) {
.filter((action) => !!action);
}
export async function executeBulkActions(parentNoteId: string, actions: {}[]) {
await server.post("bulk-action/execute", {
noteIds: [ parentNoteId ],
includeDescendants: true,
actions
});
await ws.waitForMaxKnownEntityChangeId();
toast.showMessage(t("bulk_actions.bulk_actions_executed"), 3000);
}
export default {
addAction,
parseActions,