##// END OF EJS Templates
log browser: turn into component
ergo -
Show More
This diff has been collapsed as it changes many lines, (2686 lines changed) Show them Hide them
@@ -2679,7 +2679,8 b" angular.module('appenlight.components', ["
2679 'appenlight.components.channelstream',
2679 'appenlight.components.channelstream',
2680 'appenlight.components.appenlightApp',
2680 'appenlight.components.appenlightApp',
2681 'appenlight.components.appenlightHeader',
2681 'appenlight.components.appenlightHeader',
2682 'appenlight.components.indexDashboardView'
2682 'appenlight.components.indexDashboardView',
2683 'appenlight.components.logsBrowserView',
2683 ]);
2684 ]);
2684 angular.module('appenlight.directives', [
2685 angular.module('appenlight.directives', [
2685 'appenlight.directives.c3chart',
2686 'appenlight.directives.c3chart',
@@ -3303,6 +3304,106 b' function kickstartAE(initialUserData) {'
3303 );
3304 );
3304
3305
3305
3306
3307 $templateCache.put('components/views/logs-browser/logs-browser.html',
3308 "<ng-include src=\"'templates/loader.html'\" ng-if=\"$ctrl.isLoading.logs\"></ng-include>\n" +
3309 "\n" +
3310 "<div ng-if=\"$ctrl.isLoading.logs === false\">\n" +
3311 "\n" +
3312 " <p class=\"search-params\">\n" +
3313 " <strong>Search params:</strong>\n" +
3314 " <span ng-repeat=\"tag in $ctrl.searchParams.tags\" class=\"tag\">\n" +
3315 " <strong>{{tag.type}}</strong>\n" +
3316 " {{ tag.type == 'resource' ? $ctrl.applications[tag.value].resource_name : tag.value }}\n" +
3317 "\n" +
3318 " <a ng-click=\"$ctrl.removeSearchTag(tag)\"><span class=\"fa fa-times\"></span></a>\n" +
3319 " </span>\n" +
3320 " </p>\n" +
3321 "\n" +
3322 " <p>\n" +
3323 "\n" +
3324 " <script type=\"text/ng-template\" id=\"SearchTypeAheadUrl.html\">\n" +
3325 "\n" +
3326 " </script>\n" +
3327 "\n" +
3328 " <form class=\"form\">\n" +
3329 " <div class=\"typeahead-tags\">\n" +
3330 " <input type=\"text\" id=\"typeAhead\" ng-model=\"$ctrl.filterTypeAhead\" placeholder=\"Start typing to filter logs for events, filter by servers, namespaces, levels.\"\n" +
3331 " ng-keydown=\"$ctrl.typeAheadTag($event)\"\n" +
3332 " uib-typeahead=\"tag as tag.text for tag in $ctrl.filterTypeAheadOptions | filter:$viewValue:$ctrl.aheadFilter\"\n" +
3333 " typeahead-min-length=\"1\" class=\"form-control\"\n" +
3334 " typeahead-template-url=\"templates/directives/search_type_ahead.html\">\n" +
3335 " </div>\n" +
3336 " </form>\n" +
3337 "\n" +
3338 " <div class=\"well animate-show position-absolute increse-zindex\" ng-if=\"$ctrl.showDatePicker\" ng-model=\"$ctrl.pickerDate\" ng-change=\"$ctrl.pickerDateChanged()\">\n" +
3339 " <uib-datepicker></uib-datepicker>\n" +
3340 " </div>\n" +
3341 "\n" +
3342 " </p>\n" +
3343 "\n" +
3344 " <div class=\"panel\">\n" +
3345 "\n" +
3346 " <div class=\"panel-body\">\n" +
3347 " <c3chart data-domid=\"log_events_chart\" data-data=\"$ctrl.logEventsChartData\" data-config=\"$ctrl.logEventsChartConfig\">\n" +
3348 " </c3chart>\n" +
3349 " </div>\n" +
3350 " </div>\n" +
3351 "\n" +
3352 "\n" +
3353 " <div class=\"text-center\">\n" +
3354 " <uib-pagination total-items=\"$ctrl.itemCount\" items-per-page=\"$ctrl.itemsPerPage\" ng-model=\"$ctrl.page\" max-size=\"10\"\n" +
3355 " ng-change=\"$ctrl.paginationChange()\"\n" +
3356 " class=\"pagination pagination-sm\" boundary-links=\"true\" direction-links=\"false\"></uib-pagination>\n" +
3357 " </div>\n" +
3358 "\n" +
3359 " <div class=\"panel panel-default\">\n" +
3360 "\n" +
3361 " <table class=\"table table-striped log-list\">\n" +
3362 " <caption>Logs</caption>\n" +
3363 " <thead>\n" +
3364 " <tr>\n" +
3365 " <th class=\"c1 resource\">Application</th>\n" +
3366 " <th class=\"c2 message\">Message</th>\n" +
3367 " <th class=\"c3 when\">When</th>\n" +
3368 " </tr>\n" +
3369 " </thead>\n" +
3370 " <tbody>\n" +
3371 " <tr ng-repeat=\"log in $ctrl.logsPage track by log.log_id\" class=\"{{$odd ? 'odd' : 'even'}}\">\n" +
3372 " <td class=\"c1\">\n" +
3373 " <a class=\"tag application\" ng-click=\"$ctrl.addSearchTag({type:'resource', value:log.resource_id})\">\n" +
3374 " <span class=\"name\">{{log.resource_name}}</span></a>\n" +
3375 " </td>\n" +
3376 " <td class=\"c2\">\n" +
3377 " <a class=\"tag {{log.log_level|lowercase}}\" ng-click=\"$ctrl.addSearchTag({type:'level', value:log.log_level})\">\n" +
3378 " <span class=\"name\">level:</span> {{log.log_level}}</a>\n" +
3379 " <a class=\"tag\" ng-click=\"$ctrl.addSearchTag({type:'namespace', value:log.namespace})\">\n" +
3380 " <span class=\"name\">namespace:</span> {{log.namespace}}</a>\n" +
3381 " <a ng-repeat=\"(tag, value) in log.tags\" class=\"tag\" ng-click=\"$ctrl.addSearchTag({type:tag, value:value})\">\n" +
3382 " <span class=\"name\">{{tag}}:</span> {{value}}</a>\n" +
3383 " <div class=\"log\">{{log.message}}</div>\n" +
3384 " </td>\n" +
3385 " <td class=\"c3 when\">\n" +
3386 " <a ng-click=\"$ctrl.filterId(log)\" data-uib-tooltip=\"{{log.timestamp}}\">\n" +
3387 " <iso-to-relative-time time=\"{{log.timestamp}}\"/>\n" +
3388 " </a>\n" +
3389 " </td>\n" +
3390 " </tr>\n" +
3391 "\n" +
3392 " </tbody>\n" +
3393 " </table>\n" +
3394 "\n" +
3395 " </div>\n" +
3396 "\n" +
3397 " <div class=\"text-center\">\n" +
3398 " <uib-pagination total-items=\"$ctrl.itemCount\" items-per-page=\"$ctrl.itemsPerPage\" ng-model=\"$ctrl.page\" max-size=\"10\"\n" +
3399 " ng-change=\"$ctrl.paginationChange()\"\n" +
3400 " class=\"pagination pagination-sm\" boundary-links=\"true\" direction-links=\"false\"></uib-pagination>\n" +
3401 " </div>\n" +
3402 "\n" +
3403 "</div>\n"
3404 );
3405
3406
3306 $templateCache.put('directives/permissions/permissions.html',
3407 $templateCache.put('directives/permissions/permissions.html',
3307 "<div class=\"panel panel-default\">\n" +
3408 "<div class=\"panel panel-default\">\n" +
3308 " <div class=\"panel-heading\">\n" +
3409 " <div class=\"panel-heading\">\n" +
@@ -5782,106 +5883,6 b' function kickstartAE(initialUserData) {'
5782 );
5883 );
5783
5884
5784
5885
5785 $templateCache.put('templates/logs.html',
5786 "<ng-include src=\"'templates/loader.html'\" ng-if=\"logs.isLoading.logs\"></ng-include>\n" +
5787 "\n" +
5788 "<div ng-if=\"logs.isLoading.logs === false\">\n" +
5789 "\n" +
5790 " <p class=\"search-params\">\n" +
5791 " <strong>Search params:</strong>\n" +
5792 " <span ng-repeat=\"tag in logs.searchParams.tags\" class=\"tag\">\n" +
5793 " <strong>{{tag.type}}</strong>\n" +
5794 " {{ tag.type == 'resource' ? logs.applications[tag.value].resource_name : tag.value }}\n" +
5795 "\n" +
5796 " <a ng-click=\"logs.removeSearchTag(tag)\"><span class=\"fa fa-times\"></span></a>\n" +
5797 " </span>\n" +
5798 " </p>\n" +
5799 "\n" +
5800 " <p>\n" +
5801 "\n" +
5802 " <script type=\"text/ng-template\" id=\"SearchTypeAheadUrl.html\">\n" +
5803 "\n" +
5804 " </script>\n" +
5805 "\n" +
5806 " <form class=\"form\">\n" +
5807 " <div class=\"typeahead-tags\">\n" +
5808 " <input type=\"text\" id=\"typeAhead\" ng-model=\"logs.filterTypeAhead\" placeholder=\"Start typing to filter logs for events, filter by servers, namespaces, levels.\"\n" +
5809 " ng-keydown=\"logs.typeAheadTag($event)\"\n" +
5810 " uib-typeahead=\"tag as tag.text for tag in logs.filterTypeAheadOptions | filter:$viewValue:logs.aheadFilter\"\n" +
5811 " typeahead-min-length=\"1\" class=\"form-control\"\n" +
5812 " typeahead-template-url=\"templates/directives/search_type_ahead.html\">\n" +
5813 " </div>\n" +
5814 " </form>\n" +
5815 "\n" +
5816 " <div class=\"well animate-show position-absolute increse-zindex\" ng-if=\"logs.showDatePicker\" ng-model=\"logs.pickerDate\" ng-change=\"logs.pickerDateChanged()\">\n" +
5817 " <uib-datepicker></uib-datepicker>\n" +
5818 " </div>\n" +
5819 "\n" +
5820 " </p>\n" +
5821 "\n" +
5822 " <div class=\"panel\">\n" +
5823 "\n" +
5824 " <div class=\"panel-body\">\n" +
5825 " <c3chart data-domid=\"log_events_chart\" data-data=\"logs.logEventsChartData\" data-config=\"logs.logEventsChartConfig\">\n" +
5826 " </c3chart>\n" +
5827 " </div>\n" +
5828 " </div>\n" +
5829 "\n" +
5830 "\n" +
5831 " <div class=\"text-center\">\n" +
5832 " <uib-pagination total-items=\"logs.itemCount\" items-per-page=\"logs.itemsPerPage\" ng-model=\"logs.page\" max-size=\"10\"\n" +
5833 " ng-change=\"logs.paginationChange()\"\n" +
5834 " class=\"pagination pagination-sm\" boundary-links=\"true\" direction-links=\"false\"></uib-pagination>\n" +
5835 " </div>\n" +
5836 "\n" +
5837 " <div class=\"panel panel-default\">\n" +
5838 "\n" +
5839 " <table class=\"table table-striped log-list\">\n" +
5840 " <caption>Logs</caption>\n" +
5841 " <thead>\n" +
5842 " <tr>\n" +
5843 " <th class=\"c1 resource\">Application</th>\n" +
5844 " <th class=\"c2 message\">Message</th>\n" +
5845 " <th class=\"c3 when\">When</th>\n" +
5846 " </tr>\n" +
5847 " </thead>\n" +
5848 " <tbody>\n" +
5849 " <tr ng-repeat=\"log in logs.logsPage track by log.log_id\" class=\"{{$odd ? 'odd' : 'even'}}\">\n" +
5850 " <td class=\"c1\">\n" +
5851 " <a class=\"tag application\" ng-click=\"logs.addSearchTag({type:'resource', value:log.resource_id})\">\n" +
5852 " <span class=\"name\">{{log.resource_name}}</span></a>\n" +
5853 " </td>\n" +
5854 " <td class=\"c2\">\n" +
5855 " <a class=\"tag {{log.log_level|lowercase}}\" ng-click=\"logs.addSearchTag({type:'level', value:log.log_level})\">\n" +
5856 " <span class=\"name\">level:</span> {{log.log_level}}</a>\n" +
5857 " <a class=\"tag\" ng-click=\"logs.addSearchTag({type:'namespace', value:log.namespace})\">\n" +
5858 " <span class=\"name\">namespace:</span> {{log.namespace}}</a>\n" +
5859 " <a ng-repeat=\"(tag, value) in log.tags\" class=\"tag\" ng-click=\"logs.addSearchTag({type:tag, value:value})\">\n" +
5860 " <span class=\"name\">{{tag}}:</span> {{value}}</a>\n" +
5861 " <div class=\"log\">{{log.message}}</div>\n" +
5862 " </td>\n" +
5863 " <td class=\"c3 when\">\n" +
5864 " <a ng-click=\"logs.filterId(log)\" data-uib-tooltip=\"{{log.timestamp}}\">\n" +
5865 " <iso-to-relative-time time=\"{{log.timestamp}}\"/>\n" +
5866 " </a>\n" +
5867 " </td>\n" +
5868 " </tr>\n" +
5869 "\n" +
5870 " </tbody>\n" +
5871 " </table>\n" +
5872 "\n" +
5873 " </div>\n" +
5874 "\n" +
5875 " <div class=\"text-center\">\n" +
5876 " <uib-pagination total-items=\"logs.itemCount\" items-per-page=\"logs.itemsPerPage\" ng-model=\"logs.page\" max-size=\"10\"\n" +
5877 " ng-change=\"logs.paginationChange()\"\n" +
5878 " class=\"pagination pagination-sm\" boundary-links=\"true\" direction-links=\"false\"></uib-pagination>\n" +
5879 " </div>\n" +
5880 "\n" +
5881 "</div>\n"
5882 );
5883
5884
5885 $templateCache.put('templates/quickstart.html',
5886 $templateCache.put('templates/quickstart.html',
5886 "<h2>AppEnlight quickstart</h2>\n" +
5887 "<h2>AppEnlight quickstart</h2>\n" +
5887 "\n" +
5888 "\n" +
@@ -7996,258 +7997,285 b' function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte'
7996 // # services, and proprietary license terms, please see
7997 // # services, and proprietary license terms, please see
7997 // # https://rhodecode.com/licenses/
7998 // # https://rhodecode.com/licenses/
7998
7999
7999 var aeconfig = angular.module('appenlight.config', []);
8000 angular.module('appenlight.components.logsBrowserView', [])
8000 aeconfig.factory('AeConfig', function () {
8001 .component('logsBrowserView', {
8001 var obj = {};
8002 templateUrl: 'components/views/logs-browser/logs-browser.html',
8002 obj.flashMessages = decodeEncodedJSON(window.AE.flash_messages);
8003 controller: LogsBrowserController
8003 obj.timeOptions = decodeEncodedJSON(window.AE.timeOptions);
8004 obj.plugins = decodeEncodedJSON(window.AE.plugins);
8005 obj.topNav = decodeEncodedJSON(window.AE.topNav);
8006 obj.ws_url = window.AE.ws_url;
8007 obj.urls = window.AE.urls;
8008 // set keys on values because we wont be able to retrieve them everywhere
8009 for (var key in obj.timeOptions) {
8010 obj.timeOptions[key]['key'] = key;
8011 }
8012 console.info('config', obj);
8013 return obj;
8014 });
8015
8016 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8017 // #
8018 // # This program is free software: you can redistribute it and/or modify
8019 // # it under the terms of the GNU Affero General Public License, version 3
8020 // # (only), as published by the Free Software Foundation.
8021 // #
8022 // # This program is distributed in the hope that it will be useful,
8023 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8024 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8025 // # GNU General Public License for more details.
8026 // #
8027 // # You should have received a copy of the GNU Affero General Public License
8028 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8029 // #
8030 // # This program is dual-licensed. If you wish to learn more about the
8031 // # AppEnlight Enterprise Edition, including its added features, Support
8032 // # services, and proprietary license terms, please see
8033 // # https://rhodecode.com/licenses/
8034
8035 angular.module('appenlight.controllers').controller('AdminApplicationsListController', AdminApplicationsListController);
8036
8037 AdminApplicationsListController.$inject = ['applicationsResource'];
8038
8039 function AdminApplicationsListController(applicationsResource) {
8040
8041 var vm = this;
8042 vm.loading = {applications: true};
8043
8044 vm.applications = applicationsResource.query({
8045 root_list: true,
8046 resource_type: 'application'
8047 }, function (data) {
8048 vm.loading = {applications: false};
8049 });
8004 });
8050 };
8051
8052 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8053 // #
8054 // # This program is free software: you can redistribute it and/or modify
8055 // # it under the terms of the GNU Affero General Public License, version 3
8056 // # (only), as published by the Free Software Foundation.
8057 // #
8058 // # This program is distributed in the hope that it will be useful,
8059 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8060 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8061 // # GNU General Public License for more details.
8062 // #
8063 // # You should have received a copy of the GNU Affero General Public License
8064 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8065 // #
8066 // # This program is dual-licensed. If you wish to learn more about the
8067 // # AppEnlight Enterprise Edition, including its added features, Support
8068 // # services, and proprietary license terms, please see
8069 // # https://rhodecode.com/licenses/
8070
8005
8071 angular.module('appenlight.controllers').controller('ConfigsListController', ConfigsListController);
8006 LogsBrowserController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
8072
8073 ConfigsListController.$inject = ['configsResource', 'configsNoIdResource'];
8074
8007
8075 function ConfigsListController(configsResource, configsNoIdResource) {
8008 function LogsBrowserController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
8076 var vm = this;
8009 var vm = this;
8077 vm.loading = {config: true};
8010 vm.logEventsChartConfig = {
8078
8011 data: {
8079 var filters = [
8012 json: [],
8080 'template_footer_html:global',
8013 xFormat: '%Y-%m-%dT%H:%M:%S'
8081 'list_groups_to_non_admins:global',
8014 },
8082 'per_application_reports_rate_limit:global',
8015 color: {
8083 'per_application_logs_rate_limit:global',
8016 pattern: ['#6baed6', '#e6550d', '#74c476', '#fdd0a2', '#8c564b']
8084 'per_application_metrics_rate_limit:global',
8017 },
8085 ];
8018 axis: {
8086
8019 x: {
8087 vm.configs = {};
8020 type: 'timeseries',
8088
8021 tick: {
8089 vm.configList = configsResource.query({filter: filters},
8022 format: '%Y-%m-%d'
8090 function (data) {
8023 }
8091 vm.loading = {config: false};
8024 },
8092 _.each(data, function (item) {
8025 y: {
8093 if (vm.configs[item.section] === undefined) {
8026 tick: {
8094 vm.configs[item.section] = {};
8027 count: 5,
8095 }
8028 format: d3.format('.2s')
8096 vm.configs[item.section][item.key] = item;
8029 }
8097 });
8030 }
8098 });
8031 },
8099
8032 subchart: {
8100 vm.save = function () {
8033 show: true,
8101 vm.loading.config = true;
8034 size: {
8102 _.each(vm.configList, function (item) {
8035 height: 20
8103 item.$save();
8036 }
8104 });
8037 },
8105 vm.loading.config = false;
8038 size: {
8039 height: 250
8040 },
8041 zoom: {
8042 rescale: true
8043 },
8044 grid: {
8045 x: {
8046 show: true
8047 },
8048 y: {
8049 show: true
8050 }
8051 },
8052 tooltip: {
8053 format: {
8054 title: function (d) {
8055 return '' + d;
8056 },
8057 value: function (v) {
8058 return v
8059 }
8060 }
8061 }
8106 };
8062 };
8063 vm.logEventsChartData = {};
8064 stateHolder.section = 'logs';
8065 vm.today = function () {
8066 vm.pickerDate = new Date();
8067 };
8068 vm.today();
8107
8069
8108 };
8070 vm.applications = stateHolder.AeUser.applications_map;
8109
8071 vm.logsPage = [];
8110 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8072 vm.itemCount = 0;
8111 // #
8073 vm.itemsPerPage = 250;
8112 // # This program is free software: you can redistribute it and/or modify
8074 vm.page = 1;
8113 // # it under the terms of the GNU Affero General Public License, version 3
8075 vm.$location = $location;
8114 // # (only), as published by the Free Software Foundation.
8076 vm.isLoading = {
8115 // #
8077 logs: true,
8116 // # This program is distributed in the hope that it will be useful,
8078 series: true
8117 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8079 };
8118 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8080 vm.filterTypeAheadOptions = [
8119 // # GNU General Public License for more details.
8081 {
8120 // #
8082 type: 'message',
8121 // # You should have received a copy of the GNU Affero General Public License
8083 text: 'message:',
8122 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8084 'description': 'Full-text search in your logs',
8123 // #
8085 tag: 'Message',
8124 // # This program is dual-licensed. If you wish to learn more about the
8086 example: 'message:text-im-looking-for'
8125 // # AppEnlight Enterprise Edition, including its added features, Support
8087 },
8126 // # services, and proprietary license terms, please see
8088 {
8127 // # https://rhodecode.com/licenses/
8089 type: 'namespace',
8128
8090 text: 'namespace:',
8129 angular.module('appenlight.controllers').controller('AdminGroupsCreateController', AdminGroupsCreateController);
8091 'description': 'Query logs from specific namespace',
8130
8092 tag: 'Namespace',
8131 AdminGroupsCreateController.$inject = ['$state', 'groupsResource', 'groupsPropertyResource', 'sectionViewResource', 'AeConfig'];
8093 example: "namespace:module.foo"
8132
8094 },
8133 function AdminGroupsCreateController($state, groupsResource, groupsPropertyResource, sectionViewResource, AeConfig) {
8095 {
8134
8096 type: 'resource',
8135 var vm = this;
8097 text: 'resource:',
8136 vm.loading = {
8098 'description': 'Restrict resultset to application',
8137 group: false,
8099 tag: 'Application',
8138 resource_permissions: false,
8100 example: "resource:ID"
8139 users: false
8101 },
8102 {
8103 type: 'request_id',
8104 text: 'request_id:',
8105 'description': 'Show logs with specific request id',
8106 example: "request_id:883143dc572e4c38aceae92af0ea5ae0",
8107 tag: 'Request ID'
8108 },
8109 {
8110 type: 'level',
8111 text: 'level:',
8112 'description': 'Show entries with specific log level',
8113 example: 'level:warning',
8114 tag: 'Level'
8115 },
8116 {
8117 type: 'server_name',
8118 text: 'server_name:',
8119 'description': 'Show entries tagged with this key/value pair',
8120 example: 'server_name:hostname',
8121 tag: 'Tag'
8122 },
8123 {
8124 type: 'start_date',
8125 text: 'start_date:',
8126 'description': 'Show results newer than this date (press TAB for dropdown)',
8127 example: 'start_date:2014-08-15T13:00',
8128 tag: 'Start Date'
8129 },
8130 {
8131 type: 'end_date',
8132 text: 'end_date:',
8133 'description': 'Show results older than this date (press TAB for dropdown)',
8134 example: 'start_date:2014-08-15T23:59',
8135 tag: 'End Date'
8136 },
8137 {type: 'level', value: 'debug', text: 'level:debug'},
8138 {type: 'level', value: 'info', text: 'level:info'},
8139 {type: 'level', value: 'warning', text: 'level:warning'},
8140 {type: 'level', value: 'critical', text: 'level:critical'}
8141 ];
8142 vm.filterTypeAhead = null;
8143 vm.showDatePicker = false;
8144 vm.manualOpen = false;
8145 vm.aheadFilter = typeAheadTagHelper.aheadFilter;
8146 vm.removeSearchTag = function (tag) {
8147 $location.search(tag.type, null);
8148 vm.refresh();
8149 };
8150 vm.addSearchTag = function (tag) {
8151 $location.search(tag.type, tag.value);
8152 vm.refresh();
8140 };
8153 };
8141
8154
8142 vm.form = {
8155 vm.paginationChange = function(){
8143 autocompleteUser: '',
8156 $location.search('page', vm.page);
8144 }
8157 vm.refresh();
8158 };
8145
8159
8146
8160
8147 if (typeof $state.params.groupId !== 'undefined') {
8161 _.each(vm.applications, function (item) {
8148 vm.loading.group = true;
8162 vm.filterTypeAheadOptions.push({
8149 var groupId = $state.params.groupId;
8163 type: 'resource',
8150 vm.group = groupsResource.get({groupId: groupId}, function (data) {
8164 text: 'resource:' + item.resource_id + ':' + item.resource_name,
8151 vm.loading.group = false;
8165 example: 'resource:' + item.resource_id,
8166 'tag': item.resource_name,
8167 'description': 'Restrict resultset to this application'
8152 });
8168 });
8169 });
8153
8170
8154 vm.resource_permissions = groupsPropertyResource.query(
8171 vm.typeAheadTag = function (event) {
8155 {groupId: groupId, key: 'resource_permissions'}, function (data) {
8172 var text = vm.filterTypeAhead;
8156 vm.loading.resource_permissions = false;
8173 if (_.isObject(vm.filterTypeAhead)) {
8157 var tmpObj = {
8174 text = vm.filterTypeAhead.text;
8158 'group': {
8175 };
8159 'application': {},
8176 if (!vm.filterTypeAhead) {
8160 'dashboard': {}
8177 return
8161 }
8178 }
8162 };
8179 var parsed = text.split(':');
8163 _.each(data, function (item) {
8180 var tag = {'type': null, 'value': null};
8164
8181 // app tags have : twice
8165 var section = tmpObj[item.type][item.resource_type];
8182 if (parsed.length > 2 && parsed[0] == 'resource') {
8166 if (typeof section[item.resource_id] == 'undefined') {
8183 tag.type = 'resource';
8167 section[item.resource_id] = {
8184 tag.value = parsed[1];
8168 self: item,
8185 }
8169 permissions: []
8186 // normal tag:value
8170 }
8187 else if (parsed.length > 1) {
8171 }
8188 tag.type = parsed[0];
8172 section[item.resource_id].permissions.push(item.perm_name);
8189 tag.value = parsed.slice(1).join(':');
8173
8190 }
8174 });
8191 else {
8175 vm.resourcePermissions = tmpObj;
8192 tag.type = 'message';
8176 });
8193 tag.value = parsed.join(':');
8177
8194 }
8178 vm.users = groupsPropertyResource.query(
8179 {groupId: groupId, key: 'users'}, function (data) {
8180 vm.loading.users = false;
8181 }, function () {
8182 vm.loading.users = false;
8183 });
8184
8195
8185 }
8196 // set datepicker hour based on type of field
8186 else {
8197 if ('start_date:' == text) {
8187 var groupId = null;
8198 vm.showDatePicker = true;
8188 }
8199 vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
8200 }
8201 else if ('end_date:' == text) {
8202 vm.showDatePicker = true;
8203 vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
8204 }
8189
8205
8190 var formResponse = function (response) {
8206 if (event.keyCode != 13 || !tag.type || !tag.value) {
8191 if (response.status === 422) {
8207 return
8192 setServerValidation(vm.groupForm, response.data);
8193 }
8208 }
8194 vm.loading.group = false;
8209 vm.showDatePicker = false;
8210 // aka we selected one of main options
8211 vm.addSearchTag({type: tag.type, value: tag.value});
8212 // clear typeahead
8213 vm.filterTypeAhead = undefined;
8195 };
8214 };
8196
8215
8197 vm.createGroup = function () {
8216
8198 vm.loading.group = true;
8217 vm.pickerDateChanged = function(){
8199 if (groupId) {
8218 if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
8200 groupsResource.update({groupId: vm.group.id}, vm.group, function (data) {
8219 vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
8201 setServerValidation(vm.groupForm);
8202 vm.loading.group = false;
8203 }, formResponse);
8204 }
8220 }
8205 else {
8221 else if (vm.filterTypeAhead.indexOf('end_date:') == '0') {
8206 groupsResource.save(vm.group, function (data) {
8222 vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
8207 $state.go('admin.group.update', {groupId: data.id});
8208 }, formResponse);
8209 }
8223 }
8224 vm.showDatePicker = false;
8225 };
8226
8227 vm.fetchLogs = function (searchParams) {
8228 vm.isLoading.logs = true;
8229 logsNoIdResource.query(searchParams, function (data, getResponseHeaders) {
8230 vm.isLoading.logs = false;
8231 var headers = getResponseHeaders();
8232 vm.logsPage = data;
8233 vm.itemCount = headers['x-total-count'];
8234 vm.itemsPerPage = headers['x-items-per-page'];
8235 }, function () {
8236 vm.isLoading.logs = false;
8237 });
8238 };
8239
8240 vm.fetchSeriesData = function (searchParams) {
8241 searchParams['section'] = 'logs_section';
8242 searchParams['view'] = 'fetch_series';
8243 vm.isLoading.series = true;
8244 sectionViewResource.query(searchParams, function (data) {
8245
8246 vm.logEventsChartData = {
8247 json: data,
8248 xFormat: '%Y-%m-%dT%H:%M:%S',
8249 keys: {
8250 x: 'x',
8251 value: ["logs"]
8252 },
8253 names: {
8254 logs: 'Log events'
8255 },
8256 type: 'bar'
8257 };
8258 vm.isLoading.series = false;
8259 }, function () {
8260 vm.isLoading.series = false;
8261 });
8210 };
8262 };
8211
8263
8212 vm.removeUser = function (user) {
8264 vm.filterId = function (log) {
8213 groupsPropertyResource.delete(
8265 $location.search('request_id', log.request_id);
8214 {groupId: groupId, key: 'users', user_name: user.user_name},
8266 vm.refresh();
8215 function (data) {
8216 vm.loading.users = false;
8217 vm.users = _.filter(vm.users, function (item) {
8218 return item != user;
8219 });
8220 }, function () {
8221 vm.loading.users = false;
8222 });
8223 };
8267 };
8224
8268
8225 vm.addUser = function () {
8269 vm.refresh = function(){
8226 groupsPropertyResource.save(
8270 vm.searchParams = parseSearchToTags($location.search());
8227 {groupId: groupId, key: 'users'},
8271 vm.page = Number(vm.searchParams.page) || 1;
8228 {user_name: vm.form.autocompleteUser},
8272 var params = parseTagsToSearch(vm.searchParams);
8229 function (data) {
8273 vm.fetchLogs(params);
8230 vm.loading.users = false;
8274 vm.fetchSeriesData(params);
8231 vm.users.push(data);
8275 };
8232 vm.form.autocompleteUser = '';
8276 console.info('page load');
8233 }, function () {
8277 vm.refresh();
8234 vm.loading.users = false;
8278 }
8235 });
8236 }
8237
8238 vm.searchUsers = function (searchPhrase) {
8239
8240 return sectionViewResource.query({
8241 section: 'users_section',
8242 view: 'search_users',
8243 'user_name': searchPhrase
8244 }).$promise.then(function (data) {
8245 return _.map(data, function (item) {
8246 return item.user;
8247 });
8248 });
8249 }
8250 };
8251
8279
8252 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8280 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8253 // #
8281 // #
@@ -8268,40 +8296,22 b' function AdminGroupsCreateController($state, groupsResource, groupsPropertyResou'
8268 // # services, and proprietary license terms, please see
8296 // # services, and proprietary license terms, please see
8269 // # https://rhodecode.com/licenses/
8297 // # https://rhodecode.com/licenses/
8270
8298
8271 angular.module('appenlight.controllers').controller('AdminGroupsController', AdminGroupsController);
8299 var aeconfig = angular.module('appenlight.config', []);
8272
8300 aeconfig.factory('AeConfig', function () {
8273 AdminGroupsController.$inject = ['groupsResource'];
8301 var obj = {};
8274
8302 obj.flashMessages = decodeEncodedJSON(window.AE.flash_messages);
8275 function AdminGroupsController(groupsResource) {
8303 obj.timeOptions = decodeEncodedJSON(window.AE.timeOptions);
8276
8304 obj.plugins = decodeEncodedJSON(window.AE.plugins);
8277 var vm = this;
8305 obj.topNav = decodeEncodedJSON(window.AE.topNav);
8278 vm.loading = {groups: true};
8306 obj.ws_url = window.AE.ws_url;
8279
8307 obj.urls = window.AE.urls;
8280 vm.groups = groupsResource.query({}, function (data) {
8308 // set keys on values because we wont be able to retrieve them everywhere
8281 vm.loading = {groups: false};
8309 for (var key in obj.timeOptions) {
8282 vm.activeUsers = _.reduce(vm.groups, function(memo, val){
8310 obj.timeOptions[key]['key'] = key;
8283 if (val.status == 1){
8284 return memo + 1;
8285 }
8286 return memo;
8287 }, 0);
8288
8289 });
8290
8291
8292 vm.removeGroup = function (group) {
8293 groupsResource.remove({groupId: group.id}, function (data, responseHeaders) {
8294
8295 if (data) {
8296 var index = vm.groups.indexOf(group);
8297 if (index !== -1) {
8298 vm.groups.splice(index, 1);
8299 vm.activeGroups -= 1;
8300 }
8301 }
8302 });
8303 }
8311 }
8304 };
8312 console.info('config', obj);
8313 return obj;
8314 });
8305
8315
8306 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8316 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8307 // #
8317 // #
@@ -8322,111 +8332,22 b' function AdminGroupsController(groupsResource) {'
8322 // # services, and proprietary license terms, please see
8332 // # services, and proprietary license terms, please see
8323 // # https://rhodecode.com/licenses/
8333 // # https://rhodecode.com/licenses/
8324
8334
8325 angular.module('appenlight.controllers').controller('AdminPartitionsController', AdminPartitionsController);
8335 angular.module('appenlight.controllers').controller('AdminApplicationsListController', AdminApplicationsListController);
8326
8336
8327 AdminPartitionsController.$inject = ['sectionViewResource'];
8337 AdminApplicationsListController.$inject = ['applicationsResource'];
8328
8338
8329 function AdminPartitionsController(sectionViewResource) {
8339 function AdminApplicationsListController(applicationsResource) {
8340
8330 var vm = this;
8341 var vm = this;
8331 vm.permanentPartitions = [];
8342 vm.loading = {applications: true};
8332 vm.dailyPartitions = [];
8333 vm.loading = {partitions: true};
8334 vm.dailyChecked = false;
8335 vm.permChecked = false;
8336 vm.dailyConfirm = '';
8337 vm.permConfirm = '';
8338
8339
8340 vm.loadPartitions = function (data) {
8341 var permanentPartitions = vm.transformPartitionList(
8342 data.permanent_partitions);
8343 var dailyPartitions = vm.transformPartitionList(
8344 data.daily_partitions);
8345 vm.permanentPartitions = permanentPartitions;
8346 vm.dailyPartitions = dailyPartitions;
8347 vm.loading = {partitions: false};
8348 };
8349
8350 vm.setCheckedList = function (scope) {
8351 var toTest = null;
8352 if (scope === 'dailyPartitions'){
8353 toTest = 'dailyChecked';
8354 }
8355 else{
8356 toTest = 'permChecked';
8357 }
8358
8359 if (vm[toTest]) {
8360 var val = true;
8361 }
8362 else {
8363 var val = false;
8364 }
8365
8366 _.each(vm[scope], function (item) {
8367 _.each(item[1].pg, function (index) {
8368 index.checked = val;
8369 });
8370 _.each(item[1].elasticsearch, function (index) {
8371 index.checked = val;
8372 });
8373 });
8374 }
8375
8376
8377 vm.transformPartitionList = function (inputList) {
8378 var outputList = [];
8379
8380 _.each(inputList, function (item) {
8381 var time = [item[0], {
8382 elasticsearch: [],
8383 pg: []
8384 }]
8385 _.each(item[1].pg, function (index) {
8386 time[1].pg.push({name: index, checked: false})
8387 });
8388 _.each(item[1].elasticsearch, function (index) {
8389 time[1].elasticsearch.push({
8390 name: index,
8391 checked: false
8392 })
8393 });
8394 outputList.push(time);
8395 });
8396 return outputList;
8397 };
8398
8399 sectionViewResource.get({section:'admin_section', view: 'partitions'},
8400 vm.loadPartitions);
8401
8402 vm.partitionsDelete = function (partitionType) {
8403 var es_indices = [];
8404 var pg_indices = [];
8405 _.each(vm[partitionType], function (item) {
8406 _.each(item[1].pg, function (index) {
8407 if (index.checked) {
8408 pg_indices.push(index.name)
8409 }
8410 });
8411 _.each(item[1].elasticsearch, function (index) {
8412 if (index.checked) {
8413 es_indices.push(index.name)
8414 }
8415 });
8416 });
8417
8418
8419 vm.loading = {partitions: true};
8420 sectionViewResource.save({section:'admin_section',
8421 view: 'partitions_remove'}, {
8422 es_indices: es_indices,
8423 pg_indices: pg_indices,
8424 confirm: 'CONFIRM'
8425 }, vm.loadPartitions);
8426
8427 }
8428
8343
8429 }
8344 vm.applications = applicationsResource.query({
8345 root_list: true,
8346 resource_type: 'application'
8347 }, function (data) {
8348 vm.loading = {applications: false};
8349 });
8350 };
8430
8351
8431 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8352 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8432 // #
8353 // #
@@ -8447,30 +8368,43 b' function AdminPartitionsController(sectionViewResource) {'
8447 // # services, and proprietary license terms, please see
8368 // # services, and proprietary license terms, please see
8448 // # https://rhodecode.com/licenses/
8369 // # https://rhodecode.com/licenses/
8449
8370
8450 angular.module('appenlight.controllers').controller('AdminSystemController', AdminSystemController);
8371 angular.module('appenlight.controllers').controller('ConfigsListController', ConfigsListController);
8451
8372
8452 AdminSystemController.$inject = ['sectionViewResource'];
8373 ConfigsListController.$inject = ['configsResource', 'configsNoIdResource'];
8453
8374
8454 function AdminSystemController(sectionViewResource) {
8375 function ConfigsListController(configsResource, configsNoIdResource) {
8455 var vm = this;
8376 var vm = this;
8456 vm.tables = [];
8377 vm.loading = {config: true};
8457 vm.loading = {system: true};
8378
8458 sectionViewResource.get({
8379 var filters = [
8459 section: 'admin_section',
8380 'template_footer_html:global',
8460 view: 'system'
8381 'list_groups_to_non_admins:global',
8461 }, null, function (data) {
8382 'per_application_reports_rate_limit:global',
8462 vm.DBtables = data.db_tables;
8383 'per_application_logs_rate_limit:global',
8463 vm.ESIndices = data.es_indices;
8384 'per_application_metrics_rate_limit:global',
8464 vm.queueStats = data.queue_stats;
8385 ];
8465 vm.systemLoad = data.system_load;
8386
8466 vm.packages = data.packages;
8387 vm.configs = {};
8467 vm.processInfo = data.process_info;
8388
8468 vm.disks = data.disks;
8389 vm.configList = configsResource.query({filter: filters},
8469 vm.memory = data.memory;
8390 function (data) {
8470 vm.selfInfo = data.self_info;
8391 vm.loading = {config: false};
8392 _.each(data, function (item) {
8393 if (vm.configs[item.section] === undefined) {
8394 vm.configs[item.section] = {};
8395 }
8396 vm.configs[item.section][item.key] = item;
8397 });
8398 });
8399
8400 vm.save = function () {
8401 vm.loading.config = true;
8402 _.each(vm.configList, function (item) {
8403 item.$save();
8404 });
8405 vm.loading.config = false;
8406 };
8471
8407
8472 vm.loading.system = false;
8473 });
8474 };
8408 };
8475
8409
8476 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8410 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -8492,35 +8426,35 b' function AdminSystemController(sectionViewResource) {'
8492 // # services, and proprietary license terms, please see
8426 // # services, and proprietary license terms, please see
8493 // # https://rhodecode.com/licenses/
8427 // # https://rhodecode.com/licenses/
8494
8428
8495 angular.module('appenlight.controllers').controller('AdminUsersCreateController', AdminUsersCreateController);
8429 angular.module('appenlight.controllers').controller('AdminGroupsCreateController', AdminGroupsCreateController);
8496
8430
8497 AdminUsersCreateController.$inject = ['$state', 'usersResource', 'usersPropertyResource', 'sectionViewResource', 'AeConfig'];
8431 AdminGroupsCreateController.$inject = ['$state', 'groupsResource', 'groupsPropertyResource', 'sectionViewResource', 'AeConfig'];
8498
8432
8499 function AdminUsersCreateController($state, usersResource, usersPropertyResource, sectionViewResource, AeConfig) {
8433 function AdminGroupsCreateController($state, groupsResource, groupsPropertyResource, sectionViewResource, AeConfig) {
8500
8434
8501 var vm = this;
8435 var vm = this;
8502 vm.loading = {user: false};
8436 vm.loading = {
8437 group: false,
8438 resource_permissions: false,
8439 users: false
8440 };
8441
8442 vm.form = {
8443 autocompleteUser: '',
8444 }
8503
8445
8504
8446
8505 if (typeof $state.params.userId !== 'undefined') {
8447 if (typeof $state.params.groupId !== 'undefined') {
8506 vm.loading.user = true;
8448 vm.loading.group = true;
8507 var userId = $state.params.userId;
8449 var groupId = $state.params.groupId;
8508 vm.user = usersResource.get({userId: userId}, function (data) {
8450 vm.group = groupsResource.get({groupId: groupId}, function (data) {
8509 vm.loading.user = false;
8451 vm.loading.group = false;
8510 // cast to true for angular checkbox
8511 if (vm.user.status === 1) {
8512 vm.user.status = true;
8513 }
8514 });
8452 });
8515
8453
8516 vm.resource_permissions = usersPropertyResource.query(
8454 vm.resource_permissions = groupsPropertyResource.query(
8517 {userId: userId, key: 'resource_permissions'}, function (data) {
8455 {groupId: groupId, key: 'resource_permissions'}, function (data) {
8518 vm.loading.resource_permissions = false;
8456 vm.loading.resource_permissions = false;
8519 var tmpObj = {
8457 var tmpObj = {
8520 'user': {
8521 'application': {},
8522 'dashboard': {}
8523 },
8524 'group': {
8458 'group': {
8525 'application': {},
8459 'application': {},
8526 'dashboard': {}
8460 'dashboard': {}
@@ -8529,9 +8463,9 b' function AdminUsersCreateController($state, usersResource, usersPropertyResource'
8529 _.each(data, function (item) {
8463 _.each(data, function (item) {
8530
8464
8531 var section = tmpObj[item.type][item.resource_type];
8465 var section = tmpObj[item.type][item.resource_type];
8532 if (typeof section[item.resource_id] == 'undefined'){
8466 if (typeof section[item.resource_id] == 'undefined') {
8533 section[item.resource_id] = {
8467 section[item.resource_id] = {
8534 self:item,
8468 self: item,
8535 permissions: []
8469 permissions: []
8536 }
8470 }
8537 }
8471 }
@@ -8541,110 +8475,77 b' function AdminUsersCreateController($state, usersResource, usersPropertyResource'
8541 vm.resourcePermissions = tmpObj;
8475 vm.resourcePermissions = tmpObj;
8542 });
8476 });
8543
8477
8478 vm.users = groupsPropertyResource.query(
8479 {groupId: groupId, key: 'users'}, function (data) {
8480 vm.loading.users = false;
8481 }, function () {
8482 vm.loading.users = false;
8483 });
8484
8544 }
8485 }
8545 else {
8486 else {
8546 var userId = null;
8487 var groupId = null;
8547 vm.user = {
8548 status: true
8549 }
8550 }
8488 }
8551
8489
8552 var formResponse = function (response) {
8490 var formResponse = function (response) {
8553 if (response.status == 422) {
8491 if (response.status === 422) {
8554 setServerValidation(vm.profileForm, response.data);
8492 setServerValidation(vm.groupForm, response.data);
8555 }
8493 }
8556 vm.loading.user = false;
8494 vm.loading.group = false;
8557 }
8495 };
8558
8496
8559 vm.createUser = function () {
8497 vm.createGroup = function () {
8560 vm.loading.user = true;
8498 vm.loading.group = true;
8561
8499 if (groupId) {
8562 if (userId) {
8500 groupsResource.update({groupId: vm.group.id}, vm.group, function (data) {
8563 usersResource.update({userId: vm.user.id}, vm.user, function (data) {
8501 setServerValidation(vm.groupForm);
8564 setServerValidation(vm.profileForm);
8502 vm.loading.group = false;
8565 vm.loading.user = false;
8566 }, formResponse);
8503 }, formResponse);
8567 }
8504 }
8568 else {
8505 else {
8569 usersResource.save(vm.user, function (data) {
8506 groupsResource.save(vm.group, function (data) {
8570 $state.go('admin.user.update', {userId: data.id});
8507 $state.go('admin.group.update', {groupId: data.id});
8571 }, formResponse);
8508 }, formResponse);
8572 }
8509 }
8573 }
8510 };
8574
8575 vm.generatePassword = function () {
8576 var length = 8;
8577 var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
8578 vm.gen_pass = "";
8579 for (var i = 0, n = charset.length; i < length; ++i) {
8580 vm.gen_pass += charset.charAt(Math.floor(Math.random() * n));
8581 }
8582 vm.user.user_password = '' + vm.gen_pass;
8583
8584 }
8585
8511
8586 vm.reloginUser = function () {
8512 vm.removeUser = function (user) {
8587 sectionViewResource.get({
8513 groupsPropertyResource.delete(
8588 section: 'admin_section', view: 'relogin_user',
8514 {groupId: groupId, key: 'users', user_name: user.user_name},
8589 user_id: vm.user.id
8515 function (data) {
8590 }, function () {
8516 vm.loading.users = false;
8591 window.location = AeConfig.urls.baseUrl;
8517 vm.users = _.filter(vm.users, function (item) {
8592 });
8518 return item != user;
8519 });
8520 }, function () {
8521 vm.loading.users = false;
8522 });
8523 };
8593
8524
8525 vm.addUser = function () {
8526 groupsPropertyResource.save(
8527 {groupId: groupId, key: 'users'},
8528 {user_name: vm.form.autocompleteUser},
8529 function (data) {
8530 vm.loading.users = false;
8531 vm.users.push(data);
8532 vm.form.autocompleteUser = '';
8533 }, function () {
8534 vm.loading.users = false;
8535 });
8594 }
8536 }
8595 };
8596
8597 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8598 // #
8599 // # This program is free software: you can redistribute it and/or modify
8600 // # it under the terms of the GNU Affero General Public License, version 3
8601 // # (only), as published by the Free Software Foundation.
8602 // #
8603 // # This program is distributed in the hope that it will be useful,
8604 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8605 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8606 // # GNU General Public License for more details.
8607 // #
8608 // # You should have received a copy of the GNU Affero General Public License
8609 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8610 // #
8611 // # This program is dual-licensed. If you wish to learn more about the
8612 // # AppEnlight Enterprise Edition, including its added features, Support
8613 // # services, and proprietary license terms, please see
8614 // # https://rhodecode.com/licenses/
8615
8616 angular.module('appenlight.controllers').controller('AdminUsersController', AdminUsersController);
8617
8618 AdminUsersController.$inject = ['usersResource'];
8619
8620 function AdminUsersController(usersResource) {
8621
8622 var vm = this;
8623 vm.loading = {users: true};
8624
8537
8625 vm.users = usersResource.query({}, function (data) {
8538 vm.searchUsers = function (searchPhrase) {
8626 vm.loading = {users: false};
8627 vm.activeUsers = _.reduce(vm.users, function(memo, val){
8628 if (val.status == 1){
8629 return memo + 1;
8630 }
8631 return memo;
8632 }, 0);
8633
8539
8634 });
8540 return sectionViewResource.query({
8635
8541 section: 'users_section',
8636
8542 view: 'search_users',
8637 vm.removeUser = function (user) {
8543 'user_name': searchPhrase
8638 usersResource.remove({userId: user.id}, function (data, responseHeaders) {
8544 }).$promise.then(function (data) {
8639
8545 return _.map(data, function (item) {
8640 if (data) {
8546 return item.user;
8641 var index = vm.users.indexOf(user);
8547 });
8642 if (index !== -1) {
8548 });
8643 vm.users.splice(index, 1);
8644 vm.activeUsers -= 1;
8645 }
8646 }
8647 });
8648 }
8549 }
8649 };
8550 };
8650
8551
@@ -8656,168 +8557,51 b' function AdminUsersController(usersResource) {'
8656 // #
8557 // #
8657 // # This program is distributed in the hope that it will be useful,
8558 // # This program is distributed in the hope that it will be useful,
8658 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8559 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8659 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8560 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8660 // # GNU General Public License for more details.
8561 // # GNU General Public License for more details.
8661 // #
8562 // #
8662 // # You should have received a copy of the GNU Affero General Public License
8563 // # You should have received a copy of the GNU Affero General Public License
8663 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8564 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
8664 // #
8565 // #
8665 // # This program is dual-licensed. If you wish to learn more about the
8566 // # This program is dual-licensed. If you wish to learn more about the
8666 // # AppEnlight Enterprise Edition, including its added features, Support
8567 // # AppEnlight Enterprise Edition, including its added features, Support
8667 // # services, and proprietary license terms, please see
8568 // # services, and proprietary license terms, please see
8668 // # https://rhodecode.com/licenses/
8569 // # https://rhodecode.com/licenses/
8669
8670 angular.module('appenlight.controllers')
8671 .controller('ApplicationsUpdateController', ApplicationsUpdateController)
8672
8673 ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder'];
8674
8675 function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) {
8676 'use strict';
8677
8678 var vm = this;
8679 vm.loading = {application: false};
8680
8681 vm.groupingOptions = [
8682 ['url_type', 'Error Type + location'],
8683 ['url_traceback', 'Traceback + location'],
8684 ['traceback_server', 'Traceback + Server'],
8685 ];
8686
8687 var resourceId = $state.params.resourceId;
8688
8689
8690 var options = {};
8691
8692 vm.momentJs = moment;
8693
8694 vm.formTransferModel = {password:''};
8695
8696 // set initial data
8697
8698 if (resourceId === 'new') {
8699 vm.resource = {
8700 resource_id: null,
8701 slow_report_threshold: 10,
8702 error_report_threshold: 10,
8703 allow_permanent_storage: true,
8704 default_grouping: vm.groupingOptions[1][0]
8705 };
8706 }
8707 else {
8708 vm.loading.application = true;
8709 vm.resource = applicationsResource.get({
8710 'resourceId': resourceId
8711 }, function (data) {
8712 vm.loading.application = false;
8713 });
8714 }
8715
8570
8571 angular.module('appenlight.controllers').controller('AdminGroupsController', AdminGroupsController);
8716
8572
8717 vm.updateBasicForm = function () {
8573 AdminGroupsController.$inject = ['groupsResource'];
8718 vm.loading.application = true;
8719 if (vm.resource.resource_id === null) {
8720 applicationsNoIdResource.save(null, vm.resource, function (data) {
8721 stateHolder.AeUser.addApplication(data);
8722 $state.go('applications.update', {resourceId: data.resource_id});
8723 setServerValidation(vm.BasicForm);
8724 }, function (response) {
8725 if (response.status == 422) {
8726 setServerValidation(vm.BasicForm, response.data);
8727 }
8728 vm.loading.application = false;
8729
8730 });
8731 }
8732 else {
8733 applicationsResource.update({resourceId: vm.resource.resource_id},
8734 vm.resource, function (data) {
8735 vm.resource = data;
8736 vm.loading.application = false;
8737 setServerValidation(vm.BasicForm);
8738 }, function (response) {
8739 if (response.status == 422) {
8740 setServerValidation(vm.BasicForm, response.data);
8741 }
8742 vm.loading.application = false;
8743 });
8744 }
8745 };
8746
8574
8747 vm.addRule = function () {
8575 function AdminGroupsController(groupsResource) {
8748
8576
8749 applicationsPropertyResource.save({
8577 var vm = this;
8750 resourceId: vm.resource.resource_id,
8578 vm.loading = {groups: true};
8751 key: 'postprocessing_rules'
8752 }, null,
8753 function (data) {
8754 vm.resource.postprocessing_rules.push(data);
8755 }
8756 );
8757 };
8758
8579
8759 vm.regenerateAPIKeys = function(){
8580 vm.groups = groupsResource.query({}, function (data) {
8760 vm.loading.application = true;
8581 vm.loading = {groups: false};
8761 applicationsPropertyResource.save({
8582 vm.activeUsers = _.reduce(vm.groups, function(memo, val){
8762 resourceId: vm.resource.resource_id,
8583 if (val.status == 1){
8763 key: 'api_key'
8584 return memo + 1;
8764 }, {password: vm.regenerateAPIKeysPassword},
8765 function (data) {
8766 vm.resource = data;
8767 vm.loading.application = false;
8768 vm.regenerateAPIKeysPassword = '';
8769 setServerValidation(vm.regenerateAPIKeysForm);
8770 },
8771 function (response) {
8772 if (response.status == 422) {
8773 setServerValidation(vm.regenerateAPIKeysForm, response.data);
8774
8775 }
8776 vm.loading.application = false;
8777 }
8585 }
8778 )
8586 return memo;
8779 };
8587 }, 0);
8588
8589 });
8780
8590
8781 vm.deleteApplication = function(){
8782 vm.loading.application = true;
8783 applicationsPropertyResource.update({
8784 resourceId: vm.resource.resource_id,
8785 key: 'delete_resource'
8786 }, vm.formDeleteModel,
8787 function (data) {
8788 stateHolder.AeUser.removeApplicationById(vm.resource.resource_id);
8789 $state.go('applications.list');
8790 },
8791 function (response) {
8792 if (response.status == 422) {
8793 setServerValidation(vm.formDelete, response.data);
8794
8795 }
8796 vm.loading.application = false;
8797 }
8798 );
8799 };
8800
8591
8801 vm.transferApplication = function(){
8592 vm.removeGroup = function (group) {
8802 vm.loading.application = true;
8593 groupsResource.remove({groupId: group.id}, function (data, responseHeaders) {
8803 applicationsPropertyResource.update({
8594
8804 resourceId: vm.resource.resource_id,
8595 if (data) {
8805 key: 'owner'
8596 var index = vm.groups.indexOf(group);
8806 }, vm.formTransferModel,
8597 if (index !== -1) {
8807 function (data) {
8598 vm.groups.splice(index, 1);
8808 $state.go('applications.list');
8599 vm.activeGroups -= 1;
8809 },
8810 function (response) {
8811 if (response.status == 422) {
8812 setServerValidation(vm.formTransfer, response.data);
8813
8814 }
8600 }
8815 vm.loading.application = false;
8816 }
8601 }
8817 )
8602 });
8818 }
8603 }
8819
8604 };
8820 }
8821
8605
8822 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8606 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8823 // #
8607 // #
@@ -8838,73 +8622,110 b' function ApplicationsUpdateController($state, applicationsNoIdResource, applicat'
8838 // # services, and proprietary license terms, please see
8622 // # services, and proprietary license terms, please see
8839 // # https://rhodecode.com/licenses/
8623 // # https://rhodecode.com/licenses/
8840
8624
8841 angular.module('appenlight.controllers')
8625 angular.module('appenlight.controllers').controller('AdminPartitionsController', AdminPartitionsController);
8842 .controller('IntegrationController', IntegrationController)
8843
8626
8844 IntegrationController.$inject = ['$state', 'integrationResource'];
8627 AdminPartitionsController.$inject = ['sectionViewResource'];
8845
8628
8846 function IntegrationController($state, integrationResource) {
8629 function AdminPartitionsController(sectionViewResource) {
8847
8848 var vm = this;
8630 var vm = this;
8849 vm.loading = {integration: true};
8631 vm.permanentPartitions = [];
8850 vm.config = integrationResource.get(
8632 vm.dailyPartitions = [];
8851 {
8633 vm.loading = {partitions: true};
8852 integration: $state.params.integration,
8634 vm.dailyChecked = false;
8853 action: 'setup',
8635 vm.permChecked = false;
8854 resourceId: $state.params.resourceId
8636 vm.dailyConfirm = '';
8855 }, function (data) {
8637 vm.permConfirm = '';
8856 vm.loading.integration = false;
8638
8639
8640 vm.loadPartitions = function (data) {
8641 var permanentPartitions = vm.transformPartitionList(
8642 data.permanent_partitions);
8643 var dailyPartitions = vm.transformPartitionList(
8644 data.daily_partitions);
8645 vm.permanentPartitions = permanentPartitions;
8646 vm.dailyPartitions = dailyPartitions;
8647 vm.loading = {partitions: false};
8648 };
8649
8650 vm.setCheckedList = function (scope) {
8651 var toTest = null;
8652 if (scope === 'dailyPartitions'){
8653 toTest = 'dailyChecked';
8654 }
8655 else{
8656 toTest = 'permChecked';
8657 }
8658
8659 if (vm[toTest]) {
8660 var val = true;
8661 }
8662 else {
8663 var val = false;
8664 }
8665
8666 _.each(vm[scope], function (item) {
8667 _.each(item[1].pg, function (index) {
8668 index.checked = val;
8669 });
8670 _.each(item[1].elasticsearch, function (index) {
8671 index.checked = val;
8672 });
8857 });
8673 });
8674 }
8858
8675
8859 vm.configureIntegration = function () {
8676
8860 console.info('configureIntegration');
8677 vm.transformPartitionList = function (inputList) {
8861 vm.loading.integration = true;
8678 var outputList = [];
8862 integrationResource.save(
8679
8863 {
8680 _.each(inputList, function (item) {
8864 integration: $state.params.integration,
8681 var time = [item[0], {
8865 action: 'setup',
8682 elasticsearch: [],
8866 resourceId: $state.params.resourceId
8683 pg: []
8867 }, vm.config, function (data) {
8684 }]
8868 vm.loading.integration = false;
8685 _.each(item[1].pg, function (index) {
8869 setServerValidation(vm.integrationForm);
8686 time[1].pg.push({name: index, checked: false})
8870 }, function (response) {
8687 });
8871 if (response.status == 422) {
8688 _.each(item[1].elasticsearch, function (index) {
8872 setServerValidation(vm.integrationForm, response.data);
8689 time[1].elasticsearch.push({
8873 }
8690 name: index,
8874 vm.loading.integration = false;
8691 checked: false
8692 })
8875 });
8693 });
8694 outputList.push(time);
8695 });
8696 return outputList;
8876 };
8697 };
8877
8698
8878 vm.removeIntegration = function () {
8699 sectionViewResource.get({section:'admin_section', view: 'partitions'},
8879 console.info('removeIntegration');
8700 vm.loadPartitions);
8880 integrationResource.remove({
8881 integration: $state.params.integration,
8882 resourceId: $state.params.resourceId,
8883 action: 'delete'
8884 },
8885 function () {
8886 $state.go('applications.integrations',
8887 {resourceId: $state.params.resourceId});
8888 }
8889 );
8890 }
8891
8701
8892 vm.testIntegration = function(to_test){
8702 vm.partitionsDelete = function (partitionType) {
8893 console.info('testIntegration', to_test);
8703 var es_indices = [];
8894 vm.loading.integration = true;
8704 var pg_indices = [];
8895 integrationResource.save(
8705 _.each(vm[partitionType], function (item) {
8896 {
8706 _.each(item[1].pg, function (index) {
8897 integration: $state.params.integration,
8707 if (index.checked) {
8898 action: 'test_'+ to_test,
8708 pg_indices.push(index.name)
8899 resourceId: $state.params.resourceId
8709 }
8900 }, vm.config, function (data) {
8710 });
8901 vm.loading.integration = false;
8711 _.each(item[1].elasticsearch, function (index) {
8902 }, function (response) {
8712 if (index.checked) {
8903 vm.loading.integration = false;
8713 es_indices.push(index.name)
8714 }
8904 });
8715 });
8716 });
8717
8718
8719 vm.loading = {partitions: true};
8720 sectionViewResource.save({section:'admin_section',
8721 view: 'partitions_remove'}, {
8722 es_indices: es_indices,
8723 pg_indices: pg_indices,
8724 confirm: 'CONFIRM'
8725 }, vm.loadPartitions);
8726
8905 }
8727 }
8906
8728
8907
8908 }
8729 }
8909
8730
8910 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8731 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -8926,20 +8747,31 b' function IntegrationController($state, integrationResource) {'
8926 // # services, and proprietary license terms, please see
8747 // # services, and proprietary license terms, please see
8927 // # https://rhodecode.com/licenses/
8748 // # https://rhodecode.com/licenses/
8928
8749
8929 angular.module('appenlight.controllers')
8750 angular.module('appenlight.controllers').controller('AdminSystemController', AdminSystemController);
8930 .controller('IntegrationsListController', IntegrationsListController)
8931
8751
8932 IntegrationsListController.$inject = ['$state', 'applicationsResource'];
8752 AdminSystemController.$inject = ['sectionViewResource'];
8933
8753
8934 function IntegrationsListController($state, applicationsResource) {
8754 function AdminSystemController(sectionViewResource) {
8935
8936 var vm = this;
8755 var vm = this;
8937 vm.loading = {application: true};
8756 vm.tables = [];
8938 vm.resource = applicationsResource.get({resourceId: $state.params.resourceId}, function (data) {
8757 vm.loading = {system: true};
8939 vm.loading.application = false;
8758 sectionViewResource.get({
8940 $state.current.data.resource = vm.resource;
8759 section: 'admin_section',
8760 view: 'system'
8761 }, null, function (data) {
8762 vm.DBtables = data.db_tables;
8763 vm.ESIndices = data.es_indices;
8764 vm.queueStats = data.queue_stats;
8765 vm.systemLoad = data.system_load;
8766 vm.packages = data.packages;
8767 vm.processInfo = data.process_info;
8768 vm.disks = data.disks;
8769 vm.memory = data.memory;
8770 vm.selfInfo = data.self_info;
8771
8772 vm.loading.system = false;
8941 });
8773 });
8942 }
8774 };
8943
8775
8944 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8776 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8945 // #
8777 // #
@@ -8960,19 +8792,107 b' function IntegrationsListController($state, applicationsResource) {'
8960 // # services, and proprietary license terms, please see
8792 // # services, and proprietary license terms, please see
8961 // # https://rhodecode.com/licenses/
8793 // # https://rhodecode.com/licenses/
8962
8794
8963 angular.module('appenlight.controllers')
8795 angular.module('appenlight.controllers').controller('AdminUsersCreateController', AdminUsersCreateController);
8964 .controller('ApplicationsListController', ApplicationsListController)
8965
8796
8966 ApplicationsListController.$inject = ['applicationsResource'];
8797 AdminUsersCreateController.$inject = ['$state', 'usersResource', 'usersPropertyResource', 'sectionViewResource', 'AeConfig'];
8967
8798
8968 function ApplicationsListController(applicationsResource) {
8799 function AdminUsersCreateController($state, usersResource, usersPropertyResource, sectionViewResource, AeConfig) {
8969
8800
8970 var vm = this;
8801 var vm = this;
8971 vm.loading = {applications: true};
8802 vm.loading = {user: false};
8972 vm.applications = applicationsResource.query(null, function(){
8803
8973 vm.loading.applications = false;
8804
8974 });
8805 if (typeof $state.params.userId !== 'undefined') {
8975 }
8806 vm.loading.user = true;
8807 var userId = $state.params.userId;
8808 vm.user = usersResource.get({userId: userId}, function (data) {
8809 vm.loading.user = false;
8810 // cast to true for angular checkbox
8811 if (vm.user.status === 1) {
8812 vm.user.status = true;
8813 }
8814 });
8815
8816 vm.resource_permissions = usersPropertyResource.query(
8817 {userId: userId, key: 'resource_permissions'}, function (data) {
8818 vm.loading.resource_permissions = false;
8819 var tmpObj = {
8820 'user': {
8821 'application': {},
8822 'dashboard': {}
8823 },
8824 'group': {
8825 'application': {},
8826 'dashboard': {}
8827 }
8828 };
8829 _.each(data, function (item) {
8830
8831 var section = tmpObj[item.type][item.resource_type];
8832 if (typeof section[item.resource_id] == 'undefined'){
8833 section[item.resource_id] = {
8834 self:item,
8835 permissions: []
8836 }
8837 }
8838 section[item.resource_id].permissions.push(item.perm_name);
8839
8840 });
8841 vm.resourcePermissions = tmpObj;
8842 });
8843
8844 }
8845 else {
8846 var userId = null;
8847 vm.user = {
8848 status: true
8849 }
8850 }
8851
8852 var formResponse = function (response) {
8853 if (response.status == 422) {
8854 setServerValidation(vm.profileForm, response.data);
8855 }
8856 vm.loading.user = false;
8857 }
8858
8859 vm.createUser = function () {
8860 vm.loading.user = true;
8861
8862 if (userId) {
8863 usersResource.update({userId: vm.user.id}, vm.user, function (data) {
8864 setServerValidation(vm.profileForm);
8865 vm.loading.user = false;
8866 }, formResponse);
8867 }
8868 else {
8869 usersResource.save(vm.user, function (data) {
8870 $state.go('admin.user.update', {userId: data.id});
8871 }, formResponse);
8872 }
8873 }
8874
8875 vm.generatePassword = function () {
8876 var length = 8;
8877 var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
8878 vm.gen_pass = "";
8879 for (var i = 0, n = charset.length; i < length; ++i) {
8880 vm.gen_pass += charset.charAt(Math.floor(Math.random() * n));
8881 }
8882 vm.user.user_password = '' + vm.gen_pass;
8883
8884 }
8885
8886 vm.reloginUser = function () {
8887 sectionViewResource.get({
8888 section: 'admin_section', view: 'relogin_user',
8889 user_id: vm.user.id
8890 }, function () {
8891 window.location = AeConfig.urls.baseUrl;
8892 });
8893
8894 }
8895 };
8976
8896
8977 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8897 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8978 // #
8898 // #
@@ -8993,47 +8913,40 b' function ApplicationsListController(applicationsResource) {'
8993 // # services, and proprietary license terms, please see
8913 // # services, and proprietary license terms, please see
8994 // # https://rhodecode.com/licenses/
8914 // # https://rhodecode.com/licenses/
8995
8915
8996 angular.module('appenlight.controllers')
8916 angular.module('appenlight.controllers').controller('AdminUsersController', AdminUsersController);
8997 .controller('ApplicationsPurgeLogsController', ApplicationsPurgeLogsController)
8998
8917
8999 ApplicationsPurgeLogsController.$inject = ['applicationsResource', 'sectionViewResource', 'logsNoIdResource'];
8918 AdminUsersController.$inject = ['usersResource'];
9000
8919
9001 function ApplicationsPurgeLogsController(applicationsResource, sectionViewResource, logsNoIdResource) {
8920 function AdminUsersController(usersResource) {
9002
8921
9003 var vm = this;
8922 var vm = this;
9004 vm.loading = {applications: true};
8923 vm.loading = {users: true};
9005
9006 vm.namespace = null;
9007 vm.selectedResource = null;
9008 vm.commonNamespaces = [];
9009
8924
9010 vm.applications = applicationsResource.query({'type':'update_reports'}, function () {
8925 vm.users = usersResource.query({}, function (data) {
9011 vm.loading.applications = false;
8926 vm.loading = {users: false};
9012 vm.selectedResource = vm.applications[0].resource_id;
8927 vm.activeUsers = _.reduce(vm.users, function(memo, val){
9013 vm.getCommonKeys();
8928 if (val.status == 1){
8929 return memo + 1;
8930 }
8931 return memo;
8932 }, 0);
8933
9014 });
8934 });
9015
8935
9016 /**
9017 * Fetches most commonly used tags in logs
9018 */
9019 vm.getCommonKeys = function () {
9020 sectionViewResource.get({
9021 section: 'logs_section',
9022 view: 'common_tags',
9023 resource: vm.selectedResource
9024 }, function (data) {
9025 vm.commonNamespaces = data['namespaces']
9026 });
9027 };
9028
8936
9029 vm.purgeLogs = function () {
8937 vm.removeUser = function (user) {
9030 vm.loading.applications = true;
8938 usersResource.remove({userId: user.id}, function (data, responseHeaders) {
9031 logsNoIdResource.delete({resource:vm.selectedResource,
8939
9032 namespace: vm.namespace}, function(){
8940 if (data) {
9033 vm.loading.applications = false;
8941 var index = vm.users.indexOf(user);
8942 if (index !== -1) {
8943 vm.users.splice(index, 1);
8944 vm.activeUsers -= 1;
8945 }
8946 }
9034 });
8947 });
9035 }
8948 }
9036 }
8949 };
9037
8950
9038 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
8951 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9039 // #
8952 // #
@@ -9054,58 +8967,156 b' function ApplicationsPurgeLogsController(applicationsResource, sectionViewResour'
9054 // # services, and proprietary license terms, please see
8967 // # services, and proprietary license terms, please see
9055 // # https://rhodecode.com/licenses/
8968 // # https://rhodecode.com/licenses/
9056
8969
9057 angular.module('appenlight.controllers').controller('EventsController', EventsController);
8970 angular.module('appenlight.controllers')
8971 .controller('ApplicationsUpdateController', ApplicationsUpdateController)
9058
8972
9059 EventsController.$inject = ['eventsNoIdResource', 'eventsResource'];
8973 ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder'];
9060
8974
9061 function EventsController(eventsNoIdResource, eventsResource) {
8975 function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) {
9062 console.info('EventsController');
8976 'use strict';
8977
9063 var vm = this;
8978 var vm = this;
8979 vm.loading = {application: false};
9064
8980
9065 vm.loading = {events: true};
8981 vm.groupingOptions = [
8982 ['url_type', 'Error Type + location'],
8983 ['url_traceback', 'Traceback + location'],
8984 ['traceback_server', 'Traceback + Server'],
8985 ];
9066
8986
9067 vm.events = eventsNoIdResource.query(
8987 var resourceId = $state.params.resourceId;
9068 {key: 'events'},
8988
9069 function (data) {
8989
9070 vm.loading.events = false;
8990 var options = {};
8991
8992 vm.momentJs = moment;
8993
8994 vm.formTransferModel = {password:''};
8995
8996 // set initial data
8997
8998 if (resourceId === 'new') {
8999 vm.resource = {
9000 resource_id: null,
9001 slow_report_threshold: 10,
9002 error_report_threshold: 10,
9003 allow_permanent_storage: true,
9004 default_grouping: vm.groupingOptions[1][0]
9005 };
9006 }
9007 else {
9008 vm.loading.application = true;
9009 vm.resource = applicationsResource.get({
9010 'resourceId': resourceId
9011 }, function (data) {
9012 vm.loading.application = false;
9071 });
9013 });
9014 }
9072
9015
9073
9016
9074 vm.closeEvent = function (event) {
9017 vm.updateBasicForm = function () {
9075
9018 vm.loading.application = true;
9076 eventsResource.update({eventId: event.id}, {status: 0}, function (data) {
9019 if (vm.resource.resource_id === null) {
9077 event.status = 0;
9020 applicationsNoIdResource.save(null, vm.resource, function (data) {
9078 });
9021 stateHolder.AeUser.addApplication(data);
9079 }
9022 $state.go('applications.update', {resourceId: data.resource_id});
9023 setServerValidation(vm.BasicForm);
9024 }, function (response) {
9025 if (response.status == 422) {
9026 setServerValidation(vm.BasicForm, response.data);
9027 }
9028 vm.loading.application = false;
9029
9030 });
9031 }
9032 else {
9033 applicationsResource.update({resourceId: vm.resource.resource_id},
9034 vm.resource, function (data) {
9035 vm.resource = data;
9036 vm.loading.application = false;
9037 setServerValidation(vm.BasicForm);
9038 }, function (response) {
9039 if (response.status == 422) {
9040 setServerValidation(vm.BasicForm, response.data);
9041 }
9042 vm.loading.application = false;
9043 });
9044 }
9045 };
9080
9046
9081 }
9047 vm.addRule = function () {
9048
9049 applicationsPropertyResource.save({
9050 resourceId: vm.resource.resource_id,
9051 key: 'postprocessing_rules'
9052 }, null,
9053 function (data) {
9054 vm.resource.postprocessing_rules.push(data);
9055 }
9056 );
9057 };
9082
9058
9083 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9059 vm.regenerateAPIKeys = function(){
9084 // #
9060 vm.loading.application = true;
9085 // # This program is free software: you can redistribute it and/or modify
9061 applicationsPropertyResource.save({
9086 // # it under the terms of the GNU Affero General Public License, version 3
9062 resourceId: vm.resource.resource_id,
9087 // # (only), as published by the Free Software Foundation.
9063 key: 'api_key'
9088 // #
9064 }, {password: vm.regenerateAPIKeysPassword},
9089 // # This program is distributed in the hope that it will be useful,
9065 function (data) {
9090 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9066 vm.resource = data;
9091 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9067 vm.loading.application = false;
9092 // # GNU General Public License for more details.
9068 vm.regenerateAPIKeysPassword = '';
9093 // #
9069 setServerValidation(vm.regenerateAPIKeysForm);
9094 // # You should have received a copy of the GNU Affero General Public License
9070 },
9095 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
9071 function (response) {
9096 // #
9072 if (response.status == 422) {
9097 // # This program is dual-licensed. If you wish to learn more about the
9073 setServerValidation(vm.regenerateAPIKeysForm, response.data);
9098 // # AppEnlight Enterprise Edition, including its added features, Support
9074
9099 // # services, and proprietary license terms, please see
9075 }
9100 // # https://rhodecode.com/licenses/
9076 vm.loading.application = false;
9077 }
9078 )
9079 };
9101
9080
9102 angular.module('appenlight.controllers').controller('IndexCtrl', IndexCtrl);
9081 vm.deleteApplication = function(){
9082 vm.loading.application = true;
9083 applicationsPropertyResource.update({
9084 resourceId: vm.resource.resource_id,
9085 key: 'delete_resource'
9086 }, vm.formDeleteModel,
9087 function (data) {
9088 stateHolder.AeUser.removeApplicationById(vm.resource.resource_id);
9089 $state.go('applications.list');
9090 },
9091 function (response) {
9092 if (response.status == 422) {
9093 setServerValidation(vm.formDelete, response.data);
9094
9095 }
9096 vm.loading.application = false;
9097 }
9098 );
9099 };
9103
9100
9104 IndexCtrl.$inject = [IndexCtrl];
9101 vm.transferApplication = function(){
9102 vm.loading.application = true;
9103 applicationsPropertyResource.update({
9104 resourceId: vm.resource.resource_id,
9105 key: 'owner'
9106 }, vm.formTransferModel,
9107 function (data) {
9108 $state.go('applications.list');
9109 },
9110 function (response) {
9111 if (response.status == 422) {
9112 setServerValidation(vm.formTransfer, response.data);
9113
9114 }
9115 vm.loading.application = false;
9116 }
9117 )
9118 }
9105
9119
9106 function IndexCtrl() {
9107 var vm = this;
9108 vm.selected_section = 'errors';
9109 }
9120 }
9110
9121
9111 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9122 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9128,78 +9139,72 b' function IndexCtrl() {'
9128 // # https://rhodecode.com/licenses/
9139 // # https://rhodecode.com/licenses/
9129
9140
9130 angular.module('appenlight.controllers')
9141 angular.module('appenlight.controllers')
9131 .controller('BitbucketIntegrationCtrl', BitbucketIntegrationCtrl)
9142 .controller('IntegrationController', IntegrationController)
9132
9143
9133 BitbucketIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9144 IntegrationController.$inject = ['$state', 'integrationResource'];
9134
9145
9135 function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9146 function IntegrationController($state, integrationResource) {
9147
9136 var vm = this;
9148 var vm = this;
9137 vm.loading = true;
9149 vm.loading = {integration: true};
9138 vm.assignees = [];
9150 vm.config = integrationResource.get(
9139 vm.report = report;
9151 {
9140 vm.integrationName = integrationName;
9152 integration: $state.params.integration,
9141 vm.statuses = [];
9153 action: 'setup',
9142 vm.priorities = [];
9154 resourceId: $state.params.resourceId
9143 vm.error_messages = [];
9155 }, function (data) {
9144 vm.form = {
9156 vm.loading.integration = false;
9145 content: '\n' +
9157 });
9146 'Issue created for report: ' +
9147 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9148 };
9149
9158
9150 vm.fetchInfo = function () {
9159 vm.configureIntegration = function () {
9151 integrationResource.get({
9160 console.info('configureIntegration');
9152 resourceId: vm.report.resource_id,
9161 vm.loading.integration = true;
9153 action: 'info',
9162 integrationResource.save(
9154 integration: vm.integrationName
9163 {
9155 }, null,
9164 integration: $state.params.integration,
9156 function (data) {
9165 action: 'setup',
9157 vm.loading = false;
9166 resourceId: $state.params.resourceId
9158 if (data.error_messages) {
9167 }, vm.config, function (data) {
9159 vm.error_messages = data.error_messages;
9168 vm.loading.integration = false;
9160 }
9169 setServerValidation(vm.integrationForm);
9161 vm.assignees = data.assignees;
9170 }, function (response) {
9162 vm.priorities = data.priorities;
9171 if (response.status == 422) {
9163 vm.form.responsible = vm.assignees[0];
9172 setServerValidation(vm.integrationForm, response.data);
9164 vm.form.priority = vm.priorities[0];
9165 }, function (error_data) {
9166 if (error_data.data.error_messages) {
9167 vm.error_messages = error_data.data.error_messages;
9168 }
9169 else {
9170 vm.error_messages = ['There was a problem processing your request'];
9171 }
9173 }
9174 vm.loading.integration = false;
9172 });
9175 });
9173 };
9176 };
9174 vm.ok = function () {
9177
9175 vm.loading = true;
9178 vm.removeIntegration = function () {
9176 vm.form.group_id = vm.report.group_id;
9179 console.info('removeIntegration');
9177 integrationResource.save({
9180 integrationResource.remove({
9178 resourceId: vm.report.resource_id,
9181 integration: $state.params.integration,
9179 action: 'create-issue',
9182 resourceId: $state.params.resourceId,
9180 integration: vm.integrationName
9183 action: 'delete'
9181 }, vm.form,
9184 },
9182 function (data) {
9185 function () {
9183 vm.loading = false;
9186 $state.go('applications.integrations',
9184 if (data.error_messages) {
9187 {resourceId: $state.params.resourceId});
9185 vm.error_messages = data.error_messages;
9188 }
9186 }
9189 );
9187 if (data !== false) {
9190 }
9188 $uibModalInstance.dismiss('success');
9191
9189 }
9192 vm.testIntegration = function(to_test){
9190 }, function (error_data) {
9193 console.info('testIntegration', to_test);
9191 if (error_data.data.error_messages) {
9194 vm.loading.integration = true;
9192 vm.error_messages = error_data.data.error_messages;
9195 integrationResource.save(
9193 }
9196 {
9194 else {
9197 integration: $state.params.integration,
9195 vm.error_messages = ['There was a problem processing your request'];
9198 action: 'test_'+ to_test,
9196 }
9199 resourceId: $state.params.resourceId
9200 }, vm.config, function (data) {
9201 vm.loading.integration = false;
9202 }, function (response) {
9203 vm.loading.integration = false;
9197 });
9204 });
9198 };
9205 }
9199 vm.cancel = function () {
9206
9200 $uibModalInstance.dismiss('cancel');
9207
9201 };
9202 vm.fetchInfo();
9203 }
9208 }
9204
9209
9205 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9210 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9222,80 +9227,51 b' function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integration'
9222 // # https://rhodecode.com/licenses/
9227 // # https://rhodecode.com/licenses/
9223
9228
9224 angular.module('appenlight.controllers')
9229 angular.module('appenlight.controllers')
9225 .controller('GithubIntegrationCtrl', GithubIntegrationCtrl);
9230 .controller('IntegrationsListController', IntegrationsListController)
9226
9231
9227 GithubIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9232 IntegrationsListController.$inject = ['$state', 'applicationsResource'];
9228
9233
9229 function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9234 function IntegrationsListController($state, applicationsResource) {
9235
9230 var vm = this;
9236 var vm = this;
9231 vm.loading = true;
9237 vm.loading = {application: true};
9232 vm.assignees = [];
9238 vm.resource = applicationsResource.get({resourceId: $state.params.resourceId}, function (data) {
9233 vm.report = report;
9239 vm.loading.application = false;
9234 vm.integrationName = integrationName;
9240 $state.current.data.resource = vm.resource;
9235 vm.statuses = [];
9241 });
9236 vm.assignees = [];
9242 }
9237 vm.error_messages = [];
9238 vm.form = {
9239 content: '\n' +
9240 'Issue created for report: ' +
9241 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9242 };
9243
9243
9244 vm.fetchInfo = function () {
9244 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9245 integrationResource.get({
9245 // #
9246 resourceId: vm.report.resource_id,
9246 // # This program is free software: you can redistribute it and/or modify
9247 action: 'info',
9247 // # it under the terms of the GNU Affero General Public License, version 3
9248 integration: vm.integrationName
9248 // # (only), as published by the Free Software Foundation.
9249 }, null,
9249 // #
9250 function (data) {
9250 // # This program is distributed in the hope that it will be useful,
9251 vm.loading = false;
9251 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9252 if (data.error_messages) {
9252 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9253 vm.error_messages = data.error_messages;
9253 // # GNU General Public License for more details.
9254 }
9254 // #
9255 else {
9255 // # You should have received a copy of the GNU Affero General Public License
9256 vm.assignees = data.assignees;
9256 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
9257 vm.statuses = data.statuses;
9257 // #
9258 vm.form.responsible = vm.assignees[0];
9258 // # This program is dual-licensed. If you wish to learn more about the
9259 vm.form.status = vm.statuses[0];
9259 // # AppEnlight Enterprise Edition, including its added features, Support
9260 }
9260 // # services, and proprietary license terms, please see
9261 }, function (error_data) {
9261 // # https://rhodecode.com/licenses/
9262 if (error_data.data.error_messages) {
9262
9263 vm.error_messages = error_data.data.error_messages;
9263 angular.module('appenlight.controllers')
9264 }
9264 .controller('ApplicationsListController', ApplicationsListController)
9265 else {
9265
9266 vm.error_messages = ['There was a problem processing your request'];
9266 ApplicationsListController.$inject = ['applicationsResource'];
9267 }
9267
9268 });
9268 function ApplicationsListController(applicationsResource) {
9269 };
9269
9270 vm.ok = function () {
9270 var vm = this;
9271 vm.loading = true;
9271 vm.loading = {applications: true};
9272 vm.form.group_id = vm.report.group_id;
9272 vm.applications = applicationsResource.query(null, function(){
9273 integrationResource.save({
9273 vm.loading.applications = false;
9274 resourceId: vm.report.resource_id,
9274 });
9275 action: 'create-issue',
9276 integration: vm.integrationName
9277 }, vm.form,
9278 function (data) {
9279 vm.loading = false;
9280 if (data.error_messages) {
9281 vm.error_messages = data.error_messages;
9282 }
9283 else {
9284 $uibModalInstance.dismiss('success');
9285 }
9286 }, function (error_data) {
9287 if (error_data.data.error_messages) {
9288 vm.error_messages = error_data.data.error_messages;
9289 }
9290 else {
9291 vm.error_messages = ['There was a problem processing your request'];
9292 }
9293 });
9294 };
9295 vm.cancel = function () {
9296 $uibModalInstance.dismiss('cancel');
9297 };
9298 vm.fetchInfo();
9299 }
9275 }
9300
9276
9301 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9277 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9318,82 +9294,90 b' function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationNam'
9318 // # https://rhodecode.com/licenses/
9294 // # https://rhodecode.com/licenses/
9319
9295
9320 angular.module('appenlight.controllers')
9296 angular.module('appenlight.controllers')
9321 .controller('JiraIntegrationCtrl', JiraIntegrationCtrl)
9297 .controller('ApplicationsPurgeLogsController', ApplicationsPurgeLogsController)
9322
9298
9323 JiraIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9299 ApplicationsPurgeLogsController.$inject = ['applicationsResource', 'sectionViewResource', 'logsNoIdResource'];
9324
9300
9325 function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9301 function ApplicationsPurgeLogsController(applicationsResource, sectionViewResource, logsNoIdResource) {
9302
9326 var vm = this;
9303 var vm = this;
9327 vm.loading = true;
9304 vm.loading = {applications: true};
9328 vm.assignees = [];
9329 vm.report = report;
9330 vm.integrationName = integrationName;
9331 vm.statuses = [];
9332 vm.priorities = [];
9333 vm.issue_types = [];
9334 vm.error_messages = [];
9335 vm.form = {
9336 content: '\n' +
9337 'Issue created for report: ' +
9338 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9339 };
9340
9305
9341 vm.fetchInfo = function () {
9306 vm.namespace = null;
9342 integrationResource.get({
9307 vm.selectedResource = null;
9343 resourceId: vm.report.resource_id,
9308 vm.commonNamespaces = [];
9344 action: 'info',
9309
9345 integration: vm.integrationName
9310 vm.applications = applicationsResource.query({'type':'update_reports'}, function () {
9346 }, null,
9311 vm.loading.applications = false;
9347 function (data) {
9312 vm.selectedResource = vm.applications[0].resource_id;
9348 vm.loading = false;
9313 vm.getCommonKeys();
9349 if (data.error_messages) {
9314 });
9350 vm.error_messages = data.error_messages;
9315
9351 }
9316 /**
9352 vm.assignees = data.assignees;
9317 * Fetches most commonly used tags in logs
9353 vm.priorities = data.priorities;
9318 */
9354 vm.issue_types = data.issue_types;
9319 vm.getCommonKeys = function () {
9355 vm.form.issue_type = vm.issue_types[0];
9320 sectionViewResource.get({
9356 vm.form.responsible = vm.assignees[0];
9321 section: 'logs_section',
9357 vm.form.priority = vm.priorities[0];
9322 view: 'common_tags',
9358 }, function (error_data) {
9323 resource: vm.selectedResource
9359
9324 }, function (data) {
9360 if (error_data.data.error_messages) {
9325 vm.commonNamespaces = data['namespaces']
9361 vm.error_messages = error_data.data.error_messages;
9326 });
9362 }
9363 else {
9364 vm.error_messages = ['There was a problem processing your request'];
9365 }
9366 });
9367 };
9368 vm.ok = function () {
9369 vm.loading = true;
9370 vm.form.group_id = vm.report.group_id;
9371 integrationResource.save({
9372 resourceId: vm.report.resource_id,
9373 action: 'create-issue',
9374 integration: vm.integrationName
9375 }, vm.form,
9376 function (data) {
9377 vm.loading = false;
9378 if (data.error_messages) {
9379 vm.error_messages = data.error_messages;
9380 }
9381 if (data !== false) {
9382 $uibModalInstance.dismiss('success');
9383 }
9384 }, function (error_data) {
9385 if (error_data.data.error_messages) {
9386 vm.error_messages = error_data.data.error_messages;
9387 }
9388 else {
9389 vm.error_messages = ['There was a problem processing your request'];
9390 }
9391 });
9392 };
9393 vm.cancel = function () {
9394 $uibModalInstance.dismiss('cancel');
9395 };
9327 };
9396 vm.fetchInfo();
9328
9329 vm.purgeLogs = function () {
9330 vm.loading.applications = true;
9331 logsNoIdResource.delete({resource:vm.selectedResource,
9332 namespace: vm.namespace}, function(){
9333 vm.loading.applications = false;
9334 });
9335 }
9336 }
9337
9338 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9339 // #
9340 // # This program is free software: you can redistribute it and/or modify
9341 // # it under the terms of the GNU Affero General Public License, version 3
9342 // # (only), as published by the Free Software Foundation.
9343 // #
9344 // # This program is distributed in the hope that it will be useful,
9345 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9346 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9347 // # GNU General Public License for more details.
9348 // #
9349 // # You should have received a copy of the GNU Affero General Public License
9350 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
9351 // #
9352 // # This program is dual-licensed. If you wish to learn more about the
9353 // # AppEnlight Enterprise Edition, including its added features, Support
9354 // # services, and proprietary license terms, please see
9355 // # https://rhodecode.com/licenses/
9356
9357 angular.module('appenlight.controllers').controller('EventsController', EventsController);
9358
9359 EventsController.$inject = ['eventsNoIdResource', 'eventsResource'];
9360
9361 function EventsController(eventsNoIdResource, eventsResource) {
9362 console.info('EventsController');
9363 var vm = this;
9364
9365 vm.loading = {events: true};
9366
9367 vm.events = eventsNoIdResource.query(
9368 {key: 'events'},
9369 function (data) {
9370 vm.loading.events = false;
9371 });
9372
9373
9374 vm.closeEvent = function (event) {
9375
9376 eventsResource.update({eventId: event.id}, {status: 0}, function (data) {
9377 event.status = 0;
9378 });
9379 }
9380
9397 }
9381 }
9398
9382
9399 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9383 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9415,280 +9399,203 b' function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName,'
9415 // # services, and proprietary license terms, please see
9399 // # services, and proprietary license terms, please see
9416 // # https://rhodecode.com/licenses/
9400 // # https://rhodecode.com/licenses/
9417
9401
9418 angular.module('appenlight.controllers').controller('LogsController', LogsController);
9402 angular.module('appenlight.controllers').controller('IndexCtrl', IndexCtrl);
9419
9403
9420 LogsController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
9404 IndexCtrl.$inject = [IndexCtrl];
9421
9405
9422 function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
9406 function IndexCtrl() {
9423 var vm = this;
9407 var vm = this;
9424 vm.logEventsChartConfig = {
9408 vm.selected_section = 'errors';
9425 data: {
9409 }
9426 json: [],
9427 xFormat: '%Y-%m-%dT%H:%M:%S'
9428 },
9429 color: {
9430 pattern: ['#6baed6', '#e6550d', '#74c476', '#fdd0a2', '#8c564b']
9431 },
9432 axis: {
9433 x: {
9434 type: 'timeseries',
9435 tick: {
9436 format: '%Y-%m-%d'
9437 }
9438 },
9439 y: {
9440 tick: {
9441 count: 5,
9442 format: d3.format('.2s')
9443 }
9444 }
9445 },
9446 subchart: {
9447 show: true,
9448 size: {
9449 height: 20
9450 }
9451 },
9452 size: {
9453 height: 250
9454 },
9455 zoom: {
9456 rescale: true
9457 },
9458 grid: {
9459 x: {
9460 show: true
9461 },
9462 y: {
9463 show: true
9464 }
9465 },
9466 tooltip: {
9467 format: {
9468 title: function (d) {
9469 return '' + d;
9470 },
9471 value: function (v) {
9472 return v
9473 }
9474 }
9475 }
9476 };
9477 vm.logEventsChartData = {};
9478 stateHolder.section = 'logs';
9479 vm.today = function () {
9480 vm.pickerDate = new Date();
9481 };
9482 vm.today();
9483
9484 vm.applications = stateHolder.AeUser.applications_map;
9485 vm.logsPage = [];
9486 vm.itemCount = 0;
9487 vm.itemsPerPage = 250;
9488 vm.page = 1;
9489 vm.$location = $location;
9490 vm.isLoading = {
9491 logs: true,
9492 series: true
9493 };
9494 vm.filterTypeAheadOptions = [
9495 {
9496 type: 'message',
9497 text: 'message:',
9498 'description': 'Full-text search in your logs',
9499 tag: 'Message',
9500 example: 'message:text-im-looking-for'
9501 },
9502 {
9503 type: 'namespace',
9504 text: 'namespace:',
9505 'description': 'Query logs from specific namespace',
9506 tag: 'Namespace',
9507 example: "namespace:module.foo"
9508 },
9509 {
9510 type: 'resource',
9511 text: 'resource:',
9512 'description': 'Restrict resultset to application',
9513 tag: 'Application',
9514 example: "resource:ID"
9515 },
9516 {
9517 type: 'request_id',
9518 text: 'request_id:',
9519 'description': 'Show logs with specific request id',
9520 example: "request_id:883143dc572e4c38aceae92af0ea5ae0",
9521 tag: 'Request ID'
9522 },
9523 {
9524 type: 'level',
9525 text: 'level:',
9526 'description': 'Show entries with specific log level',
9527 example: 'level:warning',
9528 tag: 'Level'
9529 },
9530 {
9531 type: 'server_name',
9532 text: 'server_name:',
9533 'description': 'Show entries tagged with this key/value pair',
9534 example: 'server_name:hostname',
9535 tag: 'Tag'
9536 },
9537 {
9538 type: 'start_date',
9539 text: 'start_date:',
9540 'description': 'Show results newer than this date (press TAB for dropdown)',
9541 example: 'start_date:2014-08-15T13:00',
9542 tag: 'Start Date'
9543 },
9544 {
9545 type: 'end_date',
9546 text: 'end_date:',
9547 'description': 'Show results older than this date (press TAB for dropdown)',
9548 example: 'start_date:2014-08-15T23:59',
9549 tag: 'End Date'
9550 },
9551 {type: 'level', value: 'debug', text: 'level:debug'},
9552 {type: 'level', value: 'info', text: 'level:info'},
9553 {type: 'level', value: 'warning', text: 'level:warning'},
9554 {type: 'level', value: 'critical', text: 'level:critical'}
9555 ];
9556 vm.filterTypeAhead = null;
9557 vm.showDatePicker = false;
9558 vm.manualOpen = false;
9559 vm.aheadFilter = typeAheadTagHelper.aheadFilter;
9560 vm.removeSearchTag = function (tag) {
9561 $location.search(tag.type, null);
9562 vm.refresh();
9563 };
9564 vm.addSearchTag = function (tag) {
9565 $location.search(tag.type, tag.value);
9566 vm.refresh();
9567 };
9568
9569 vm.paginationChange = function(){
9570 $location.search('page', vm.page);
9571 vm.refresh();
9572 };
9573
9410
9411 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9412 // #
9413 // # This program is free software: you can redistribute it and/or modify
9414 // # it under the terms of the GNU Affero General Public License, version 3
9415 // # (only), as published by the Free Software Foundation.
9416 // #
9417 // # This program is distributed in the hope that it will be useful,
9418 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9419 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9420 // # GNU General Public License for more details.
9421 // #
9422 // # You should have received a copy of the GNU Affero General Public License
9423 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
9424 // #
9425 // # This program is dual-licensed. If you wish to learn more about the
9426 // # AppEnlight Enterprise Edition, including its added features, Support
9427 // # services, and proprietary license terms, please see
9428 // # https://rhodecode.com/licenses/
9574
9429
9575 _.each(vm.applications, function (item) {
9430 angular.module('appenlight.controllers')
9576 vm.filterTypeAheadOptions.push({
9431 .controller('BitbucketIntegrationCtrl', BitbucketIntegrationCtrl)
9577 type: 'resource',
9578 text: 'resource:' + item.resource_id + ':' + item.resource_name,
9579 example: 'resource:' + item.resource_id,
9580 'tag': item.resource_name,
9581 'description': 'Restrict resultset to this application'
9582 });
9583 });
9584
9432
9585 vm.typeAheadTag = function (event) {
9433 BitbucketIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9586 var text = vm.filterTypeAhead;
9587 if (_.isObject(vm.filterTypeAhead)) {
9588 text = vm.filterTypeAhead.text;
9589 };
9590 if (!vm.filterTypeAhead) {
9591 return
9592 }
9593 var parsed = text.split(':');
9594 var tag = {'type': null, 'value': null};
9595 // app tags have : twice
9596 if (parsed.length > 2 && parsed[0] == 'resource') {
9597 tag.type = 'resource';
9598 tag.value = parsed[1];
9599 }
9600 // normal tag:value
9601 else if (parsed.length > 1) {
9602 tag.type = parsed[0];
9603 tag.value = parsed.slice(1).join(':');
9604 }
9605 else {
9606 tag.type = 'message';
9607 tag.value = parsed.join(':');
9608 }
9609
9434
9610 // set datepicker hour based on type of field
9435 function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9611 if ('start_date:' == text) {
9436 var vm = this;
9612 vm.showDatePicker = true;
9437 vm.loading = true;
9613 vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
9438 vm.assignees = [];
9614 }
9439 vm.report = report;
9615 else if ('end_date:' == text) {
9440 vm.integrationName = integrationName;
9616 vm.showDatePicker = true;
9441 vm.statuses = [];
9617 vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
9442 vm.priorities = [];
9618 }
9443 vm.error_messages = [];
9444 vm.form = {
9445 content: '\n' +
9446 'Issue created for report: ' +
9447 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9448 };
9619
9449
9620 if (event.keyCode != 13 || !tag.type || !tag.value) {
9450 vm.fetchInfo = function () {
9621 return
9451 integrationResource.get({
9622 }
9452 resourceId: vm.report.resource_id,
9623 vm.showDatePicker = false;
9453 action: 'info',
9624 // aka we selected one of main options
9454 integration: vm.integrationName
9625 vm.addSearchTag({type: tag.type, value: tag.value});
9455 }, null,
9626 // clear typeahead
9456 function (data) {
9627 vm.filterTypeAhead = undefined;
9457 vm.loading = false;
9458 if (data.error_messages) {
9459 vm.error_messages = data.error_messages;
9460 }
9461 vm.assignees = data.assignees;
9462 vm.priorities = data.priorities;
9463 vm.form.responsible = vm.assignees[0];
9464 vm.form.priority = vm.priorities[0];
9465 }, function (error_data) {
9466 if (error_data.data.error_messages) {
9467 vm.error_messages = error_data.data.error_messages;
9468 }
9469 else {
9470 vm.error_messages = ['There was a problem processing your request'];
9471 }
9472 });
9473 };
9474 vm.ok = function () {
9475 vm.loading = true;
9476 vm.form.group_id = vm.report.group_id;
9477 integrationResource.save({
9478 resourceId: vm.report.resource_id,
9479 action: 'create-issue',
9480 integration: vm.integrationName
9481 }, vm.form,
9482 function (data) {
9483 vm.loading = false;
9484 if (data.error_messages) {
9485 vm.error_messages = data.error_messages;
9486 }
9487 if (data !== false) {
9488 $uibModalInstance.dismiss('success');
9489 }
9490 }, function (error_data) {
9491 if (error_data.data.error_messages) {
9492 vm.error_messages = error_data.data.error_messages;
9493 }
9494 else {
9495 vm.error_messages = ['There was a problem processing your request'];
9496 }
9497 });
9628 };
9498 };
9499 vm.cancel = function () {
9500 $uibModalInstance.dismiss('cancel');
9501 };
9502 vm.fetchInfo();
9503 }
9629
9504
9505 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9506 // #
9507 // # This program is free software: you can redistribute it and/or modify
9508 // # it under the terms of the GNU Affero General Public License, version 3
9509 // # (only), as published by the Free Software Foundation.
9510 // #
9511 // # This program is distributed in the hope that it will be useful,
9512 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9513 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9514 // # GNU General Public License for more details.
9515 // #
9516 // # You should have received a copy of the GNU Affero General Public License
9517 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
9518 // #
9519 // # This program is dual-licensed. If you wish to learn more about the
9520 // # AppEnlight Enterprise Edition, including its added features, Support
9521 // # services, and proprietary license terms, please see
9522 // # https://rhodecode.com/licenses/
9630
9523
9631 vm.pickerDateChanged = function(){
9524 angular.module('appenlight.controllers')
9632 if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
9525 .controller('GithubIntegrationCtrl', GithubIntegrationCtrl);
9633 vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
9634 }
9635 else if (vm.filterTypeAhead.indexOf('end_date:') == '0') {
9636 vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
9637 }
9638 vm.showDatePicker = false;
9639 };
9640
9526
9641 vm.fetchLogs = function (searchParams) {
9527 GithubIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9642 vm.isLoading.logs = true;
9643 logsNoIdResource.query(searchParams, function (data, getResponseHeaders) {
9644 vm.isLoading.logs = false;
9645 var headers = getResponseHeaders();
9646 vm.logsPage = data;
9647 vm.itemCount = headers['x-total-count'];
9648 vm.itemsPerPage = headers['x-items-per-page'];
9649 }, function () {
9650 vm.isLoading.logs = false;
9651 });
9652 };
9653
9528
9654 vm.fetchSeriesData = function (searchParams) {
9529 function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9655 searchParams['section'] = 'logs_section';
9530 var vm = this;
9656 searchParams['view'] = 'fetch_series';
9531 vm.loading = true;
9657 vm.isLoading.series = true;
9532 vm.assignees = [];
9658 sectionViewResource.query(searchParams, function (data) {
9533 vm.report = report;
9659
9534 vm.integrationName = integrationName;
9660 vm.logEventsChartData = {
9535 vm.statuses = [];
9661 json: data,
9536 vm.assignees = [];
9662 xFormat: '%Y-%m-%dT%H:%M:%S',
9537 vm.error_messages = [];
9663 keys: {
9538 vm.form = {
9664 x: 'x',
9539 content: '\n' +
9665 value: ["logs"]
9540 'Issue created for report: ' +
9666 },
9541 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9667 names: {
9668 logs: 'Log events'
9669 },
9670 type: 'bar'
9671 };
9672 vm.isLoading.series = false;
9673 }, function () {
9674 vm.isLoading.series = false;
9675 });
9676 };
9542 };
9677
9543
9678 vm.filterId = function (log) {
9544 vm.fetchInfo = function () {
9679 $location.search('request_id', log.request_id);
9545 integrationResource.get({
9680 vm.refresh();
9546 resourceId: vm.report.resource_id,
9547 action: 'info',
9548 integration: vm.integrationName
9549 }, null,
9550 function (data) {
9551 vm.loading = false;
9552 if (data.error_messages) {
9553 vm.error_messages = data.error_messages;
9554 }
9555 else {
9556 vm.assignees = data.assignees;
9557 vm.statuses = data.statuses;
9558 vm.form.responsible = vm.assignees[0];
9559 vm.form.status = vm.statuses[0];
9560 }
9561 }, function (error_data) {
9562 if (error_data.data.error_messages) {
9563 vm.error_messages = error_data.data.error_messages;
9564 }
9565 else {
9566 vm.error_messages = ['There was a problem processing your request'];
9567 }
9568 });
9681 };
9569 };
9682
9570 vm.ok = function () {
9683 vm.refresh = function(){
9571 vm.loading = true;
9684 vm.searchParams = parseSearchToTags($location.search());
9572 vm.form.group_id = vm.report.group_id;
9685 vm.page = Number(vm.searchParams.page) || 1;
9573 integrationResource.save({
9686 var params = parseTagsToSearch(vm.searchParams);
9574 resourceId: vm.report.resource_id,
9687 vm.fetchLogs(params);
9575 action: 'create-issue',
9688 vm.fetchSeriesData(params);
9576 integration: vm.integrationName
9577 }, vm.form,
9578 function (data) {
9579 vm.loading = false;
9580 if (data.error_messages) {
9581 vm.error_messages = data.error_messages;
9582 }
9583 else {
9584 $uibModalInstance.dismiss('success');
9585 }
9586 }, function (error_data) {
9587 if (error_data.data.error_messages) {
9588 vm.error_messages = error_data.data.error_messages;
9589 }
9590 else {
9591 vm.error_messages = ['There was a problem processing your request'];
9592 }
9593 });
9689 };
9594 };
9690 console.info('page load');
9595 vm.cancel = function () {
9691 vm.refresh();
9596 $uibModalInstance.dismiss('cancel');
9597 };
9598 vm.fetchInfo();
9692 }
9599 }
9693
9600
9694 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9601 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9711,12 +9618,82 b' function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdReso'
9711 // # https://rhodecode.com/licenses/
9618 // # https://rhodecode.com/licenses/
9712
9619
9713 angular.module('appenlight.controllers')
9620 angular.module('appenlight.controllers')
9714 .controller('OverviewCtrl', OverviewCtrl);
9621 .controller('JiraIntegrationCtrl', JiraIntegrationCtrl)
9715
9622
9716 OverviewCtrl.$inject = [];
9623 JiraIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
9717
9624
9718 function OverviewCtrl() {
9625 function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
9626 var vm = this;
9627 vm.loading = true;
9628 vm.assignees = [];
9629 vm.report = report;
9630 vm.integrationName = integrationName;
9631 vm.statuses = [];
9632 vm.priorities = [];
9633 vm.issue_types = [];
9634 vm.error_messages = [];
9635 vm.form = {
9636 content: '\n' +
9637 'Issue created for report: ' +
9638 $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
9639 };
9719
9640
9641 vm.fetchInfo = function () {
9642 integrationResource.get({
9643 resourceId: vm.report.resource_id,
9644 action: 'info',
9645 integration: vm.integrationName
9646 }, null,
9647 function (data) {
9648 vm.loading = false;
9649 if (data.error_messages) {
9650 vm.error_messages = data.error_messages;
9651 }
9652 vm.assignees = data.assignees;
9653 vm.priorities = data.priorities;
9654 vm.issue_types = data.issue_types;
9655 vm.form.issue_type = vm.issue_types[0];
9656 vm.form.responsible = vm.assignees[0];
9657 vm.form.priority = vm.priorities[0];
9658 }, function (error_data) {
9659
9660 if (error_data.data.error_messages) {
9661 vm.error_messages = error_data.data.error_messages;
9662 }
9663 else {
9664 vm.error_messages = ['There was a problem processing your request'];
9665 }
9666 });
9667 };
9668 vm.ok = function () {
9669 vm.loading = true;
9670 vm.form.group_id = vm.report.group_id;
9671 integrationResource.save({
9672 resourceId: vm.report.resource_id,
9673 action: 'create-issue',
9674 integration: vm.integrationName
9675 }, vm.form,
9676 function (data) {
9677 vm.loading = false;
9678 if (data.error_messages) {
9679 vm.error_messages = data.error_messages;
9680 }
9681 if (data !== false) {
9682 $uibModalInstance.dismiss('success');
9683 }
9684 }, function (error_data) {
9685 if (error_data.data.error_messages) {
9686 vm.error_messages = error_data.data.error_messages;
9687 }
9688 else {
9689 vm.error_messages = ['There was a problem processing your request'];
9690 }
9691 });
9692 };
9693 vm.cancel = function () {
9694 $uibModalInstance.dismiss('cancel');
9695 };
9696 vm.fetchInfo();
9720 }
9697 }
9721
9698
9722 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
9699 ;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -12357,8 +12334,7 b" angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun"
12357
12334
12358 $stateProvider.state('logs', {
12335 $stateProvider.state('logs', {
12359 url: '/ui/logs?resource',
12336 url: '/ui/logs?resource',
12360 templateUrl: 'templates/logs.html',
12337 component: 'logsBrowserView'
12361 controller: 'LogsController as logs'
12362 });
12338 });
12363
12339
12364 $stateProvider.state('front_dashboard', {
12340 $stateProvider.state('front_dashboard', {
@@ -43,7 +43,8 b" angular.module('appenlight.components', ["
43 'appenlight.components.channelstream',
43 'appenlight.components.channelstream',
44 'appenlight.components.appenlightApp',
44 'appenlight.components.appenlightApp',
45 'appenlight.components.appenlightHeader',
45 'appenlight.components.appenlightHeader',
46 'appenlight.components.indexDashboardView'
46 'appenlight.components.indexDashboardView',
47 'appenlight.components.logsBrowserView',
47 ]);
48 ]);
48 angular.module('appenlight.directives', [
49 angular.module('appenlight.directives', [
49 'appenlight.directives.c3chart',
50 'appenlight.directives.c3chart',
@@ -1,14 +1,14 b''
1 <ng-include src="'templates/loader.html'" ng-if="logs.isLoading.logs"></ng-include>
1 <ng-include src="'templates/loader.html'" ng-if="$ctrl.isLoading.logs"></ng-include>
2
2
3 <div ng-if="logs.isLoading.logs === false">
3 <div ng-if="$ctrl.isLoading.logs === false">
4
4
5 <p class="search-params">
5 <p class="search-params">
6 <strong>Search params:</strong>
6 <strong>Search params:</strong>
7 <span ng-repeat="tag in logs.searchParams.tags" class="tag">
7 <span ng-repeat="tag in $ctrl.searchParams.tags" class="tag">
8 <strong>{{tag.type}}</strong>
8 <strong>{{tag.type}}</strong>
9 {{ tag.type == 'resource' ? logs.applications[tag.value].resource_name : tag.value }}
9 {{ tag.type == 'resource' ? $ctrl.applications[tag.value].resource_name : tag.value }}
10
10
11 <a ng-click="logs.removeSearchTag(tag)"><span class="fa fa-times"></span></a>
11 <a ng-click="$ctrl.removeSearchTag(tag)"><span class="fa fa-times"></span></a>
12 </span>
12 </span>
13 </p>
13 </p>
14
14
@@ -20,15 +20,15 b''
20
20
21 <form class="form">
21 <form class="form">
22 <div class="typeahead-tags">
22 <div class="typeahead-tags">
23 <input type="text" id="typeAhead" ng-model="logs.filterTypeAhead" placeholder="Start typing to filter logs for events, filter by servers, namespaces, levels."
23 <input type="text" id="typeAhead" ng-model="$ctrl.filterTypeAhead" placeholder="Start typing to filter logs for events, filter by servers, namespaces, levels."
24 ng-keydown="logs.typeAheadTag($event)"
24 ng-keydown="$ctrl.typeAheadTag($event)"
25 uib-typeahead="tag as tag.text for tag in logs.filterTypeAheadOptions | filter:$viewValue:logs.aheadFilter"
25 uib-typeahead="tag as tag.text for tag in $ctrl.filterTypeAheadOptions | filter:$viewValue:$ctrl.aheadFilter"
26 typeahead-min-length="1" class="form-control"
26 typeahead-min-length="1" class="form-control"
27 typeahead-template-url="templates/directives/search_type_ahead.html">
27 typeahead-template-url="templates/directives/search_type_ahead.html">
28 </div>
28 </div>
29 </form>
29 </form>
30
30
31 <div class="well animate-show position-absolute increse-zindex" ng-if="logs.showDatePicker" ng-model="logs.pickerDate" ng-change="logs.pickerDateChanged()">
31 <div class="well animate-show position-absolute increse-zindex" ng-if="$ctrl.showDatePicker" ng-model="$ctrl.pickerDate" ng-change="$ctrl.pickerDateChanged()">
32 <uib-datepicker></uib-datepicker>
32 <uib-datepicker></uib-datepicker>
33 </div>
33 </div>
34
34
@@ -37,15 +37,15 b''
37 <div class="panel">
37 <div class="panel">
38
38
39 <div class="panel-body">
39 <div class="panel-body">
40 <c3chart data-domid="log_events_chart" data-data="logs.logEventsChartData" data-config="logs.logEventsChartConfig">
40 <c3chart data-domid="log_events_chart" data-data="$ctrl.logEventsChartData" data-config="$ctrl.logEventsChartConfig">
41 </c3chart>
41 </c3chart>
42 </div>
42 </div>
43 </div>
43 </div>
44
44
45
45
46 <div class="text-center">
46 <div class="text-center">
47 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.page" max-size="10"
47 <uib-pagination total-items="$ctrl.itemCount" items-per-page="$ctrl.itemsPerPage" ng-model="$ctrl.page" max-size="10"
48 ng-change="logs.paginationChange()"
48 ng-change="$ctrl.paginationChange()"
49 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
49 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
50 </div>
50 </div>
51
51
@@ -61,22 +61,22 b''
61 </tr>
61 </tr>
62 </thead>
62 </thead>
63 <tbody>
63 <tbody>
64 <tr ng-repeat="log in logs.logsPage track by log.log_id" class="{{$odd ? 'odd' : 'even'}}">
64 <tr ng-repeat="log in $ctrl.logsPage track by log.log_id" class="{{$odd ? 'odd' : 'even'}}">
65 <td class="c1">
65 <td class="c1">
66 <a class="tag application" ng-click="logs.addSearchTag({type:'resource', value:log.resource_id})">
66 <a class="tag application" ng-click="$ctrl.addSearchTag({type:'resource', value:log.resource_id})">
67 <span class="name">{{log.resource_name}}</span></a>
67 <span class="name">{{log.resource_name}}</span></a>
68 </td>
68 </td>
69 <td class="c2">
69 <td class="c2">
70 <a class="tag {{log.log_level|lowercase}}" ng-click="logs.addSearchTag({type:'level', value:log.log_level})">
70 <a class="tag {{log.log_level|lowercase}}" ng-click="$ctrl.addSearchTag({type:'level', value:log.log_level})">
71 <span class="name">level:</span> {{log.log_level}}</a>
71 <span class="name">level:</span> {{log.log_level}}</a>
72 <a class="tag" ng-click="logs.addSearchTag({type:'namespace', value:log.namespace})">
72 <a class="tag" ng-click="$ctrl.addSearchTag({type:'namespace', value:log.namespace})">
73 <span class="name">namespace:</span> {{log.namespace}}</a>
73 <span class="name">namespace:</span> {{log.namespace}}</a>
74 <a ng-repeat="(tag, value) in log.tags" class="tag" ng-click="logs.addSearchTag({type:tag, value:value})">
74 <a ng-repeat="(tag, value) in log.tags" class="tag" ng-click="$ctrl.addSearchTag({type:tag, value:value})">
75 <span class="name">{{tag}}:</span> {{value}}</a>
75 <span class="name">{{tag}}:</span> {{value}}</a>
76 <div class="log">{{log.message}}</div>
76 <div class="log">{{log.message}}</div>
77 </td>
77 </td>
78 <td class="c3 when">
78 <td class="c3 when">
79 <a ng-click="logs.filterId(log)" data-uib-tooltip="{{log.timestamp}}">
79 <a ng-click="$ctrl.filterId(log)" data-uib-tooltip="{{log.timestamp}}">
80 <iso-to-relative-time time="{{log.timestamp}}"/>
80 <iso-to-relative-time time="{{log.timestamp}}"/>
81 </a>
81 </a>
82 </td>
82 </td>
@@ -88,8 +88,8 b''
88 </div>
88 </div>
89
89
90 <div class="text-center">
90 <div class="text-center">
91 <uib-pagination total-items="logs.itemCount" items-per-page="logs.itemsPerPage" ng-model="logs.page" max-size="10"
91 <uib-pagination total-items="$ctrl.itemCount" items-per-page="$ctrl.itemsPerPage" ng-model="$ctrl.page" max-size="10"
92 ng-change="logs.paginationChange()"
92 ng-change="$ctrl.paginationChange()"
93 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
93 class="pagination pagination-sm" boundary-links="true" direction-links="false"></uib-pagination>
94 </div>
94 </div>
95
95
@@ -17,11 +17,15 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 angular.module('appenlight.controllers').controller('LogsController', LogsController);
20 angular.module('appenlight.components.logsBrowserView', [])
21 .component('logsBrowserView', {
22 templateUrl: 'components/views/logs-browser/logs-browser.html',
23 controller: LogsBrowserController
24 });
21
25
22 LogsController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
26 LogsBrowserController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
23
27
24 function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
28 function LogsBrowserController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
25 var vm = this;
29 var vm = this;
26 vm.logEventsChartConfig = {
30 vm.logEventsChartConfig = {
27 data: {
31 data: {
@@ -23,8 +23,7 b" angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun"
23
23
24 $stateProvider.state('logs', {
24 $stateProvider.state('logs', {
25 url: '/ui/logs?resource',
25 url: '/ui/logs?resource',
26 templateUrl: 'templates/logs.html',
26 component: 'logsBrowserView'
27 controller: 'LogsController as logs'
28 });
27 });
29
28
30 $stateProvider.state('front_dashboard', {
29 $stateProvider.state('front_dashboard', {
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now