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: {
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
}
}
})

View File

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

View File

@ -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)
}
}

View File

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