From 262fd6fdbbcaaf0b63cac23cb9a6a4f2a1d9605f Mon Sep 17 00:00:00 2001 From: p0psicles Date: Fri, 21 May 2021 09:44:19 +0200 Subject: [PATCH 1/5] Send showRemove message to frontend. * Don't redirect on show removal, as we want to handle that in the frontend, without page reloads. --- medusa/queues/show_queue.py | 3 +++ medusa/server/web/home/handler.py | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/medusa/queues/show_queue.py b/medusa/queues/show_queue.py index fe85d60338..e1cfdd492f 100644 --- a/medusa/queues/show_queue.py +++ b/medusa/queues/show_queue.py @@ -950,6 +950,9 @@ def run(self): log.exception('Exception occurred while trying to delete show {show}, error: {error', {'show': self.show.name, 'error': error}) + # Send showRemoved to frontend, so we can remove it from localStorage. + ws.Message('QueueItemShowRemove', self.show.to_json(detailed=False)).push() # Send ws update to client + self.show.delete_show(full=self.full) self.finish() diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index c0787484fd..8c40c37d9a 100644 --- a/medusa/server/web/home/handler.py +++ b/medusa/server/web/home/handler.py @@ -1042,9 +1042,6 @@ def deleteShow(self, showslug=None, full=0): # Remove show from 'RECENT SHOWS' in 'Shows' menu app.SHOWS_RECENT = [show for show in app.SHOWS_RECENT if show['showSlug'] != showslug] - # Don't redirect to the default page, so the user can confirm that the show was deleted - return self.redirect('/home/') - def refreshShow(self, showslug=None): # @TODO: Replace with status=refresh from PATCH /api/v2/show/{id} identifier = SeriesIdentifier.from_slug(showslug) From 8700dd45a58322a7f191ac59f2d8265773206dc4 Mon Sep 17 00:00:00 2001 From: p0psicles Date: Fri, 21 May 2021 09:45:17 +0200 Subject: [PATCH 2/5] Remove show from store + localStorage on show removal. --- .../slim/src/components/sub-menu.vue | 24 +++++++++++++++---- themes-default/slim/src/store/index.js | 2 ++ .../slim/src/store/modules/shows.js | 13 +++++++++- .../slim/src/store/mutation-types.js | 2 ++ themes/dark/assets/js/medusa-runtime.js | 10 ++++---- themes/light/assets/js/medusa-runtime.js | 10 ++++---- 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/themes-default/slim/src/components/sub-menu.vue b/themes-default/slim/src/components/sub-menu.vue index bd87008ceb..f126b99c1b 100644 --- a/themes-default/slim/src/components/sub-menu.vue +++ b/themes-default/slim/src/components/sub-menu.vue @@ -21,7 +21,8 @@