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

Added Max Retries text field on Instance screen #3562

Merged
merged 3 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/miq_ae_class_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ def instance_column_names
end

def field_column_names
%w(aetype collect datatype default_value display_name name on_entry on_error on_exit substitute)
%w(aetype collect datatype default_value display_name name on_entry on_error on_exit max_retries max_time substitute)
end

def value_column_names
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/miq_ae_class_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ def ae_field_fonticon(field)
'fa fa-file-text-o'
end
end

def state_class?(cls_id)
MiqAeClass.find_by(:id => cls_id).state_machine?
end
end
34 changes: 18 additions & 16 deletions app/views/miq_ae_class/_instance_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
%h3= _('Fields')
#instance_fields_div
- if !@in_a_form

- state_class = state_class?(@record.class_id)
%table#instance_fields_grid.table.table-striped.table-bordered
%thead
%th= _('Name')
%th= _('Value')
%th= _('On Entry')
%th= _('On Exit')
%th= _('On Error')
- if state_class
%th= _('On Entry')
%th= _('On Exit')
%th= _('On Error')
%th= _('Max Retries')
%th= _('Max Time')
%th= _('Collect')
%th= _('Max Retries')
%th= _('Max Time')
%th= _('Message')
%tbody
- @ae_class.ae_fields.each do |field|
Expand All @@ -30,18 +31,19 @@
********
- else
= nonblank(ae_value.value, field.default_value)
%td
= nonblank(ae_value.on_entry, field.on_entry)
%td
= nonblank(ae_value.on_exit, field.on_exit)
%td
= nonblank(ae_value.on_error, field.on_error)
- if state_class
%td
= nonblank(ae_value.on_entry, field.on_entry)
%td
= nonblank(ae_value.on_exit, field.on_exit)
%td
= nonblank(ae_value.on_error, field.on_error)
%td
= nonblank(ae_value.max_retries, field.max_retries)
%td
= nonblank(ae_value.max_time, field.max_time)
%td
= nonblank(ae_value.collect, field.collect)
%td
= nonblank(ae_value.max_retries, field.max_retries)
%td
= nonblank(ae_value.max_time, field.max_time)
%td
= field.message

Expand Down
66 changes: 45 additions & 21 deletions app/views/miq_ae_class/_instance_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@
%hr
%h3= _('Fields')
%table.table.table-striped.table-bordered
- state_class = state_class?(@edit[:ae_class_id])
%thead
%tr
%th= _('Name')
%th= _('Value')
%th= _('On Entry')
%th= _('On Exit')
%th= _('On Error')
- if state_class
%th= _('On Entry')
%th= _('On Exit')
%th= _('On Error')
%th= _('Max Retries')
%th= _('Max Time')
%th= _('Collect')
%tbody
- @edit[:new][:ae_values].each_with_index do |flds, i|
- non_state_field = @edit[:new][:ae_fields][i]["aetype"] != "state"
%tr
- glyphicon = @edit[:new][:ae_fields][i]["substitute"] ? "pficon pficon-ok" : "pficon pficon-close"
%td.text-nowrap
Expand Down Expand Up @@ -77,27 +82,46 @@
flds["value"].blank? ? '' : flds["value"],
:placeholder => default_value,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["on_entry"]
= text_field_tag("#{prefix}inst_on_entry_#{i}",
flds["on_entry"].blank? ? '' : flds["on_entry"],
:placeholder => default_value,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["on_exit"]
= text_field_tag("#{prefix}inst_on_exit_#{i}",
flds["on_exit"].blank? ? '' : flds["on_exit"],
:placeholder => default_value,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["on_error"]
= text_field_tag("#{prefix}inst_on_error_#{i}",
flds["on_error"].blank? ? '' : flds["on_error"],
:placeholder => default_value,
"data-miq_observe" => obs)
- if state_class
%td
- default_value = @edit[:new][:ae_fields][i]["on_entry"]
= text_field_tag("#{prefix}inst_on_entry_#{i}",
flds["on_entry"].blank? ? '' : flds["on_entry"],
:placeholder => default_value,
:disabled => non_state_field,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["on_exit"]
= text_field_tag("#{prefix}inst_on_exit_#{i}",
flds["on_exit"].blank? ? '' : flds["on_exit"],
:placeholder => default_value,
:disabled => non_state_field,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["on_error"]
= text_field_tag("#{prefix}inst_on_error_#{i}",
flds["on_error"].blank? ? '' : flds["on_error"],
:placeholder => default_value,
:disabled => non_state_field,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["max_retries"]
= text_field_tag("#{prefix}inst_max_retries_#{i}",
flds["max_retries"].blank? ? '' : flds["max_retries"],
:placeholder => default_value,
:disabled => non_state_field,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["max_time"]
= text_field_tag("#{prefix}inst_max_time_#{i}",
flds["max_time"].blank? ? '' : flds["max_time"],
:placeholder => default_value,
:disabled => non_state_field,
"data-miq_observe" => obs)
%td
- default_value = @edit[:new][:ae_fields][i]["collect"]
= text_field_tag("#{prefix}inst_collect_#{i}",
flds["collect"].blank? ? '' : flds["collect"],
:placeholder => default_value,
:disabled => !%w(relationship state).include?(@edit[:new][:ae_fields][i]["aetype"]),
"data-miq_observe" => obs)