Skip to content

Commit

Permalink
Merge pull request #12205 from moolitayer/datawarehouse
Browse files Browse the repository at this point in the history
Adding Datawarehouse management
  • Loading branch information
blomquisg authored Nov 29, 2016
2 parents 9f2034c + 04e5ef6 commit 7c4063d
Show file tree
Hide file tree
Showing 48 changed files with 1,011 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
$scope.emsCommonModel.metrics_password != '' && $scope.angularForm.metrics_password.$valid &&
$scope.emsCommonModel.metrics_verify != '' && $scope.angularForm.metrics_verify.$valid)) {
return true;
} else if(($scope.currentTab == "default" &&
($scope.emsCommonModel.ems_controller == "ems_container" || $scope.emsCommonModel.ems_controller == "ems_middleware")) &&
} else if($scope.currentTab == "default" &&
["ems_container", "ems_middleware", "ems_datawarehouse" ].indexOf($scope.emsCommonModel.ems_controller) >= 0 &&
($scope.emsCommonModel.emstype) &&
($scope.emsCommonModel.default_hostname != '' && $scope.emsCommonModel.default_api_port) &&
($scope.emsCommonModel.default_password != '' && $scope.angularForm.default_password.$valid) &&
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,8 @@ def render_or_redirect_partial(pfx)
javascript_redirect edit_ems_container_path(params[:id])
elsif params[:pressed] == "ems_middleware_edit" && params[:id]
javascript_redirect edit_ems_middleware_path(params[:id])
elsif params[:pressed] == "ems_datawarehouse_edit" && params[:id]
javascript_redirect edit_ems_datawarehouse_path(params[:id])
elsif params[:pressed] == "ems_network_edit" && params[:id]
javascript_redirect edit_ems_network_path(params[:id])
elsif %w(arbitration_profile_edit arbitration_profile_new).include?(params[:pressed]) && params[:id]
Expand Down
47 changes: 47 additions & 0 deletions app/controllers/ems_datawarehouse_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class EmsDatawarehouseController < ApplicationController
include EmsCommon
include Mixins::EmsCommonAngular

before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data

def self.model
ManageIQ::Providers::DatawarehouseManager
end

def self.table_name
@table_name ||= "ems_datawarehouse"
end

def index
redirect_to :action => 'show_list'
end

def show_link(ems, options = {})
ems_datawarehouse_path(ems.id, options)
end

def ems_path(*args)
ems_datawarehouse_path(*args)
end

def listicon_image(item, _view)
item.decorate.try(:listicon_image)
end

def new_ems_path
new_ems_datawarehouse_path
end

def restful?
true
end

def ems_datawarehouse_form_fields
ems_form_fields
end

menu_section :dwh
end
22 changes: 21 additions & 1 deletion app/controllers/mixins/ems_common_angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ def ems_form_fields
:ems_controller => controller_name,
:default_auth_status => default_auth_status,
} if controller_name == "ems_middleware"

render :json => {:name => @ems.name,
:emstype => @ems.emstype,
:zone => zone,
:default_hostname => @ems.connection_configurations.default.endpoint.hostname,
:default_api_port => @ems.connection_configurations.default.endpoint.port,
:service_account => service_account ? service_account : "",
:bearer_token_exists => @ems.authentication_token(:bearer).nil? ? false : true,
:ems_controller => controller_name,
:default_auth_status => default_auth_status,
} if controller_name == "ems_datawarehouse"
end

private ############################
Expand Down Expand Up @@ -402,7 +413,12 @@ def set_ems_record_vars(ems, mode = nil)
hawkular_endpoint = {:role => :hawkular, :hostname => hawkular_hostname, :port => hawkular_api_port}
end

if ems.kind_of?(ManageIQ::Providers::Hawkular::MiddlewareManager)
if ems.kind_of?(ManageIQ::Providers::MiddlewareManager)
default_endpoint = {:role => :default, :hostname => hostname, :port => port}
end

if ems.kind_of?(ManageIQ::Providers::Hawkular::DatawarehouseManager)
params[:cred_type] = ems.default_authentication_type
default_endpoint = {:role => :default, :hostname => hostname, :port => port}
end

Expand Down Expand Up @@ -480,6 +496,10 @@ def build_credentials(ems, mode)
creds[:bearer] = {:auth_key => default_key, :save => (mode != :validate)}
creds.delete(:default)
end
if ems.kind_of?(ManageIQ::Providers::DatawarehouseManager)
default_key = params[:default_password] ? params[:default_password] : ems.authentication_key
creds[:default] = {:auth_key => default_key, :userid => "_", :save => (mode != :validate)}
end
creds
end

Expand Down
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def view_to_url(view, parent = nil)
if controller == "ems_middleware" && action == "show"
return ems_middlewares_path
end
if controller == "ems_datawarehouse" && action == "show"
return ems_datawarehouses_path
end
if controller == "ems_network" && action == "show"
return ems_networks_path
end
Expand Down Expand Up @@ -1311,6 +1314,7 @@ def render_listnav_filename
ems_cloud
ems_cluster
ems_container
ems_datawarehouse
ems_infra
ems_middleware
ems_network
Expand Down Expand Up @@ -1376,6 +1380,7 @@ def render_listnav_filename
ems_cloud
ems_cluster
ems_container
ems_datawarehouse
ems_infra
ems_middleware
ems_network
Expand Down
80 changes: 80 additions & 0 deletions app/helpers/application_helper/toolbar/ems_datawarehouse_center.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
class ApplicationHelper::Toolbar::EmsDatawarehouseCenter < ApplicationHelper::Toolbar::Basic
button_group('ems_datawarehouse_vmdb', [
select(
:ems_datawarehouse_vmdb_choice,
'fa fa-cog fa-lg',
t = N_('Configuration'),
t,
:items => [
button(
:ems_datawarehouse_refresh,
'fa fa-refresh fa-lg',
N_('Refresh items and relationships related to this Datawarehouse Provider'),
N_('Refresh items and relationships'),
:confirm => N_("Refresh items and relationships related to this Datawarehouse Provider?")),
separator,
button(
:ems_datawarehouse_edit,
'pficon pficon-edit fa-lg',
t = N_('Edit this Datawarehouse Provider'),
t),
button(
:ems_datawarehouse_delete,
'pficon pficon-delete fa-lg',
t = N_('Remove this Datawarehouse Provider'),
t,
:url_parms => "&refresh=y",
:confirm => N_("Warning: This Datawarehouse Provider and ALL" \
" of its components will be permanently removed!")),
]
),
])
button_group('ems_datawarehouse_monitoring', [
select(
:ems_datawarehouser_monitoring_choice,
'product product-monitoring fa-lg',
t = N_('Monitoring'),
t,
:items => [
button(
:ems_datawarehouse_timeline,
'product product-timeline fa-lg',
N_('Show Timelines for this Datawarehouse Provider'),
N_('Timelines'),
:url_parms => "?display=timeline"),
]
),
])
button_group('ems_datawarehouse_policy', [
select(
:ems_datawarehouse_policy_choice,
'fa fa-shield fa-lg',
t = N_('Policy'),
t,
:items => [
button(
:ems_datawarehouse_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for this Datawarehouse Provider'),
N_('Edit Tags')),
]
),
])
button_group('ems_datawarehouse_authentication', [
select(
:ems_datawarehouse_authentication_choice,
'fa fa-lock fa-lg',
t = N_('Authentication'),
t,
:items => [
button(
:ems_datawarehouse_recheck_auth_status,
'fa fa-search fa-lg',
N_("Re-check Authentication Status for this #{ui_lookup(:table=>'ems_datawarehouse')}"),
N_('Re-check Authentication Status'),
:klass => ApplicationHelper::Button::GenericFeatureButton,
:options => {:feature => :authentication_status}),
]
),
])
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
class ApplicationHelper::Toolbar::EmsDatawarehousesCenter < ApplicationHelper::Toolbar::Basic
button_group('ems_datawarehouse_vmdb', [
select(
:ems_datawarehouse_vmdb_choice,
'fa fa-cog fa-lg',
t = N_('Configuration'),
t,
:items => [
button(
:ems_datawarehouse_refresh,
'icon fa fa-refresh fa-lg',
N_('Refresh Items and Relationships for these Datawarehouse Providers'),
N_('Refresh Items and Relationships'),
:confirm => N_("Refresh Items and Relationships related to these Datawarehouse Providers?"),
:enabled => false,
:url_parms => "main_div",
:onwhen => "1+"),
separator,
button(
:ems_datawarehouse_new,
'pficon pficon-add-circle-o fa-lg',
t = N_('Add a New Datawarehouse Provider'),
t,
:url => "/new"),
button(
:ems_datawarehouse_edit,
'pficon pficon-edit fa-lg',
N_('Select a single Datawarehouse Providers to edit'),
N_('Edit Selected Datawarehouse Providers'),
:url_parms => "main_div",
:enabled => false,
:onwhen => "1"),
button(
:ems_datawarehouse_delete,
'pficon pficon-delete fa-lg',
N_('Remove selected Datawarehouse Providers'),
N_('Remove Datawarehouse Providers'),
:url_parms => "main_div",
:confirm => N_("Warning: The selected Datawarehouse Providers and ALL " \
"of their components will be permanently removed!"),
:enabled => false,
:onwhen => "1+"),
]
),
])
button_group('ems_datawarehouse_policy', [
select(
:ems_datawarehouse_policy_choice,
'fa fa-shield fa-lg',
t = N_('Policy'),
t,
:enabled => false,
:onwhen => "1+",
:items => [
button(
:ems_datawarehouse_tag,
'pficon pficon-edit fa-lg',
N_('Edit Tags for these Datawarehouse Providers'),
N_('Edit Tags'),
:url_parms => "main_div",
:enabled => false,
:onwhen => "1+"),
]
),
])
button_group('ems_datawarehouse_authentication', [
select(
:ems_datawarehouse_authentication_choice,
'fa fa-lock fa-lg',
t = N_('Authentication'),
t,
:enabled => false,
:onwhen => "1+",
:items => [
button(
:ems_datawarehouse_recheck_auth_status,
'fa fa-search fa-lg',
N_('Re-check Authentication Status for the selected Datawarehouse Providers'),
N_('Re-check Authentication Status'),
:url_parms => "main_div",
:enabled => false,
:onwhen => "1+"),
]
),
])
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper/toolbar_chooser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def center_toolbar_filename_classic
unless @in_a_form
if %w(auth_key_pair_cloud availability_zone host_aggregate cloud_object_store_object cloud_object_store_container cloud_tenant
cloud_volume cloud_volume_backup cloud_volume_snapshot configuration_job container_group container_node container_service
ems_cloud ems_cluster ems_container ems_middleware container_project container_route container_replicator container_image
ems_cloud ems_cluster ems_container ems_datawarehouse ems_middleware container_project container_route container_replicator container_image
ems_network security_group floating_ip cloud_subnet network_router network_topology network_port cloud_network load_balancer
container_image_registry ems_infra flavor host container_build infra_networking infra_topology ems_storage
ontap_file_share ontap_logical_disk container_topology middleware_topology cloud_topology middleware_server
Expand Down
15 changes: 15 additions & 0 deletions app/helpers/datawarehouse_summary_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module DatawarehouseSummaryHelper
include TextualMixins::TextualName

def textual_ems
textual_link(@record.ext_management_system)
end

def textual_nativeid
@record.nativeid
end

def textual_group_smart_management
%i(tags)
end
end
4 changes: 4 additions & 0 deletions app/helpers/ems_datawarehouse_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module EmsDatawarehouseHelper
include DatawarehouseSummaryHelper
include_concern 'TextualSummary'
end
43 changes: 43 additions & 0 deletions app/helpers/ems_datawarehouse_helper/textual_summary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module EmsDatawarehouseHelper::TextualSummary
include TextualMixins::TextualRefreshStatus
#
# Groups
#

def textual_group_properties
%i(name type hostname port)
end

def textual_group_relationships
# Order of items should be from parent to child
[]
end

def textual_group_status
%i(refresh_status)
end

def textual_group_smart_management
%i(tags)
end

#
# Items
#

def textual_name
@ems.name
end

def textual_type
@ems.emstype_description
end

def textual_hostname
@ems.hostname
end

def textual_port
@ems.supports_port? ? @ems.port : nil
end
end
1 change: 1 addition & 0 deletions app/models/ems_refresh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module EmsRefresh
extend EmsRefresh::SaveInventoryInfra
extend EmsRefresh::SaveInventoryContainer
extend EmsRefresh::SaveInventoryMiddleware
extend EmsRefresh::SaveInventoryDatawarehouse
extend EmsRefresh::SaveInventoryNetwork
extend EmsRefresh::SaveInventorySwift
extend EmsRefresh::SaveInventoryHelper
Expand Down
1 change: 1 addition & 0 deletions app/models/ems_refresh/save_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def save_ems_inventory(ems, hashes, target = nil)
when ManageIQ::Providers::StorageManager::CinderManager then save_ems_cinder_inventory(ems, hashes, target)
when ManageIQ::Providers::StorageManager::SwiftManager then save_ems_swift_inventory(ems, hashes, target)
when ManageIQ::Providers::MiddlewareManager then save_ems_middleware_inventory(ems, hashes, target)
when ManageIQ::Providers::DatawarehouseManager then save_ems_datawarehouse_inventory(ems, hashes, target)
end
end

Expand Down
Loading

0 comments on commit 7c4063d

Please sign in to comment.