chore(react/ribbon): search & execute button

This commit is contained in:
Elian Doran
2025-08-24 16:02:15 +03:00
parent b6d5a6ec2e
commit 80ad87671a
2 changed files with 10 additions and 25 deletions

View File

@@ -156,6 +156,16 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
keyboardShortcut="Enter"
onClick={refreshResults}
/>
<Button
icon="bx bxs-zap"
text={t("search_definition.search_execute")}
onClick={async () => {
await server.post(`search-and-execute-note/${note.noteId}`);
refreshResults();
toast.showMessage(t("search_definition.actions_executed"), 3000);
}}
/>
</div>
</td>
</tr>

View File

@@ -41,16 +41,6 @@ const TPL = /*html*/`
<tr>
<td colspan="3">
<div style="display: flex; justify-content: space-evenly">
<button type="button" class="btn btn-sm search-button">
<span class="bx bx-search"></span>
${}
</button>
<button type="button" class="btn btn-sm search-and-execute-button">
<span class="bx bxs-zap"></span>
${t("search_definition.search_execute")}
</button>
<button type="button" class="btn btn-sm save-to-note-button">
<span class="bx bx-save"></span>
${t("search_definition.save_to_note")}
@@ -126,9 +116,6 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.$searchOptions = this.$widget.find(".search-options");
this.$actionOptions = this.$widget.find(".action-options");
this.$searchAndExecuteButton = this.$widget.find(".search-and-execute-button");
this.$searchAndExecuteButton.on("click", () => this.searchAndExecute());
this.$saveToNoteButton = this.$widget.find(".save-to-note-button");
this.$saveToNoteButton.on("click", async () => {
const { notePath } = await server.post<SaveSearchNoteResponse>("special-notes/save-search-note", { searchNoteId: this.noteId });
@@ -162,18 +149,6 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.$searchAndExecuteButton.css("visibility", actions.length > 0 ? "visible" : "_hidden");
}
getContent() {
return "";
}
async searchAndExecute() {
await server.post(`search-and-execute-note/${this.noteId}`);
this.triggerCommand("refreshResults");
toastService.showMessage(t("search_definition.actions_executed"), 3000);
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
// only refreshing deleted attrs, otherwise components update themselves
if (loadResults.getAttributeRows().find((attrRow) => attrRow.type === "label" && attrRow.name === "action" && attrRow.isDeleted)) {