show loading status

This commit is contained in:
Nazar Kanaev 2020-08-04 22:28:13 +01:00
parent 44b5a6a67f
commit d913872e76
3 changed files with 8 additions and 4 deletions

View File

@ -65,7 +65,7 @@ func StaticHandler(rw http.ResponseWriter, req *http.Request) {
func StatusHandler(rw http.ResponseWriter, req *http.Request) {
writeJSON(rw, map[string]interface{}{
"running": *handler(req).queueSize > 0,
"running": *handler(req).queueSize,
"stats": db(req).FeedStats(),
})
}

View File

@ -13,8 +13,10 @@
<div class="vh-100 position-relative overflow-auto border-right flex-shrink-0" :style="{width: feedListWidth+'px'}">
<drag :width="feedListWidth" @resize="resizeFeedList"></drag>
<div class="px-2 toolbar d-flex align-items-center mb-3">
<span class="icon mx-2">{% inline "anchor.svg" %}</span>
<div class="flex-grow-1 noselect">&nbsp;</div>
<div class="icon mx-2" :class="{loading: loading.feeds}">{% inline "anchor.svg" %}</div>
<div class="text-truncate cursor-default flex-grow-1 noselect">
<span v-if="loading.feeds">Refreshing ({{loading.feeds}} left)</span>
</div>
<b-dropdown right no-caret lazy="true" variant="link" class="settings-dropdown" toggle-class="toolbar-item px-2">
<template v-slot:button-content class="toolbar-item">
<span class="icon">{% inline "more-horizontal.svg" %}</span>

View File

@ -142,6 +142,7 @@ var vm = new Vue({
'itemListWidth': null,
'settings': 'create',
'loading': {
'feeds': false,
'newfeed': false,
'items': false,
},
@ -272,6 +273,7 @@ var vm = new Vue({
methods: {
refreshStats: function() {
api.status().then(function(data) {
vm.loading.feeds = data.running
if (data.running) {
setTimeout(vm.refreshStats.bind(vm), 2000)
}
@ -490,7 +492,7 @@ var vm = new Vue({
this.theme.size = +(this.theme.size + (0.1 * x)).toFixed(1)
},
fetchAllFeeds: function() {
api.feeds.refresh()
api.feeds.refresh().then(this.refreshStats.bind(this))
},
}
})