mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -03:30
Added AS to /inventories/hosts/N and /inventories/groups/N as well has /home/[groups, hosts]. Fixed CSS container sizing issue, so widget will not overlap footer.
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryGroupsForm,
|
function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryGroupsForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, Prompt,
|
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, Prompt,
|
||||||
BuildTree, GetBasePath, GroupsList, GroupsAdd, GroupsEdit, LoadInventory,
|
BuildTree, GetBasePath, GroupsList, GroupsAdd, GroupsEdit, LoadInventory,
|
||||||
GroupsDelete, EditInventory, InventoryStatus)
|
GroupsDelete, EditInventory, InventoryStatus, Stream)
|
||||||
{
|
{
|
||||||
|
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
@@ -108,6 +108,8 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
scope.showActivity = function() { Stream(); }
|
||||||
|
|
||||||
scope.addGroup = function() {
|
scope.addGroup = function() {
|
||||||
GroupsList({ "inventory_id": id, group_id: scope.group_id });
|
GroupsList({ "inventory_id": id, group_id: scope.group_id });
|
||||||
}
|
}
|
||||||
@@ -159,6 +161,6 @@ InventoryGroups.$inject = [
|
|||||||
'$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryGroupsForm',
|
'$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryGroupsForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'Prompt',
|
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'Prompt',
|
||||||
'BuildTree', 'GetBasePath', 'GroupsList', 'GroupsAdd', 'GroupsEdit', 'LoadInventory',
|
'BuildTree', 'GetBasePath', 'GroupsList', 'GroupsAdd', 'GroupsEdit', 'LoadInventory',
|
||||||
'GroupsDelete', 'EditInventory', 'InventoryStatus'
|
'GroupsDelete', 'EditInventory', 'InventoryStatus', 'Stream'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Home.$inject=[ '$routeParams', '$scope', '$rootScope', '$location', 'Wait', 'Obj
|
|||||||
|
|
||||||
|
|
||||||
function HomeGroups ($location, $routeParams, HomeGroupList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
function HomeGroups ($location, $routeParams, HomeGroupList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||||
GetBasePath, SearchInit, PaginateInit, FormatDate, HostsStatusMsg, UpdateStatusMsg, ViewUpdateStatus) {
|
GetBasePath, SearchInit, PaginateInit, FormatDate, HostsStatusMsg, UpdateStatusMsg, ViewUpdateStatus, Stream) {
|
||||||
|
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -159,17 +159,18 @@ function HomeGroups ($location, $routeParams, HomeGroupList, GenerateList, Proce
|
|||||||
|
|
||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
|
|
||||||
|
scope.showActivity = function() { Stream(); }
|
||||||
scope.viewUpdateStatus = function(id) { ViewUpdateStatus({ scope: scope, group_id: id }) };
|
scope.viewUpdateStatus = function(id) { ViewUpdateStatus({ scope: scope, group_id: id }) };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
||||||
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus'
|
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus', 'Stream'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||||
GetBasePath, SearchInit, PaginateInit, FormatDate, SetHostStatus, ToggleHostEnabled, HostsEdit) {
|
GetBasePath, SearchInit, PaginateInit, FormatDate, SetHostStatus, ToggleHostEnabled, HostsEdit, Stream) {
|
||||||
|
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -214,6 +215,7 @@ function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, Process
|
|||||||
|
|
||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
|
|
||||||
|
scope.showActivity = function() { Stream(); }
|
||||||
scope.toggle_host_enabled = function(id, sources) { ToggleHostEnabled(id, sources, scope); }
|
scope.toggle_host_enabled = function(id, sources) { ToggleHostEnabled(id, sources, scope); }
|
||||||
|
|
||||||
scope.editHost = function(host_id, host_name) {
|
scope.editHost = function(host_id, host_name) {
|
||||||
@@ -233,6 +235,6 @@ function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, Process
|
|||||||
|
|
||||||
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
||||||
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus',
|
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus',
|
||||||
'SetHostStatus', 'ToggleHostEnabled', 'HostsEdit'
|
'SetHostStatus', 'ToggleHostEnabled', 'HostsEdit', 'Stream'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
|
|||||||
RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt,
|
RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt,
|
||||||
GetBasePath, HostsList, HostsAdd, HostsEdit, HostsDelete,
|
GetBasePath, HostsList, HostsAdd, HostsEdit, HostsDelete,
|
||||||
HostsReload, BuildTree, EditHostGroups, InventoryHostsHelp, HelpDialog, Wait,
|
HostsReload, BuildTree, EditHostGroups, InventoryHostsHelp, HelpDialog, Wait,
|
||||||
ToggleHostEnabled)
|
ToggleHostEnabled, Stream)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -40,6 +40,8 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
|
|||||||
LoadBreadCrumbs({ path: '/inventories/' + id, title: inventory_name });
|
LoadBreadCrumbs({ path: '/inventories/' + id, title: inventory_name });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
scope.showActivity = function() { Stream(); }
|
||||||
|
|
||||||
scope.filterHosts = function() {
|
scope.filterHosts = function() {
|
||||||
HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] });
|
HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] });
|
||||||
}
|
}
|
||||||
@@ -164,6 +166,6 @@ InventoryHosts.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$lo
|
|||||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt',
|
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt',
|
||||||
'GetBasePath', 'HostsList', 'HostsAdd', 'HostsEdit', 'HostsDelete',
|
'GetBasePath', 'HostsList', 'HostsAdd', 'HostsEdit', 'HostsDelete',
|
||||||
'HostsReload', 'BuildTree', 'EditHostGroups', 'InventoryHostsHelp', 'HelpDialog', 'Wait',
|
'HostsReload', 'BuildTree', 'EditHostGroups', 'InventoryHostsHelp', 'HelpDialog', 'Wait',
|
||||||
'ToggleHostEnabled'
|
'ToggleHostEnabled', 'Stream'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,15 @@ angular.module('InventoryHostsFormDefinition', [])
|
|||||||
iconSize: 'large',
|
iconSize: 'large',
|
||||||
ngClick: "showHelp()",
|
ngClick: "showHelp()",
|
||||||
id: "hosts-page-help"
|
id: "hosts-page-help"
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'edit',
|
||||||
|
iconSize: 'large'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,15 @@ angular.module('HomeGroupListDefinition', [])
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'all',
|
||||||
|
iconSize: 'large'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
|
|||||||
@@ -81,6 +81,15 @@ angular.module('HomeHostListDefinition', [])
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'all',
|
||||||
|
iconSize: 'large'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ angular.module('InventorySummaryDefinition', [])
|
|||||||
awToolTip: "Refresh the page",
|
awToolTip: "Refresh the page",
|
||||||
ngClick: "refresh()",
|
ngClick: "refresh()",
|
||||||
iconSize: 'large'
|
iconSize: 'large'
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'all',
|
||||||
|
iconSize: 'large'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,17 @@
|
|||||||
angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefinition', 'SearchHelper', 'PaginateHelper',
|
angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefinition', 'SearchHelper', 'PaginateHelper',
|
||||||
'RefreshHelper', 'ListGenerator', 'StreamWidget'])
|
'RefreshHelper', 'ListGenerator', 'StreamWidget'])
|
||||||
|
|
||||||
.factory('ShowStream', [ function() {
|
.factory('setStreamHeight', [ function() {
|
||||||
|
return function() {
|
||||||
|
// Try not to overlap footer. Because stream is positioned absolute, the parent
|
||||||
|
// doesn't resize correctly when stream is loaded.
|
||||||
|
var stream = $('#stream-container');
|
||||||
|
var height = stream.height() + 50;
|
||||||
|
$('#tab-content-container').css({ "min-height": height });
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
.factory('ShowStream', [ 'setStreamHeight', function(setStreamHeight) {
|
||||||
return function() {
|
return function() {
|
||||||
// Slide in the Stream widget
|
// Slide in the Stream widget
|
||||||
|
|
||||||
@@ -25,9 +35,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
'background-color': '#FFF'
|
'background-color': '#FFF'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Try not to overlap footer. Because stream is positioned absolute, the parent
|
setStreamHeight();
|
||||||
// doesn't resize correctly when stream is loaded.
|
|
||||||
$('#tab-content-container').css({ 'min-height': stream.height() + 50 });
|
|
||||||
|
|
||||||
// Slide in stream
|
// Slide in stream
|
||||||
stream.show('slide', {'direction': 'left'}, {'duration': 500, 'queue': false });
|
stream.show('slide', {'direction': 'left'}, {'duration': 500, 'queue': false });
|
||||||
@@ -172,7 +180,6 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
// load up the form
|
// load up the form
|
||||||
var results = data;
|
var results = data;
|
||||||
|
|
||||||
$('#form-modal').on('show.bs.modal', function (e) {
|
$('#form-modal').on('show.bs.modal', function (e) {
|
||||||
$('#form-modal-body').css({
|
$('#form-modal-body').css({
|
||||||
width:'auto', //probably not needed
|
width:'auto', //probably not needed
|
||||||
@@ -230,9 +237,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
|
|
||||||
.factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit',
|
.factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit',
|
||||||
'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl',
|
'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl',
|
||||||
'ShowDetail', 'StreamBreadCrumbs',
|
'ShowDetail', 'StreamBreadCrumbs', 'setStreamHeight',
|
||||||
function($rootScope, $location, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList,
|
function($rootScope, $location, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList,
|
||||||
FormatDate, ShowStream, HideStream, BuildDescription, FixUrl, BuildUrl, ShowDetail, StreamBreadCrumbs) {
|
FormatDate, ShowStream, HideStream, BuildDescription, FixUrl, BuildUrl, ShowDetail, StreamBreadCrumbs, setStreamHeight) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var list = StreamList;
|
var list = StreamList;
|
||||||
@@ -240,13 +247,20 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
var view = GenerateList;
|
var view = GenerateList;
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
|
|
||||||
if (base !== 'home') {
|
if ($location.path() !== '/home') {
|
||||||
// Restrict what we're looking at based on the path
|
// Restrict what we're looking at based on the path
|
||||||
var type = (base == 'inventories') ? 'inventory' : base.replace(/s$/,'');
|
var type = (base == 'inventories') ? 'inventory' : base.replace(/s$/,'');
|
||||||
var paths = $location.path().split('/');
|
var paths = $location.path().split('/');
|
||||||
paths.splice(0,1);
|
paths.splice(0,1);
|
||||||
if (paths.length > 1 && /^\d+/.test(paths[1])) {
|
if (paths.length > 1 && /^\d+/.test(paths[paths.length - 1])) {
|
||||||
defaultUrl += '?object1=' + type + '&object1_id=' + paths[i];
|
type = paths[paths.length - 2];
|
||||||
|
type = (type == 'inventories') ? 'inventory' : type.replace(/s$/,'');
|
||||||
|
defaultUrl += '?object1=' + type + '&object1_id=' + paths[paths.length - 1];
|
||||||
|
}
|
||||||
|
else if (paths.length > 1) {
|
||||||
|
type = paths[paths.length - 1];
|
||||||
|
type = (type == 'inventories') ? 'inventory' : type.replace(/s$/,'');
|
||||||
|
defaultUrl += '?or__object1=' + type + '&or__object2=' + type;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
defaultUrl += '?or__object1=' + type + '&or__object2=' + type;
|
defaultUrl += '?or__object1=' + type + '&or__object2=' + type;
|
||||||
@@ -284,10 +298,10 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
ShowDetail(id);
|
ShowDetail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope.removePostRefresh) {
|
if (scope.removeStreamPostRefresh) {
|
||||||
scope.removePostRefresh();
|
scope.removeStreamPostRefresh();
|
||||||
}
|
}
|
||||||
scope.removePostRefresh = scope.$on('PostRefresh', function() {
|
scope.removeStreamPostRefresh = scope.$on('PostRefresh', function() {
|
||||||
for (var i=0; i < scope['activities'].length; i++) {
|
for (var i=0; i < scope['activities'].length; i++) {
|
||||||
// Convert event_time date to local time zone
|
// Convert event_time date to local time zone
|
||||||
cDate = new Date(scope['activities'][i].timestamp);
|
cDate = new Date(scope['activities'][i].timestamp);
|
||||||
@@ -332,7 +346,10 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
|
|
||||||
// Description
|
// Description
|
||||||
scope['activities'][i].description = BuildDescription(scope['activities'][i]);
|
scope['activities'][i].description = BuildDescription(scope['activities'][i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Give ng-repeate a chance to show the data before adjusting the page size.
|
||||||
|
setTimeout(function() { setStreamHeight(); }, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize search and paginate pieces and load data
|
// Initialize search and paginate pieces and load data
|
||||||
|
|||||||
@@ -1378,6 +1378,7 @@ tr td button i {
|
|||||||
#stream-container {
|
#stream-container {
|
||||||
display: none;
|
display: none;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
z-index: 20; /* has to be greater than tree selector */
|
||||||
}
|
}
|
||||||
|
|
||||||
#stream-content {
|
#stream-content {
|
||||||
|
|||||||
Reference in New Issue
Block a user