mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
AC-331 final clean up
This commit is contained in:
@@ -77,6 +77,10 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
scope.viewJobs = function(id) {
|
scope.viewJobs = function(id) {
|
||||||
$location.url('/jobs/?inventory__int=' + id + '&order_by=status');
|
$location.url('/jobs/?inventory__int=' + id + '&order_by=status');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope.viewFailedJobs = function(id) {
|
||||||
|
$location.url('/jobs/?inventory__int=' + id + '&status=failed&order_by=status');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',
|
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',
|
||||||
@@ -482,11 +486,10 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
HostsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name,
|
HostsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name,
|
||||||
request: 'delete' });
|
request: 'delete' });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scope.removeHost = function(host_id, host_name) {
|
scope.viewJobs = function(last_job) {
|
||||||
HostsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name,
|
$location.url('/jobs/?id__int=' + last_job );
|
||||||
request: 'remove' });
|
}
|
||||||
} */
|
|
||||||
|
|
||||||
scope.viewLastEvents = function(host_id, last_job, host_name, last_job_name) {
|
scope.viewLastEvents = function(host_id, last_job, host_name, last_job_name) {
|
||||||
// Choose View-> Latest job events
|
// Choose View-> Latest job events
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
scope[list.iterator + 'SearchValue'] = $routeParams['inventory__int'];
|
scope[list.iterator + 'SearchValue'] = $routeParams['inventory__int'];
|
||||||
scope[list.iterator + 'SearchFieldLabel'] = 'Inventory ID';
|
scope[list.iterator + 'SearchFieldLabel'] = 'Inventory ID';
|
||||||
}
|
}
|
||||||
|
if ($routeParams['id__int']) {
|
||||||
|
scope[list.iterator + 'SearchField'] = 'id';
|
||||||
|
scope[list.iterator + 'SearchValue'] = $routeParams['id__int'];
|
||||||
|
scope[list.iterator + 'SearchFieldLabel'] = 'Job ID';
|
||||||
|
}
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
|
|
||||||
// Called from Inventories page, failed jobs link. Now sort by status so faild jobs appear at top of list
|
// Called from Inventories page, failed jobs link. Now sort by status so faild jobs appear at top of list
|
||||||
|
|||||||
@@ -122,9 +122,10 @@ angular.module('InventoryFormDefinition', [])
|
|||||||
dropdown: {
|
dropdown: {
|
||||||
type: 'DropDown',
|
type: 'DropDown',
|
||||||
label: 'View',
|
label: 'View',
|
||||||
|
"class": "btn-sm",
|
||||||
ngDisabled: 'host.last_job == null',
|
ngDisabled: 'host.last_job == null',
|
||||||
options: [
|
options: [
|
||||||
{ ngClick: 'viewJobs(\{\{ host.id \}\})', label: 'Jobs' },
|
{ ngClick: 'viewJobs(\{\{ host.last_job \}\})', label: 'Latest job' },
|
||||||
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
||||||
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest job events' },
|
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest job events' },
|
||||||
{ ngClick: "viewLastSummary(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
{ ngClick: "viewLastSummary(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
||||||
|
|||||||
@@ -37,20 +37,6 @@ angular.module('InventoriesListDefinition', [])
|
|||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
excludeModal: true
|
excludeModal: true
|
||||||
}
|
}
|
||||||
/*,
|
|
||||||
has_active_failures: {
|
|
||||||
label: 'Failed Jobs?',
|
|
||||||
showValue: false,
|
|
||||||
text: 'View failures',
|
|
||||||
ngShow: "\{\{ inventory.has_active_failures \}\}",
|
|
||||||
icon: 'icon-exclamation-sign',
|
|
||||||
"class": 'active-failures-\{\{ inventory.has_active_failures \}\}',
|
|
||||||
ngClick: 'viewJobs(\{\{ inventory.id \}\})',
|
|
||||||
searchField: 'has_active_failures',
|
|
||||||
searchType: 'boolean',
|
|
||||||
searchOptions: [{ name: "No", value: 0 }, { name: "Yes", value: 1 }],
|
|
||||||
excludeModal: true
|
|
||||||
}*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@@ -65,6 +51,17 @@ angular.module('InventoriesListDefinition', [])
|
|||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
|
|
||||||
|
dropdown: {
|
||||||
|
type: 'DropDown',
|
||||||
|
label: 'View',
|
||||||
|
'class': 'btn-xs',
|
||||||
|
options: [
|
||||||
|
{ ngClick: 'viewJobs(\{\{ inventory.id \}\})', label: 'Jobs' },
|
||||||
|
{ ngClick: "viewFailedJobs(\{\{ inventory.id \}\})", label: 'Failed jobs' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
edit: {
|
edit: {
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
ngClick: "editInventory(\{\{ inventory.id \}\})",
|
ngClick: "editInventory(\{\{ inventory.id \}\})",
|
||||||
|
|||||||
@@ -98,14 +98,22 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
|||||||
var list = params['list'];
|
var list = params['list'];
|
||||||
var fld = params['fld'];
|
var fld = params['fld'];
|
||||||
var options = params['options'];
|
var options = params['options'];
|
||||||
var base = params['base'];
|
var field;
|
||||||
var field = list['fields'][fld];
|
|
||||||
|
|
||||||
html = "<td>\n";
|
if (params.type) {
|
||||||
html += "<div class=\"btn-group btn-group-sm\">\n";
|
field = list[params.type][fld];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
field = list['fields'][fld];
|
||||||
|
}
|
||||||
|
|
||||||
|
html = (params.td == undefined || params.td !== false) ? "<td>\n" : "";
|
||||||
|
html += "<div class=\"btn-group\">\n";
|
||||||
html += "<button type=\"button\" ";
|
html += "<button type=\"button\" ";
|
||||||
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
|
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
|
||||||
html += "class=\"btn btn-default btn-mini dropdown-toggle\" data-toggle=\"dropdown\">";
|
html += "class=\"btn btn-default";
|
||||||
|
html += (field['class']) ? " " + field['class'] : " btn-xs";
|
||||||
|
html += " dropdown-toggle\" data-toggle=\"dropdown\">";
|
||||||
html += field.label;
|
html += field.label;
|
||||||
html += " <span class=\"caret\"></span></button>\n";
|
html += " <span class=\"caret\"></span></button>\n";
|
||||||
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
|
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
|
||||||
@@ -118,7 +126,8 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
|||||||
}
|
}
|
||||||
html += "</ul>\n";
|
html += "</ul>\n";
|
||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
html += "</td>\n";
|
|
||||||
|
html += (params.td == undefined || params.td !== false) ? "</td>\n" : "";
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
angular.module('ListGenerator', ['GeneratorHelpers'])
|
angular.module('ListGenerator', ['GeneratorHelpers'])
|
||||||
.factory('GenerateList', [ '$location', '$compile', '$rootScope', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon',
|
.factory('GenerateList', [ '$location', '$compile', '$rootScope', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon',
|
||||||
'Column',
|
'Column', 'DropDown',
|
||||||
function($location, $compile, $rootScope, SearchWidget, PaginateWidget, Attr, Icon, Column) {
|
function($location, $compile, $rootScope, SearchWidget, PaginateWidget, Attr, Icon, Column, DropDown) {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
setList: function(list) {
|
setList: function(list) {
|
||||||
@@ -279,7 +279,20 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
// Row level actions
|
// Row level actions
|
||||||
html += "<td class=\"actions\">";
|
html += "<td class=\"actions\">";
|
||||||
for (action in list.fieldActions) {
|
for (action in list.fieldActions) {
|
||||||
html += this.button(list.fieldActions[action]);
|
if (list.fieldActions[action].type && list.fieldActions[action].type == 'DropDown') {
|
||||||
|
html += DropDown({
|
||||||
|
list: list,
|
||||||
|
fld: action,
|
||||||
|
options: options,
|
||||||
|
base: base,
|
||||||
|
type: 'fieldActions',
|
||||||
|
td: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('here');
|
||||||
|
html += this.button(list.fieldActions[action]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
html += "</td>";
|
html += "</td>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user