mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 06:17:36 -02:30
Latest UI Inventory updates
This commit is contained in:
@@ -24,9 +24,10 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
||||
var current_item = params.current_item; //id of the item that should be selected on open
|
||||
var list = params.list; // list object
|
||||
var field = params.field; // form field
|
||||
|
||||
|
||||
// Show pop-up to select user
|
||||
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
|
||||
scope['lookUp' + name] = function() {
|
||||
var listGenerator = GenerateList;
|
||||
var listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select ' + name });
|
||||
@@ -37,11 +38,15 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
||||
var name;
|
||||
for (var i=0; i < listScope[list.name].length; i++) {
|
||||
if (listScope[list.iterator + "_" + listScope[list.name][i].id + "_class"] == "success") {
|
||||
found = true;
|
||||
found = true;
|
||||
scope[field] = listScope[list.name][i].id;
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
listScope[list.name][i][form.fields[field].sourceField];
|
||||
scope[form.name + '_form'].$setDirty();
|
||||
if (form.fields[field] && form.fields[field].sourceModel) {
|
||||
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
|
||||
listScope[list.name][i][form.fields[field].sourceField];
|
||||
}
|
||||
if (scope[form.name + '_form']) {
|
||||
scope[form.name + '_form'].$setDirty();
|
||||
}
|
||||
listGenerator.hide();
|
||||
}
|
||||
}
|
||||
@@ -62,11 +67,12 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
||||
listScope[list.iterator + "_" + id + "_class"] = "success";
|
||||
}
|
||||
}
|
||||
|
||||
SearchInit({ scope: listScope, set: list.name, list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: listScope, list: list, url: defaultUrl, mode: 'lookup' });
|
||||
scope.search(list.iterator);
|
||||
listScope['toggle_' + list.iterator](current_item);
|
||||
listScope.search(list.iterator);
|
||||
if (current_item) {
|
||||
listScope['toggle_' + list.iterator](current_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user