Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(react/bulk_actions): clean up
Elian Doran899f85f4e740
diff --git a/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts b/apps/client/src/widgets/bulk_actions/abstract_bulk_action.tsindex c296b949f0..42a3f8d788 100644--- a/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts+++ b/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts@@ -1,7 +1,5 @@-import { t } from "../../services/i18n.js";import server from "../../services/server.js";import ws from "../../services/ws.js";-import utils from "../../services/utils.js";import type FAttribute from "../../entities/fattribute.js";import { VNode } from "preact";@@ -28,29 +26,9 @@ export default abstract class AbstractBulkAction {this.actionDef = actionDef;}- render() {- try {- const $rendered = this.doRender();- if (Array.isArray($rendered)) {- $rendered- .find(".action-conf-del")- .on("click", () => this.deleteAction())- .attr("title", t("abstract_bulk_action.remove_this_search_action"));-- utils.initHelpDropdown($rendered);-- return $rendered;- } else {- return $rendered;- }- } catch (e: any) {- logError(`Failed rendering search action: ${JSON.stringify(this.attribute.dto)} with error: ${e.message} ${e.stack}`);- return null;- }- }-// to be overridden- abstract doRender(): JQuery<HTMLElement> | VNode;+ abstract doRender(): VNode;+static get actionName() {return "";}@@ -70,9 +48,6 @@ export default abstract class AbstractBulkAction {async deleteAction() {await server.remove(`notes/${this.attribute.noteId}/attributes/${this.attribute.attributeId}`);-await ws.waitForMaxKnownEntityChangeId();-- //await this.triggerCommand('refreshSearchDefinition');}}diff --git a/apps/client/src/widgets/dialogs/bulk_actions.tsx b/apps/client/src/widgets/dialogs/bulk_actions.tsxindex 7cff1ece8e..ce41781cc4 100644--- a/apps/client/src/widgets/dialogs/bulk_actions.tsx+++ b/apps/client/src/widgets/dialogs/bulk_actions.tsx@@ -104,7 +104,7 @@ function ExistingActionsList({ existingActions }: { existingActions?: RenameNote<table class="bulk-existing-action-list">{ existingActions? existingActions- .map(action => action.render())+ .map(action => action.doRender()).filter(renderedAction => renderedAction !== null): <p>{t("bulk_actions.none_yet")}</p>}