mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
chore(client/ts): port bulk_actions/abstract_bulk_action
This commit is contained in:
parent
4505564f13
commit
ac75e72491
@ -2,9 +2,17 @@ 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 FAttribute from "../../entities/fattribute.js";
|
||||
|
||||
export default class AbstractBulkAction {
|
||||
constructor(attribute, actionDef) {
|
||||
interface ActionDefinition {
|
||||
|
||||
}
|
||||
|
||||
export default abstract class AbstractBulkAction {
|
||||
attribute: FAttribute;
|
||||
actionDef: ActionDefinition;
|
||||
|
||||
constructor(attribute: FAttribute, actionDef: ActionDefinition) {
|
||||
this.attribute = attribute;
|
||||
this.actionDef = actionDef;
|
||||
}
|
||||
@ -20,18 +28,18 @@ export default class AbstractBulkAction {
|
||||
utils.initHelpDropdown($rendered);
|
||||
|
||||
return $rendered;
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e: any) {
|
||||
logError(`Failed rendering search action: ${JSON.stringify(this.attribute.dto)} with error: ${e.message} ${e.stack}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// to be overridden
|
||||
doRender() {}
|
||||
abstract doRender(): JQuery<HTMLElement>;
|
||||
abstract get actionName(): string;
|
||||
|
||||
async saveAction(data) {
|
||||
const actionObject = Object.assign({ name: this.constructor.actionName }, data);
|
||||
async saveAction(data: {}) {
|
||||
const actionObject = Object.assign({ name: (this.constructor as unknown as AbstractBulkAction).actionName }, data);
|
||||
|
||||
await server.put(`notes/${this.attribute.noteId}/attribute`, {
|
||||
attributeId: this.attribute.attributeId,
|
Loading…
x
Reference in New Issue
Block a user