From 991c17f88e1984ee5d3ede23cc5bc7b7f129b64e Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 5 Jul 2020 23:18:13 +0300 Subject: [PATCH] Add table with banned URLs and ability to remove url from cachex --- src/lang/en.js | 4 ++- src/store/modules/mediaProxyCache.js | 2 +- src/views/mediaProxyCache/index.vue | 46 +++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index 92caee07..f2b60b86 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -97,7 +97,9 @@ export default { ban: 'Ban', url: 'URL', evict: 'Evict', - evictedMessage: 'This URL was evicted' + evictedMessage: 'This URL was evicted', + actions: 'Actions', + remove: 'Remove from Cachex' }, documentation: { documentation: 'Documentation', diff --git a/src/store/modules/mediaProxyCache.js b/src/store/modules/mediaProxyCache.js index 5990c8e8..c148dbdf 100644 --- a/src/store/modules/mediaProxyCache.js +++ b/src/store/modules/mediaProxyCache.js @@ -11,7 +11,7 @@ const mediaProxyCache = { }, mutations: { SET_BANNED_URLS: (state, urls) => { - state.bannedUrls = urls + state.bannedUrls = urls.map(el => { return { url: el } }) }, SET_BANNED_URLS_COUNT: (state, count) => { state.bannedUrlsCount = count diff --git a/src/views/mediaProxyCache/index.vue b/src/views/mediaProxyCache/index.vue index e0bfb5d0..f13dfb7d 100644 --- a/src/views/mediaProxyCache/index.vue +++ b/src/views/mediaProxyCache/index.vue @@ -13,6 +13,28 @@ {{ $t('mediaProxyCache.ban') }} {{ $t('mediaProxyCache.evict') }} + > + + + + + + @@ -25,7 +47,19 @@ export default { data() { return { url: '', - ban: false + ban: false, + selectedUrls: [] + } + }, + computed: { + bannedUrls() { + return this.$store.state.mediaProxyCache.bannedUrls + }, + isDesktop() { + return this.$store.state.app.device === 'desktop' + }, + loading() { + return this.$store.state.mediaProxyCache.loading } }, mounted() { @@ -37,6 +71,13 @@ export default { evictURL() { const urls = typeof this.url === 'string' ? [this.url] : this.url this.$store.dispatch('PurgeUrls', { urls, ban: this.ban }) + }, + handleSelectionChange(value) { + this.$data.selectedUrls = value + }, + removeUrl(url) { + const urls = typeof this.url === 'string' ? [this.url] : this.url + this.$store.dispatch('RemoveBannedUrls', urls) } } } @@ -46,6 +87,9 @@ export default { h1 { margin: 0; } +.banned-urls-table { + margin: 15px; +} .evict-button { margin-left: 5px; }