import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
const TPL = `
|
|
`;
export default class RenameLabelBulkAction extends AbstractBulkAction {
static get actionName() { return "renameLabel"; }
static get actionTitle() { return "Rename label"; }
doRender() {
const $action = $(TPL);
const $oldLabelName = $action.find('.old-label-name');
$oldLabelName.val(this.actionDef.oldLabelName || "");
const $newLabelName = $action.find('.new-label-name');
$newLabelName.val(this.actionDef.newLabelName || "");
const spacedUpdate = new SpacedUpdate(async () => {
await this.saveAction({
oldLabelName: $oldLabelName.val(),
newLabelName: $newLabelName.val()
});
}, 1000)
$oldLabelName.on('input', () => spacedUpdate.scheduleUpdate());
$newLabelName.on('input', () => spacedUpdate.scheduleUpdate());
return $action;
}
}