39 lines
1.1 KiB
JavaScript
Raw Normal View History

import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
2021-01-19 22:10:24 +01:00
const TPL = `
<tr>
<td>
Delete label:
</td>
<td>
2021-01-26 14:10:34 +01:00
<input type="text"
class="form-control label-name"
pattern="[\\p{L}\\p{N}_:]+"
title="Alphanumeric characters, underscore and colon are allowed characters."
placeholder="label name"/>
2021-01-19 22:10:24 +01:00
</td>
2021-01-26 14:10:34 +01:00
<td class="button-column">
2021-01-26 10:48:28 +01:00
<span class="bx bx-x icon-action action-conf-del"></span>
2021-01-19 22:10:24 +01:00
</td>
</tr>`;
export default class DeleteLabelBulkAction extends AbstractBulkAction {
2021-01-19 22:10:24 +01:00
static get actionName() { return "deleteLabel"; }
2022-06-03 17:29:08 +02:00
static get actionTitle() { return "Delete label"; }
2021-01-19 22:10:24 +01:00
doRender() {
const $action = $(TPL);
const $labelName = $action.find('.label-name');
$labelName.val(this.actionDef.labelName || "");
const spacedUpdate = new SpacedUpdate(async () => {
await this.saveAction({ labelName: $labelName.val() });
}, 1000)
$labelName.on('input', () => spacedUpdate.scheduleUpdate());
return $action;
}
}