AC-1023 AC-1025 fixed drag-n-drop issues. Linting exposed a datatype mismatch issue.

This commit is contained in:
Chris Houseknecht 2014-02-06 15:19:58 -05:00
parent 11d8387120
commit c52818ecee
4 changed files with 12 additions and 11 deletions

View File

@ -634,9 +634,9 @@ function($rootScope, $location, $log, $routeParams, Rest, Alert, Prompt, Process
url = (scope.selected_group_id === null) ? GetBasePath('inventory') + scope.inventory_id + '/hosts/' :
GetBasePath('groups') + scope.selected_group_id + '/hosts/',
group = (scope.selected_tree_id) ? Find({ list: scope.groups, key: 'id', val: scope.selected_tree_id }) : null;
if (scope.removeHostsReload) {
scope.removeHostsReload();
}

View File

@ -402,14 +402,13 @@ angular.module('InventoryTree', ['Utilities', 'RestServices', 'GroupsHelper', 'P
function($compile, Alert, ProcessErrors, Find, Wait, Rest, Empty, GetBasePath) {
return function(params) {
var scope = params.scope;
var target = Find({ list: scope.groups, key: 'id', val: params.target_tree_id });
var host = Find({ list: scope.hosts, key: 'id', val: params.host_id });
var found = false;
var scope = params.scope,
target = Find({ list: scope.groups, key: 'id', val: params.target_tree_id }),
host = Find({ list: scope.hosts, key: 'id', val: params.host_id }),
found = false, i;
if (host.summary_fields.all_groups) {
for (var i=0; i< host.summary_fields.all_groups.length; i++) {
for (i=0; i< host.summary_fields.all_groups.length; i++) {
if (host.summary_fields.all_groups[i].id == target.group_id) {
found = true;
break;

View File

@ -590,10 +590,12 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
// Drag-n-drop succeeded. Trigger a response from the inventory.edit controller
$(this).removeClass('droppable-hover');
if (ui.draggable.attr('data-type') === 'group') {
scope.$emit('CopyMoveGroup', ui.draggable.attr('data-tree-id'), $(this).attr('data-tree-id'));
scope.$emit('CopyMoveGroup', parseInt(ui.draggable.attr('data-tree-id'),10),
parseInt($(this).attr('data-tree-id'),10));
}
else if (ui.draggable.attr('data-type') === 'host') {
scope.$emit('CopyMoveHost', $(this).attr('data-tree-id'), ui.draggable.attr('data-host-id'));
scope.$emit('CopyMoveHost', parseInt($(this).attr('data-tree-id'),10),
parseInt(ui.draggable.attr('data-host-id'),10));
}
},
tolerance: 'pointer'

View File

@ -201,7 +201,7 @@ function($rootScope, $location, $cookieStore, $compile, SearchWidget, PaginateWi
applyDefaults: function() {
for (var fld in this.form.fields) {
if (this.form.fields[fld].default || this.form.fields[fld].default === 0) {
if (this.form.fields[fld]['default'] || this.form.fields[fld]['default'] === 0) {
if (this.form.fields[fld].type === 'select' && this.scope[fld + '_options']) {
this.scope[fld] = this.scope[fld + '_options'][this.form.fields[fld]['default']];
}