Skip to content

Commit d9ead32

Browse files
authored
Merge pull request #9467 from GilbertCherrie/fix_button_form
Fix button form
2 parents 4913865 + e586f2e commit d9ead32

File tree

4 files changed

+131
-8
lines changed

4 files changed

+131
-8
lines changed

app/stylesheet/ddf_override.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,13 @@
516516
margin-top: 40px;
517517
}
518518
}
519+
520+
.object-attribute {
521+
display: inline-flex;
522+
width: 100%;
523+
524+
.attribute-label {
525+
margin-left: 25%;
526+
margin-right: 5%;
527+
}
528+
}
Lines changed: 120 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,121 @@
1+
- field_changed_url ||= "form_field_changed"
2+
- ae_sim_form ||= false
3+
- ae_custom_button ||= false
4+
- ae_ansible_custom_button ||= false
15
- rec_id = @edit && @edit[:action_id].present? ? @edit[:action_id] : "new"
2-
- url = "/miq_ae_tools/resolve_automate_simulation/#{rec_id}"
3-
= react('AutomateSimulationForm',
4-
:resolve => resolve,
5-
:maxNameLength => ViewHelper::MAX_NAME_LEN,
6-
:url => url,
7-
:attrValuesPairs => ApplicationController::AE_MAX_RESOLUTION_FIELDS.times,
8-
:maxLength => ViewHelper::MAX_NAME_LEN)
6+
#main-div
7+
- if ae_sim_form
8+
- url = "/miq_ae_tools/resolve_automate_simulation/#{rec_id}"
9+
= react('AutomateSimulationForm',
10+
:resolve => resolve,
11+
:maxNameLength => ViewHelper::MAX_NAME_LEN,
12+
:url => url,
13+
:attrValuesPairs => ApplicationController::AE_MAX_RESOLUTION_FIELDS.times,
14+
:maxLength => ViewHelper::MAX_NAME_LEN)
15+
- else
16+
- url = url_for_only_path(:action => field_changed_url, :id => rec_id)
17+
.form
18+
- if form_action == "ae_resolve" && !ae_ansible_custom_button
19+
%h3
20+
= _("Object Details")
21+
.form-group
22+
%label.control-label
23+
= _("System/Process")
24+
25+
= select_tag('instance_name',
26+
options_for_select(resolve[:instance_names].sort_by(&:downcase),
27+
resolve[:new][:instance_name]),
28+
"data-miq_sparkle_on" => true,
29+
"data-miq_sparkle_off" => true,
30+
:class => "selectpicker form-control")
31+
:javascript
32+
miqInitSelectPicker();
33+
miqSelectPickerEvent('instance_name', "#{url}")
34+
- unless ae_ansible_custom_button
35+
.form-group
36+
%label.control-label
37+
= _("Message")
38+
39+
= text_field_tag("object_message",
40+
resolve[:new][:object_message],
41+
:maxlength => ViewHelper::MAX_NAME_LEN,
42+
:class => "form-control form-control",
43+
"data-miq_observe" => {:interval => '.5',
44+
:url => url}.to_json)
45+
= javascript_tag("if (!$('#description').length) #{javascript_focus('object_message')}")
46+
.form-group
47+
%label.control-label
48+
= _("Request")
49+
50+
= text_field_tag("object_request",
51+
resolve[:new][:object_request],
52+
:maxlength => ViewHelper::MAX_NAME_LEN,
53+
:class => "form-control form-control",
54+
"data-miq_observe" => {:interval => '.5', :url => url}.to_json)
55+
- if form_action != "miq_action"
56+
- if ae_custom_button
57+
%hr
58+
%h3
59+
= _("Object Attribute")
60+
.form-horizontal
61+
.form-group.object-attribute
62+
%label.attribute-label
63+
= _("Type")
64+
.attribute-value
65+
= ui_lookup(:model => @resolve[:target_class])
66+
- else
67+
%hr
68+
%h3
69+
= _("Object Attribute")
70+
.form
71+
.form-group
72+
%label.control-label
73+
= _("Type")
74+
%hr
75+
= select_tag('target_class',
76+
options_for_select([["<#{_('None')}>", nil]] + resolve[:target_classes].invert.to_a,
77+
resolve[:new][:target_class]),
78+
"data-miq_sparkle_on" => true,
79+
"data-miq_sparkle_off" => true,
80+
:class => "selectpicker form-control")
81+
:javascript
82+
miqInitSelectPicker();
83+
miqSelectPickerEvent('target_class', "#{url}")
84+
- if resolve[:new][:target_class] && !resolve[:new][:target_class].blank? && resolve[:targets]
85+
.form-group
86+
%label.control-label
87+
= _("Selection")
88+
89+
= select_tag('target_id',
90+
options_for_select([["<#{_('Choose')}>", nil]] + resolve[:targets],
91+
resolve[:new][:target_id]),
92+
"data-miq_sparkle_on" => true,
93+
"data-miq_sparkle_off" => true,
94+
:class => "selectpicker form-control")
95+
:javascript
96+
miqInitSelectPicker();
97+
miqSelectPickerEvent('target_id', "#{url}")
98+
%hr
99+
%h3
100+
= _("Attribute/Value Pairs")
101+
.form-horizontal
102+
- ApplicationController::AE_MAX_RESOLUTION_FIELDS.times do |i|
103+
- f = "attribute_" + (i + 1).to_s
104+
- v = "value_" + (i + 1).to_s
105+
.form-group
106+
%label.col-md-2.control-label
107+
= (i + 1).to_s
108+
.col-md-4
109+
= text_field_tag(f,
110+
resolve[:new][:attrs][i][0],
111+
:maxlength => ViewHelper::MAX_NAME_LEN,
112+
:class => "form-control",
113+
"data-miq_observe" => {:interval => '.5',
114+
:url => url}.to_json)
115+
.col-md-4
116+
= text_field_tag(v,
117+
resolve[:new][:attrs][i][1],
118+
:maxlength => ViewHelper::MAX_NAME_LEN,
119+
:class => "form-control",
120+
"data-miq_observe" => {:interval => '.5',
121+
:url => url}.to_json)

app/views/miq_ae_tools/resolve_react.html.haml

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/views/shared/buttons/_ab_form.html.haml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
= render :partial => "layouts/flash_msg"
12
#ab_form
23
#custom_button_tabs
34
%ul.nav.nav-tabs{'role' => 'tablist'}

0 commit comments

Comments
 (0)