Closed Laflamme closed 3 months ago
Hello again!
Thanks for your ideas. I'll have to look into the "last updated" indicator a bit, to see how I can nicely integrate it into the design, but it's a nice feature to have!
I've also been wanting to implement a refresh button, but that may not exactly be straightforward. I don't know how familiar you are with Rust, but I'd probably need to create a struct to store the rendered page with a function to update it and then share that with all the routes. My only concern here is that there is no way to tell the browser to refresh after the check is done (except maybe long polling, but that will require Javascript). I don't want to add websockets just for that ideally.
Thanks again for the suggestions! I'll try to work on them as soon as I can!
I know just enough about rust to know it's great that you are using it, but nothing at the code level 😅
Until you think of a more elegant solution, maybe you could swap the main page for a temporary page with something like:
Checking your images for updates Please try refreshing this page for results
Since you clearly have an eye for design, you could have an animation of the cup logo being filled and emptied, which would reinforce your branding.
Well since swapping the page would require Javascript as well, I'll probably go with long polling which is simpler and show a loading indicator. Changing the whole page is something better suited for a framework.
@Laflamme here's a preview!
Tell me if you like it or want to change something!
Looks great! Not too intrusive, also serves to separate the list from the statistic boxes, and the refresh icon is in its logical place.
If you end up having to use JavaScript for something else, you could display relative time (“Last checked: 52 minutes ago”) for an even cleaner look, but I think it works great as it is!
I'm happy you like it! I did end up using Javascript for the refresh button, but relative time isn't very easy to implement. I'd normally use a JS package like date-fns
for this, but that would require build modules and including them.
I am considering switching to React at some point, which would enable many more features. If and when that time comes, I'll certainly look into it. (If I don't, please remind me).
I've implemented the code for the loading indicator and the refresh button and I will push my changes is a bit. You can try them out by using the nightly docker image: ghcr.io/sergi0g/cup:nightly
. I won't create a release yet because I want to add a few more features. You'll get the update in a few days (If you're using Docker anyway, Cup will tell you :wink:).
I believe it would be practical to have a last checked indicator at the bottom of the list: just plain text, outside of the table, with the time that the last general check command was performed.
That could also be a great place to add a Check now link (the link could include a query that would trigger the check, so you wouldn't have to add any javascript to the webpage).