-
Notifications
You must be signed in to change notification settings - Fork 356
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
Configuration manager non explorer version #6782
Changes from all commits
6173e3a
006f335
09277ae
c0aacb3
ba12336
e9f011f
f432d05
c67e3cb
126a2be
dd14060
c40dd5e
a96ff9d
88ae1db
a22109d
5e1a1aa
2a09746
694bf6b
b4ae380
4932109
689ccf7
19ab37e
5241991
34e0b77
68d5bc7
af486f6
905f193
3e7c4f7
af02511
8790311
b9962af
1003ca0
87844e2
3f8593e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
class ConfigurationProfileController < ApplicationController | ||
include Mixins::GenericListMixin | ||
himdel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
include Mixins::GenericShowMixin | ||
include Mixins::GenericSessionMixin | ||
include Mixins::BreadcrumbsMixin | ||
|
||
before_action :check_privileges | ||
before_action :get_session_data | ||
after_action :cleanup_action | ||
after_action :set_session_data | ||
|
||
def self.display_methods | ||
%w[configured_systems] | ||
end | ||
|
||
def button | ||
@edit = session[:edit] # Restore @edit for adv search box | ||
params[:display] = @display if display_methods.include?(@display) # Were we displaying nested list | ||
|
||
# Handle Toolbar Policy Tag Button | ||
@refresh_div = "main_div" # Default div for button.rjs to refresh | ||
|
||
if params[:pressed].starts_with?("configured_system_") # Handle buttons from sub-items screen | ||
tag(ConfiguredSystem) if params[:pressed] == "configured_system_tag" | ||
provision if params[:pressed] == "configured_system_provision" | ||
end | ||
|
||
if @refresh_div == "main_div" && @lastaction == "show_list" | ||
replace_gtl_main_div | ||
else | ||
render_flash unless performed? | ||
end | ||
end | ||
|
||
def show_list | ||
opts = {:no_checkboxes => true} | ||
process_show_list(opts) | ||
end | ||
|
||
private | ||
|
||
def breadcrumbs_options | ||
{ | ||
:breadcrumbs => [ | ||
{:title => _("Configuration Profile")}, | ||
{:title => _("Profiles"), :url => controller_url}, | ||
], | ||
} | ||
end | ||
|
||
menu_section :conf | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class ConfiguredSystemController < ApplicationController | ||
include Mixins::GenericListMixin | ||
include Mixins::GenericShowMixin | ||
include Mixins::GenericSessionMixin | ||
include Mixins::BreadcrumbsMixin | ||
include Mixins::ManagerControllerMixin | ||
|
||
before_action :check_privileges | ||
before_action :get_session_data | ||
after_action :cleanup_action | ||
after_action :set_session_data | ||
|
||
def self.table_name | ||
@table_name ||= "configured_system" | ||
end | ||
|
||
def button | ||
@edit = session[:edit] # Restore @edit for adv search box | ||
|
||
# Handle Toolbar Policy Tag Button | ||
@refresh_div = "main_div" # Default div for button.rjs to refresh | ||
model = self.class.model | ||
tag(model) if params[:pressed] == "configured_system_tag" | ||
provision if params[:pressed] == "configured_system_provision" | ||
render_flash unless performed? | ||
end | ||
|
||
def show_list | ||
options = {:named_scope => :under_configuration_managers} | ||
process_show_list(options) | ||
end | ||
|
||
private | ||
|
||
def textual_group_list | ||
[%i[properties relationships environment], %i[os tenancy tags]] | ||
end | ||
helper_method :textual_group_list | ||
|
||
def breadcrumbs_options | ||
{ | ||
:breadcrumbs => [ | ||
{:title => _("Configuration Management")}, | ||
{:title => _("Configured Systems"), :url => controller_url}, | ||
], | ||
} | ||
end | ||
|
||
menu_section :conf | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
class EmsConfigurationController < ApplicationController | ||
include Mixins::GenericListMixin | ||
include Mixins::GenericShowMixin | ||
include Mixins::GenericSessionMixin | ||
include Mixins::BreadcrumbsMixin | ||
include Mixins::GenericFormMixin | ||
include Mixins::ManagerControllerMixin | ||
include Mixins::FindRecord | ||
|
||
before_action :check_privileges | ||
before_action :get_session_data | ||
after_action :cleanup_action | ||
after_action :set_session_data | ||
|
||
def self.model | ||
ManageIQ::Providers::ConfigurationManager | ||
end | ||
|
||
def self.table_name | ||
@table_name ||= "ems_configuration" | ||
end | ||
|
||
def self.display_methods | ||
%w[configuration_profiles configured_systems] | ||
end | ||
|
||
def button | ||
@edit = session[:edit] # Restore @edit for adv search box | ||
params[:display] = @display if display_methods.include?(@display) # Were we displaying nested list | ||
|
||
# Handle Toolbar Policy Tag Button | ||
@refresh_div = "main_div" # Default div for button.rjs to refresh | ||
model = self.class.model | ||
tag(model) if params[:pressed] == "#{params[:controller]}_tag" | ||
return if ["#{params[:controller]}_tag"].include?(params[:pressed]) && @flash_array.nil? # Tag screen showing | ||
|
||
if params[:pressed].starts_with?("configured_system_") # Handle buttons from sub-items screen | ||
tag(ConfiguredSystem) if params[:pressed] == "configured_system_tag" | ||
provision if params[:pressed] == "configured_system_provision" | ||
end | ||
|
||
case params[:pressed] | ||
when 'ems_configuration_edit_provider' | ||
edit | ||
when 'ems_configuration_add_provider' | ||
new | ||
when "ems_configuration_refresh_provider" | ||
refresh | ||
when "ems_configuration_delete_provider" | ||
delete | ||
end | ||
|
||
if single_delete_test | ||
single_delete_redirect | ||
elsif (params[:pressed].ends_with?("_edit_provider") || params[:pressed] == "ems_configuration_add_provider") && @flash_array.nil? | ||
if @flash_array | ||
show_list | ||
replace_gtl_main_div | ||
else | ||
javascript_redirect(:action => @refresh_partial, :id => @redirect_id) | ||
end | ||
elsif @refresh_div == "main_div" && @lastaction == "show_list" | ||
replace_gtl_main_div | ||
else | ||
render_flash unless performed? | ||
end | ||
end | ||
|
||
private | ||
|
||
def self.model_to_name(_provmodel) | ||
Dictionary.gettext('ems_configuration', :type => :ui_title, :translate => false) | ||
end | ||
|
||
def manager_prefix | ||
"configuration_manager" | ||
end | ||
|
||
def privilege_prefix | ||
"ems_configuration" | ||
end | ||
|
||
def refresh | ||
assert_privileges("ems_configuration_refresh_provider") | ||
manager_button_operation('refresh_ems', _('Refresh')) | ||
end | ||
|
||
def concrete_model | ||
ManageIQ::Providers::ConfigurationManager | ||
end | ||
|
||
def provider_class | ||
ManageIQ::Providers::Foreman::Provider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is Foreman still here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fryguy This is still here because currently UI does not have a type drop down in Add a new Provider form, i was hoping once we have new Data driven Provider form in place we will have a type drop down for user to select what type of Provider they want to add with their respective fields. Do you think i should i add a Type drop down on the Add form, if yes, what should be the options, then we can change this code to use value from the type field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we do it for other providers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is this related to the problem with the Provider model vs ExtManagementSystem model? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. other provider have a type field on the form, based upon the type selected a Provider object is created. I am working on adding a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a point to all this? Consider that for now Foreman::Provider is precisely the class this controller needs. None of this code should exists in the first place, aren't we just wasting time that could be spent on finishing the proper way of doing that via the API? (I mean, introducing little tech debt is probably cheaper than designing technical debt to introduce :) .) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @h-kataria happy to help add permissions and supported_for_create to the provider, would rather that than hard coding Foreman There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these are meant to be temporary, then I'm fine with that, especially as the goal is to move towards pluggable DDF for this feature.
Isn't that what we are doing with this discussion? It's clear there's a general design issue with respect to provider/manager split, so discussing it is something we need to do anyway for the API. It helps to have that discussion in context with the code that is actually consuming it, hence me bringing in @agrare, as he has some opinions on how best to deal with the provider/manager split. Also this thread started as me noticing Foreman in the code when the purpose of the PR is to remove Foreman from the code, so it stood out. It's not clear from the code that the purpose for the method is to drive the drop-down for adding a new provider. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line of code in question does not drive the drop-down as currently there is no Type drop-down in the UI. Currently users can only add a Foreman Provider and this line is providing class for the new record, when the Add button is UI is pressed. |
||
end | ||
|
||
def breadcrumbs_options | ||
{ | ||
:breadcrumbs => [ | ||
{:title => _("Configuration Management")}, | ||
{:title => _("Providers"), :url => controller_url}, | ||
], | ||
} | ||
end | ||
|
||
def set_redirect_vars | ||
@in_a_form = true | ||
@redirect_controller = "ems_configuration" | ||
@redirect_id = @provider_manager.id if @provider_manager.try(:id) | ||
@refresh_partial = @provider_manager.try(:id) ? "edit" : "new" | ||
end | ||
|
||
menu_section :conf | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be
configuration_manager
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no,
configuration_manger
is no longer an explorer controller but shares some code withautomation_manager
controller and that is explorer style screen, so i need to add this here so i can redirect appropriately from shared methods.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, right