Show More
@@ -2709,7 +2709,6 b" angular.module('appenlight.plugins', pluginsToLoad);" | |||||
2709 | var app = angular.module('appenlight', [ |
|
2709 | var app = angular.module('appenlight', [ | |
2710 | 'appenlight.base', |
|
2710 | 'appenlight.base', | |
2711 | 'appenlight.config', |
|
2711 | 'appenlight.config', | |
2712 | 'appenlight.user', |
|
|||
2713 | 'appenlight.templates', |
|
2712 | 'appenlight.templates', | |
2714 | 'appenlight.filters', |
|
2713 | 'appenlight.filters', | |
2715 | 'appenlight.services', |
|
2714 | 'appenlight.services', | |
@@ -2718,10 +2717,8 b" var app = angular.module('appenlight', [" | |||||
2718 | 'appenlight.plugins' |
|
2717 | 'appenlight.plugins' | |
2719 | ]); |
|
2718 | ]); | |
2720 |
|
2719 | |||
2721 | function kickstartAE() { |
|
2720 | // needs manual execution because of plugin files | |
2722 |
|
2721 | function kickstartAE(initialUserData) { | ||
2723 |
|
||||
2724 |
|
||||
2725 | app.config(['$httpProvider', '$uibTooltipProvider', '$locationProvider', function ($httpProvider, $uibTooltipProvider, $locationProvider) { |
|
2722 | app.config(['$httpProvider', '$uibTooltipProvider', '$locationProvider', function ($httpProvider, $uibTooltipProvider, $locationProvider) { | |
2726 | $locationProvider.html5Mode(true); |
|
2723 | $locationProvider.html5Mode(true); | |
2727 | $httpProvider.interceptors.push(['$q', '$rootScope', '$timeout', 'stateHolder', function ($q, $rootScope, $timeout, stateHolder) { |
|
2724 | $httpProvider.interceptors.push(['$q', '$rootScope', '$timeout', 'stateHolder', function ($q, $rootScope, $timeout, stateHolder) { | |
@@ -2773,14 +2770,14 b' function kickstartAE() {' | |||||
2773 | }); |
|
2770 | }); | |
2774 | }); |
|
2771 | }); | |
2775 |
|
2772 | |||
2776 |
app.run(['$rootScope', '$timeout', 'stateHolder', '$state', '$location', '$transitions', '$window', 'AeConfig', |
|
2773 | app.run(['$rootScope', '$timeout', 'stateHolder', '$state', '$location', '$transitions', '$window', 'AeConfig', | |
2777 |
function ($rootScope, $timeout, stateHolder, $state, $location, $transitions, $window, AeConfig |
|
2774 | function ($rootScope, $timeout, stateHolder, $state, $location, $transitions, $window, AeConfig) { | |
|
2775 | stateHolder.AeUser = buildUser(initialUserData || {"user_name": null, "id": null}); | |||
2778 | $rootScope.$state = $state; |
|
2776 | $rootScope.$state = $state; | |
2779 | $rootScope.stateHolder = stateHolder; |
|
2777 | $rootScope.stateHolder = stateHolder; | |
2780 | $rootScope.flash = stateHolder.flashMessages.list; |
|
2778 | $rootScope.flash = stateHolder.flashMessages.list; | |
2781 | $rootScope.closeAlert = stateHolder.flashMessages.closeAlert; |
|
2779 | $rootScope.closeAlert = stateHolder.flashMessages.closeAlert; | |
2782 | $rootScope.AeConfig = AeConfig; |
|
2780 | $rootScope.AeConfig = AeConfig; | |
2783 | $rootScope.AeUser = AeUser; |
|
|||
2784 |
|
2781 | |||
2785 | var transitionApp = function($transition$, $state) { |
|
2782 | var transitionApp = function($transition$, $state) { | |
2786 | // redirect user to /register unless its one of open views |
|
2783 | // redirect user to /register unless its one of open views | |
@@ -2807,14 +2804,22 b' function kickstartAE() {' | |||||
2807 | isOpenView = true; |
|
2804 | isOpenView = true; | |
2808 | } |
|
2805 | } | |
2809 | }); |
|
2806 | }); | |
2810 | if (AeUser.id === null && !isGuestState && !isOpenView) { |
|
2807 | if (stateHolder.AeUser.id === null && !isGuestState && !isOpenView) { | |
2811 | if (window.location.toString().indexOf(AeConfig.urls.otherRoutes.register) === -1) { |
|
2808 | if (window.location.toString().indexOf(AeConfig.urls.otherRoutes.register) === -1) { | |
2812 |
|
2809 | |||
2813 |
|
|
2810 | var newLocation = AeConfig.urls.otherRoutes.register + '?came_from=' + encodeURIComponent(window.location); | |
|
2811 | // fix infinite digest here | |||
|
2812 | $rootScope.$on('$locationChangeStart', | |||
|
2813 | function(event, toState, toParams, fromState, fromParams, options){ | |||
|
2814 | event.preventDefault(); | |||
|
2815 | $window.location = newLocation; | |||
|
2816 | }); | |||
|
2817 | $window.location = newLocation; | |||
2814 | return false; |
|
2818 | return false; | |
2815 | } |
|
2819 | } | |
2816 | return false; |
|
2820 | return false; | |
2817 | } |
|
2821 | } | |
|
2822 | return true; | |||
2818 | }; |
|
2823 | }; | |
2819 | $transitions.onBefore({}, transitionApp); |
|
2824 | $transitions.onBefore({}, transitionApp); | |
2820 |
|
2825 | |||
@@ -4853,20 +4858,20 b' function kickstartAE() {' | |||||
4853 | "<div class=\"row\">\n" + |
|
4858 | "<div class=\"row\">\n" + | |
4854 | " <div class=\"col-sm-12 dashboard\" id=\"content\">\n" + |
|
4859 | " <div class=\"col-sm-12 dashboard\" id=\"content\">\n" + | |
4855 | "\n" + |
|
4860 | "\n" + | |
4856 | " <div ng-if=\"!AeUser.applications.length\">\n" + |
|
4861 | " <div ng-if=\"!stateHolder.AeUser.applications.length\">\n" + | |
4857 | "\n" + |
|
4862 | "\n" + | |
4858 | " <div ng-include=\"'templates/quickstart.html'\"></div>\n" + |
|
4863 | " <div ng-include=\"'templates/quickstart.html'\"></div>\n" + | |
4859 | "\n" + |
|
4864 | "\n" + | |
4860 | " </div>\n" + |
|
4865 | " </div>\n" + | |
4861 | "\n" + |
|
4866 | "\n" + | |
4862 | " <div ng-if=\"AeUser.applications.length\">\n" + |
|
4867 | " <div ng-if=\"stateHolder.AeUser.applications.length\">\n" + | |
4863 | "\n" + |
|
4868 | "\n" + | |
4864 | " <div class=\"row\">\n" + |
|
4869 | " <div class=\"row\">\n" + | |
4865 | " <div class=\"col-sm-6\">\n" + |
|
4870 | " <div class=\"col-sm-6\">\n" + | |
4866 | " <div class=\"panel panel-default\">\n" + |
|
4871 | " <div class=\"panel panel-default\">\n" + | |
4867 | " <div class=\"panel-body\">\n" + |
|
4872 | " <div class=\"panel-body\">\n" + | |
4868 | " <form class=\"graph-type form-inline\">\n" + |
|
4873 | " <form class=\"graph-type form-inline\">\n" + | |
4869 | " <select ng-model=\"index.resource\" ng-options=\"r.resource_id as r.resource_name for r in AeUser.applications\" ng-change=\"index.updateSearchParams()\"\n" + |
|
4874 | " <select ng-model=\"index.resource\" ng-options=\"r.resource_id as r.resource_name for r in stateHolder.AeUser.applications\" ng-change=\"index.updateSearchParams()\"\n" + | |
4870 | " class=\"SelectField form-control input-sm slim-input\"></select>\n" + |
|
4875 | " class=\"SelectField form-control input-sm slim-input\"></select>\n" + | |
4871 | "\n" + |
|
4876 | "\n" + | |
4872 | " <select class=\"SelectField form-control input-sm slim-input\" ng-model=\"index.timeSpan\"\n" + |
|
4877 | " <select class=\"SelectField form-control input-sm slim-input\" ng-model=\"index.timeSpan\"\n" + | |
@@ -6138,7 +6143,7 b' function kickstartAE() {' | |||||
6138 | "\n" + |
|
6143 | "\n" + | |
6139 | "<div ng-if=\"report.report !== null && !report.is_loading.report\">\n" + |
|
6144 | "<div ng-if=\"report.report !== null && !report.is_loading.report\">\n" + | |
6140 | "\n" + |
|
6145 | "\n" + | |
6141 | " <div ng-if=\"AeUser.id\" class=\"row\">\n" + |
|
6146 | " <div ng-if=\"stateHolder.AeUser.id\" class=\"row\">\n" + | |
6142 | " <div class=\"col-lg-12\">\n" + |
|
6147 | " <div class=\"col-lg-12\">\n" + | |
6143 | " <a onclick=\"window.history.back()\" class=\"btn btn-default\" ng-if=\"report.window.history.length > 2\"><span class=\"fa fa-arrow-circle-o-left\"></span>\n" + |
|
6148 | " <a onclick=\"window.history.back()\" class=\"btn btn-default\" ng-if=\"report.window.history.length > 2\"><span class=\"fa fa-arrow-circle-o-left\"></span>\n" + | |
6144 | " Go back</a>\n" + |
|
6149 | " Go back</a>\n" + | |
@@ -7684,9 +7689,9 b' function AdminUsersController(usersResource) {' | |||||
7684 | angular.module('appenlight.controllers') |
|
7689 | angular.module('appenlight.controllers') | |
7685 | .controller('ApplicationsUpdateController', ApplicationsUpdateController) |
|
7690 | .controller('ApplicationsUpdateController', ApplicationsUpdateController) | |
7686 |
|
7691 | |||
7687 |
ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', ' |
|
7692 | ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder']; | |
7688 |
|
7693 | |||
7689 |
function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, |
|
7694 | function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) { | |
7690 | 'use strict'; |
|
7695 | 'use strict'; | |
7691 |
|
7696 | |||
7692 | var vm = this; |
|
7697 | var vm = this; | |
@@ -7732,9 +7737,7 b' function ApplicationsUpdateController($state, applicationsNoIdResource, applicat' | |||||
7732 | vm.loading.application = true; |
|
7737 | vm.loading.application = true; | |
7733 | if (vm.resource.resource_id === null) { |
|
7738 | if (vm.resource.resource_id === null) { | |
7734 | applicationsNoIdResource.save(null, vm.resource, function (data) { |
|
7739 | applicationsNoIdResource.save(null, vm.resource, function (data) { | |
7735 |
|
7740 | stateHolder.AeUser.addApplication(data); | ||
7736 | AeUser.addApplication(data); |
|
|||
7737 |
|
||||
7738 | $state.go('applications.update', {resourceId: data.resource_id}); |
|
7741 | $state.go('applications.update', {resourceId: data.resource_id}); | |
7739 | setServerValidation(vm.BasicForm); |
|
7742 | setServerValidation(vm.BasicForm); | |
7740 | }, function (response) { |
|
7743 | }, function (response) { | |
@@ -7801,9 +7804,7 b' function ApplicationsUpdateController($state, applicationsNoIdResource, applicat' | |||||
7801 | key: 'delete_resource' |
|
7804 | key: 'delete_resource' | |
7802 | }, vm.formDeleteModel, |
|
7805 | }, vm.formDeleteModel, | |
7803 | function (data) { |
|
7806 | function (data) { | |
7804 |
|
7807 | stateHolder.AeUser.removeApplicationById(vm.resource.resource_id); | ||
7805 | AeUser.removeApplicationById(vm.resource.resource_id); |
|
|||
7806 |
|
||||
7807 | $state.go('applications.list'); |
|
7808 | $state.go('applications.list'); | |
7808 | }, |
|
7809 | }, | |
7809 | function (response) { |
|
7810 | function (response) { | |
@@ -8120,9 +8121,9 b' function EventsController(eventsNoIdResource, eventsResource) {' | |||||
8120 | angular.module('appenlight.controllers') |
|
8121 | angular.module('appenlight.controllers') | |
8121 | .controller('IndexDashboardController', IndexDashboardController); |
|
8122 | .controller('IndexDashboardController', IndexDashboardController); | |
8122 |
|
8123 | |||
8123 |
IndexDashboardController.$inject = ['$scope', '$location','$cookies', '$interval', 'stateHolder', 'userSelfPropertyResource', 'applicationsPropertyResource', 'AeConfig' |
|
8124 | IndexDashboardController.$inject = ['$scope', '$location','$cookies', '$interval', 'stateHolder', 'userSelfPropertyResource', 'applicationsPropertyResource', 'AeConfig']; | |
8124 |
|
8125 | |||
8125 |
function IndexDashboardController($scope, $location, $cookies, $interval, stateHolder, userSelfPropertyResource, applicationsPropertyResource, AeConfig |
|
8126 | function IndexDashboardController($scope, $location, $cookies, $interval, stateHolder, userSelfPropertyResource, applicationsPropertyResource, AeConfig) { | |
8126 | var vm = this; |
|
8127 | var vm = this; | |
8127 | stateHolder.section = 'dashboard'; |
|
8128 | stateHolder.section = 'dashboard'; | |
8128 | vm.timeOptions = {}; |
|
8129 | vm.timeOptions = {}; | |
@@ -8133,7 +8134,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
8133 | } |
|
8134 | } | |
8134 | }); |
|
8135 | }); | |
8135 | vm.urls = AeConfig.urls; |
|
8136 | vm.urls = AeConfig.urls; | |
8136 | vm.applications = AeUser.applications_map; |
|
8137 | vm.applications = stateHolder.AeUser.applications_map; | |
8137 | vm.show_dashboard = false; |
|
8138 | vm.show_dashboard = false; | |
8138 | vm.resource = null; |
|
8139 | vm.resource = null; | |
8139 | vm.graphType = {selected: null}; |
|
8140 | vm.graphType = {selected: null}; | |
@@ -8527,7 +8528,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
8527 | }); |
|
8528 | }); | |
8528 |
|
8529 | |||
8529 | vm.determineStartState = function () { |
|
8530 | vm.determineStartState = function () { | |
8530 | if (AeUser.applications.length) { |
|
8531 | if (stateHolder.AeUser.applications.length) { | |
8531 | vm.resource = Number($location.search().resource); |
|
8532 | vm.resource = Number($location.search().resource); | |
8532 |
|
8533 | |||
8533 | if (!vm.resource){ |
|
8534 | if (!vm.resource){ | |
@@ -8538,7 +8539,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
8538 | vm.resource = cookieResource; |
|
8539 | vm.resource = cookieResource; | |
8539 | } |
|
8540 | } | |
8540 | else{ |
|
8541 | else{ | |
8541 | vm.resource = AeUser.applications[0].resource_id; |
|
8542 | vm.resource = stateHolder.AeUser.applications[0].resource_id; | |
8542 | } |
|
8543 | } | |
8543 | } |
|
8544 | } | |
8544 | } |
|
8545 | } | |
@@ -8782,7 +8783,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
8782 | ; |
|
8783 | ; | |
8783 | } |
|
8784 | } | |
8784 |
|
8785 | |||
8785 | if (AeUser.applications.length){ |
|
8786 | if (stateHolder.AeUser.applications.length){ | |
8786 | vm.show_dashboard = true; |
|
8787 | vm.show_dashboard = true; | |
8787 | vm.determineStartState(); |
|
8788 | vm.determineStartState(); | |
8788 | vm.refreshData(); |
|
8789 | vm.refreshData(); | |
@@ -8821,13 +8822,13 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
8821 | angular.module('appenlight.controllers') |
|
8822 | angular.module('appenlight.controllers') | |
8822 | .controller('HeaderCtrl', HeaderCtrl); |
|
8823 | .controller('HeaderCtrl', HeaderCtrl); | |
8823 |
|
8824 | |||
8824 |
HeaderCtrl.$inject = ['$state', 'stateHolder' |
|
8825 | HeaderCtrl.$inject = ['$state', 'stateHolder']; | |
8825 |
|
8826 | |||
8826 |
function HeaderCtrl($state, stateHolder |
|
8827 | function HeaderCtrl($state, stateHolder) { | |
8827 | var vm = this; |
|
8828 | var vm = this; | |
8828 | vm.stateHolder = stateHolder; |
|
8829 | vm.stateHolder = stateHolder; | |
8829 | vm.assignedReports = AeUser.assigned_reports; |
|
8830 | vm.assignedReports = stateHolder.AeUser.assigned_reports; | |
8830 | vm.latestEvents = AeUser.latest_events; |
|
8831 | vm.latestEvents = stateHolder.AeUser.latest_events; | |
8831 | vm.activeEvents = 0; |
|
8832 | vm.activeEvents = 0; | |
8832 | _.each(vm.latestEvents, function (event) { |
|
8833 | _.each(vm.latestEvents, function (event) { | |
8833 | if (event.status === 1 && event.end_date === null) { |
|
8834 | if (event.status === 1 && event.end_date === null) { | |
@@ -9193,9 +9194,9 b' function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName,' | |||||
9193 |
|
9194 | |||
9194 | angular.module('appenlight.controllers').controller('LogsController', LogsController); |
|
9195 | angular.module('appenlight.controllers').controller('LogsController', LogsController); | |
9195 |
|
9196 | |||
9196 |
LogsController.$inject = ['$scope', '$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource' |
|
9197 | LogsController.$inject = ['$scope', '$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource']; | |
9197 |
|
9198 | |||
9198 |
function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource |
|
9199 | function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) { | |
9199 | var vm = this; |
|
9200 | var vm = this; | |
9200 | vm.logEventsChartConfig = { |
|
9201 | vm.logEventsChartConfig = { | |
9201 | data: { |
|
9202 | data: { | |
@@ -9257,7 +9258,7 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs' | |||||
9257 | }; |
|
9258 | }; | |
9258 | vm.today(); |
|
9259 | vm.today(); | |
9259 |
|
9260 | |||
9260 | vm.applications = AeUser.applications_map; |
|
9261 | vm.applications = stateHolder.AeUser.applications_map; | |
9261 | vm.logsPage = []; |
|
9262 | vm.logsPage = []; | |
9262 | vm.itemCount = 0; |
|
9263 | vm.itemCount = 0; | |
9263 | vm.itemsPerPage = 250; |
|
9264 | vm.itemsPerPage = 250; | |
@@ -9645,11 +9646,11 b" angular.module('appenlight.controllers')" | |||||
9645 | .controller('ReportsListSlowController', ReportsListSlowController); |
|
9646 | .controller('ReportsListSlowController', ReportsListSlowController); | |
9646 |
|
9647 | |||
9647 | ReportsListSlowController.$inject = ['$scope', '$location', '$cookies', |
|
9648 | ReportsListSlowController.$inject = ['$scope', '$location', '$cookies', | |
9648 |
'stateHolder', 'typeAheadTagHelper', 'slowReportsResource' |
|
9649 | 'stateHolder', 'typeAheadTagHelper', 'slowReportsResource'] | |
9649 |
|
9650 | |||
9650 |
function ReportsListSlowController($scope, $location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource |
|
9651 | function ReportsListSlowController($scope, $location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource) { | |
9651 | var vm = this; |
|
9652 | var vm = this; | |
9652 | vm.applications = AeUser.applications_map; |
|
9653 | vm.applications = stateHolder.AeUser.applications_map; | |
9653 | stateHolder.section = 'slow_reports'; |
|
9654 | stateHolder.section = 'slow_reports'; | |
9654 | vm.today = function () { |
|
9655 | vm.today = function () { | |
9655 | vm.pickerDate = new Date(); |
|
9656 | vm.pickerDate = new Date(); | |
@@ -9787,7 +9788,7 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ' | |||||
9787 | tag: 'Status ' + status.toUpperCase() |
|
9788 | tag: 'Status ' + status.toUpperCase() | |
9788 | }); |
|
9789 | }); | |
9789 | }); |
|
9790 | }); | |
9790 | _.each(AeUser.applications, function (item) { |
|
9791 | _.each(stateHolder.AeUser.applications, function (item) { | |
9791 | vm.filterTypeAheadOptions.push({ |
|
9792 | vm.filterTypeAheadOptions.push({ | |
9792 | type: 'resource', |
|
9793 | type: 'resource', | |
9793 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
|
9794 | text: 'resource:' + item.resource_id + ':' + item.resource_name, | |
@@ -9940,12 +9941,12 b" angular.module('appenlight.controllers')" | |||||
9940 | .controller('ReportsListController', ReportsListController); |
|
9941 | .controller('ReportsListController', ReportsListController); | |
9941 |
|
9942 | |||
9942 | ReportsListController.$inject = ['$scope', '$location', '$cookies', |
|
9943 | ReportsListController.$inject = ['$scope', '$location', '$cookies', | |
9943 |
'stateHolder', 'typeAheadTagHelper', 'reportsResource' |
|
9944 | 'stateHolder', 'typeAheadTagHelper', 'reportsResource']; | |
9944 |
|
9945 | |||
9945 | function ReportsListController($scope, $location, $cookies, stateHolder, |
|
9946 | function ReportsListController($scope, $location, $cookies, stateHolder, | |
9946 |
typeAheadTagHelper, reportsResource |
|
9947 | typeAheadTagHelper, reportsResource) { | |
9947 | var vm = this; |
|
9948 | var vm = this; | |
9948 | vm.applications = AeUser.applications_map; |
|
9949 | vm.applications = stateHolder.AeUser.applications_map; | |
9949 | stateHolder.section = 'reports'; |
|
9950 | stateHolder.section = 'reports'; | |
9950 | vm.today = function () { |
|
9951 | vm.today = function () { | |
9951 | vm.pickerDate = new Date(); |
|
9952 | vm.pickerDate = new Date(); | |
@@ -10103,7 +10104,7 b' function ReportsListController($scope, $location, $cookies, stateHolder,' | |||||
10103 | tag: 'Status ' + status.toUpperCase() |
|
10104 | tag: 'Status ' + status.toUpperCase() | |
10104 | }); |
|
10105 | }); | |
10105 | }); |
|
10106 | }); | |
10106 | _.each(AeUser.applications, function (item) { |
|
10107 | _.each(stateHolder.AeUser.applications, function (item) { | |
10107 | vm.filterTypeAheadOptions.push({ |
|
10108 | vm.filterTypeAheadOptions.push({ | |
10108 | type: 'resource', |
|
10109 | type: 'resource', | |
10109 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
|
10110 | text: 'resource:' + item.resource_id + ':' + item.resource_name, | |
@@ -10260,9 +10261,9 b' function ReportsListController($scope, $location, $cookies, stateHolder,' | |||||
10260 | angular.module('appenlight.controllers').controller('ReportsViewController', ReportsViewController); |
|
10261 | angular.module('appenlight.controllers').controller('ReportsViewController', ReportsViewController); | |
10261 | ReportsViewController.$inject = ['$window', '$location', '$state', '$uibModal', |
|
10262 | ReportsViewController.$inject = ['$window', '$location', '$state', '$uibModal', | |
10262 | '$cookies', 'reportGroupPropertyResource', 'reportGroupResource', |
|
10263 | '$cookies', 'reportGroupPropertyResource', 'reportGroupResource', | |
10263 |
'logsNoIdResource', ' |
|
10264 | 'logsNoIdResource', 'stateHolder']; | |
10264 |
|
10265 | |||
10265 |
function ReportsViewController($window, $location, $state, $uibModal, $cookies, reportGroupPropertyResource, reportGroupResource, logsNoIdResource, |
|
10266 | function ReportsViewController($window, $location, $state, $uibModal, $cookies, reportGroupPropertyResource, reportGroupResource, logsNoIdResource, stateHolder) { | |
10266 | var vm = this; |
|
10267 | var vm = this; | |
10267 | vm.window = $window; |
|
10268 | vm.window = $window; | |
10268 | vm.reportHistoryConfig = { |
|
10269 | vm.reportHistoryConfig = { | |
@@ -10442,7 +10443,7 b' function ReportsViewController($window, $location, $state, $uibModal, $cookies, ' | |||||
10442 | vm.rawTraceback += ' ' + frame.cline + "\r\n"; |
|
10443 | vm.rawTraceback += ' ' + frame.cline + "\r\n"; | |
10443 | }); |
|
10444 | }); | |
10444 |
|
10445 | |||
10445 | if (AeUser.id){ |
|
10446 | if (stateHolder.AeUser.id){ | |
10446 | vm.fetchHistory(); |
|
10447 | vm.fetchHistory(); | |
10447 | } |
|
10448 | } | |
10448 |
|
10449 | |||
@@ -12772,6 +12773,7 b" angular.module('appenlight.services.stateHolder', []).factory('stateHolder', ['$" | |||||
12772 | resource: null, |
|
12773 | resource: null, | |
12773 | plugins: Plugins, |
|
12774 | plugins: Plugins, | |
12774 | flashMessages: flashMessages, |
|
12775 | flashMessages: flashMessages, | |
|
12776 | AeUser: {"user_name": null, "id": null} | |||
12775 | }; |
|
12777 | }; | |
12776 | return stateHolder; |
|
12778 | return stateHolder; | |
12777 | }]); |
|
12779 | }]); | |
@@ -12910,21 +12912,17 b" underscore.factory('_', function () {" | |||||
12910 | // # services, and proprietary license terms, please see |
|
12912 | // # services, and proprietary license terms, please see | |
12911 | // # https://rhodecode.com/licenses/ |
|
12913 | // # https://rhodecode.com/licenses/ | |
12912 |
|
12914 | |||
12913 | var aeuser = angular.module('appenlight.user', []); |
|
12915 | function buildUser(jsonData){ | |
12914 | aeuser.factory('AeUser', ['AeConfig', function () { |
|
|||
12915 | var decodedAeUser = decodeEncodedJSON(window.AE.user); |
|
|||
12916 |
|
||||
12917 | var AeUser = { |
|
12916 | var AeUser = { | |
12918 |
user_name: |
|
12917 | user_name: jsonData.user_name || null, | |
12919 |
id: |
|
12918 | id: jsonData.id, | |
12920 |
assigned_reports: |
|
12919 | assigned_reports: jsonData.assigned_reports || null, | |
12921 |
latest_events: |
|
12920 | latest_events: jsonData.latest_events || null, | |
12922 |
permissions: |
|
12921 | permissions: jsonData.permissions || null, | |
12923 |
groups: |
|
12922 | groups: jsonData.groups || null, | |
12924 | applications: [], |
|
12923 | applications: [], | |
12925 | dashboards: [] |
|
12924 | dashboards: [] | |
12926 | }; |
|
12925 | }; | |
12927 |
|
||||
12928 | AeUser.applications_map = {}; |
|
12926 | AeUser.applications_map = {}; | |
12929 | AeUser.dashboards_map = {}; |
|
12927 | AeUser.dashboards_map = {}; | |
12930 | AeUser.addApplication = function (item) { |
|
12928 | AeUser.addApplication = function (item) { | |
@@ -12973,12 +12971,11 b" aeuser.factory('AeUser', ['AeConfig', function () {" | |||||
12973 | return hasPerm; |
|
12971 | return hasPerm; | |
12974 | }; |
|
12972 | }; | |
12975 |
|
12973 | |||
12976 |
_.each( |
|
12974 | _.each(jsonData.applications, function (item) { | |
12977 | AeUser.addApplication(item); |
|
12975 | AeUser.addApplication(item); | |
12978 | }); |
|
12976 | }); | |
12979 |
_.each( |
|
12977 | _.each(jsonData.dashboards, function (item) { | |
12980 | AeUser.addDashboard(item); |
|
12978 | AeUser.addDashboard(item); | |
12981 | }); |
|
12979 | }); | |
12982 |
|
||||
12983 | return AeUser; |
|
12980 | return AeUser; | |
12984 | }]); |
|
12981 | } |
@@ -6,4 +6,8 b'' | |||||
6 | <h1 class="page-title">{{ _('Dashboard') }}</h1> |
|
6 | <h1 class="page-title">{{ _('Dashboard') }}</h1> | |
7 | {% endblock %} |
|
7 | {% endblock %} | |
8 |
|
8 | |||
9 |
{% block content%} |
|
9 | {% block content%} | |
|
10 | <div class="text-center"> | |||
|
11 | <span class="fa fa-cog fa-spin fa-5x m-a-4"></span> | |||
|
12 | </div> | |||
|
13 | {% endblock %} |
@@ -1,6 +1,6 b'' | |||||
1 | {% import 'widgets.jinja2' as widgets %} |
|
1 | {% import 'widgets.jinja2' as widgets %} | |
2 | <!DOCTYPE html> |
|
2 | <!DOCTYPE html> | |
3 |
<html {% block ng_controller %}{% endblock %} |
|
3 | <html {% block ng_controller %}{% endblock %}> | |
4 | <head> |
|
4 | <head> | |
5 | <title>{% block title %}Application performance, exception and error monitoring for Python, |
|
5 | <title>{% block title %}Application performance, exception and error monitoring for Python, | |
6 | Django, Flask and Javascript - AppEnlight{% endblock %}</title> |
|
6 | Django, Flask and Javascript - AppEnlight{% endblock %}</title> | |
@@ -22,23 +22,14 b'' | |||||
22 |
|
22 | |||
23 | {% endblock %} |
|
23 | {% endblock %} | |
24 | {% block additional_styles %}{% endblock %} |
|
24 | {% block additional_styles %}{% endblock %} | |
25 |
|
||||
26 | <script type="text/javascript"> |
|
25 | <script type="text/javascript"> | |
27 | var AE = {}; |
|
26 | var AE = {}; | |
28 | AE.urls = {{ url_list|tojson|safe }}; |
|
27 | AE.urls = {{ url_list|tojson|safe }}; | |
29 | AE.ws_url = '{{ request.registry.settings['cometd.ws_url'] }}'; |
|
28 | AE.ws_url = '{{ request.registry.settings['cometd.ws_url'] }}'; | |
30 | {% if request.user %} |
|
|||
31 | AE.user = {{ request.user.get_dict(include_keys=['user_name','id', 'applications', 'assigned_reports', 'latest_events', 'permissions', 'groups'], extended_info=True) |toJSONUnsafe}} |
|
|||
32 | {% else %} |
|
|||
33 | AE.user = '{"user_name": null, "id": null}'; |
|
|||
34 | {% endif %} |
|
|||
35 | AE.flash_messages = {{ flash_msgs|toJSONUnsafe }}; |
|
29 | AE.flash_messages = {{ flash_msgs|toJSONUnsafe }}; | |
36 | AE.timeOptions = {{ h.time_options|toJSONUnsafe }}; |
|
30 | AE.timeOptions = {{ h.time_options|toJSONUnsafe }}; | |
37 | AE.plugins = {{ js_plugins|toJSONUnsafe }}; |
|
31 | AE.plugins = {{ js_plugins|toJSONUnsafe }}; | |
38 | </script> |
|
32 | </script> | |
39 | {% block scripts %} |
|
|||
40 | {% block additional_layout_scripts %}{% endblock %} |
|
|||
41 | {% endblock %} |
|
|||
42 | {% if request.registry.settings.get('appenlight.public_api_key') %} |
|
33 | {% if request.registry.settings.get('appenlight.public_api_key') %} | |
43 | <script type="application/javascript"> |
|
34 | <script type="application/javascript"> | |
44 | var initAppEnlight = function () { |
|
35 | var initAppEnlight = function () { | |
@@ -76,7 +67,36 b'' | |||||
76 | {% for plugin in js_plugins %} |
|
67 | {% for plugin in js_plugins %} | |
77 | <script src="{{ request.static_url('appenlight:webassets/{}/js/{}'.format(plugin['name'], plugin['config']['src']), _query={'rev':js_hash}) }}"></script> |
|
68 | <script src="{{ request.static_url('appenlight:webassets/{}/js/{}'.format(plugin['name'], plugin['config']['src']), _query={'rev':js_hash}) }}"></script> | |
78 | {% endfor %} |
|
69 | {% endfor %} | |
79 | <script> kickstartAE(); </script> |
|
70 | <script> | |
|
71 | var xhr = new XMLHttpRequest(); | |||
|
72 | xhr.open('GET', AE.urls.userSelf); | |||
|
73 | xhr.onload = function() { | |||
|
74 | if (xhr.status === 200) { | |||
|
75 | kickstartAE(JSON.parse(xhr.responseText)); | |||
|
76 | angular.bootstrap(document, ['appenlight']); | |||
|
77 | } | |||
|
78 | else { | |||
|
79 | kickstartAE(null); | |||
|
80 | angular.bootstrap(document, ['appenlight']); | |||
|
81 | } | |||
|
82 | }; | |||
|
83 | // do not run angular on register page | |||
|
84 | ||||
|
85 | var noAngularRoutes = [ | |||
|
86 | AE.urls.otherRoutes.register, | |||
|
87 | AE.urls.otherRoutes.lostPassword, | |||
|
88 | AE.urls.otherRoutes.lostPasswordGenerate, | |||
|
89 | ]; | |||
|
90 | shouldRunAngular = true; | |||
|
91 | for (var i=0; i< noAngularRoutes.length; i++){ | |||
|
92 | if (window.location.toString().indexOf(noAngularRoutes[i]) !== -1) { | |||
|
93 | shouldRunAngular = false; | |||
|
94 | } | |||
|
95 | } | |||
|
96 | if (shouldRunAngular) { | |||
|
97 | xhr.send(); | |||
|
98 | } | |||
|
99 | </script> | |||
80 | </head> |
|
100 | </head> | |
81 | <body class="{% block section_name %}{% endblock %} {% raw %}top-state-{{$state.current.name.split('.')[0].replace('.', '-').replace('.', '-')}} state-{{$state.current.name.replace('.', '-').replace('.', '-')}}{% endraw %} {% if request.user %}user-logged {% else %}user-unlogged{% endif %}" id="html_body"> |
|
101 | <body class="{% block section_name %}{% endblock %} {% raw %}top-state-{{$state.current.name.split('.')[0].replace('.', '-').replace('.', '-')}} state-{{$state.current.name.replace('.', '-').replace('.', '-')}}{% endraw %} {% if request.user %}user-logged {% else %}user-unlogged{% endif %}" id="html_body"> | |
82 | <div class="extra-deco1"></div> |
|
102 | <div class="extra-deco1"></div> |
@@ -1,8 +1,5 b'' | |||||
1 | {% extends "/layout.jinja2" %} |
|
1 | {% extends "/layout.jinja2" %} | |
2 | {% from '/reports/reports_small_list_old.jinja2' import render_reports with context %} |
|
2 | {% from '/reports/reports_small_list_old.jinja2' import render_reports with context %} | |
3 | {% block additional_layout_scripts %} |
|
|||
4 | dojo.require('appenlight.dashboard.index'); |
|
|||
5 | {% endblock %} |
|
|||
6 | {% block content_class %}{% endblock %} |
|
3 | {% block content_class %}{% endblock %} | |
7 | {% set layout_disable_menu = True %} |
|
4 | {% set layout_disable_menu = True %} | |
8 |
|
5 |
@@ -1,5 +1,4 b'' | |||||
1 | {% extends "/layout.jinja2" %} |
|
1 | {% extends "/layout.jinja2" %} | |
2 | {% block ng_app %}{% endblock %} |
|
|||
3 | {% block content %} |
|
2 | {% block content %} | |
4 |
|
3 | |||
5 | <div class="col-sm-offset-1 col-sm-10"> |
|
4 | <div class="col-sm-offset-1 col-sm-10"> |
@@ -1,5 +1,4 b'' | |||||
1 | {% extends "/layout.jinja2" %} |
|
1 | {% extends "/layout.jinja2" %} | |
2 | {% block ng_app %}{% endblock %} |
|
|||
3 | {% block content %} |
|
2 | {% block content %} | |
4 | <div class="col-sm-offset-1 col-sm-10"> |
|
3 | <div class="col-sm-offset-1 col-sm-10"> | |
5 |
|
4 |
@@ -1,5 +1,4 b'' | |||||
1 | {% extends "/layout.jinja2" %} |
|
1 | {% extends "/layout.jinja2" %} | |
2 | {% block ng_app %}{% endblock %} |
|
|||
3 | {% block ng_controller %} data-ng-controller="RegisterController as |
|
2 | {% block ng_controller %} data-ng-controller="RegisterController as | |
4 | register" {% endblock %} |
|
3 | register" {% endblock %} | |
5 | {% block content_class %}two-col equal{% endblock %} |
|
4 | {% block content_class %}two-col equal{% endblock %} |
@@ -181,9 +181,10 b' def users_self(request):' | |||||
181 | request.session.flash(_('Your profile got updated.')) |
|
181 | request.session.flash(_('Your profile got updated.')) | |
182 | else: |
|
182 | else: | |
183 | return HTTPUnprocessableEntity(body=form.errors_json) |
|
183 | return HTTPUnprocessableEntity(body=form.errors_json) | |
184 |
return request.user.get_dict( |
|
184 | return request.user.get_dict( | |
185 | 'security_code', |
|
185 | exclude_keys=['security_code_date', 'notes', 'security_code', | |
186 |
|
|
186 | 'user_password'], | |
|
187 | extended_info=True) | |||
187 |
|
188 | |||
188 |
|
189 | |||
189 | @view_config(route_name='users_self_property', |
|
190 | @view_config(route_name='users_self_property', | |
@@ -440,7 +441,7 b' def alert_channel_DELETE(request):' | |||||
440 | channel = None |
|
441 | channel = None | |
441 | for chan in user.alert_channels: |
|
442 | for chan in user.alert_channels: | |
442 | if (chan.channel_name == request.params.get('channel_name') and |
|
443 | if (chan.channel_name == request.params.get('channel_name') and | |
443 | chan.channel_value == request.params.get('channel_value')): |
|
444 | chan.channel_value == request.params.get('channel_value')): | |
444 | channel = chan |
|
445 | channel = chan | |
445 | break |
|
446 | break | |
446 | if channel: |
|
447 | if channel: |
@@ -74,7 +74,6 b" angular.module('appenlight.plugins', pluginsToLoad);" | |||||
74 | var app = angular.module('appenlight', [ |
|
74 | var app = angular.module('appenlight', [ | |
75 | 'appenlight.base', |
|
75 | 'appenlight.base', | |
76 | 'appenlight.config', |
|
76 | 'appenlight.config', | |
77 | 'appenlight.user', |
|
|||
78 | 'appenlight.templates', |
|
77 | 'appenlight.templates', | |
79 | 'appenlight.filters', |
|
78 | 'appenlight.filters', | |
80 | 'appenlight.services', |
|
79 | 'appenlight.services', | |
@@ -83,10 +82,8 b" var app = angular.module('appenlight', [" | |||||
83 | 'appenlight.plugins' |
|
82 | 'appenlight.plugins' | |
84 | ]); |
|
83 | ]); | |
85 |
|
84 | |||
86 | function kickstartAE() { |
|
85 | // needs manual execution because of plugin files | |
87 |
|
86 | function kickstartAE(initialUserData) { | ||
88 |
|
||||
89 |
|
||||
90 | app.config(['$httpProvider', '$uibTooltipProvider', '$locationProvider', function ($httpProvider, $uibTooltipProvider, $locationProvider) { |
|
87 | app.config(['$httpProvider', '$uibTooltipProvider', '$locationProvider', function ($httpProvider, $uibTooltipProvider, $locationProvider) { | |
91 | $locationProvider.html5Mode(true); |
|
88 | $locationProvider.html5Mode(true); | |
92 | $httpProvider.interceptors.push(['$q', '$rootScope', '$timeout', 'stateHolder', function ($q, $rootScope, $timeout, stateHolder) { |
|
89 | $httpProvider.interceptors.push(['$q', '$rootScope', '$timeout', 'stateHolder', function ($q, $rootScope, $timeout, stateHolder) { | |
@@ -138,14 +135,14 b' function kickstartAE() {' | |||||
138 | }); |
|
135 | }); | |
139 | }); |
|
136 | }); | |
140 |
|
137 | |||
141 |
app.run(['$rootScope', '$timeout', 'stateHolder', '$state', '$location', '$transitions', '$window', 'AeConfig', |
|
138 | app.run(['$rootScope', '$timeout', 'stateHolder', '$state', '$location', '$transitions', '$window', 'AeConfig', | |
142 |
function ($rootScope, $timeout, stateHolder, $state, $location, $transitions, $window, AeConfig |
|
139 | function ($rootScope, $timeout, stateHolder, $state, $location, $transitions, $window, AeConfig) { | |
|
140 | stateHolder.AeUser = buildUser(initialUserData || {"user_name": null, "id": null}); | |||
143 | $rootScope.$state = $state; |
|
141 | $rootScope.$state = $state; | |
144 | $rootScope.stateHolder = stateHolder; |
|
142 | $rootScope.stateHolder = stateHolder; | |
145 | $rootScope.flash = stateHolder.flashMessages.list; |
|
143 | $rootScope.flash = stateHolder.flashMessages.list; | |
146 | $rootScope.closeAlert = stateHolder.flashMessages.closeAlert; |
|
144 | $rootScope.closeAlert = stateHolder.flashMessages.closeAlert; | |
147 | $rootScope.AeConfig = AeConfig; |
|
145 | $rootScope.AeConfig = AeConfig; | |
148 | $rootScope.AeUser = AeUser; |
|
|||
149 |
|
146 | |||
150 | var transitionApp = function($transition$, $state) { |
|
147 | var transitionApp = function($transition$, $state) { | |
151 | // redirect user to /register unless its one of open views |
|
148 | // redirect user to /register unless its one of open views | |
@@ -172,14 +169,22 b' function kickstartAE() {' | |||||
172 | isOpenView = true; |
|
169 | isOpenView = true; | |
173 | } |
|
170 | } | |
174 | }); |
|
171 | }); | |
175 | if (AeUser.id === null && !isGuestState && !isOpenView) { |
|
172 | if (stateHolder.AeUser.id === null && !isGuestState && !isOpenView) { | |
176 | if (window.location.toString().indexOf(AeConfig.urls.otherRoutes.register) === -1) { |
|
173 | if (window.location.toString().indexOf(AeConfig.urls.otherRoutes.register) === -1) { | |
177 | console.log('redirect to register'); |
|
174 | console.log('redirect to register'); | |
178 |
|
|
175 | var newLocation = AeConfig.urls.otherRoutes.register + '?came_from=' + encodeURIComponent(window.location); | |
|
176 | // fix infinite digest here | |||
|
177 | $rootScope.$on('$locationChangeStart', | |||
|
178 | function(event, toState, toParams, fromState, fromParams, options){ | |||
|
179 | event.preventDefault(); | |||
|
180 | $window.location = newLocation; | |||
|
181 | }); | |||
|
182 | $window.location = newLocation; | |||
179 | return false; |
|
183 | return false; | |
180 | } |
|
184 | } | |
181 | return false; |
|
185 | return false; | |
182 | } |
|
186 | } | |
|
187 | return true; | |||
183 | }; |
|
188 | }; | |
184 | $transitions.onBefore({}, transitionApp); |
|
189 | $transitions.onBefore({}, transitionApp); | |
185 |
|
190 |
@@ -20,9 +20,9 b'' | |||||
20 | angular.module('appenlight.controllers') |
|
20 | angular.module('appenlight.controllers') | |
21 | .controller('ApplicationsUpdateController', ApplicationsUpdateController) |
|
21 | .controller('ApplicationsUpdateController', ApplicationsUpdateController) | |
22 |
|
22 | |||
23 |
ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', ' |
|
23 | ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder']; | |
24 |
|
24 | |||
25 |
function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, |
|
25 | function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) { | |
26 | 'use strict'; |
|
26 | 'use strict'; | |
27 | console.debug('ApplicationsUpdateController'); |
|
27 | console.debug('ApplicationsUpdateController'); | |
28 | var vm = this; |
|
28 | var vm = this; | |
@@ -68,9 +68,7 b' function ApplicationsUpdateController($state, applicationsNoIdResource, applicat' | |||||
68 | vm.loading.application = true; |
|
68 | vm.loading.application = true; | |
69 | if (vm.resource.resource_id === null) { |
|
69 | if (vm.resource.resource_id === null) { | |
70 | applicationsNoIdResource.save(null, vm.resource, function (data) { |
|
70 | applicationsNoIdResource.save(null, vm.resource, function (data) { | |
71 |
|
|
71 | stateHolder.AeUser.addApplication(data); | |
72 | AeUser.addApplication(data); |
|
|||
73 | console.log('apps',AeUser.applications); |
|
|||
74 | $state.go('applications.update', {resourceId: data.resource_id}); |
|
72 | $state.go('applications.update', {resourceId: data.resource_id}); | |
75 | setServerValidation(vm.BasicForm); |
|
73 | setServerValidation(vm.BasicForm); | |
76 | }, function (response) { |
|
74 | }, function (response) { | |
@@ -137,9 +135,7 b' function ApplicationsUpdateController($state, applicationsNoIdResource, applicat' | |||||
137 | key: 'delete_resource' |
|
135 | key: 'delete_resource' | |
138 | }, vm.formDeleteModel, |
|
136 | }, vm.formDeleteModel, | |
139 | function (data) { |
|
137 | function (data) { | |
140 | console.log('apps',AeUser.applications); |
|
138 | stateHolder.AeUser.removeApplicationById(vm.resource.resource_id); | |
141 | AeUser.removeApplicationById(vm.resource.resource_id); |
|
|||
142 | console.log('apps',AeUser.applications); |
|
|||
143 | $state.go('applications.list'); |
|
139 | $state.go('applications.list'); | |
144 | }, |
|
140 | }, | |
145 | function (response) { |
|
141 | function (response) { |
@@ -20,9 +20,9 b'' | |||||
20 | angular.module('appenlight.controllers') |
|
20 | angular.module('appenlight.controllers') | |
21 | .controller('IndexDashboardController', IndexDashboardController); |
|
21 | .controller('IndexDashboardController', IndexDashboardController); | |
22 |
|
22 | |||
23 |
IndexDashboardController.$inject = ['$scope', '$location','$cookies', '$interval', 'stateHolder', 'userSelfPropertyResource', 'applicationsPropertyResource', 'AeConfig' |
|
23 | IndexDashboardController.$inject = ['$scope', '$location','$cookies', '$interval', 'stateHolder', 'userSelfPropertyResource', 'applicationsPropertyResource', 'AeConfig']; | |
24 |
|
24 | |||
25 |
function IndexDashboardController($scope, $location, $cookies, $interval, stateHolder, userSelfPropertyResource, applicationsPropertyResource, AeConfig |
|
25 | function IndexDashboardController($scope, $location, $cookies, $interval, stateHolder, userSelfPropertyResource, applicationsPropertyResource, AeConfig) { | |
26 | var vm = this; |
|
26 | var vm = this; | |
27 | stateHolder.section = 'dashboard'; |
|
27 | stateHolder.section = 'dashboard'; | |
28 | vm.timeOptions = {}; |
|
28 | vm.timeOptions = {}; | |
@@ -33,7 +33,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
33 | } |
|
33 | } | |
34 | }); |
|
34 | }); | |
35 | vm.urls = AeConfig.urls; |
|
35 | vm.urls = AeConfig.urls; | |
36 | vm.applications = AeUser.applications_map; |
|
36 | vm.applications = stateHolder.AeUser.applications_map; | |
37 | vm.show_dashboard = false; |
|
37 | vm.show_dashboard = false; | |
38 | vm.resource = null; |
|
38 | vm.resource = null; | |
39 | vm.graphType = {selected: null}; |
|
39 | vm.graphType = {selected: null}; | |
@@ -427,7 +427,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
427 | }); |
|
427 | }); | |
428 |
|
428 | |||
429 | vm.determineStartState = function () { |
|
429 | vm.determineStartState = function () { | |
430 | if (AeUser.applications.length) { |
|
430 | if (stateHolder.AeUser.applications.length) { | |
431 | vm.resource = Number($location.search().resource); |
|
431 | vm.resource = Number($location.search().resource); | |
432 |
|
432 | |||
433 | if (!vm.resource){ |
|
433 | if (!vm.resource){ | |
@@ -438,7 +438,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
438 | vm.resource = cookieResource; |
|
438 | vm.resource = cookieResource; | |
439 | } |
|
439 | } | |
440 | else{ |
|
440 | else{ | |
441 | vm.resource = AeUser.applications[0].resource_id; |
|
441 | vm.resource = stateHolder.AeUser.applications[0].resource_id; | |
442 | } |
|
442 | } | |
443 | } |
|
443 | } | |
444 | } |
|
444 | } | |
@@ -682,7 +682,7 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH' | |||||
682 | ; |
|
682 | ; | |
683 | } |
|
683 | } | |
684 |
|
684 | |||
685 | if (AeUser.applications.length){ |
|
685 | if (stateHolder.AeUser.applications.length){ | |
686 | vm.show_dashboard = true; |
|
686 | vm.show_dashboard = true; | |
687 | vm.determineStartState(); |
|
687 | vm.determineStartState(); | |
688 | vm.refreshData(); |
|
688 | vm.refreshData(); |
@@ -20,13 +20,13 b'' | |||||
20 | angular.module('appenlight.controllers') |
|
20 | angular.module('appenlight.controllers') | |
21 | .controller('HeaderCtrl', HeaderCtrl); |
|
21 | .controller('HeaderCtrl', HeaderCtrl); | |
22 |
|
22 | |||
23 |
HeaderCtrl.$inject = ['$state', 'stateHolder' |
|
23 | HeaderCtrl.$inject = ['$state', 'stateHolder']; | |
24 |
|
24 | |||
25 |
function HeaderCtrl($state, stateHolder |
|
25 | function HeaderCtrl($state, stateHolder) { | |
26 | var vm = this; |
|
26 | var vm = this; | |
27 | vm.stateHolder = stateHolder; |
|
27 | vm.stateHolder = stateHolder; | |
28 | vm.assignedReports = AeUser.assigned_reports; |
|
28 | vm.assignedReports = stateHolder.AeUser.assigned_reports; | |
29 | vm.latestEvents = AeUser.latest_events; |
|
29 | vm.latestEvents = stateHolder.AeUser.latest_events; | |
30 | vm.activeEvents = 0; |
|
30 | vm.activeEvents = 0; | |
31 | _.each(vm.latestEvents, function (event) { |
|
31 | _.each(vm.latestEvents, function (event) { | |
32 | if (event.status === 1 && event.end_date === null) { |
|
32 | if (event.status === 1 && event.end_date === null) { |
@@ -19,9 +19,9 b'' | |||||
19 |
|
19 | |||
20 | angular.module('appenlight.controllers').controller('LogsController', LogsController); |
|
20 | angular.module('appenlight.controllers').controller('LogsController', LogsController); | |
21 |
|
21 | |||
22 |
LogsController.$inject = ['$scope', '$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource' |
|
22 | LogsController.$inject = ['$scope', '$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource']; | |
23 |
|
23 | |||
24 |
function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource |
|
24 | function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) { | |
25 | var vm = this; |
|
25 | var vm = this; | |
26 | vm.logEventsChartConfig = { |
|
26 | vm.logEventsChartConfig = { | |
27 | data: { |
|
27 | data: { | |
@@ -83,7 +83,7 b' function LogsController($scope, $location, stateHolder, typeAheadTagHelper, logs' | |||||
83 | }; |
|
83 | }; | |
84 | vm.today(); |
|
84 | vm.today(); | |
85 |
|
85 | |||
86 | vm.applications = AeUser.applications_map; |
|
86 | vm.applications = stateHolder.AeUser.applications_map; | |
87 | vm.logsPage = []; |
|
87 | vm.logsPage = []; | |
88 | vm.itemCount = 0; |
|
88 | vm.itemCount = 0; | |
89 | vm.itemsPerPage = 250; |
|
89 | vm.itemsPerPage = 250; |
@@ -21,12 +21,12 b" angular.module('appenlight.controllers')" | |||||
21 | .controller('ReportsListController', ReportsListController); |
|
21 | .controller('ReportsListController', ReportsListController); | |
22 |
|
22 | |||
23 | ReportsListController.$inject = ['$scope', '$location', '$cookies', |
|
23 | ReportsListController.$inject = ['$scope', '$location', '$cookies', | |
24 |
'stateHolder', 'typeAheadTagHelper', 'reportsResource' |
|
24 | 'stateHolder', 'typeAheadTagHelper', 'reportsResource']; | |
25 |
|
25 | |||
26 | function ReportsListController($scope, $location, $cookies, stateHolder, |
|
26 | function ReportsListController($scope, $location, $cookies, stateHolder, | |
27 |
typeAheadTagHelper, reportsResource |
|
27 | typeAheadTagHelper, reportsResource) { | |
28 | var vm = this; |
|
28 | var vm = this; | |
29 | vm.applications = AeUser.applications_map; |
|
29 | vm.applications = stateHolder.AeUser.applications_map; | |
30 | stateHolder.section = 'reports'; |
|
30 | stateHolder.section = 'reports'; | |
31 | vm.today = function () { |
|
31 | vm.today = function () { | |
32 | vm.pickerDate = new Date(); |
|
32 | vm.pickerDate = new Date(); | |
@@ -184,7 +184,7 b' function ReportsListController($scope, $location, $cookies, stateHolder,' | |||||
184 | tag: 'Status ' + status.toUpperCase() |
|
184 | tag: 'Status ' + status.toUpperCase() | |
185 | }); |
|
185 | }); | |
186 | }); |
|
186 | }); | |
187 | _.each(AeUser.applications, function (item) { |
|
187 | _.each(stateHolder.AeUser.applications, function (item) { | |
188 | vm.filterTypeAheadOptions.push({ |
|
188 | vm.filterTypeAheadOptions.push({ | |
189 | type: 'resource', |
|
189 | type: 'resource', | |
190 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
|
190 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
@@ -25,11 +25,11 b" angular.module('appenlight.controllers')" | |||||
25 | .controller('ReportsListSlowController', ReportsListSlowController); |
|
25 | .controller('ReportsListSlowController', ReportsListSlowController); | |
26 |
|
26 | |||
27 | ReportsListSlowController.$inject = ['$scope', '$location', '$cookies', |
|
27 | ReportsListSlowController.$inject = ['$scope', '$location', '$cookies', | |
28 |
'stateHolder', 'typeAheadTagHelper', 'slowReportsResource' |
|
28 | 'stateHolder', 'typeAheadTagHelper', 'slowReportsResource'] | |
29 |
|
29 | |||
30 |
function ReportsListSlowController($scope, $location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource |
|
30 | function ReportsListSlowController($scope, $location, $cookies, stateHolder, typeAheadTagHelper, slowReportsResource) { | |
31 | var vm = this; |
|
31 | var vm = this; | |
32 | vm.applications = AeUser.applications_map; |
|
32 | vm.applications = stateHolder.AeUser.applications_map; | |
33 | stateHolder.section = 'slow_reports'; |
|
33 | stateHolder.section = 'slow_reports'; | |
34 | vm.today = function () { |
|
34 | vm.today = function () { | |
35 | vm.pickerDate = new Date(); |
|
35 | vm.pickerDate = new Date(); | |
@@ -167,7 +167,7 b' function ReportsListSlowController($scope, $location, $cookies, stateHolder, typ' | |||||
167 | tag: 'Status ' + status.toUpperCase() |
|
167 | tag: 'Status ' + status.toUpperCase() | |
168 | }); |
|
168 | }); | |
169 | }); |
|
169 | }); | |
170 | _.each(AeUser.applications, function (item) { |
|
170 | _.each(stateHolder.AeUser.applications, function (item) { | |
171 | vm.filterTypeAheadOptions.push({ |
|
171 | vm.filterTypeAheadOptions.push({ | |
172 | type: 'resource', |
|
172 | type: 'resource', | |
173 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
|
173 | text: 'resource:' + item.resource_id + ':' + item.resource_name, |
@@ -20,9 +20,9 b'' | |||||
20 | angular.module('appenlight.controllers').controller('ReportsViewController', ReportsViewController); |
|
20 | angular.module('appenlight.controllers').controller('ReportsViewController', ReportsViewController); | |
21 | ReportsViewController.$inject = ['$window', '$location', '$state', '$uibModal', |
|
21 | ReportsViewController.$inject = ['$window', '$location', '$state', '$uibModal', | |
22 | '$cookies', 'reportGroupPropertyResource', 'reportGroupResource', |
|
22 | '$cookies', 'reportGroupPropertyResource', 'reportGroupResource', | |
23 |
'logsNoIdResource', ' |
|
23 | 'logsNoIdResource', 'stateHolder']; | |
24 |
|
24 | |||
25 |
function ReportsViewController($window, $location, $state, $uibModal, $cookies, reportGroupPropertyResource, reportGroupResource, logsNoIdResource, |
|
25 | function ReportsViewController($window, $location, $state, $uibModal, $cookies, reportGroupPropertyResource, reportGroupResource, logsNoIdResource, stateHolder) { | |
26 | var vm = this; |
|
26 | var vm = this; | |
27 | vm.window = $window; |
|
27 | vm.window = $window; | |
28 | vm.reportHistoryConfig = { |
|
28 | vm.reportHistoryConfig = { | |
@@ -202,7 +202,7 b' function ReportsViewController($window, $location, $state, $uibModal, $cookies, ' | |||||
202 | vm.rawTraceback += ' ' + frame.cline + "\r\n"; |
|
202 | vm.rawTraceback += ' ' + frame.cline + "\r\n"; | |
203 | }); |
|
203 | }); | |
204 |
|
204 | |||
205 | if (AeUser.id){ |
|
205 | if (stateHolder.AeUser.id){ | |
206 | vm.fetchHistory(); |
|
206 | vm.fetchHistory(); | |
207 | } |
|
207 | } | |
208 |
|
208 |
@@ -86,6 +86,7 b" angular.module('appenlight.services.stateHolder', []).factory('stateHolder', ['$" | |||||
86 | resource: null, |
|
86 | resource: null, | |
87 | plugins: Plugins, |
|
87 | plugins: Plugins, | |
88 | flashMessages: flashMessages, |
|
88 | flashMessages: flashMessages, | |
|
89 | AeUser: {"user_name": null, "id": null} | |||
89 | }; |
|
90 | }; | |
90 | return stateHolder; |
|
91 | return stateHolder; | |
91 | }]); |
|
92 | }]); |
@@ -14,20 +14,20 b'' | |||||
14 | <div class="row"> |
|
14 | <div class="row"> | |
15 | <div class="col-sm-12 dashboard" id="content"> |
|
15 | <div class="col-sm-12 dashboard" id="content"> | |
16 |
|
16 | |||
17 | <div ng-if="!AeUser.applications.length"> |
|
17 | <div ng-if="!stateHolder.AeUser.applications.length"> | |
18 |
|
18 | |||
19 | <div ng-include="'templates/quickstart.html'"></div> |
|
19 | <div ng-include="'templates/quickstart.html'"></div> | |
20 |
|
20 | |||
21 | </div> |
|
21 | </div> | |
22 |
|
22 | |||
23 | <div ng-if="AeUser.applications.length"> |
|
23 | <div ng-if="stateHolder.AeUser.applications.length"> | |
24 |
|
24 | |||
25 | <div class="row"> |
|
25 | <div class="row"> | |
26 | <div class="col-sm-6"> |
|
26 | <div class="col-sm-6"> | |
27 | <div class="panel panel-default"> |
|
27 | <div class="panel panel-default"> | |
28 | <div class="panel-body"> |
|
28 | <div class="panel-body"> | |
29 | <form class="graph-type form-inline"> |
|
29 | <form class="graph-type form-inline"> | |
30 | <select ng-model="index.resource" ng-options="r.resource_id as r.resource_name for r in AeUser.applications" ng-change="index.updateSearchParams()" |
|
30 | <select ng-model="index.resource" ng-options="r.resource_id as r.resource_name for r in stateHolder.AeUser.applications" ng-change="index.updateSearchParams()" | |
31 | class="SelectField form-control input-sm slim-input"></select> |
|
31 | class="SelectField form-control input-sm slim-input"></select> | |
32 |
|
32 | |||
33 | <select class="SelectField form-control input-sm slim-input" ng-model="index.timeSpan" |
|
33 | <select class="SelectField form-control input-sm slim-input" ng-model="index.timeSpan" |
@@ -94,7 +94,7 b'' | |||||
94 |
|
94 | |||
95 | <div ng-if="report.report !== null && !report.is_loading.report"> |
|
95 | <div ng-if="report.report !== null && !report.is_loading.report"> | |
96 |
|
96 | |||
97 | <div ng-if="AeUser.id" class="row"> |
|
97 | <div ng-if="stateHolder.AeUser.id" class="row"> | |
98 | <div class="col-lg-12"> |
|
98 | <div class="col-lg-12"> | |
99 | <a onclick="window.history.back()" class="btn btn-default" ng-if="report.window.history.length > 2"><span class="fa fa-arrow-circle-o-left"></span> |
|
99 | <a onclick="window.history.back()" class="btn btn-default" ng-if="report.window.history.length > 2"><span class="fa fa-arrow-circle-o-left"></span> | |
100 | Go back</a> |
|
100 | Go back</a> |
@@ -17,21 +17,17 b'' | |||||
17 | // # services, and proprietary license terms, please see |
|
17 | // # services, and proprietary license terms, please see | |
18 | // # https://rhodecode.com/licenses/ |
|
18 | // # https://rhodecode.com/licenses/ | |
19 |
|
19 | |||
20 | var aeuser = angular.module('appenlight.user', []); |
|
20 | function buildUser(jsonData){ | |
21 | aeuser.factory('AeUser', ['AeConfig', function () { |
|
|||
22 | var decodedAeUser = decodeEncodedJSON(window.AE.user); |
|
|||
23 | console.log('decodedAeUser', decodedAeUser); |
|
|||
24 | var AeUser = { |
|
21 | var AeUser = { | |
25 |
user_name: |
|
22 | user_name: jsonData.user_name || null, | |
26 |
id: |
|
23 | id: jsonData.id, | |
27 |
assigned_reports: |
|
24 | assigned_reports: jsonData.assigned_reports || null, | |
28 |
latest_events: |
|
25 | latest_events: jsonData.latest_events || null, | |
29 |
permissions: |
|
26 | permissions: jsonData.permissions || null, | |
30 |
groups: |
|
27 | groups: jsonData.groups || null, | |
31 | applications: [], |
|
28 | applications: [], | |
32 | dashboards: [] |
|
29 | dashboards: [] | |
33 | }; |
|
30 | }; | |
34 | console.log('AeUser', AeUser); |
|
|||
35 | AeUser.applications_map = {}; |
|
31 | AeUser.applications_map = {}; | |
36 | AeUser.dashboards_map = {}; |
|
32 | AeUser.dashboards_map = {}; | |
37 | AeUser.addApplication = function (item) { |
|
33 | AeUser.addApplication = function (item) { | |
@@ -80,12 +76,11 b" aeuser.factory('AeUser', ['AeConfig', function () {" | |||||
80 | return hasPerm; |
|
76 | return hasPerm; | |
81 | }; |
|
77 | }; | |
82 |
|
78 | |||
83 |
_.each( |
|
79 | _.each(jsonData.applications, function (item) { | |
84 | AeUser.addApplication(item); |
|
80 | AeUser.addApplication(item); | |
85 | }); |
|
81 | }); | |
86 |
_.each( |
|
82 | _.each(jsonData.dashboards, function (item) { | |
87 | AeUser.addDashboard(item); |
|
83 | AeUser.addDashboard(item); | |
88 | }); |
|
84 | }); | |
89 |
|
||||
90 | return AeUser; |
|
85 | return AeUser; | |
91 | }]); |
|
86 | } |
General Comments 0
You need to be logged in to leave comments.
Login now