From 67f86700151e096c51bbec7bcf62254f636c08e3 Mon Sep 17 00:00:00 2001 From: Bogdan Bogdanov Date: Thu, 24 Dec 2020 18:50:58 +0200 Subject: [PATCH] Add update plugins button to search plugin manager --- src/Api.ts | 4 ++++ .../dialogs/searchDialog/PluginsManager.vue | 16 +++++++++++++++- src/locale/en.ts | 1 + src/store/searchEngine.ts | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Api.ts b/src/Api.ts index 3360e8c..911cbd4 100644 --- a/src/Api.ts +++ b/src/Api.ts @@ -293,6 +293,10 @@ class Api { // Search page + public updateSearchPlugins(): Promise { + return this.axios.post('/search/updatePlugins').then(Api.handleResponse); + } + public getSearchPlugins(): Promise { return this.axios.get('/search/plugins').then(Api.handleResponse); } diff --git a/src/components/dialogs/searchDialog/PluginsManager.vue b/src/components/dialogs/searchDialog/PluginsManager.vue index 90498e1..e6c9af9 100644 --- a/src/components/dialogs/searchDialog/PluginsManager.vue +++ b/src/components/dialogs/searchDialog/PluginsManager.vue @@ -15,13 +15,21 @@ @change="togglePluginAvailability(plugin)" /> + + + {{ $t("update_plugins") }} + + diff --git a/src/locale/en.ts b/src/locale/en.ts index c87e966..637d8b1 100644 --- a/src/locale/en.ts +++ b/src/locale/en.ts @@ -65,6 +65,7 @@ export default { search_engine: 'Search engine', usage: 'usage', plugin_manager: 'Plugin manager', + update_plugins: 'Update plugins', title: { _: 'Title', diff --git a/src/store/searchEngine.ts b/src/store/searchEngine.ts index 7a24bc5..2bda9b9 100644 --- a/src/store/searchEngine.ts +++ b/src/store/searchEngine.ts @@ -61,5 +61,20 @@ export default { enablePluginRequestSuccess({ dispatch }) { dispatch('fetchSearchPlugins'); // refresh the plugins }, + async updatePluginsRequest({ dispatch }) { + try { + await api.updateSearchPlugins(); + + dispatch("updatePluginsRequestSuccess"); + } catch { + dispatch("updatePluginsRequestFailure"); + } + }, + async updatePluginsRequestSuccess({ dispatch }) { + await dispatch('getSearchPluginsRequest'); + }, + updatePluginsRequestFailure() { + // Do nothing + }, }, } as Module;