mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
search definition action refactoring
This commit is contained in:
parent
898c941333
commit
87925f72a3
6
package-lock.json
generated
6
package-lock.json
generated
@ -2634,9 +2634,9 @@
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "11.2.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-11.2.1.tgz",
|
||||
"integrity": "sha512-Im1y29Bnil+Nzs+FCTq01J1OtLbs+2ZGLLllaqX/9n5GgpdtDmZhS/++JHBsYZ+4+0n7asO+JKQgJD+CqPClzg==",
|
||||
"version": "9.4.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-9.4.1.tgz",
|
||||
"integrity": "sha512-r4CxoVG9Ja7tBtkilWMnBsBGup8G8Z+v7icZmwysHa8/OSr0OrLjrcOF/30BAP7yPE5fz/XTxygnltzW4OTZdw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^1.0.1",
|
||||
|
@ -77,7 +77,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "7.0.3",
|
||||
"electron": "11.2.1",
|
||||
"electron": "9.4.1",
|
||||
"electron-builder": "22.9.1",
|
||||
"electron-packager": "15.2.0",
|
||||
"electron-rebuild": "2.3.4",
|
||||
|
@ -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');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user