Skip to content

Commit

Permalink
Do not allow edit of variable rate for tier in fixed rate_detail
Browse files Browse the repository at this point in the history
This Simplify rates editor. The rates editor is a complex form and
user can hardly comprehend what it does. By removing useless field we
give at least some clue to the user.

Now, let's discuss, why this is valid change:
 - For variable rate the computation goes like
   cost = fixed_rate + variable_rate * metric
 - For fixed rate the computation goes like
   metric = 1
   cost = fixed_rate + variable_rate * metric
(transferred from ManageIQ/manageiq@94bebcd)
  • Loading branch information
isimluk committed Oct 26, 2016
1 parent 5b40aa8 commit 36163ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/views/chargeback/_cb_tier_edit_values.html.haml
@@ -1,4 +1,5 @@
- tier = @edit[:new][:tiers][detail_index][row_within_rate]
- detail = @edit[:new][:details][detail_index]
%td
- tier_val = (tier[:start].to_s.eql? 'Infinity') ? '' : tier[:start]
= text_field_tag("start_#{detail_index}_#{row_within_rate}", tier_val,
Expand All @@ -11,5 +12,9 @@
= text_field_tag("fixed_rate_#{detail_index}_#{row_within_rate}", tier[:fixed_rate],
:maxlength => MAX_NAME_LEN, 'data-miq_observe' => {:interval => '.5', :url => url}.to_json)
%td{:align => 'right'}
= text_field_tag("variable_rate_#{detail_index}_#{row_within_rate}", tier[:variable_rate],
:maxlength => MAX_NAME_LEN, 'data-miq_observe' => {:interval => '.5', :url => url}.to_json)
- if detail['group'] == 'fixed' && (tier[:variable_rate].blank? || tier[:variable_rate].zero?)
/simplify editor, by disabling variable rate edit for fixed rates (allow edit only when this value already exists)
= '-'
- else
= text_field_tag("variable_rate_#{detail_index}_#{row_within_rate}", tier[:variable_rate],
:maxlength => MAX_NAME_LEN, 'data-miq_observe' => {:interval => '.5', :url => url}.to_json)

0 comments on commit 36163ea

Please sign in to comment.