diff --git a/awx/ui/static/js/helpers/paginate.js b/awx/ui/static/js/helpers/paginate.js index 4f73081de9..acc6c228ce 100644 --- a/awx/ui/static/js/helpers/paginate.js +++ b/awx/ui/static/js/helpers/paginate.js @@ -70,9 +70,11 @@ angular.module('PaginateHelper', ['RefreshHelper', 'ngCookies']) scope[iterator + 'Page'] = 0; var new_url = url.replace(/\?page_size\=\d+/,''); - var connect = (/\/$/.test(new_url)) ? '?' : '&'; + console.log('new_url: ' + new_url); + var connect = (/\/$/.test(new_url)) ? '?' : '&'; new_url += (scope[iterator + 'SearchParams']) ? connect + scope[iterator + 'SearchParams'] + '&page_size=' + scope[iterator + 'PageSize' ] : - + connect + 'page_size=' + scope[iterator + 'PageSize' ]; + connect + 'page_size=' + scope[iterator + 'PageSize' ]; + console.log('new_url: ' + new_url); Refresh({ scope: scope, set: set, iterator: iterator, url: new_url }); } } diff --git a/awx/ui/static/js/lists/Streams.js b/awx/ui/static/js/lists/Streams.js index ff17ad1cb4..76c023ede5 100644 --- a/awx/ui/static/js/lists/Streams.js +++ b/awx/ui/static/js/lists/Streams.js @@ -19,17 +19,20 @@ angular.module('StreamListDefinition', []) "class": "table-condensed", fields: { - event_time: { - key: true, - label: 'When' - }, user: { - label: 'Who', + label: 'User', + linkTo: "\{\{ activity.userLink \}\}", sourceModel: 'user', - sourceField: 'username' + sourceField: 'username', + awToolTip: "\{\{ userToolTip \}\}", + dataPlacement: 'top' }, - operation: { - label: 'Operation' + timestamp: { + label: 'Event Time', + }, + objects: { + label: 'Objects', + ngBindHtml: 'activity.objects' }, description: { label: 'Description' diff --git a/awx/ui/static/js/widgets/Stream.js b/awx/ui/static/js/widgets/Stream.js index ee90e98645..e69aea74bb 100644 --- a/awx/ui/static/js/widgets/Stream.js +++ b/awx/ui/static/js/widgets/Stream.js @@ -61,7 +61,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti return function(params) { var list = StreamList; - var defaultUrl = $basePath + 'html/event_log.html/'; + var defaultUrl = GetBasePath('activity_stream'); var view = GenerateList; // Push the current page onto browser histor. If user clicks back button, restore current page without @@ -84,9 +84,10 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti } scope.refreshStream = function() { - scope['activities'].splice(10,10); - //scope.search(list.iterator); - } + scope.search(list.iterator); + } + + function fixUrl(u) { return u.replace(/\/api\/v1\//,'/#/'); } if (scope.removePostRefresh) { scope.removePostRefresh(); @@ -94,10 +95,26 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti scope.removePostRefresh = scope.$on('PostRefresh', function() { for (var i=0; i < scope['activities'].length; i++) { // Convert event_time date to local time zone - cDate = new Date(scope['activities'][i].event_time); - scope['activities'][i].event_time = FormatDate(cDate); + cDate = new Date(scope['activities'][i].timestamp); + scope['activities'][i].timestamp = FormatDate(cDate); // Display username - scope['activities'][i].user = scope.activities[i].summary_fields.user.username; + scope['activities'][i].user = (scope['activities'][i].summary_fields.user) ? scope['activities'][i].summary_fields.user.username : + 'System'; + if (scope['activities'][i].user !== 'System') { + scope['activities'][i].userLink = (scope['activities'][i].summary_fields.user) ? fixUrl(scope['activities'][i].related.user) : + ""; + } + + // Objects + var href; + if (scope['activities'][i].summary_fields.object1) { + href = fixUrl(scope['activities'][i].related.object_1); + scope['activities'][i].objects = "" + scope['activities'][i].summary_fields.object1.name + ""; + } + if (scope['activities'][i].summary_fields.object2) { + href = fixUrl(scope['activities'][i].related.object_2); + scope['activities'][i].objects += ", " + scope['activities'][i].summary_fields.object2.name + ""; + } } ShowStream(); }); diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index 4cff7f0b4e..1c46a9f2f8 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -340,6 +340,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers']) html += (field.ngClass) ? Attr(field, 'ngClass') : ""; html += (options.mode == 'lookup' || options.mode == 'select') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : ""; html += (field.columnShow) ? Attr(field, 'columnShow') : ""; + html += (field.ngBindHtml) ? "ng-bind-html-unsafe=\"" + field.ngBindHtml + "\" " : ""; html += ">\n"; // Add ngShow @@ -359,7 +360,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers']) // Start the Link if ( (field.key || field.link || field.linkTo || field.ngClick || field.ngHref) && - options['mode'] != 'lookup' && options['mode'] != 'select' && !field.noLink ) { + options['mode'] != 'lookup' && options['mode'] != 'select' && !field.noLink && !field.ngBindHtml) { var cap=false; if (field.linkTo) { html += "