From c956d4358ca1933e23a29c15629d75de390cb895 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 21 Dec 2024 16:36:16 +0200 Subject: [PATCH] chore(client/ts): port services/bulk_action --- src/public/app/services/{bulk_action.js => bulk_action.ts} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename src/public/app/services/{bulk_action.js => bulk_action.ts} (95%) diff --git a/src/public/app/services/bulk_action.js b/src/public/app/services/bulk_action.ts similarity index 95% rename from src/public/app/services/bulk_action.js rename to src/public/app/services/bulk_action.ts index 313f36a8f..5a039ea4f 100644 --- a/src/public/app/services/bulk_action.js +++ b/src/public/app/services/bulk_action.ts @@ -14,6 +14,7 @@ import AddLabelBulkAction from "../widgets/bulk_actions/label/add_label.js"; import AddRelationBulkAction from "../widgets/bulk_actions/relation/add_relation.js"; import RenameNoteBulkAction from "../widgets/bulk_actions/note/rename_note.js"; import { t } from "./i18n.js"; +import FNote from "../entities/fnote.js"; const ACTION_GROUPS = [ { @@ -50,7 +51,7 @@ const ACTION_CLASSES = [ ExecuteScriptBulkAction ]; -async function addAction(noteId, actionName) { +async function addAction(noteId: string, actionName: string) { await server.post(`notes/${noteId}/attributes`, { type: 'label', name: 'action', @@ -62,7 +63,7 @@ async function addAction(noteId, actionName) { await ws.waitForMaxKnownEntityChangeId(); } -function parseActions(note) { +function parseActions(note: FNote) { const actionLabels = note.getLabels('action'); return actionLabels.map(actionAttr => { @@ -70,7 +71,7 @@ function parseActions(note) { try { actionDef = JSON.parse(actionAttr.value); - } catch (e) { + } catch (e: any) { logError(`Parsing of attribute: '${actionAttr.value}' failed with error: ${e.message}`); return null; }