mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
AC-1023 AC-1025 fixed drag-n-drop issues. Linting exposed a datatype mismatch issue.
This commit is contained in:
@@ -402,14 +402,13 @@ angular.module('InventoryTree', ['Utilities', 'RestServices', 'GroupsHelper', 'P
|
|||||||
function($compile, Alert, ProcessErrors, Find, Wait, Rest, Empty, GetBasePath) {
|
function($compile, Alert, ProcessErrors, Find, Wait, Rest, Empty, GetBasePath) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope;
|
var scope = params.scope,
|
||||||
var target = Find({ list: scope.groups, key: 'id', val: params.target_tree_id });
|
target = Find({ list: scope.groups, key: 'id', val: params.target_tree_id }),
|
||||||
var host = Find({ list: scope.hosts, key: 'id', val: params.host_id });
|
host = Find({ list: scope.hosts, key: 'id', val: params.host_id }),
|
||||||
|
found = false, i;
|
||||||
var found = false;
|
|
||||||
|
|
||||||
if (host.summary_fields.all_groups) {
|
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) {
|
if (host.summary_fields.all_groups[i].id == target.group_id) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -590,10 +590,12 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
|||||||
// Drag-n-drop succeeded. Trigger a response from the inventory.edit controller
|
// Drag-n-drop succeeded. Trigger a response from the inventory.edit controller
|
||||||
$(this).removeClass('droppable-hover');
|
$(this).removeClass('droppable-hover');
|
||||||
if (ui.draggable.attr('data-type') === 'group') {
|
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') {
|
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'
|
tolerance: 'pointer'
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ function($rootScope, $location, $cookieStore, $compile, SearchWidget, PaginateWi
|
|||||||
|
|
||||||
applyDefaults: function() {
|
applyDefaults: function() {
|
||||||
for (var fld in this.form.fields) {
|
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']) {
|
if (this.form.fields[fld].type === 'select' && this.scope[fld + '_options']) {
|
||||||
this.scope[fld] = this.scope[fld + '_options'][this.form.fields[fld]['default']];
|
this.scope[fld] = this.scope[fld + '_options'][this.form.fields[fld]['default']];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user