diff --git a/frontend/src/components/UI/Dialogs/BaseDialog.vue b/frontend/src/components/UI/Dialogs/BaseDialog.vue index 83e25880e..23123fce4 100644 --- a/frontend/src/components/UI/Dialogs/BaseDialog.vue +++ b/frontend/src/components/UI/Dialogs/BaseDialog.vue @@ -5,22 +5,19 @@ :width="modalWidth + 'px'" :content-class="top ? 'top-dialog' : undefined" > - + - + {{ titleIcon }} - - {{ title }} + @@ -33,6 +30,7 @@ + diff --git a/frontend/src/locales/messages/en-US.json b/frontend/src/locales/messages/en-US.json index 55e0ab035..c897010d8 100644 --- a/frontend/src/locales/messages/en-US.json +++ b/frontend/src/locales/messages/en-US.json @@ -221,7 +221,13 @@ }, "toolbox": { "toolbox": "Toolbox", - "new-name": "New Name" + "new-name": "New Name", + "recipes-effected": "Recipes Effected", + "title-case-all": "Title Case All", + "no-unused-items": "No Unused Items", + "remove-unused": "Remove Unused", + "assign-all": "Assign All", + "bulk-assign": "Bulk Assign" } }, "user": { diff --git a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/BulkAssign.vue b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/BulkAssign.vue index 962adbef0..ea66fadd8 100644 --- a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/BulkAssign.vue +++ b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/BulkAssign.vue @@ -28,7 +28,7 @@ @@ -76,6 +76,7 @@ export default { }, data() { return { + results: [], search: "", loading: false, assignTargetRecipes: [], @@ -86,20 +87,25 @@ export default { mounted() { this.$store.dispatch("requestAllRecipes"); }, + watch: { + search() { + this.getResults(); + }, + }, computed: { allRecipes() { return this.$store.getters.getRecentRecipes; }, - results() { - if (this.search === null || this.search === "") { - return []; - } - return this.allRecipes.filter(x => { - return ( - this.checkForKeywords(x.name) || this.checkForKeywords(x.description) - ); - }); - }, + // results() { + // if (this.search === null || this.search === "") { + // return []; + // } + // return this.allRecipes.filter(x => { + // return ( + // this.checkForKeywords(x.name) || this.checkForKeywords(x.description) + // ); + // }); + // }, keywords() { const lowered = this.search.toLowerCase(); return lowered.split(" "); @@ -123,6 +129,7 @@ export default { await api.recipes.patch(element); }); this.loading = false; + this.closeDialog(); }, closeDialog() { this.$refs.assignDialog.close(); @@ -131,6 +138,27 @@ export default { this.$refs.assignDialog.open(); this.reset(); }, + getResults() { + this.loading = true; + + // cancel pending call + clearTimeout(this._timerId); + this._timerId = setTimeout(() => { + this.results = this.filterResults(); + }, 300); + this.loading = false; + // delay new call 500ms + }, + filterResults() { + if (this.search === null || this.search === "") { + return []; + } + return this.allRecipes.filter(x => { + return ( + this.checkForKeywords(x.name) || this.checkForKeywords(x.description) + ); + }); + }, checkForKeywords(str) { const searchStr = str.toLowerCase(); return this.keywords.some(x => searchStr.includes(x)); diff --git a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/RemoveUnused.vue b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/RemoveUnused.vue index 608f689d8..12554c1a1 100644 --- a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/RemoveUnused.vue +++ b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/RemoveUnused.vue @@ -4,7 +4,11 @@ ref="deleteDialog" title-icon="mdi-tag" color="error" - :title="title" + :title=" + $t('general.delete') + + ' ' + + (isTags ? $t('recipe.tags') : $t('recipe.categories')) + " :loading="loading" modal-width="400" > @@ -16,11 +20,11 @@ - No Unused Items + {{ $t("settings.toolbox.no-unused-items") }} - Remove Unused + {{ $t("settings.toolbox.remove-unused") }} @@ -58,11 +62,6 @@ export default { loading: false, }; }, - computed: { - title() { - return this.isTags ? "Delete Tags" : "Delete Categories"; - }, - }, methods: { closeDialog() { this.$refs.deleteDialog.close(); diff --git a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/index.vue b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/index.vue index d32716a72..a9e1fef14 100644 --- a/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/index.vue +++ b/frontend/src/pages/Admin/ToolBox/CategoryTagEditor/index.vue @@ -18,7 +18,8 @@