mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
added websockets to dashboard
This commit is contained in:
parent
c020e38a4a
commit
8d15d0ade7
@ -587,6 +587,10 @@ angular.module('Tower', [
|
|||||||
$log.debug('Job summary_complete ' + data.unified_job_id);
|
$log.debug('Job summary_complete ' + data.unified_job_id);
|
||||||
$rootScope.$emit('JobSummaryComplete', data);
|
$rootScope.$emit('JobSummaryComplete', data);
|
||||||
});
|
});
|
||||||
|
sock.on("schedule_change", function(data) {
|
||||||
|
$log.debug('schedule changed to ' + data.status);
|
||||||
|
$rootScope.$emit('ScheduleChange', data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openSocket();
|
openSocket();
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* config.js
|
* config.js
|
||||||
*
|
*
|
||||||
* Gobal configuration variables for controlling application behavior.
|
* Gobal configuration variables for controlling application behavior.
|
||||||
*
|
*
|
||||||
* Do NOT change this file, unless the changes should be included in
|
* Do NOT change this file, unless the changes should be included in
|
||||||
* production builds. For development, copy this file to local_config.js,
|
* production builds. For development, copy this file to local_config.js,
|
||||||
* and make changes. git will ignore local_config.js
|
* and make changes. git will ignore local_config.js
|
||||||
*
|
*
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
* Host count graph should only be loaded if the user is a super user
|
* Host count graph should only be loaded if the user is a super user
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, DashboardCounts, HostGraph, JobStatusGraph, HostPieChart, DashboardJobs,
|
function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, DashboardCounts, HostGraph, JobStatusGraph, HostPieChart, DashboardJobs,
|
||||||
ClearScope, Stream, Rest, GetBasePath, ProcessErrors, Button){
|
ClearScope, Stream, Rest, GetBasePath, ProcessErrors, Button){
|
||||||
|
|
||||||
ClearScope('home');
|
ClearScope('home');
|
||||||
|
|
||||||
var buttons, html, e, waitCount, loadedCount,borderStyles;
|
var buttons, html, e, waitCount, loadedCount,borderStyles, jobs_scope, schedule_scope;
|
||||||
|
|
||||||
// Add buttons to the top of the Home page. We're using lib/ansible/generator_helpers.js-> Buttons()
|
// Add buttons to the top of the Home page. We're using lib/ansible/generator_helpers.js-> Buttons()
|
||||||
// to build buttons dynamically and insure all styling and icons match the rest of the application.
|
// to build buttons dynamically and insure all styling and icons match the rest of the application.
|
||||||
@ -77,8 +77,12 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
|
|||||||
if ($scope.removeWidgetLoaded) {
|
if ($scope.removeWidgetLoaded) {
|
||||||
$scope.removeWidgetLoaded();
|
$scope.removeWidgetLoaded();
|
||||||
}
|
}
|
||||||
$scope.removeWidgetLoaded = $scope.$on('WidgetLoaded', function () {
|
$scope.removeWidgetLoaded = $scope.$on('WidgetLoaded', function (e, label, jobscope, schedulescope) {
|
||||||
// Once all the widgets report back 'loaded', turn off Wait widget
|
// Once all the widgets report back 'loaded', turn off Wait widget
|
||||||
|
if(label==="dashboard_jobs"){
|
||||||
|
jobs_scope = jobscope;
|
||||||
|
schedule_scope = schedulescope;
|
||||||
|
}
|
||||||
loadedCount++;
|
loadedCount++;
|
||||||
if (loadedCount === waitCount) {
|
if (loadedCount === waitCount) {
|
||||||
$(window).resize(_.debounce(function() {
|
$(window).resize(_.debounce(function() {
|
||||||
@ -92,8 +96,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($scope.removeDashboardReady) {
|
if ($scope.removeDashboardReady) {
|
||||||
$scope.removeDashboardReady();
|
$scope.removeDashboardReady();
|
||||||
}
|
}
|
||||||
@ -135,8 +137,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
|
|||||||
else{
|
else{
|
||||||
$('#dash-host-count-graph').remove(); //replaceWith("<div id='dash-host-count-graph' class='left-side col-sm-12 col-xs-12'></div>");
|
$('#dash-host-count-graph').remove(); //replaceWith("<div id='dash-host-count-graph' class='left-side col-sm-12 col-xs-12'></div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DashboardJobs({
|
DashboardJobs({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
target: 'dash-jobs-list',
|
target: 'dash-jobs-list',
|
||||||
@ -150,6 +150,23 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($rootScope.removeJobStatusChange) {
|
||||||
|
$rootScope.removeJobStatusChange();
|
||||||
|
}
|
||||||
|
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function() {
|
||||||
|
jobs_scope.refreshJobs();
|
||||||
|
$scope.$emit('ReloadJobStatusGraph');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($rootScope.removeScheduleChange) {
|
||||||
|
$rootScope.removeScheduleChange();
|
||||||
|
}
|
||||||
|
$rootScope.removeScheduleChange = $rootScope.$on('ScheduleChange', function() {
|
||||||
|
schedule_scope.refreshSchedules();
|
||||||
|
$scope.$emit('ReloadJobStatusGraph');
|
||||||
|
});
|
||||||
|
|
||||||
$scope.showActivity = function () {
|
$scope.showActivity = function () {
|
||||||
Stream({
|
Stream({
|
||||||
scope: $scope
|
scope: $scope
|
||||||
@ -174,7 +191,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', 'Wait', 'DashboardCounts', 'HostGraph','JobStatusGraph', 'HostPieChart', 'DashboardJobs',
|
Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'DashboardCounts', 'HostGraph','JobStatusGraph', 'HostPieChart', 'DashboardJobs',
|
||||||
'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', 'Button'
|
'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', 'Button'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"key" : "Hosts" ,
|
|
||||||
"color" : "#1778c3",
|
|
||||||
"values" : [
|
|
||||||
[1340755200000 , 2] , [1340762400000 , 4] ,
|
|
||||||
[1340769600000 , 8] , [1340776800000 , 16] ,
|
|
||||||
[1340784000000 , 32] , [1340791200000 , 64] ,
|
|
||||||
[1340798400000 , 128] , [1340805600000 , 150] ,
|
|
||||||
[1340812800000 , 175] , [1340820000000 , 180] ,
|
|
||||||
[1340827200000 , 190] , [1340834400000 , 195] ,
|
|
||||||
[1343347200000 , 195]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key" : "License" ,
|
|
||||||
"color" : "#171717",
|
|
||||||
"values" : [
|
|
||||||
[1340755200000 , 500] , [1340762400000 , 500] ,
|
|
||||||
[1340769600000 , 500] , [1340776800000 , 500] ,
|
|
||||||
[1340784000000 , 500] , [1340791200000 , 500] ,
|
|
||||||
[1340798400000 , 500] , [1340805600000 , 500] ,
|
|
||||||
[1340812800000 , 500] , [1340820000000 , 500] ,
|
|
||||||
[1340827200000 , 500] , [1340834400000 , 500] ,
|
|
||||||
[1343347200000 , 500]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,30 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"key" : "Successful" ,
|
|
||||||
"color" : "#1778c3",
|
|
||||||
"values" : [
|
|
||||||
[1340755200000 , 100] , [1340762400000 , 101] ,
|
|
||||||
[1340769600000 , 102] , [1340776800000 , 103] ,
|
|
||||||
[1340784000000 , 103] , [1340791200000 , 103] ,
|
|
||||||
[1340798400000 , 103] , [1340805600000 , 103] ,
|
|
||||||
[1340812800000 , 103] , [1340820000000 , 103] ,
|
|
||||||
[1340827200000 , 103] , [1340834400000 , 103] ,
|
|
||||||
[1343347200000 , 103]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key" : "Failed" ,
|
|
||||||
"color" : "#aa0000",
|
|
||||||
"values" : [
|
|
||||||
[1340755200000 , 50] , [1340762400000 , 50] ,
|
|
||||||
[1340769600000 , 50] , [1340776800000 , 50] ,
|
|
||||||
[1340784000000 , 50] , [1340791200000 , 50] ,
|
|
||||||
[1340798400000 , 50] , [1340805600000 , 50] ,
|
|
||||||
[1340812800000 , 50] , [1340820000000 , 50] ,
|
|
||||||
[1340827200000 , 50] , [1340834400000 , 50] ,
|
|
||||||
[1343347200000 , 50]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ angular.module('DashboardJobsWidget', ['RestServices', 'Utilities'])
|
|||||||
listCount++;
|
listCount++;
|
||||||
if (listCount === 1) {
|
if (listCount === 1) {
|
||||||
//api_complete = true;
|
//api_complete = true;
|
||||||
scope.$emit('WidgetLoaded');
|
scope.$emit('WidgetLoaded', "dashboard_jobs", jobs_scope, scheduled_scope);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -81,6 +81,13 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities'])
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($rootScope.removeReloadJobStatusGraph) {
|
||||||
|
$rootScope.removeReloadJobStatusGraph();
|
||||||
|
}
|
||||||
|
$rootScope.removeReloadJobStatusGraph = $rootScope.$on('ReloadJobStatusGraph', function() {
|
||||||
|
createGraph();
|
||||||
|
});
|
||||||
|
|
||||||
element = angular.element(document.getElementById(target));
|
element = angular.element(document.getElementById(target));
|
||||||
element.html(html);
|
element.html(html);
|
||||||
$compile(element)(scope);
|
$compile(element)(scope);
|
||||||
|
Loading…
Reference in New Issue
Block a user