Skip to content

Commit

Permalink
Replace the old network provider forms with the DDF-based ProviderForm
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed May 29, 2020
1 parent 590486b commit eb52249
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
4 changes: 4 additions & 0 deletions app/helpers/ems_network_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module EmsNetworkHelper
include_concern 'TextualSummary'

def edit_redirect_path(lastaction, ems)
lastaction == 'show_list' ? ems_networks_path : ems_network_path(ems)
end
end
20 changes: 1 addition & 19 deletions app/views/ems_network/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
- url = url_for_only_path(:controller => 'ems_network', :action => 'update', :id => (@ems.id || 'new'))
= form_for(@ems,
:url => url,
:method => :post,
:html => {"ng-controller" => "emsCommonFormController",
"name" => "angularForm",
"ng-show" => "afterGet",
"update-url" => url,
"form-fields-url" => "/#{controller_name}/ems_network_form_fields/",
"novalidate" => true}) do |f|
%input{:type => 'hidden', :id => "form_id", :value => "##{f.options[:html][:id]}"}
%input{:type => 'hidden', :id => "button_name", :name => "button", :value => "save"}
%input{:type => 'hidden', :id => "cred_type", :name => "cred_type", :value => "default"}
= render :partial => "shared/views/ems_common/angular/form"

:javascript
ManageIQ.angular.app.value('emsCommonFormId', '#{@ems.id || "new"}');
miq_bootstrap($('#form_id').val());

= react('ProviderForm', :providerId => @ems.id.to_s, :redirect => edit_redirect_path(@lastaction, @ems), :kind => 'network', :title => ui_lookup(:model => 'ManageIQ::Providers::NetworkManager'))
21 changes: 1 addition & 20 deletions app/views/ems_network/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
- url = url_for_only_path(:controller => 'ems_network', :action => 'create', :id => (@ems.id || 'new'))
= form_for(@ems,
:url => url,
:method => :post,
:html => {"ng-controller" => "emsCommonFormController",
"name" => "angularForm",
"ng-show" => "afterGet",
"create-url" => url,
"form-fields-url" => "/#{controller_name}/ems_network_form_fields/",
"novalidate" => true}) do |f|
%input{:type => 'hidden', :id => "form_id", :value => "##{f.options[:html][:id]}"}
%input{:type => 'hidden', :id => "button_name", :name => "button", :value => "add"}
%input{:type => 'hidden', :id => "cred_type", :name => "cred_type", :value => "default"}

= render :partial => "shared/views/ems_common/angular/form"

:javascript
ManageIQ.angular.app.value('emsCommonFormId', '#{@ems.id || "new"}');
miq_bootstrap($('#form_id').val());

= react('ProviderForm', :redirect => ems_networks_path, :kind => 'network', :title => ui_lookup(:model => 'ManageIQ::Providers::NetworkManager'))

0 comments on commit eb52249

Please # to comment.