refresh rate ui

This commit is contained in:
Nazar Kanaev 2020-10-12 20:42:14 +01:00
parent 55a1c297be
commit e17ce0fb31
3 changed files with 18 additions and 0 deletions

View File

@ -56,7 +56,18 @@
<span class="icon mr-1">{% inline "rotate-cw.svg" %}</span>
Refresh Feeds
</b-dropdown-item-button>
<b-dropdown-divider></b-dropdown-divider>
<b-dropdown-header>Refresh</b-dropdown-header>
<b-dropdown-item-button @click.stop="refreshRate = min" v-for="min in [0, 60]">
<span class="icon mr-1" :class="{invisible: refreshRate != min}">{% inline "check.svg" %}</span>
<span v-if="min == 0">Manually</span>
<span v-if="min == 60">Every hour</span>
</b-dropdown-item-button>
<b-dropdown-divider></b-dropdown-divider>
<b-dropdown-header>Sort by</b-dropdown-header>
<b-dropdown-item-button @click.stop="itemSortNewestFirst=true">
<span class="icon mr-1" :class="{invisible: !itemSortNewestFirst}">{% inline "check.svg" %}</span>

View File

@ -163,6 +163,7 @@ var vm = new Vue({
'font': '',
'size': 1,
},
'refreshRate': undefined,
}
},
computed: {
@ -270,6 +271,10 @@ var vm = new Vue({
if (oldVal === undefined) return // do nothing, initial setup
api.settings.update({item_list_width: newVal})
}, 1000),
'refreshRate': function(newVal, oldVal) {
if (oldVal === undefined) return // do nothing, initial setup
api.settings.update({refresh_rate: newVal})
},
},
methods: {
refreshStats: function(loopMode) {
@ -574,6 +579,7 @@ api.settings.get().then(function(data) {
vm.theme.name = data.theme_name
vm.theme.font = data.theme_font
vm.theme.size = data.theme_size
vm.refreshRate = data.refresh_rate
vm.refreshItems()
vm.$mount('#app')
})

View File

@ -12,6 +12,7 @@ func settingsDefaults() map[string]interface{} {
"theme_name": "light",
"theme_font": "",
"theme_size": 1,
"refresh_rate": 0,
}
}