Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] web_widget_progressbar_color #2989

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from

Conversation

rousseldenis
Copy link
Contributor

@rousseldenis rousseldenis commented Nov 13, 2024

Rendering example:

image

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very Nice !
Thanks !

Copy link

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

<xpath expr="//div[@t-attf-class]" position="attributes">
<attribute
name="t-attf-class"
add="{{ (state.currentValue > 40 and state.currentValue &lt;= 70) ? 'o_progress_warning' : state.currentValue > 70 ? 'o_progress_danger' : ''}}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add="{{ (state.currentValue > 40 and state.currentValue &lt;= 70) ? 'o_progress_warning' : state.currentValue > 70 ? 'o_progress_danger' : ''}}"
add="{{ (state.currentValue > 40 * state.maxValue/100 and state.currentValue &lt;= 70 * state.maxValue/100) ? 'o_progress_warning' : state.currentValue > 70 * state.maxValue/100 ? 'o_progress_danger' : ''}}"

Copy link

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not making a gradient progressbar instead ? Then you don't have to configure the thresholds

@rousseldenis
Copy link
Contributor Author

Why not making a gradient progressbar instead ? Then you don't have to configure the thresholds

Could you develop ?

@jbaudoux
Copy link

jbaudoux commented Nov 13, 2024

Why not making a gradient progressbar instead ? Then you don't have to configure the thresholds

Could you develop ?

Something like applying always this class:

.o_progressbar .o_progress  o_progressbar_gradient {
  background: linear-gradient(to right, green, yellow, red)
}

@pedrobaeza pedrobaeza added this to the 16.0 milestone Nov 13, 2024
@rousseldenis
Copy link
Contributor Author

Why not making a gradient progressbar instead ? Then you don't have to configure the thresholds

Could you develop ?

Something like applying always this class:

.o_progressbar .o_progress  o_progressbar_gradient {
  background: linear-gradient(to right, green, yellow, red)
}

The result:

image

This is not the expecting result

@rousseldenis
Copy link
Contributor Author

@legalsylvain @pedrobaeza @jbaudoux

I will change the imlpementaiton to this (need a little bit tweaking) as this is our needs:

image

@rousseldenis
Copy link
Contributor Author

I think also changing the module name to web_widget_progressbar_gradient to reflect more the final implementation.

@legalsylvain
Copy link
Contributor

Hi @rousseldenis : looks nice !

A "matter of taste" remarks :

  • Generally, red is "bad / problematic", yellow is not "very good", and green is "good / allowed". for traffic lights, for example.
  • Generally also, 0% means an unfulfilled objective, and 100% means a successful target
    So, my proposal is to have red -> Yellow -> green. (instead of green -> yellow -> green).

However, just a suggestion. If you think it's better like that, let's move on.

@rousseldenis
Copy link
Contributor Author

  • So, my proposal is to have red -> Yellow -> green. (instead of green -> yellow -> green).

The current implementation is to reflect the "occupation" which means that the less is better, the more is worse.

I'll try to add an option to the widget to allow the inversemode (in fact, mine 😅 )

Allows to reverse the gradient rendering
@rousseldenis
Copy link
Contributor Author

@legalsylvain

Now:

image

So both options are supported. The normal rendering is red to green. Inverse mode, green to red.

@legalsylvain
Copy link
Contributor

Thanks !

It looks like there is a little offset when 100 is displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants