-
Notifications
You must be signed in to change notification settings - Fork 358
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
Customizable chart top values (dropdown choices) #8826
Customizable chart top values (dropdown choices) #8826
Conversation
Noticed that the |
dbfcedb
to
0fe84a1
Compare
I added a Anyway, I'm ready for bringing this forward, and thus will try to remove the Draft state (like last night)... |
0fe84a1
to
2594c31
Compare
GRAPH_MAX_COUNT = 10 | ||
GRAPH_MAX_COUNT = ::Settings.reporting.chart_top_values || 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is happening at constant time, so if the user changes it you'd have to reboot the worker/server. Instead of a constant, this should probably move to a method to allow the runtime lookup.
Additionally, we try to avoid having "hidden" values in the settings. Instead, it's probably preferable to only use settings, and then just set the value in the settings to 10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fryguy I'm afraid that I'm not versed to come up with the best way to do what you are suggesting, but PTAL at my latest force-push. It appears to achieve the dynamic behavior on UI.
In the meantime, I opened this PR on Core to support this logic.
2594c31
to
98e8964
Compare
@@ -1202,7 +1205,7 @@ def set_form_vars | |||
@edit[:new][:graph_other] = @rpt.graph[:other] ? @rpt.graph[:other] : false | |||
else | |||
@edit[:new][:graph_type] = @rpt.graph | |||
@edit[:new][:graph_count] = GRAPH_MAX_COUNT | |||
@edit[:new][:graph_count] = chart_top_values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be
@edit[:new][:graph_count] = chart_top_values | |
@edit[:new][:graph_count] = self.class.chart_top_values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my tests, chart_top_values
didn't work, nor did self.class.chart_top_values
. The only one I got working is ReportController::Reports::Editor.chart_top_values
, which looks odd right in the module
defining file itself, but... anyway, PTAL at the latest force-push.
Please also include a default value hardcoded in the settings and set to 10 (I think it needs to be a core PR and then make this PR dependent on that one) |
@miyamotoh Just for my clarity, what does this value represent? Is this a dashboard top 10 thing only, or is this any chart report? If the former, I wonder if we should more clearly name the option |
@Fryguy PTAL the opening description of this PR, as I added a little screenshot. |
ohhh thanks...that's much clearer now |
updated the OP to show it depends on ManageIQ/manageiq#22632 |
Weird question. If someone picks a large number, say 10, and saves the report, then an admin changes the settings to a smaller number, say 5, then what happens to existing reports. I'm ok if they continue to show 10, but we need to make sure the report editor doesn't blow up. |
98e8964
to
59b237a
Compare
b74716c
to
710ff48
Compare
Hey @miyamotoh , could you please check with the failing specs.. |
Signed-off-by: Hiro Miyamoto <miyamotoh@us.ibm.com>
710ff48
to
93fc67c
Compare
Checked commit miyamotoh@93fc67c with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
@jeffibm PTAL at the latest force-push. Thanks! |
Depends on
Proposing to make the "chart top values" (currently hardcoded to 10) externalized to
settings.yaml
and thus customizable. It'd read the below setting, if present, and use it. If this is good, I'm happy to create a PR for the Core with the default value (10).This controls how long/big this dropdown goes;