AC-977 Fixed raw html showing up in Action field on detail dialog. Added a subtitle on the AS widget. On inventory groups/host page the subtitle explains what activities are being displayed, and only activities realted to the selected group (on the inventory page) are displayed. If All Hosts selected, then all activities for all groups related to the current inventory are displayed. Also, brought back activity stream button for inventory hosts.

This commit is contained in:
Chris Houseknecht
2014-01-29 16:59:52 -05:00
parent 57235cad7a
commit 168c4235f5
5 changed files with 54 additions and 7 deletions

View File

@@ -521,10 +521,26 @@ function InventoriesEdit ($scope, $location, $routeParams, $compile, GenerateLis
} }
$scope.showGroupActivity = function() { $scope.showGroupActivity = function() {
var url = GetBasePath('activity_stream') + '?group__inventory__id=' + $scope.inventory_id; var url, title, group;
Stream({ scope: $scope, inventory_name: $scope.inventory_name, url: url }); if ($scope.selected_group_id) {
group = Find({ list: $scope.groups, key: 'id', val: $scope.selected_tree_id });
url = GetBasePath('activity_stream') + '?group__id=' + $scope.selected_group_id;
title = 'Showing all activities for group ' + group.name;
}
else {
title = 'Showing all activities for all ' + $scope.inventory_name + ' groups';
url = GetBasePath('activity_stream') + '?group__inventory__id=' + $scope.inventory_id;
}
Stream({ scope: $scope, inventory_name: $scope.inventory_name, url: url, title: title });
} }
$scope.showHostActivity = function() {
var url, title;
title = 'Showing all activities for all ' + $scope.inventory_name + ' hosts';
url = GetBasePath('activity_stream') + '?host__inventory__id=' + $scope.inventory_id;
Stream({ scope: $scope, inventory_name: $scope.inventory_name, url: url, title: title });
}
$scope.showJobSummary = function(job_id) { $scope.showJobSummary = function(job_id) {
ShowJobSummary({ job_id: job_id }); ShowJobSummary({ job_id: job_id });
} }

View File

@@ -100,7 +100,13 @@ angular.module('InventoryHostsDefinition', [])
ngHide: 'selected_tree_id == 1', //disable when 'All Hosts' selected ngHide: 'selected_tree_id == 1', //disable when 'All Hosts' selected
awToolTip: "Create a new host" awToolTip: "Create a new host"
}, },
help: { stream: {
ngClick: "showHostActivity()",
awToolTip: "View Activity Stream",
mode: 'all',
ngShow: "user_is_superuser"
},
help: {
mode: 'all', mode: 'all',
awToolTip: awToolTip:
//"<div style=\"text-align:left;\"><img src=\"/static/img/cow.png\" style=\"width:50px; height:56px; float:left; padding-right:5px;\">" + //"<div style=\"text-align:left;\"><img src=\"/static/img/cow.png\" style=\"width:50px; height:56px; float:left; padding-right:5px;\">" +

View File

@@ -189,14 +189,17 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
} }
else if (obj1) { else if (obj1) {
name = ''; name = '';
var name_nolink = '';
// find the name in changes, if needed // find the name in changes, if needed
if ( !(obj1_obj && obj1_obj.name) || obj1_obj && obj1_obj.name && /^_delete/.test(obj1_obj.name) ) { if ( !(obj1_obj && obj1_obj.name) || obj1_obj && obj1_obj.name && /^_delete/.test(obj1_obj.name) ) {
if (activity.changes && activity.changes.name) { if (activity.changes && activity.changes.name) {
if (typeof activity.changes.name == 'string') { if (typeof activity.changes.name == 'string') {
name = ' ' + activity.changes.name; name = ' ' + activity.changes.name;
name_nolink = name;
} }
else if (typeof activity.changes.name == 'object' && Array.isArray(activity.changes.name)) { else if (typeof activity.changes.name == 'object' && Array.isArray(activity.changes.name)) {
name = ' ' + activity.changes.name[0] name = ' ' + activity.changes.name[0];
name_nolink = name;
} }
} }
else if (obj1 == 'job' && obj1_obj && activity.changes && activity.changes.job_template) { else if (obj1 == 'job' && obj1_obj && activity.changes && activity.changes.job_template) {
@@ -204,9 +207,11 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
if (activity.operation != 'delete') { if (activity.operation != 'delete') {
obj1_obj['base'] = obj1; obj1_obj['base'] = obj1;
name = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">'+ obj1_obj.id + ' ' + activity.changes.job_template + '</a>'; name = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">'+ obj1_obj.id + ' ' + activity.changes.job_template + '</a>';
name_nolink = ' ' + obj1_obj.id + ' ' + activity.changes.job_template;
} }
else { else {
name = ' ' + obj1_obj.id + ' ' + activity.changes.job_template; name = ' ' + obj1_obj.id + ' ' + activity.changes.job_template;
name_nolink = name;
} }
} }
else if (obj1 == 'job' && obj1_obj) { else if (obj1 == 'job' && obj1_obj) {
@@ -214,17 +219,20 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
if (activity.operation != 'delete') { if (activity.operation != 'delete') {
obj1_obj['base'] = obj1; obj1_obj['base'] = obj1;
name = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.id + '</a>'; name = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.id + '</a>';
name_nolink = ' ' + obj1_obj.id;
} }
else { else {
name = ' ' + obj1_obj.id; name = ' ' + obj1_obj.id;
name_nolink = name;
} }
} }
} }
else if (obj1_obj && obj1_obj.name) { else if (obj1_obj && obj1_obj.name) {
name = ' ' + stripDeleted(obj1_obj.name); name = ' ' + stripDeleted(obj1_obj.name);
name_nolink = name;
} }
descr += obj1 + name; descr += obj1 + name;
descr_nolink += obj1 + name; descr_nolink += obj1 + name_nolink;
} }
activity['description'] = descr; activity['description'] = descr;
activity['description_nolink'] = descr_nolink; activity['description_nolink'] = descr_nolink;
@@ -301,10 +309,10 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
var PreviousSearchParams = Store('CurrentSearchParams'); var PreviousSearchParams = Store('CurrentSearchParams');
// pass in an inventory name to fix breadcrumb display // pass in an inventory name to fix breadcrumb display
var inventory_name = (params) ? params.inventory_name : null; var inventory_name = (params && params.inventory_name) ? params.inventory_name : null;
// url will override the attempt to compute an activity_stream query // url will override the attempt to compute an activity_stream query
var url = (params) ? params.url : null; var url = (params && params.url) ? params.url : null;
$rootScope.flashMessage = null; $rootScope.flashMessage = null;
@@ -357,6 +365,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
secondWidget: true, secondWidget: true,
activityStream: true activityStream: true
}); });
// descriptive title describing what AS is showing
scope.streamTitle = (params && params.title) ? params.title : null;
scope.closeStream = function(inUrl) { scope.closeStream = function(inUrl) {
HideStream(); HideStream();

View File

@@ -1382,6 +1382,11 @@ tr td button i {
border: 1px solid @grey; border: 1px solid @grey;
border-radius: 8px; border-radius: 8px;
padding: 8px; padding: 8px;
h5 {
margin-top: 0;
margin-bottom: 20px;
}
} }
/* /*

View File

@@ -147,6 +147,15 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
html += "<div class=\"well\">\n"; html += "<div class=\"well\">\n";
} }
if (options.activityStream) {
// Add a title row
html += "<div class=\"row\">\n";
html += "<div class=\"col-lg-12\">\n";
html += "<h5>{{ streamTitle }}</h5>\n";
html += "</div>\n";
html += "</div>\n";
}
html += "<div class=\"row\">\n"; html += "<div class=\"row\">\n";
if (list.name != 'groups') { if (list.name != 'groups') {