mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 10:15:52 +01:00
search definition action refactoring
This commit is contained in:
@@ -14,7 +14,7 @@ export default class AbstractSearchAction extends Component {
|
||||
try {
|
||||
const $rendered = this.doRender();
|
||||
|
||||
$rendered.attr('data-attribute-id', this.attribute.attributeId);
|
||||
$rendered.find('.action-conf-del').on('click', () => this.deleteAction())
|
||||
|
||||
return $rendered;
|
||||
}
|
||||
@@ -39,4 +39,12 @@ export default class AbstractSearchAction extends Component {
|
||||
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
}
|
||||
|
||||
async deleteAction() {
|
||||
await server.remove(`notes/${this.attribute.noteId}/attributes/${this.attribute.attributeId}`);
|
||||
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
await this.triggerCommand('refreshSearchDefinition');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const TPL = `
|
||||
Delete matched note
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const TPL = `
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="bx bx-x icon-action" data-action-conf-del></span>
|
||||
<span class="bx bx-x icon-action action-conf-del"></span>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
|
||||
@@ -200,16 +200,6 @@ export default class SearchDefinitionWidget extends TabAwareWidget {
|
||||
this.refresh();
|
||||
});
|
||||
|
||||
this.$widget.on('click', '[data-action-conf-del]', async event => {
|
||||
const attributeId = $(event.target).closest('[data-attribute-id]').attr('data-attribute-id');
|
||||
|
||||
await server.remove(`notes/${this.noteId}/attributes/${attributeId}`);
|
||||
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
this.refresh();
|
||||
});
|
||||
|
||||
this.$searchOptions = this.$widget.find('.search-options');
|
||||
this.$actionOptions = this.$widget.find('.action-options');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user