Skip to content

Commit

Permalink
Clean up and delete the code related to the old provider forms
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Aug 10, 2020
1 parent f725e29 commit b2b16d7
Show file tree
Hide file tree
Showing 27 changed files with 10 additions and 5,097 deletions.

This file was deleted.

14 changes: 0 additions & 14 deletions app/controllers/ems_block_storage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsBlockStorageController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::BreadcrumbsMixin

Expand All @@ -23,19 +22,6 @@ def breadcrumb_name(_model)
_('Block Storage Managers')
end

def ems_path(*args)
path_hash = {:action => 'show', :id => args[0].id.to_s }
path_hash.merge(args[1])
end

def new_ems_path
{:action => 'new'}
end

def ems_storage_form_fields
ems_form_fields
end

# Show the main MS list view
def show_list
opts = {:supported_features_filter => "supports_block_storage?",
Expand Down
15 changes: 1 addition & 14 deletions app/controllers/ems_cloud_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsCloudController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon # common methods for EmsInfra/Cloud controllers
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::DashboardViewMixin
include Mixins::BreadcrumbsMixin
Expand Down Expand Up @@ -34,21 +33,9 @@ def show
super
end

def ems_path(*args)
ems_cloud_path(*args)
end

def new_ems_path
new_ems_cloud_path
end

def ems_cloud_form_fields
ems_form_fields
end

# Special EmsCloud link builder for restful routes
def show_link(ems, options = {})
ems_path(ems.id, options)
ems_cloud_path(ems.id, options)
end

def restful?
Expand Down
88 changes: 2 additions & 86 deletions app/controllers/ems_container_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsContainerController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon # common methods for EmsInfra/Cloud/Container controllers
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::DashboardViewMixin
include ContainersExternalLoggingSupportMixin
Expand Down Expand Up @@ -31,89 +30,6 @@ def show
super
end

def ems_path(*args)
ems_container_path(*args)
end

def new_ems_path
new_ems_container_path
end

def ems_container_form_fields
ems_form_fields
end

def update
assert_privileges("#{permission_prefix}_edit")
if params[:button] == "detect"
update_ems_button_detect
else
super
end
end

def create
assert_privileges("#{permission_prefix}_new")
if params[:button] == "detect"
create_ems_button_detect
else
super
end
end

def create_ems_button_detect
ems = model.model_from_emstype(params[:emstype]).new
update_ems_button_detect(ems)
end

def update_ems_button_detect(verify_ems = nil)
route_type = if params[:current_tab] == "alerts"
"prometheus_alerts"
else
params[:metrics_selection]
end

verify_ems ||= find_record_with_rbac(model, params[:id])
set_ems_record_vars(verify_ems, :validate)
@in_a_form = true

begin
raise "Route detection not applicable for provider type" unless verify_ems.respond_to?(:hostname_for_service)

result = verify_ems.hostname_for_service(route_type)
add_flash(_("Route Detection: success"))
rescue StandardError => e
$log.warn("MIQ(#{controller_name}_controller-#{action_name}): get_hostname_from_routes error: #{e.message}")
add_flash(_("Route Detection: failure [%{details}]") % {:details => e.message}, :error)
end

render :json => {
:message => @flash_array.last[:message],
:level => @flash_array.last[:level],
:hostname => result
}
end

def retrieve_metrics_selection
if @ems.connection_configurations.try(:prometheus)
"prometheus"
elsif @ems.connection_configurations.try(:hawkular)
"hawkular"
else
"disabled"
end
end

def retrieve_alerts_selection
return "disabled" if @ems.connection_configurations.try(:prometheus_alerts).nil?

"prometheus"
end

def retrieve_virtualization_selection
@ems.connection_configurations.try(:kubevirt).nil? ? "disabled" : "kubevirt"
end

def restful?
true
end
Expand All @@ -126,9 +42,9 @@ def textual_group_list
helper_method :textual_group_list

############################
# Special EmsCloud link builder for restful routes
# Special EmsContainer link builder for restful routes
def show_link(ems, options = {})
ems_path(ems.id, options)
ems_container_path(ems.id, options)
end

def breadcrumbs_options
Expand Down
22 changes: 2 additions & 20 deletions app/controllers/ems_infra_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsInfraController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon # common methods for EmsInfra/Cloud controllers
include Mixins::EmsCommon::Angular
include Mixins::DashboardViewMixin
include Mixins::BreadcrumbsMixin

Expand Down Expand Up @@ -33,14 +32,6 @@ def show
super
end

def ems_path(*args)
ems_infra_path(*args)
end

def new_ems_path
new_ems_infra_path
end

def show_list
@showtype = nil
super
Expand All @@ -50,11 +41,6 @@ def index
redirect_to(:action => 'show_list')
end

def new
@disabled_ems_infra_types = [%w[KubeVirt kubevirt]]
super
end

def scaling
assert_privileges("ems_infra_scale")

Expand Down Expand Up @@ -219,10 +205,6 @@ def open_admin_ui_done
end
end

def ems_infra_form_fields
ems_form_fields
end

def restful?
true
end
Expand All @@ -243,9 +225,9 @@ def record_class
end

############################
# Special EmsCloud link builder for restful routes
# Special EmsInfra link builder for restful routes
def show_link(ems, options = {})
ems_path(ems.id, options)
ems_infra_path(ems.id, options)
end

def update_stack_up(stack, stack_parameters, provider_id, return_message)
Expand Down
13 changes: 0 additions & 13 deletions app/controllers/ems_network_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsNetworkController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::BreadcrumbsMixin

Expand All @@ -19,18 +18,6 @@ def self.table_name
@table_name ||= "ems_network"
end

def ems_path(*args)
ems_network_path(*args)
end

def new_ems_path
{:action => 'new'}
end

def ems_network_form_fields
ems_form_fields
end

def restful?
true
end
Expand Down
14 changes: 0 additions & 14 deletions app/controllers/ems_object_storage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsObjectStorageController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::BreadcrumbsMixin

Expand All @@ -23,26 +22,13 @@ def breadcrumb_name(_model)
_('Object Storage Managers')
end

def ems_path(*args)
path_hash = {:action => 'show', :id => args[0].id.to_s }
path_hash.merge(args[1])
end

def show_list
opts = {:supported_features_filter => "supports_object_storage?",
:layout => "ems_storage",
:model => model}
process_show_list(opts)
end

def new_ems_path
{:action => 'new'}
end

def ems_storage_form_fields
ems_form_fields
end

def breadcrumbs_options
{
:breadcrumbs => [
Expand Down
32 changes: 1 addition & 31 deletions app/controllers/ems_physical_infra_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsPhysicalInfraController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon # common methods for EmsInfra/Cloud controllers
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::DashboardViewMixin
include Mixins::BreadcrumbsMixin
Expand All @@ -20,35 +19,6 @@ def self.table_name
@table_name ||= "ems_physical_infra"
end

def ems_path(*args)
ems_physical_infra_path(*args)
end

def new_ems_path
new_ems_physical_infra_path
end

def ems_physical_infra_form_fields
assert_privileges("#{permission_prefix}_edit")
@ems = model.new if params[:id] == 'new'
@ems = find_record_with_rbac(model, params[:id]) if params[:id] != 'new'

render :json => {
:name => @ems.name,
:emstype => @ems.emstype,
:zone => zone,
:provider_id => @ems.provider_id || "",
:hostname => @ems.hostname,
:default_hostname => @ems.connection_configurations.default.endpoint.hostname,
:default_api_port => @ems.connection_configurations.default.endpoint.port,
:provider_region => @ems.provider_region,
:default_userid => @ems.authentication_userid || "",
:ems_controller => controller_name,
:default_auth_status => default_auth_status,
:default_security_protocol => @ems.security_protocol || "",
}
end

def display_physical_servers_with_host
nested_list(PhysicalServer, :named_scope => :with_hosts, :breadcrumb_title => _("Physical Servers with Host"))
end
Expand Down Expand Up @@ -80,7 +50,7 @@ def restful?
############################
# Special EmsCloud link builder for restful routes
def show_link(ems, options = {})
ems_path(ems.id, options)
ems_physical_infra_path(ems.id, options)
end

def breadcrumbs_options
Expand Down
14 changes: 0 additions & 14 deletions app/controllers/ems_storage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class EmsStorageController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::EmsCommon
include Mixins::EmsCommon::Angular
include Mixins::GenericSessionMixin
include Mixins::BreadcrumbsMixin

Expand All @@ -19,19 +18,6 @@ def self.table_name
@table_name ||= "ems_storage"
end

def ems_path(*args)
path_hash = {:action => 'show', :id => args[0].id.to_s }
path_hash.merge(args[1])
end

def new_ems_path
{:action => 'new'}
end

def ems_storage_form_fields
ems_form_fields
end

TYPE_CHECK_SHOW_IDENTIFIERS = %w[ems_storage_show].freeze

def check_generic_rbac
Expand Down
Loading

0 comments on commit b2b16d7

Please sign in to comment.