diff mbox series

web-app: show newest messages logs first and add message level colors

Message ID 20241103154104.1239792-1-radian.dc@gmail.com
State New
Headers show
Series web-app: show newest messages logs first and add message level colors | expand

Commit Message

Adrian DC Nov. 3, 2024, 3:41 p.m. UTC
For developers / users, especially if an update fails,
the most relevant messages logs are the latest ones,
hence reverse the order of messages by prepending latests first.

Also rework the messages logs output with more colors per level
---

Signed-off-by: Adrian DC <radian.dc@gmail.com>
---
 web-app/js/swupdate.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Stefano Babic Nov. 4, 2024, 9:36 a.m. UTC | #1
Hi Adrian,

On 11/3/24 16:41, Adrian DC wrote:
> For developers / users, especially if an update fails,
> the most relevant messages logs are the latest ones,
> hence reverse the order of messages by prepending latests first.
>
> Also rework the messages logs output with more colors per level

This is a long story. And yes, for developers make sense to do as you
suggest. That is the reason I implemented in the early beginning exactly
in this way, with last messages on the top. But there were complains,
because this is not the usual way to show logs, and putting new messages
on the top were judge "unnatural".

I will avoid to start again to switch up and down the order of messages.
I will just accept a change in the GUI where it is possible to switch
the order at runtime (via button, ...).

Best regards,
Stefano Babic

> ---
>
> Signed-off-by: Adrian DC <radian.dc@gmail.com>
> ---
>   web-app/js/swupdate.js | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/web-app/js/swupdate.js b/web-app/js/swupdate.js
> index faeca3d2..dfbcd74f 100755
> --- a/web-app/js/swupdate.js
> +++ b/web-app/js/swupdate.js
> @@ -155,7 +155,11 @@ window.onload = function () {
>           p.text(msg.text)
>           p.addClass('mb-1')
>           if (msg.level <= 3) { p.addClass('text-danger') }
> -        $('#messages').append(p)
> +        else if (msg.level <= 4) { p.addClass('text-info') }
> +        else if (msg.level <= 5) { }
> +        else if (msg.level <= 6) { p.addClass('text-success') }
> +        else if (msg.level <= 7) { p.addClass('text-muted') }
> +        $('#messages').prepend(p)
>           break
>         }
>         case 'status': {
Adrian DC Nov. 9, 2024, 1:34 a.m. UTC | #2
Hi Stefano,

Ok I'm fine with the reasoning and history.
I'll rework it into a configurable build option to toggle it upwards if 
opt-in requested.

What about the message level colors implemented ?
Checking SWUpdate logs and issues, such as compatibility issues (wrong 
machine, incompatible partitions layout, or faulty update signatures)
have become easier and less magical / less complex to understand since then.

Best regards,

Le lundi 4 novembre 2024 à 10:36:15 UTC+1, Stefano Babic a écrit :

Hi Adrian, 

On 11/3/24 16:41, Adrian DC wrote: 
> For developers / users, especially if an update fails, 
> the most relevant messages logs are the latest ones, 
> hence reverse the order of messages by prepending latests first. 
> 
> Also rework the messages logs output with more colors per level 

This is a long story. And yes, for developers make sense to do as you 
suggest. That is the reason I implemented in the early beginning exactly 
in this way, with last messages on the top. But there were complains, 
because this is not the usual way to show logs, and putting new messages 
on the top were judge "unnatural". 

I will avoid to start again to switch up and down the order of messages. 
I will just accept a change in the GUI where it is possible to switch 
the order at runtime (via button, ...). 

Best regards, 
Stefano Babic 

> --- 
> 
> Signed-off-by: Adrian DC <radi...@gmail.com> 
> --- 
> web-app/js/swupdate.js | 6 +++++- 
> 1 file changed, 5 insertions(+), 1 deletion(-) 
> 
> diff --git a/web-app/js/swupdate.js b/web-app/js/swupdate.js 
> index faeca3d2..dfbcd74f 100755 
> --- a/web-app/js/swupdate.js 
> +++ b/web-app/js/swupdate.js 
> @@ -155,7 +155,11 @@ window.onload = function () { 
> p.text(msg.text) 
> p.addClass('mb-1') 
> if (msg.level <= 3) { p.addClass('text-danger') } 
> - $('#messages').append(p) 
> + else if (msg.level <= 4) { p.addClass('text-info') } 
> + else if (msg.level <= 5) { } 
> + else if (msg.level <= 6) { p.addClass('text-success') } 
> + else if (msg.level <= 7) { p.addClass('text-muted') } 
> + $('#messages').prepend(p) 
> break 
> } 
> case 'status': {
diff mbox series

Patch

diff --git a/web-app/js/swupdate.js b/web-app/js/swupdate.js
index faeca3d2..dfbcd74f 100755
--- a/web-app/js/swupdate.js
+++ b/web-app/js/swupdate.js
@@ -155,7 +155,11 @@  window.onload = function () {
         p.text(msg.text)
         p.addClass('mb-1')
         if (msg.level <= 3) { p.addClass('text-danger') }
-        $('#messages').append(p)
+        else if (msg.level <= 4) { p.addClass('text-info') }
+        else if (msg.level <= 5) { }
+        else if (msg.level <= 6) { p.addClass('text-success') }
+        else if (msg.level <= 7) { p.addClass('text-muted') }
+        $('#messages').prepend(p)
         break
       }
       case 'status': {