Prevent certain search filter combinations from being used

This commit is contained in:
Preston 2020-12-17 13:55:47 -05:00
parent 46568bd640
commit ea03dee245
4 changed files with 32 additions and 0 deletions

View File

@ -14,6 +14,10 @@ export default Vue.extend({
values: { values: {
type: Array, type: Array,
required: true required: true
},
disabled: {
type: Boolean,
default: false
} }
}, },
data: function () { data: function () {
@ -31,5 +35,10 @@ export default Vue.extend({
mounted: function () { mounted: function () {
this.id = this._uid this.id = this._uid
this.selectedValue = this.values[0] this.selectedValue = this.values[0]
},
methods: {
updateSelectedValue: function (value) {
this.selectedValue = value
}
} }
}) })

View File

@ -15,6 +15,7 @@
:name="inputName" :name="inputName"
:value="values[index]" :value="values[index]"
:checked="index === 0" :checked="index === 0"
:disabled="disabled"
class="radio" class="radio"
type="radio" type="radio"
@change="$emit('change', values[index])" @change="$emit('change', values[index])"

View File

@ -85,14 +85,32 @@ export default Vue.extend({
}, },
updateTime: function (value) { updateTime: function (value) {
if (this.searchSettings.type !== 'video') {
const typeRadio = this.$refs.typeRadio
typeRadio.updateSelectedValue('all')
this.updateType('all')
}
this.$store.commit('setSearchTime', value) this.$store.commit('setSearchTime', value)
}, },
updateType: function (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) this.$store.commit('setSearchType', value)
}, },
updateDuration: function (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) this.$store.commit('setSearchDuration', value)
} }
} }

View File

@ -9,6 +9,7 @@
:labels="sortByLabels" :labels="sortByLabels"
:values="sortByValues" :values="sortByValues"
class="searchRadio" class="searchRadio"
ref="sortByRadio"
@change="updateSortBy" @change="updateSortBy"
/> />
<ft-radio-button <ft-radio-button
@ -16,6 +17,7 @@
:labels="timeLabels" :labels="timeLabels"
:values="timeValues" :values="timeValues"
class="searchRadio" class="searchRadio"
ref="timeRadio"
@change="updateTime" @change="updateTime"
/> />
<ft-radio-button <ft-radio-button
@ -23,6 +25,7 @@
:labels="typeLabels" :labels="typeLabels"
:values="typeValues" :values="typeValues"
class="searchRadio" class="searchRadio"
ref="typeRadio"
@change="updateType" @change="updateType"
/> />
<ft-radio-button <ft-radio-button
@ -30,6 +33,7 @@
:labels="durationLabels" :labels="durationLabels"
:values="durationValues" :values="durationValues"
class="searchRadio" class="searchRadio"
ref="durationRadio"
@change="updateDuration" @change="updateDuration"
/> />
</ft-flex-box> </ft-flex-box>