2021-01-19 22:10:24 +01:00
|
|
|
import SpacedUpdate from "../../services/spaced_update.js";
|
|
|
|
import AbstractAction from "./abstract_action.js";
|
|
|
|
|
|
|
|
const TPL = `
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Delete relation:
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
<div style="margin-right: 15px;" class="text-nowrap">Relation name:</div>
|
|
|
|
|
2021-01-20 20:31:24 +01:00
|
|
|
<input type="text"
|
|
|
|
class="form-control relation-name"
|
|
|
|
pattern="[\\p{L}\\p{N}_:]+"
|
|
|
|
title="Alphanumeric characters, underscore and colon are allowed characters."/>
|
2021-01-19 22:10:24 +01:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
|
|
|
</td>
|
|
|
|
</tr>`;
|
|
|
|
|
|
|
|
export default class DeleteRelationSearchAction extends AbstractAction {
|
|
|
|
static get actionName() { return "deleteRelation"; }
|
|
|
|
|
|
|
|
doRender() {
|
|
|
|
const $action = $(TPL);
|
|
|
|
const $relationName = $action.find('.relation-name');
|
|
|
|
$relationName.val(this.actionDef.relationName || "");
|
|
|
|
|
|
|
|
const spacedUpdate = new SpacedUpdate(async () => {
|
|
|
|
await this.saveAction({ relationName: $relationName.val() });
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
$relationName.on('input', () => spacedUpdate.scheduleUpdate());
|
|
|
|
|
|
|
|
return $action;
|
|
|
|
}
|
|
|
|
}
|