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

[WIP] Add new selector for Chargeback Rate editing screen to select the base model #4001

Conversation

hstastna
Copy link
Contributor

@hstastna hstastna commented May 29, 2018

Partially fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1581817
Needs to merge with:
ManageIQ/manageiq#17507
ManageIQ/manageiq-schema#304 (new alternative of ManageIQ/manageiq-schema#209)


What:
When choosing Chargeback for Images/Projects/Vms under Configure Report Columns section while adding a new/editing an existing Report under Cloud Intel > Reports > Reports, some of the fields are not available. This is ok but there was a misunderstanding that those fields were missing there. This is why I add note/info about which fields are not supported to the Report editing screen (in another PR: #4081), and also new selector for Chargeback Rate editing screen (under Cloud Intel > Chargeback > Rates) is added to choose what the Rate is based on (Images/Projects/Vms) (this PR). We call it the base model (see ManageIQ/manageiq-schema#209).


Before:
Adding/editing a Chargeback Rate:
edit_rate_before
Displaying details page of a Chargeback Rate:
rate_show


After:
Adding a new Chargeback Rate (the Rate Details table is displayed after choosing one of the "base models" by the new drop down because the rate details depend on it):
add_new_rate_after
The new selector for configuring Rate columns (for choosing the base model), in editing screen:
report_base_model-select
Adding/editing an existing Chargeback Rate with base model:
(After changing the model, the Rate Details table is cleared to its default values, similarly as for Reports, and the columns of the table are updated according to the chosen base model: only appropriate columns are displayed for each base model)
new_rate_base_model
Displaying details page of a new Chargeback Rate, with the base model:
new_rate2_show
Displaying details page of a Chargeback Rate, without the base model (all the existing rates):
(The rate is based on 'Any' as its details' table has all the available/any columns)
old_rate_show
Editing the Chargeback Rate without the base model:
('Any' option is also available - user can see all the original details' values and edit them)
old_rate-edit
Changing the base model of the Chargeback Rate without the base model:
(While changing the base model from "Any" to any other, user will not lose his original details' values, the table will not be reset to its default values as usually, only the appropriate columns display - with already existing values of the rate, already saved in the DB)
old_rate_change_base
Saving the Chargeback Rate without the base model:
model_required

Note:
Copying of the Rate with/without base model also works but it will not be possible to save the Rate based on 'Any'.

@hstastna hstastna changed the title [WIP] Add missing note about unavailable fields while editing report [WIP] Add missing info about unavailable fields while editing report May 29, 2018
@miq-bot miq-bot added the wip label May 29, 2018
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch 4 times, most recently from 6875c28 to 3170e58 Compare May 29, 2018 13:14
@hstastna hstastna changed the title [WIP] Add missing info about unavailable fields while editing report [WIP] Add missing info about unavailable fields while editing report/rate May 29, 2018
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch 5 times, most recently from acb74f4 to 662d6f9 Compare May 29, 2018 14:06
@hstastna hstastna changed the title [WIP] Add missing info about unavailable fields while editing report/rate [WIP] Add missing info about unavailable fields while adding/editing report/rate May 29, 2018
@hstastna hstastna changed the title [WIP] Add missing info about unavailable fields while adding/editing report/rate Add missing info about unavailable fields while adding/editing report/rate May 29, 2018
@miq-bot miq-bot removed the wip label May 29, 2018
Copy link
Contributor

@lpichler lpichler left a comment

Choose a reason for hiding this comment

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

great! It looks good to me 👍

@lpichler
Copy link
Contributor

@miq-bot assign @mzazrivec

%br
= _('* Caution: Allocated CPU Count/Cores, Used CPU, Used Disk I/O and Allocated Memory are not supported for Chargeback for Projects. ')
%br
= _('* Caution: Allocated/Used CPU Cores are not supported for Chargeback for Vms. ')
Copy link
Member

Choose a reason for hiding this comment

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

Could we just rephrase these into a single sentence on a single line?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand how. These are three different sentences how would you like to put it into one ?

Copy link
Member

@skateman skateman May 30, 2018

Choose a reason for hiding this comment

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

keyword: rephrase 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are three things: Chargeback for Images, Projects, Vms. We need to inform which fields are not supported for each of them. How would you put so much info into the one line to keep readability? Anyway, I see later comments and it looks like there will be completely different solution to what I was told to do here.

Copy link
Member

Choose a reason for hiding this comment

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

Well, for me it looks weird to have a lot of warning signs...something like this in real life:

Copy link
Contributor Author

@hstastna hstastna May 30, 2018

Choose a reason for hiding this comment

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

Well, four lines of "Caution" is also too much for me but here it is not possible to put all the info in one line and to keep readability, it's too much info to put just into one line. Anyway, I was told to do so.. Aaand.. now I was told to do it completely differently so don't worry about this, I will udpate the PR soon! ;)

- report_base = @edit[:new][:model].titleize.split(' ').last.pluralize
%br
%strong
= _("* Caution: #{unavailable_fields} are not supported for Chargeback for #{report_base}.")
Copy link
Member

Choose a reason for hiding this comment

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

This is probably not okay from the translation side, you need to use the % operator.

- if @edit[:new][:model] && @edit[:new][:model].starts_with?('Chargeback')
- unavailable_fields = unavailable_fields_for_model
- if unavailable_fields
- report_base = @edit[:new][:model].titleize.split(' ').last.pluralize
Copy link
Member

Choose a reason for hiding this comment

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

Translation missing here, probably ui_lookup but not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I don't display anything so I don't think so. I think I miss ui_lookup later.

Copy link
Member

Choose a reason for hiding this comment

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

You're displaying report_base a few lines below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is what i meant by "later".

@@ -274,6 +274,19 @@ def title

private

# Get string with unavailable fields for displaying note about them while adding/editing report
def unavailable_fields_for_model
case @edit[:new][:model]
Copy link
Member

Choose a reason for hiding this comment

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

Instead of testing for the @edit[:new][:model] I would make this method more universal by using an argument instead.

'Allocated CPU Count, Used CPU, Used Disk I/O and Used Network I/O'
when 'ChargebackContainerProject'
'Allocated CPU Count/Cores, Used CPU, Used Disk I/O and Allocated Memory'
end
Copy link
Member

Choose a reason for hiding this comment

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

Translations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't use ui_lookup here. Or did you mean anything else?

Copy link
Member

Choose a reason for hiding this comment

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

_

@martinpovolny
Copy link

I don't like the fact, that the information about fields that are not allowed for chargeback is in the UI. Practically in the views.

This should come from the backend.

@lpichler
Copy link
Contributor

lpichler commented May 30, 2018

after clarification with @martinpovolny we will do the different solution. It will be about "Chargeback Rates for concrete type of report"

@hstastna hstastna changed the title Add missing info about unavailable fields while adding/editing report/rate [WIP] Add missing info about unavailable fields while adding/editing report/rate May 30, 2018
@miq-bot miq-bot added the wip label May 30, 2018
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch 4 times, most recently from 2c32744 to ee1ddd7 Compare June 1, 2018 12:33
@hstastna hstastna changed the title [WIP] Add missing info about unavailable fields while adding/editing report/rate [WIP] Add missing info about unavailable fields while adding/editing Chargeback Rate Jun 7, 2018
@hstastna hstastna changed the title [WIP] Add missing info about unavailable fields while adding/editing Chargeback Rate [WIP] Add new selector for Chargeback Rate editing screen to select the Rate base model Jun 7, 2018
@hstastna hstastna changed the title [WIP] Add new selector for Chargeback Rate editing screen to select the Rate base model [WIP] Add new selector for Chargeback Rate editing screen to select the base model Jun 7, 2018
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch 2 times, most recently from adaac83 to 169bfd1 Compare June 7, 2018 11:26
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch 2 times, most recently from f2cd3db to a7b811f Compare June 7, 2018 13:29
@hstastna
Copy link
Contributor Author

Changes for Reports moved to another PR.

@miq-bot
Copy link
Member

miq-bot commented Sep 5, 2018

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Mar 11, 2019

This pull request has been automatically closed because it has not been updated for at least 6 months.

Feel free to reopen this pull request if these changes are still valid.

Thank you for all your contributions!

@himdel himdel reopened this Mar 12, 2019
@miq-bot
Copy link
Member

miq-bot commented Mar 12, 2019

This pull request is not mergeable. Please rebase and repush.

@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch from a7b811f to 3c33d98 Compare March 28, 2019 15:33
Also, add flash message to inform that setting the base model for the rate is required.
Edit/simplify the method by moving setting the rate details to the new method cb_rate_set_details
Save the id to @edit to be able to get the original Rate details while
copying the rate and changing the base model. This is important for 'older'
rates with no base model set before for not losing the original details.
Also, reset the Rate Details according to the base model
if the base model was changed by user.
@hstastna hstastna force-pushed the Cannot_Create_VM_Chargeback_Reports_with_CPU_Cores branch from 3c33d98 to c317d24 Compare March 28, 2019 15:40
Add simple condition 'if @edit[:new][:model]' and '#rate_edit_details' to rate edit table haml
to be able to easily refresh/display or not display the table if report base model was not set yet.
@miq-bot
Copy link
Member

miq-bot commented Mar 28, 2019

Checked commits hstastna/manageiq-ui-classic@9a33fff~...c3623ce with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 1 offense detected

**

  • 💣 💥 🔥 🚒 - Linter/Haml - Linter::Haml STDERR:
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.6-compliant syntax, but you are running 2.3.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

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

Successfully merging this pull request may close these issues.

None yet

7 participants