search definition action refactoring

This commit is contained in:
zadam 2021-01-26 10:48:28 +01:00
parent 898c941333
commit 87925f72a3
12 changed files with 21 additions and 23 deletions

6
package-lock.json generated
View file

@ -2634,9 +2634,9 @@
} }
}, },
"electron": { "electron": {
"version": "11.2.1", "version": "9.4.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-11.2.1.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-9.4.1.tgz",
"integrity": "sha512-Im1y29Bnil+Nzs+FCTq01J1OtLbs+2ZGLLllaqX/9n5GgpdtDmZhS/++JHBsYZ+4+0n7asO+JKQgJD+CqPClzg==", "integrity": "sha512-r4CxoVG9Ja7tBtkilWMnBsBGup8G8Z+v7icZmwysHa8/OSr0OrLjrcOF/30BAP7yPE5fz/XTxygnltzW4OTZdw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",

View file

@ -77,7 +77,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "11.2.1", "electron": "9.4.1",
"electron-builder": "22.9.1", "electron-builder": "22.9.1",
"electron-packager": "15.2.0", "electron-packager": "15.2.0",
"electron-rebuild": "2.3.4", "electron-rebuild": "2.3.4",

View file

@ -14,7 +14,7 @@ export default class AbstractSearchAction extends Component {
try { try {
const $rendered = this.doRender(); const $rendered = this.doRender();
$rendered.attr('data-attribute-id', this.attribute.attributeId); $rendered.find('.action-conf-del').on('click', () => this.deleteAction())
return $rendered; return $rendered;
} }
@ -39,4 +39,12 @@ export default class AbstractSearchAction extends Component {
await ws.waitForMaxKnownEntityChangeId(); await ws.waitForMaxKnownEntityChangeId();
} }
async deleteAction() {
await server.remove(`notes/${this.attribute.noteId}/attributes/${this.attribute.attributeId}`);
await ws.waitForMaxKnownEntityChangeId();
await this.triggerCommand('refreshSearchDefinition');
}
} }

View file

@ -17,7 +17,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -8,7 +8,7 @@ const TPL = `
Delete matched note Delete matched note
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -17,7 +17,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -16,7 +16,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -28,7 +28,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -28,7 +28,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -24,7 +24,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -24,7 +24,7 @@ const TPL = `
</div> </div>
</td> </td>
<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> </td>
</tr>`; </tr>`;

View file

@ -200,16 +200,6 @@ export default class SearchDefinitionWidget extends TabAwareWidget {
this.refresh(); 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.$searchOptions = this.$widget.find('.search-options');
this.$actionOptions = this.$widget.find('.action-options'); this.$actionOptions = this.$widget.find('.action-options');