mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-05 04:31:31 +08:00
chore(client/ts): port services/bulk_action
This commit is contained in:
parent
05e49f77e6
commit
c956d4358c
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user