Skip to content
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

Move the Ansible Tower UI to the Automation tab #170

Merged
merged 24 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a90de89
Add the new Ansible Tower Ui under Automation
lgalis Jan 16, 2017
227a5d0
Use the AutomationManager Ansible Tower model
lgalis Jan 26, 2017
ddbe375
Remove the Ansible Tower Provider from the Configuration management tab
lgalis Jan 26, 2017
49a49de
Update for the New Ansible Tower Model
lgalis Jan 27, 2017
6ecb778
Use automation_manager instead of ansible_tower
lgalis Jan 27, 2017
4823919
Styling fixes for rubocop comments
lgalis Jan 30, 2017
2d5ddb7
Fixed Ansible Tower Manager Automation menu and toolbar
lgalis Jan 30, 2017
a262987
Updated feature identifier for automation_manager_configured_system
lgalis Jan 30, 2017
017de35
Updated feature identifier for automation_manager_configured_system_s…
lgalis Jan 31, 2017
90e5f65
Updated indendentations for toolbar files
lgalis Jan 31, 2017
1a18276
Fix indentation to use 2 spaces rather than 4
lgalis Feb 1, 2017
8a596c0
Refactor Automation and Foreman Controllers
lgalis Feb 1, 2017
9a41173
Replace http().success calls with http().then/.catch
lgalis Feb 4, 2017
845eb9c
Fixed icon for automation
lgalis Feb 6, 2017
7bdfe58
Address rubocop comments
lgalis Feb 6, 2017
2cd50a0
Address codeclimate comments
lgalis Feb 7, 2017
b1f061d
Remove Jobs menu from the Configuration Management
lgalis Feb 8, 2017
3dd4c5d
Fix manager call from provider
lgalis Feb 8, 2017
5747cf6
Remove Jobs menu from the Configuration Management
lgalis Feb 8, 2017
d63b47e
Fixed Adv. search for configured systems
lgalis Feb 8, 2017
65c0309
Fixed links in gtl list
lgalis Feb 8, 2017
757926a
Toolbar refactoring for automation manager configured systems
lgalis Feb 9, 2017
17467d6
Toolbar and Dialog for fixes after refactoring for automation manager
lgalis Feb 9, 2017
83d5e5c
Fixed configured system list for Ansible Folders
lgalis Feb 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
ManageIQ.angular.app.controller('automationManagerFormController', ['$http', '$scope', 'automationManagerFormId', 'miqService', function($http, $scope, automationManagerFormId, miqService) {
$scope.automationManagerModel = {
name: '',
url: '',
zone: '',
verify_ssl: '',
log_userid: '',
log_password: '',
log_verify: '',
};
$scope.formId = automationManagerFormId;
$scope.afterGet = false;
$scope.validateClicked = miqService.validateWithAjax;
$scope.modelCopy = angular.copy( $scope.automationManagerModel );
$scope.model = 'automationManagerModel';

ManageIQ.angular.scope = $scope;

if (automationManagerFormId === 'new') {
$scope.newRecord = true;

$scope.automationManagerModel.name = '';
$scope.automationManagerModel.url = '';
$scope.automationManagerModel.verify_ssl = false;
$scope.automationManagerModel.log_userid = '';
$scope.automationManagerModel.log_password = '';
$scope.automationManagerModel.log_verify = '';

$http.get('/automation_manager/automation_manager_form_fields/' + automationManagerFormId)
.then(getAutomationManagerNewFormDataComplete)
.catch(miqService.handleFailure);
} else {
$scope.newRecord = false;
miqService.sparkleOn();

$http.get('/automation_manager/automation_manager_form_fields/' + automationManagerFormId)
.then(getAutomationManagerFormDataComplete)
.catch(miqService.handleFailure);

miqService.sparkleOff();
}

function getAutomationManagerNewFormDataComplete(response) {
var data = response.data;
$scope.afterGet = true;
$scope.automationManagerModel.zone = data.zone;
$scope.modelCopy = angular.copy($scope.automationManagerModel);
}

function getAutomationManagerFormDataComplete(response) {
var data = response.data;
$scope.afterGet = true;

$scope.automationManagerModel.name = data.name;
$scope.automationManagerModel.zone = data.zone;
$scope.automationManagerModel.url = data.url;
$scope.automationManagerModel.verify_ssl = data.verify_ssl == "1";

$scope.automationManagerModel.log_userid = data.log_userid;

if($scope.automationManagerModel.log_userid != '') {
$scope.automationManagerModel.log_password = $scope.automationManagerModel.log_verify = miqService.storedPasswordPlaceholder;
}
$scope.modelCopy = angular.copy( $scope.automationManagerModel );
}

$scope.canValidateBasicInfo = function() {
if ($scope.isBasicInfoValid()) {
return true;
}
else {
return false;
}
};

$scope.isBasicInfoValid = function() {
if($scope.angularForm.url.$valid &&
$scope.angularForm.log_userid.$valid &&
$scope.angularForm.log_password.$valid &&
$scope.angularForm.log_verify.$valid)
return true;
else
return false;
};

var automationManagerEditButtonClicked = function(buttonName, serializeFields) {
miqService.sparkleOn();
var url = '/automation_manager/edit/' + automationManagerFormId + '?button=' + buttonName;
if (serializeFields === undefined) {
miqService.miqAjaxButton(url);
} else {
miqService.miqAjaxButton(url, serializeFields);
}
};

$scope.cancelClicked = function() {
automationManagerEditButtonClicked('cancel');
$scope.angularForm.$setPristine(true);
};

$scope.resetClicked = function() {
$scope.$broadcast('resetClicked');
$scope.automationManagerModel = angular.copy( $scope.modelCopy );
$scope.angularForm.$setPristine(true);
miqService.miqFlash('warn', __('All changes have been reset'));
};

$scope.saveClicked = function() {
automationManagerEditButtonClicked('save', true);
$scope.angularForm.$setPristine(true);
};

$scope.addClicked = function() {
$scope.saveClicked();
};
}]);
29 changes: 17 additions & 12 deletions app/controllers/application_controller/ci_processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ def process_objects(objs, task, display_name = nil)
:models => ui_lookup(:models => klass.to_s)})
end

def foreman_button_operation(method, display_name)
def manager_button_operation(method, display_name)
items = []
if params[:id]
if params[:id].nil? || !ExtManagementSystem.where(:id => params[:id]).exists?
Expand All @@ -1959,25 +1959,30 @@ def foreman_button_operation(method, display_name)
if items.empty?
add_flash(_("No providers were selected for %{task}") % {:task => display_name}, :error)
else
process_cfgmgr(items, method) unless items.empty? && !flash_errors?
process_managers(items, method) unless items.empty? && !flash_errors?
end
end

def process_cfgmgr(providers, task)
providers, _services_out_region = filter_ids_in_region(providers, "ManageIQ::Providers::ConfigurationManager")
return if providers.empty?
def process_managers(managers, task)
controller_class = request.parameters[:controller]
provider_class = case controller_class
when 'provider_foreman' then ManageIQ::Providers::ConfigurationManager
when 'automation_manager' then ManageIQ::Providers::AutomationManager
end

options = {:ids => providers, :task => task, :userid => session[:userid]}
kls = ManageIQ::Providers::ConfigurationManager.find_by_id(providers.first).class
manager_ids, _services_out_region = filter_ids_in_region(managers, provider_class.to_s)
return if manager_ids.empty?

options = {:ids => manager_ids, :task => task, :userid => session[:userid]}
kls = provider_class.find_by(:id => manager_ids.first).class
kls.process_tasks(options)
rescue => err
add_flash(_("Error during '%{task}': %{message}") % {:task => task, :message => err.message}, :error)
else
add_flash(n_("%{task} initiated for %{count} provider (%{controller})",
"%{task} initiated for %{count} providers (%{controller})", providers.length) %
{:task => task_name(task),
:controller => ProviderForemanController.model_to_name(kls.to_s),
:count => providers.length})
add_flash(n_("%{task} initiated for %{count} provider",
"%{task} initiated for %{count} providers)", manager_ids.length) %
{:task => task_name(task),
:count => manager_ids.length})
end

# Delete all selected or single displayed VM(s)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/application_controller/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ def adv_search_button

if ["delete", "saveit"].include?(params[:button])
if @edit[:in_explorer] || x_active_tree == :storage_tree
if "cs_filter_tree" == x_active_tree.to_s
build_configuration_manager_tree(:cs_filter, x_active_tree)
if "configuration_manager_cs_filter_tree" == x_active_tree.to_s
build_configuration_manager_tree(:configuration_manager_cs_filter, x_active_tree)
else
tree_type = x_active_tree.to_s.sub(/_tree/, '').to_sym
builder = TreeBuilder.class_for_type(tree_type)
Expand Down Expand Up @@ -451,7 +451,7 @@ def adv_search_button
if ["delete", "saveit"].include?(params[:button])
if @edit[:in_explorer] || x_active_tree == :storage_tree
tree_name = x_active_tree.to_s
if "cs_filter_tree" == tree_name
if "configuration_manager_cs_filter_tree_tree" == tree_name
page.replace_html("#{tree_name}_div", :partial => "provider_foreman/#{tree_name}")
else
page.replace_html("#{tree_name}_div", :partial => "shared/tree", :locals => {
Expand Down Expand Up @@ -511,7 +511,7 @@ def adv_search_clear
if x_active_tree.to_s =~ /_filter_tree$/ &&
!["Vm", "MiqTemplate"].include?(TreeBuilder.get_model_for_prefix(@nodetype))
search_id = 0
if x_active_tree == :cs_filter_tree
if x_active_tree == :configuration_manager_cs_filter_tree || x_active_tree == :automation_manager_cs_filter_tree
adv_search_build("ConfiguredSystem")
else
adv_search_build(vm_model_from_active_tree(x_active_tree))
Expand Down
Loading