From ea03dee245582e32240c4b6a38f56ac0e0ab8d1a Mon Sep 17 00:00:00 2001 From: Preston Date: Thu, 17 Dec 2020 13:55:47 -0500 Subject: [PATCH] Prevent certain search filter combinations from being used --- .../ft-radio-button/ft-radio-button.js | 9 +++++++++ .../ft-radio-button/ft-radio-button.vue | 1 + .../ft-search-filters/ft-search-filters.js | 18 ++++++++++++++++++ .../ft-search-filters/ft-search-filters.vue | 4 ++++ 4 files changed, 32 insertions(+) diff --git a/src/renderer/components/ft-radio-button/ft-radio-button.js b/src/renderer/components/ft-radio-button/ft-radio-button.js index 3c95e4ef2..ee9554bc7 100644 --- a/src/renderer/components/ft-radio-button/ft-radio-button.js +++ b/src/renderer/components/ft-radio-button/ft-radio-button.js @@ -14,6 +14,10 @@ export default Vue.extend({ values: { type: Array, required: true + }, + disabled: { + type: Boolean, + default: false } }, data: function () { @@ -31,5 +35,10 @@ export default Vue.extend({ mounted: function () { this.id = this._uid this.selectedValue = this.values[0] + }, + methods: { + updateSelectedValue: function (value) { + this.selectedValue = value + } } }) diff --git a/src/renderer/components/ft-radio-button/ft-radio-button.vue b/src/renderer/components/ft-radio-button/ft-radio-button.vue index 116a16c75..4822888d2 100644 --- a/src/renderer/components/ft-radio-button/ft-radio-button.vue +++ b/src/renderer/components/ft-radio-button/ft-radio-button.vue @@ -15,6 +15,7 @@ :name="inputName" :value="values[index]" :checked="index === 0" + :disabled="disabled" class="radio" type="radio" @change="$emit('change', values[index])" diff --git a/src/renderer/components/ft-search-filters/ft-search-filters.js b/src/renderer/components/ft-search-filters/ft-search-filters.js index 49a66d3b1..688a90032 100644 --- a/src/renderer/components/ft-search-filters/ft-search-filters.js +++ b/src/renderer/components/ft-search-filters/ft-search-filters.js @@ -85,14 +85,32 @@ export default Vue.extend({ }, updateTime: function (value) { + if (this.searchSettings.type !== 'video') { + const typeRadio = this.$refs.typeRadio + typeRadio.updateSelectedValue('all') + this.updateType('all') + } this.$store.commit('setSearchTime', value) }, updateType: function (value) { + if (value === 'channel' || value === 'playlist') { + const timeRadio = this.$refs.timeRadio + const durationRadio = this.$refs.durationRadio + timeRadio.updateSelectedValue('') + durationRadio.updateSelectedValue('') + this.updateTime('') + this.updateDuration('') + } this.$store.commit('setSearchType', value) }, updateDuration: function (value) { + if (value !== '' && this.searchSettings.type !== 'video') { + const typeRadio = this.$refs.typeRadio + typeRadio.updateSelectedValue('all') + this.updateType('all') + } this.$store.commit('setSearchDuration', value) } } diff --git a/src/renderer/components/ft-search-filters/ft-search-filters.vue b/src/renderer/components/ft-search-filters/ft-search-filters.vue index 5a45fa13d..095337878 100644 --- a/src/renderer/components/ft-search-filters/ft-search-filters.vue +++ b/src/renderer/components/ft-search-filters/ft-search-filters.vue @@ -9,6 +9,7 @@ :labels="sortByLabels" :values="sortByValues" class="searchRadio" + ref="sortByRadio" @change="updateSortBy" />