\n" +
@@ -5782,106 +5883,6 @@ function kickstartAE(initialUserData) {
);
- $templateCache.put('templates/logs.html',
- "
\n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- " Search params:\n" +
- " \n" +
- " {{tag.type}}\n" +
- " {{ tag.type == 'resource' ? logs.applications[tag.value].resource_name : tag.value }}\n" +
- "\n" +
- " \n" +
- " \n" +
- "
\n" +
- "\n" +
- "
\n" +
- "\n" +
- " \n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- " \n" +
- "
\n" +
- "\n" +
- " \n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- " \n" +
- " \n" +
- "
\n" +
- "
\n" +
- "\n" +
- "\n" +
- "
\n" +
- " \n" +
- "
\n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- "\n" +
- "
\n" +
- " \n" +
- "
\n" +
- "\n" +
- "
\n"
- );
-
-
$templateCache.put('templates/quickstart.html',
"
AppEnlight quickstart
\n" +
"\n" +
@@ -7996,258 +7997,285 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-var aeconfig = angular.module('appenlight.config', []);
-aeconfig.factory('AeConfig', function () {
- var obj = {};
- obj.flashMessages = decodeEncodedJSON(window.AE.flash_messages);
- obj.timeOptions = decodeEncodedJSON(window.AE.timeOptions);
- obj.plugins = decodeEncodedJSON(window.AE.plugins);
- obj.topNav = decodeEncodedJSON(window.AE.topNav);
- obj.ws_url = window.AE.ws_url;
- obj.urls = window.AE.urls;
- // set keys on values because we wont be able to retrieve them everywhere
- for (var key in obj.timeOptions) {
- obj.timeOptions[key]['key'] = key;
- }
- console.info('config', obj);
- return obj;
-});
-
-;// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-
-angular.module('appenlight.controllers').controller('AdminApplicationsListController', AdminApplicationsListController);
-
-AdminApplicationsListController.$inject = ['applicationsResource'];
-
-function AdminApplicationsListController(applicationsResource) {
-
- var vm = this;
- vm.loading = {applications: true};
-
- vm.applications = applicationsResource.query({
- root_list: true,
- resource_type: 'application'
- }, function (data) {
- vm.loading = {applications: false};
+angular.module('appenlight.components.logsBrowserView', [])
+ .component('logsBrowserView', {
+ templateUrl: 'components/views/logs-browser/logs-browser.html',
+ controller: LogsBrowserController
});
-};
-
-;// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('ConfigsListController', ConfigsListController);
-
-ConfigsListController.$inject = ['configsResource', 'configsNoIdResource'];
+LogsBrowserController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
-function ConfigsListController(configsResource, configsNoIdResource) {
+function LogsBrowserController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
var vm = this;
- vm.loading = {config: true};
-
- var filters = [
- 'template_footer_html:global',
- 'list_groups_to_non_admins:global',
- 'per_application_reports_rate_limit:global',
- 'per_application_logs_rate_limit:global',
- 'per_application_metrics_rate_limit:global',
- ];
-
- vm.configs = {};
-
- vm.configList = configsResource.query({filter: filters},
- function (data) {
- vm.loading = {config: false};
- _.each(data, function (item) {
- if (vm.configs[item.section] === undefined) {
- vm.configs[item.section] = {};
- }
- vm.configs[item.section][item.key] = item;
- });
- });
-
- vm.save = function () {
- vm.loading.config = true;
- _.each(vm.configList, function (item) {
- item.$save();
- });
- vm.loading.config = false;
+ vm.logEventsChartConfig = {
+ data: {
+ json: [],
+ xFormat: '%Y-%m-%dT%H:%M:%S'
+ },
+ color: {
+ pattern: ['#6baed6', '#e6550d', '#74c476', '#fdd0a2', '#8c564b']
+ },
+ axis: {
+ x: {
+ type: 'timeseries',
+ tick: {
+ format: '%Y-%m-%d'
+ }
+ },
+ y: {
+ tick: {
+ count: 5,
+ format: d3.format('.2s')
+ }
+ }
+ },
+ subchart: {
+ show: true,
+ size: {
+ height: 20
+ }
+ },
+ size: {
+ height: 250
+ },
+ zoom: {
+ rescale: true
+ },
+ grid: {
+ x: {
+ show: true
+ },
+ y: {
+ show: true
+ }
+ },
+ tooltip: {
+ format: {
+ title: function (d) {
+ return '' + d;
+ },
+ value: function (v) {
+ return v
+ }
+ }
+ }
};
+ vm.logEventsChartData = {};
+ stateHolder.section = 'logs';
+ vm.today = function () {
+ vm.pickerDate = new Date();
+ };
+ vm.today();
-};
-
-;// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-
-angular.module('appenlight.controllers').controller('AdminGroupsCreateController', AdminGroupsCreateController);
-
-AdminGroupsCreateController.$inject = ['$state', 'groupsResource', 'groupsPropertyResource', 'sectionViewResource', 'AeConfig'];
-
-function AdminGroupsCreateController($state, groupsResource, groupsPropertyResource, sectionViewResource, AeConfig) {
-
- var vm = this;
- vm.loading = {
- group: false,
- resource_permissions: false,
- users: false
+ vm.applications = stateHolder.AeUser.applications_map;
+ vm.logsPage = [];
+ vm.itemCount = 0;
+ vm.itemsPerPage = 250;
+ vm.page = 1;
+ vm.$location = $location;
+ vm.isLoading = {
+ logs: true,
+ series: true
+ };
+ vm.filterTypeAheadOptions = [
+ {
+ type: 'message',
+ text: 'message:',
+ 'description': 'Full-text search in your logs',
+ tag: 'Message',
+ example: 'message:text-im-looking-for'
+ },
+ {
+ type: 'namespace',
+ text: 'namespace:',
+ 'description': 'Query logs from specific namespace',
+ tag: 'Namespace',
+ example: "namespace:module.foo"
+ },
+ {
+ type: 'resource',
+ text: 'resource:',
+ 'description': 'Restrict resultset to application',
+ tag: 'Application',
+ example: "resource:ID"
+ },
+ {
+ type: 'request_id',
+ text: 'request_id:',
+ 'description': 'Show logs with specific request id',
+ example: "request_id:883143dc572e4c38aceae92af0ea5ae0",
+ tag: 'Request ID'
+ },
+ {
+ type: 'level',
+ text: 'level:',
+ 'description': 'Show entries with specific log level',
+ example: 'level:warning',
+ tag: 'Level'
+ },
+ {
+ type: 'server_name',
+ text: 'server_name:',
+ 'description': 'Show entries tagged with this key/value pair',
+ example: 'server_name:hostname',
+ tag: 'Tag'
+ },
+ {
+ type: 'start_date',
+ text: 'start_date:',
+ 'description': 'Show results newer than this date (press TAB for dropdown)',
+ example: 'start_date:2014-08-15T13:00',
+ tag: 'Start Date'
+ },
+ {
+ type: 'end_date',
+ text: 'end_date:',
+ 'description': 'Show results older than this date (press TAB for dropdown)',
+ example: 'start_date:2014-08-15T23:59',
+ tag: 'End Date'
+ },
+ {type: 'level', value: 'debug', text: 'level:debug'},
+ {type: 'level', value: 'info', text: 'level:info'},
+ {type: 'level', value: 'warning', text: 'level:warning'},
+ {type: 'level', value: 'critical', text: 'level:critical'}
+ ];
+ vm.filterTypeAhead = null;
+ vm.showDatePicker = false;
+ vm.manualOpen = false;
+ vm.aheadFilter = typeAheadTagHelper.aheadFilter;
+ vm.removeSearchTag = function (tag) {
+ $location.search(tag.type, null);
+ vm.refresh();
+ };
+ vm.addSearchTag = function (tag) {
+ $location.search(tag.type, tag.value);
+ vm.refresh();
};
- vm.form = {
- autocompleteUser: '',
- }
+ vm.paginationChange = function(){
+ $location.search('page', vm.page);
+ vm.refresh();
+ };
- if (typeof $state.params.groupId !== 'undefined') {
- vm.loading.group = true;
- var groupId = $state.params.groupId;
- vm.group = groupsResource.get({groupId: groupId}, function (data) {
- vm.loading.group = false;
+ _.each(vm.applications, function (item) {
+ vm.filterTypeAheadOptions.push({
+ type: 'resource',
+ text: 'resource:' + item.resource_id + ':' + item.resource_name,
+ example: 'resource:' + item.resource_id,
+ 'tag': item.resource_name,
+ 'description': 'Restrict resultset to this application'
});
+ });
- vm.resource_permissions = groupsPropertyResource.query(
- {groupId: groupId, key: 'resource_permissions'}, function (data) {
- vm.loading.resource_permissions = false;
- var tmpObj = {
- 'group': {
- 'application': {},
- 'dashboard': {}
- }
- };
- _.each(data, function (item) {
-
- var section = tmpObj[item.type][item.resource_type];
- if (typeof section[item.resource_id] == 'undefined') {
- section[item.resource_id] = {
- self: item,
- permissions: []
- }
- }
- section[item.resource_id].permissions.push(item.perm_name);
-
- });
- vm.resourcePermissions = tmpObj;
- });
-
- vm.users = groupsPropertyResource.query(
- {groupId: groupId, key: 'users'}, function (data) {
- vm.loading.users = false;
- }, function () {
- vm.loading.users = false;
- });
+ vm.typeAheadTag = function (event) {
+ var text = vm.filterTypeAhead;
+ if (_.isObject(vm.filterTypeAhead)) {
+ text = vm.filterTypeAhead.text;
+ };
+ if (!vm.filterTypeAhead) {
+ return
+ }
+ var parsed = text.split(':');
+ var tag = {'type': null, 'value': null};
+ // app tags have : twice
+ if (parsed.length > 2 && parsed[0] == 'resource') {
+ tag.type = 'resource';
+ tag.value = parsed[1];
+ }
+ // normal tag:value
+ else if (parsed.length > 1) {
+ tag.type = parsed[0];
+ tag.value = parsed.slice(1).join(':');
+ }
+ else {
+ tag.type = 'message';
+ tag.value = parsed.join(':');
+ }
- }
- else {
- var groupId = null;
- }
+ // set datepicker hour based on type of field
+ if ('start_date:' == text) {
+ vm.showDatePicker = true;
+ vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
+ }
+ else if ('end_date:' == text) {
+ vm.showDatePicker = true;
+ vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
+ }
- var formResponse = function (response) {
- if (response.status === 422) {
- setServerValidation(vm.groupForm, response.data);
+ if (event.keyCode != 13 || !tag.type || !tag.value) {
+ return
}
- vm.loading.group = false;
+ vm.showDatePicker = false;
+ // aka we selected one of main options
+ vm.addSearchTag({type: tag.type, value: tag.value});
+ // clear typeahead
+ vm.filterTypeAhead = undefined;
};
- vm.createGroup = function () {
- vm.loading.group = true;
- if (groupId) {
- groupsResource.update({groupId: vm.group.id}, vm.group, function (data) {
- setServerValidation(vm.groupForm);
- vm.loading.group = false;
- }, formResponse);
+
+ vm.pickerDateChanged = function(){
+ if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
+ vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
}
- else {
- groupsResource.save(vm.group, function (data) {
- $state.go('admin.group.update', {groupId: data.id});
- }, formResponse);
+ else if (vm.filterTypeAhead.indexOf('end_date:') == '0') {
+ vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
}
+ vm.showDatePicker = false;
+ };
+
+ vm.fetchLogs = function (searchParams) {
+ vm.isLoading.logs = true;
+ logsNoIdResource.query(searchParams, function (data, getResponseHeaders) {
+ vm.isLoading.logs = false;
+ var headers = getResponseHeaders();
+ vm.logsPage = data;
+ vm.itemCount = headers['x-total-count'];
+ vm.itemsPerPage = headers['x-items-per-page'];
+ }, function () {
+ vm.isLoading.logs = false;
+ });
+ };
+
+ vm.fetchSeriesData = function (searchParams) {
+ searchParams['section'] = 'logs_section';
+ searchParams['view'] = 'fetch_series';
+ vm.isLoading.series = true;
+ sectionViewResource.query(searchParams, function (data) {
+
+ vm.logEventsChartData = {
+ json: data,
+ xFormat: '%Y-%m-%dT%H:%M:%S',
+ keys: {
+ x: 'x',
+ value: ["logs"]
+ },
+ names: {
+ logs: 'Log events'
+ },
+ type: 'bar'
+ };
+ vm.isLoading.series = false;
+ }, function () {
+ vm.isLoading.series = false;
+ });
};
- vm.removeUser = function (user) {
- groupsPropertyResource.delete(
- {groupId: groupId, key: 'users', user_name: user.user_name},
- function (data) {
- vm.loading.users = false;
- vm.users = _.filter(vm.users, function (item) {
- return item != user;
- });
- }, function () {
- vm.loading.users = false;
- });
+ vm.filterId = function (log) {
+ $location.search('request_id', log.request_id);
+ vm.refresh();
};
- vm.addUser = function () {
- groupsPropertyResource.save(
- {groupId: groupId, key: 'users'},
- {user_name: vm.form.autocompleteUser},
- function (data) {
- vm.loading.users = false;
- vm.users.push(data);
- vm.form.autocompleteUser = '';
- }, function () {
- vm.loading.users = false;
- });
- }
-
- vm.searchUsers = function (searchPhrase) {
-
- return sectionViewResource.query({
- section: 'users_section',
- view: 'search_users',
- 'user_name': searchPhrase
- }).$promise.then(function (data) {
- return _.map(data, function (item) {
- return item.user;
- });
- });
- }
-};
+ vm.refresh = function(){
+ vm.searchParams = parseSearchToTags($location.search());
+ vm.page = Number(vm.searchParams.page) || 1;
+ var params = parseTagsToSearch(vm.searchParams);
+ vm.fetchLogs(params);
+ vm.fetchSeriesData(params);
+ };
+ console.info('page load');
+ vm.refresh();
+}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8268,40 +8296,22 @@ function AdminGroupsCreateController($state, groupsResource, groupsPropertyResou
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('AdminGroupsController', AdminGroupsController);
-
-AdminGroupsController.$inject = ['groupsResource'];
-
-function AdminGroupsController(groupsResource) {
-
- var vm = this;
- vm.loading = {groups: true};
-
- vm.groups = groupsResource.query({}, function (data) {
- vm.loading = {groups: false};
- vm.activeUsers = _.reduce(vm.groups, function(memo, val){
- if (val.status == 1){
- return memo + 1;
- }
- return memo;
- }, 0);
-
- });
-
-
- vm.removeGroup = function (group) {
- groupsResource.remove({groupId: group.id}, function (data, responseHeaders) {
-
- if (data) {
- var index = vm.groups.indexOf(group);
- if (index !== -1) {
- vm.groups.splice(index, 1);
- vm.activeGroups -= 1;
- }
- }
- });
+var aeconfig = angular.module('appenlight.config', []);
+aeconfig.factory('AeConfig', function () {
+ var obj = {};
+ obj.flashMessages = decodeEncodedJSON(window.AE.flash_messages);
+ obj.timeOptions = decodeEncodedJSON(window.AE.timeOptions);
+ obj.plugins = decodeEncodedJSON(window.AE.plugins);
+ obj.topNav = decodeEncodedJSON(window.AE.topNav);
+ obj.ws_url = window.AE.ws_url;
+ obj.urls = window.AE.urls;
+ // set keys on values because we wont be able to retrieve them everywhere
+ for (var key in obj.timeOptions) {
+ obj.timeOptions[key]['key'] = key;
}
-};
+ console.info('config', obj);
+ return obj;
+});
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8322,111 +8332,22 @@ function AdminGroupsController(groupsResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('AdminPartitionsController', AdminPartitionsController);
+angular.module('appenlight.controllers').controller('AdminApplicationsListController', AdminApplicationsListController);
-AdminPartitionsController.$inject = ['sectionViewResource'];
+AdminApplicationsListController.$inject = ['applicationsResource'];
-function AdminPartitionsController(sectionViewResource) {
+function AdminApplicationsListController(applicationsResource) {
+
var vm = this;
- vm.permanentPartitions = [];
- vm.dailyPartitions = [];
- vm.loading = {partitions: true};
- vm.dailyChecked = false;
- vm.permChecked = false;
- vm.dailyConfirm = '';
- vm.permConfirm = '';
-
-
- vm.loadPartitions = function (data) {
- var permanentPartitions = vm.transformPartitionList(
- data.permanent_partitions);
- var dailyPartitions = vm.transformPartitionList(
- data.daily_partitions);
- vm.permanentPartitions = permanentPartitions;
- vm.dailyPartitions = dailyPartitions;
- vm.loading = {partitions: false};
- };
-
- vm.setCheckedList = function (scope) {
- var toTest = null;
- if (scope === 'dailyPartitions'){
- toTest = 'dailyChecked';
- }
- else{
- toTest = 'permChecked';
- }
-
- if (vm[toTest]) {
- var val = true;
- }
- else {
- var val = false;
- }
-
- _.each(vm[scope], function (item) {
- _.each(item[1].pg, function (index) {
- index.checked = val;
- });
- _.each(item[1].elasticsearch, function (index) {
- index.checked = val;
- });
- });
- }
-
-
- vm.transformPartitionList = function (inputList) {
- var outputList = [];
-
- _.each(inputList, function (item) {
- var time = [item[0], {
- elasticsearch: [],
- pg: []
- }]
- _.each(item[1].pg, function (index) {
- time[1].pg.push({name: index, checked: false})
- });
- _.each(item[1].elasticsearch, function (index) {
- time[1].elasticsearch.push({
- name: index,
- checked: false
- })
- });
- outputList.push(time);
- });
- return outputList;
- };
-
- sectionViewResource.get({section:'admin_section', view: 'partitions'},
- vm.loadPartitions);
-
- vm.partitionsDelete = function (partitionType) {
- var es_indices = [];
- var pg_indices = [];
- _.each(vm[partitionType], function (item) {
- _.each(item[1].pg, function (index) {
- if (index.checked) {
- pg_indices.push(index.name)
- }
- });
- _.each(item[1].elasticsearch, function (index) {
- if (index.checked) {
- es_indices.push(index.name)
- }
- });
- });
-
-
- vm.loading = {partitions: true};
- sectionViewResource.save({section:'admin_section',
- view: 'partitions_remove'}, {
- es_indices: es_indices,
- pg_indices: pg_indices,
- confirm: 'CONFIRM'
- }, vm.loadPartitions);
-
- }
+ vm.loading = {applications: true};
-}
+ vm.applications = applicationsResource.query({
+ root_list: true,
+ resource_type: 'application'
+ }, function (data) {
+ vm.loading = {applications: false};
+ });
+};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8447,30 +8368,43 @@ function AdminPartitionsController(sectionViewResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('AdminSystemController', AdminSystemController);
+angular.module('appenlight.controllers').controller('ConfigsListController', ConfigsListController);
-AdminSystemController.$inject = ['sectionViewResource'];
+ConfigsListController.$inject = ['configsResource', 'configsNoIdResource'];
-function AdminSystemController(sectionViewResource) {
+function ConfigsListController(configsResource, configsNoIdResource) {
var vm = this;
- vm.tables = [];
- vm.loading = {system: true};
- sectionViewResource.get({
- section: 'admin_section',
- view: 'system'
- }, null, function (data) {
- vm.DBtables = data.db_tables;
- vm.ESIndices = data.es_indices;
- vm.queueStats = data.queue_stats;
- vm.systemLoad = data.system_load;
- vm.packages = data.packages;
- vm.processInfo = data.process_info;
- vm.disks = data.disks;
- vm.memory = data.memory;
- vm.selfInfo = data.self_info;
+ vm.loading = {config: true};
+
+ var filters = [
+ 'template_footer_html:global',
+ 'list_groups_to_non_admins:global',
+ 'per_application_reports_rate_limit:global',
+ 'per_application_logs_rate_limit:global',
+ 'per_application_metrics_rate_limit:global',
+ ];
+
+ vm.configs = {};
+
+ vm.configList = configsResource.query({filter: filters},
+ function (data) {
+ vm.loading = {config: false};
+ _.each(data, function (item) {
+ if (vm.configs[item.section] === undefined) {
+ vm.configs[item.section] = {};
+ }
+ vm.configs[item.section][item.key] = item;
+ });
+ });
+
+ vm.save = function () {
+ vm.loading.config = true;
+ _.each(vm.configList, function (item) {
+ item.$save();
+ });
+ vm.loading.config = false;
+ };
- vm.loading.system = false;
- });
};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -8492,35 +8426,35 @@ function AdminSystemController(sectionViewResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('AdminUsersCreateController', AdminUsersCreateController);
+angular.module('appenlight.controllers').controller('AdminGroupsCreateController', AdminGroupsCreateController);
-AdminUsersCreateController.$inject = ['$state', 'usersResource', 'usersPropertyResource', 'sectionViewResource', 'AeConfig'];
+AdminGroupsCreateController.$inject = ['$state', 'groupsResource', 'groupsPropertyResource', 'sectionViewResource', 'AeConfig'];
-function AdminUsersCreateController($state, usersResource, usersPropertyResource, sectionViewResource, AeConfig) {
+function AdminGroupsCreateController($state, groupsResource, groupsPropertyResource, sectionViewResource, AeConfig) {
var vm = this;
- vm.loading = {user: false};
+ vm.loading = {
+ group: false,
+ resource_permissions: false,
+ users: false
+ };
+
+ vm.form = {
+ autocompleteUser: '',
+ }
- if (typeof $state.params.userId !== 'undefined') {
- vm.loading.user = true;
- var userId = $state.params.userId;
- vm.user = usersResource.get({userId: userId}, function (data) {
- vm.loading.user = false;
- // cast to true for angular checkbox
- if (vm.user.status === 1) {
- vm.user.status = true;
- }
+ if (typeof $state.params.groupId !== 'undefined') {
+ vm.loading.group = true;
+ var groupId = $state.params.groupId;
+ vm.group = groupsResource.get({groupId: groupId}, function (data) {
+ vm.loading.group = false;
});
- vm.resource_permissions = usersPropertyResource.query(
- {userId: userId, key: 'resource_permissions'}, function (data) {
+ vm.resource_permissions = groupsPropertyResource.query(
+ {groupId: groupId, key: 'resource_permissions'}, function (data) {
vm.loading.resource_permissions = false;
var tmpObj = {
- 'user': {
- 'application': {},
- 'dashboard': {}
- },
'group': {
'application': {},
'dashboard': {}
@@ -8529,9 +8463,9 @@ function AdminUsersCreateController($state, usersResource, usersPropertyResource
_.each(data, function (item) {
var section = tmpObj[item.type][item.resource_type];
- if (typeof section[item.resource_id] == 'undefined'){
+ if (typeof section[item.resource_id] == 'undefined') {
section[item.resource_id] = {
- self:item,
+ self: item,
permissions: []
}
}
@@ -8541,110 +8475,77 @@ function AdminUsersCreateController($state, usersResource, usersPropertyResource
vm.resourcePermissions = tmpObj;
});
+ vm.users = groupsPropertyResource.query(
+ {groupId: groupId, key: 'users'}, function (data) {
+ vm.loading.users = false;
+ }, function () {
+ vm.loading.users = false;
+ });
+
}
else {
- var userId = null;
- vm.user = {
- status: true
- }
+ var groupId = null;
}
var formResponse = function (response) {
- if (response.status == 422) {
- setServerValidation(vm.profileForm, response.data);
+ if (response.status === 422) {
+ setServerValidation(vm.groupForm, response.data);
}
- vm.loading.user = false;
- }
+ vm.loading.group = false;
+ };
- vm.createUser = function () {
- vm.loading.user = true;
-
- if (userId) {
- usersResource.update({userId: vm.user.id}, vm.user, function (data) {
- setServerValidation(vm.profileForm);
- vm.loading.user = false;
+ vm.createGroup = function () {
+ vm.loading.group = true;
+ if (groupId) {
+ groupsResource.update({groupId: vm.group.id}, vm.group, function (data) {
+ setServerValidation(vm.groupForm);
+ vm.loading.group = false;
}, formResponse);
}
else {
- usersResource.save(vm.user, function (data) {
- $state.go('admin.user.update', {userId: data.id});
+ groupsResource.save(vm.group, function (data) {
+ $state.go('admin.group.update', {groupId: data.id});
}, formResponse);
}
- }
-
- vm.generatePassword = function () {
- var length = 8;
- var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- vm.gen_pass = "";
- for (var i = 0, n = charset.length; i < length; ++i) {
- vm.gen_pass += charset.charAt(Math.floor(Math.random() * n));
- }
- vm.user.user_password = '' + vm.gen_pass;
-
- }
+ };
- vm.reloginUser = function () {
- sectionViewResource.get({
- section: 'admin_section', view: 'relogin_user',
- user_id: vm.user.id
- }, function () {
- window.location = AeConfig.urls.baseUrl;
- });
+ vm.removeUser = function (user) {
+ groupsPropertyResource.delete(
+ {groupId: groupId, key: 'users', user_name: user.user_name},
+ function (data) {
+ vm.loading.users = false;
+ vm.users = _.filter(vm.users, function (item) {
+ return item != user;
+ });
+ }, function () {
+ vm.loading.users = false;
+ });
+ };
+ vm.addUser = function () {
+ groupsPropertyResource.save(
+ {groupId: groupId, key: 'users'},
+ {user_name: vm.form.autocompleteUser},
+ function (data) {
+ vm.loading.users = false;
+ vm.users.push(data);
+ vm.form.autocompleteUser = '';
+ }, function () {
+ vm.loading.users = false;
+ });
}
-};
-
-;// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-
-angular.module('appenlight.controllers').controller('AdminUsersController', AdminUsersController);
-
-AdminUsersController.$inject = ['usersResource'];
-
-function AdminUsersController(usersResource) {
-
- var vm = this;
- vm.loading = {users: true};
- vm.users = usersResource.query({}, function (data) {
- vm.loading = {users: false};
- vm.activeUsers = _.reduce(vm.users, function(memo, val){
- if (val.status == 1){
- return memo + 1;
- }
- return memo;
- }, 0);
+ vm.searchUsers = function (searchPhrase) {
- });
-
-
- vm.removeUser = function (user) {
- usersResource.remove({userId: user.id}, function (data, responseHeaders) {
-
- if (data) {
- var index = vm.users.indexOf(user);
- if (index !== -1) {
- vm.users.splice(index, 1);
- vm.activeUsers -= 1;
- }
- }
- });
+ return sectionViewResource.query({
+ section: 'users_section',
+ view: 'search_users',
+ 'user_name': searchPhrase
+ }).$promise.then(function (data) {
+ return _.map(data, function (item) {
+ return item.user;
+ });
+ });
}
};
@@ -8656,168 +8557,51 @@ function AdminUsersController(usersResource) {
// #
// # This program is distributed in the hope that it will be useful,
// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-
-angular.module('appenlight.controllers')
- .controller('ApplicationsUpdateController', ApplicationsUpdateController)
-
-ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder'];
-
-function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) {
- 'use strict';
-
- var vm = this;
- vm.loading = {application: false};
-
- vm.groupingOptions = [
- ['url_type', 'Error Type + location'],
- ['url_traceback', 'Traceback + location'],
- ['traceback_server', 'Traceback + Server'],
- ];
-
- var resourceId = $state.params.resourceId;
-
-
- var options = {};
-
- vm.momentJs = moment;
-
- vm.formTransferModel = {password:''};
-
- // set initial data
-
- if (resourceId === 'new') {
- vm.resource = {
- resource_id: null,
- slow_report_threshold: 10,
- error_report_threshold: 10,
- allow_permanent_storage: true,
- default_grouping: vm.groupingOptions[1][0]
- };
- }
- else {
- vm.loading.application = true;
- vm.resource = applicationsResource.get({
- 'resourceId': resourceId
- }, function (data) {
- vm.loading.application = false;
- });
- }
+// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// # GNU General Public License for more details.
+// #
+// # You should have received a copy of the GNU Affero General Public License
+// # along with this program. If not, see
.
+// #
+// # This program is dual-licensed. If you wish to learn more about the
+// # AppEnlight Enterprise Edition, including its added features, Support
+// # services, and proprietary license terms, please see
+// # https://rhodecode.com/licenses/
+angular.module('appenlight.controllers').controller('AdminGroupsController', AdminGroupsController);
- vm.updateBasicForm = function () {
- vm.loading.application = true;
- if (vm.resource.resource_id === null) {
- applicationsNoIdResource.save(null, vm.resource, function (data) {
- stateHolder.AeUser.addApplication(data);
- $state.go('applications.update', {resourceId: data.resource_id});
- setServerValidation(vm.BasicForm);
- }, function (response) {
- if (response.status == 422) {
- setServerValidation(vm.BasicForm, response.data);
- }
- vm.loading.application = false;
-
- });
- }
- else {
- applicationsResource.update({resourceId: vm.resource.resource_id},
- vm.resource, function (data) {
- vm.resource = data;
- vm.loading.application = false;
- setServerValidation(vm.BasicForm);
- }, function (response) {
- if (response.status == 422) {
- setServerValidation(vm.BasicForm, response.data);
- }
- vm.loading.application = false;
- });
- }
- };
+AdminGroupsController.$inject = ['groupsResource'];
- vm.addRule = function () {
-
- applicationsPropertyResource.save({
- resourceId: vm.resource.resource_id,
- key: 'postprocessing_rules'
- }, null,
- function (data) {
- vm.resource.postprocessing_rules.push(data);
- }
- );
- };
+function AdminGroupsController(groupsResource) {
+
+ var vm = this;
+ vm.loading = {groups: true};
- vm.regenerateAPIKeys = function(){
- vm.loading.application = true;
- applicationsPropertyResource.save({
- resourceId: vm.resource.resource_id,
- key: 'api_key'
- }, {password: vm.regenerateAPIKeysPassword},
- function (data) {
- vm.resource = data;
- vm.loading.application = false;
- vm.regenerateAPIKeysPassword = '';
- setServerValidation(vm.regenerateAPIKeysForm);
- },
- function (response) {
- if (response.status == 422) {
- setServerValidation(vm.regenerateAPIKeysForm, response.data);
-
- }
- vm.loading.application = false;
+ vm.groups = groupsResource.query({}, function (data) {
+ vm.loading = {groups: false};
+ vm.activeUsers = _.reduce(vm.groups, function(memo, val){
+ if (val.status == 1){
+ return memo + 1;
}
- )
- };
+ return memo;
+ }, 0);
+
+ });
- vm.deleteApplication = function(){
- vm.loading.application = true;
- applicationsPropertyResource.update({
- resourceId: vm.resource.resource_id,
- key: 'delete_resource'
- }, vm.formDeleteModel,
- function (data) {
- stateHolder.AeUser.removeApplicationById(vm.resource.resource_id);
- $state.go('applications.list');
- },
- function (response) {
- if (response.status == 422) {
- setServerValidation(vm.formDelete, response.data);
-
- }
- vm.loading.application = false;
- }
- );
- };
- vm.transferApplication = function(){
- vm.loading.application = true;
- applicationsPropertyResource.update({
- resourceId: vm.resource.resource_id,
- key: 'owner'
- }, vm.formTransferModel,
- function (data) {
- $state.go('applications.list');
- },
- function (response) {
- if (response.status == 422) {
- setServerValidation(vm.formTransfer, response.data);
-
+ vm.removeGroup = function (group) {
+ groupsResource.remove({groupId: group.id}, function (data, responseHeaders) {
+
+ if (data) {
+ var index = vm.groups.indexOf(group);
+ if (index !== -1) {
+ vm.groups.splice(index, 1);
+ vm.activeGroups -= 1;
}
- vm.loading.application = false;
}
- )
+ });
}
-
-}
+};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8838,73 +8622,110 @@ function ApplicationsUpdateController($state, applicationsNoIdResource, applicat
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers')
- .controller('IntegrationController', IntegrationController)
+angular.module('appenlight.controllers').controller('AdminPartitionsController', AdminPartitionsController);
-IntegrationController.$inject = ['$state', 'integrationResource'];
+AdminPartitionsController.$inject = ['sectionViewResource'];
-function IntegrationController($state, integrationResource) {
-
+function AdminPartitionsController(sectionViewResource) {
var vm = this;
- vm.loading = {integration: true};
- vm.config = integrationResource.get(
- {
- integration: $state.params.integration,
- action: 'setup',
- resourceId: $state.params.resourceId
- }, function (data) {
- vm.loading.integration = false;
+ vm.permanentPartitions = [];
+ vm.dailyPartitions = [];
+ vm.loading = {partitions: true};
+ vm.dailyChecked = false;
+ vm.permChecked = false;
+ vm.dailyConfirm = '';
+ vm.permConfirm = '';
+
+
+ vm.loadPartitions = function (data) {
+ var permanentPartitions = vm.transformPartitionList(
+ data.permanent_partitions);
+ var dailyPartitions = vm.transformPartitionList(
+ data.daily_partitions);
+ vm.permanentPartitions = permanentPartitions;
+ vm.dailyPartitions = dailyPartitions;
+ vm.loading = {partitions: false};
+ };
+
+ vm.setCheckedList = function (scope) {
+ var toTest = null;
+ if (scope === 'dailyPartitions'){
+ toTest = 'dailyChecked';
+ }
+ else{
+ toTest = 'permChecked';
+ }
+
+ if (vm[toTest]) {
+ var val = true;
+ }
+ else {
+ var val = false;
+ }
+
+ _.each(vm[scope], function (item) {
+ _.each(item[1].pg, function (index) {
+ index.checked = val;
+ });
+ _.each(item[1].elasticsearch, function (index) {
+ index.checked = val;
+ });
});
+ }
- vm.configureIntegration = function () {
- console.info('configureIntegration');
- vm.loading.integration = true;
- integrationResource.save(
- {
- integration: $state.params.integration,
- action: 'setup',
- resourceId: $state.params.resourceId
- }, vm.config, function (data) {
- vm.loading.integration = false;
- setServerValidation(vm.integrationForm);
- }, function (response) {
- if (response.status == 422) {
- setServerValidation(vm.integrationForm, response.data);
- }
- vm.loading.integration = false;
+
+ vm.transformPartitionList = function (inputList) {
+ var outputList = [];
+
+ _.each(inputList, function (item) {
+ var time = [item[0], {
+ elasticsearch: [],
+ pg: []
+ }]
+ _.each(item[1].pg, function (index) {
+ time[1].pg.push({name: index, checked: false})
+ });
+ _.each(item[1].elasticsearch, function (index) {
+ time[1].elasticsearch.push({
+ name: index,
+ checked: false
+ })
});
+ outputList.push(time);
+ });
+ return outputList;
};
- vm.removeIntegration = function () {
- console.info('removeIntegration');
- integrationResource.remove({
- integration: $state.params.integration,
- resourceId: $state.params.resourceId,
- action: 'delete'
- },
- function () {
- $state.go('applications.integrations',
- {resourceId: $state.params.resourceId});
- }
- );
- }
+ sectionViewResource.get({section:'admin_section', view: 'partitions'},
+ vm.loadPartitions);
- vm.testIntegration = function(to_test){
- console.info('testIntegration', to_test);
- vm.loading.integration = true;
- integrationResource.save(
- {
- integration: $state.params.integration,
- action: 'test_'+ to_test,
- resourceId: $state.params.resourceId
- }, vm.config, function (data) {
- vm.loading.integration = false;
- }, function (response) {
- vm.loading.integration = false;
+ vm.partitionsDelete = function (partitionType) {
+ var es_indices = [];
+ var pg_indices = [];
+ _.each(vm[partitionType], function (item) {
+ _.each(item[1].pg, function (index) {
+ if (index.checked) {
+ pg_indices.push(index.name)
+ }
+ });
+ _.each(item[1].elasticsearch, function (index) {
+ if (index.checked) {
+ es_indices.push(index.name)
+ }
});
+ });
+
+
+ vm.loading = {partitions: true};
+ sectionViewResource.save({section:'admin_section',
+ view: 'partitions_remove'}, {
+ es_indices: es_indices,
+ pg_indices: pg_indices,
+ confirm: 'CONFIRM'
+ }, vm.loadPartitions);
+
}
-
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -8926,20 +8747,31 @@ function IntegrationController($state, integrationResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers')
- .controller('IntegrationsListController', IntegrationsListController)
+angular.module('appenlight.controllers').controller('AdminSystemController', AdminSystemController);
-IntegrationsListController.$inject = ['$state', 'applicationsResource'];
+AdminSystemController.$inject = ['sectionViewResource'];
-function IntegrationsListController($state, applicationsResource) {
-
+function AdminSystemController(sectionViewResource) {
var vm = this;
- vm.loading = {application: true};
- vm.resource = applicationsResource.get({resourceId: $state.params.resourceId}, function (data) {
- vm.loading.application = false;
- $state.current.data.resource = vm.resource;
+ vm.tables = [];
+ vm.loading = {system: true};
+ sectionViewResource.get({
+ section: 'admin_section',
+ view: 'system'
+ }, null, function (data) {
+ vm.DBtables = data.db_tables;
+ vm.ESIndices = data.es_indices;
+ vm.queueStats = data.queue_stats;
+ vm.systemLoad = data.system_load;
+ vm.packages = data.packages;
+ vm.processInfo = data.process_info;
+ vm.disks = data.disks;
+ vm.memory = data.memory;
+ vm.selfInfo = data.self_info;
+
+ vm.loading.system = false;
});
-}
+};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8960,19 +8792,107 @@ function IntegrationsListController($state, applicationsResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers')
- .controller('ApplicationsListController', ApplicationsListController)
+angular.module('appenlight.controllers').controller('AdminUsersCreateController', AdminUsersCreateController);
-ApplicationsListController.$inject = ['applicationsResource'];
+AdminUsersCreateController.$inject = ['$state', 'usersResource', 'usersPropertyResource', 'sectionViewResource', 'AeConfig'];
-function ApplicationsListController(applicationsResource) {
+function AdminUsersCreateController($state, usersResource, usersPropertyResource, sectionViewResource, AeConfig) {
var vm = this;
- vm.loading = {applications: true};
- vm.applications = applicationsResource.query(null, function(){
- vm.loading.applications = false;
- });
-}
+ vm.loading = {user: false};
+
+
+ if (typeof $state.params.userId !== 'undefined') {
+ vm.loading.user = true;
+ var userId = $state.params.userId;
+ vm.user = usersResource.get({userId: userId}, function (data) {
+ vm.loading.user = false;
+ // cast to true for angular checkbox
+ if (vm.user.status === 1) {
+ vm.user.status = true;
+ }
+ });
+
+ vm.resource_permissions = usersPropertyResource.query(
+ {userId: userId, key: 'resource_permissions'}, function (data) {
+ vm.loading.resource_permissions = false;
+ var tmpObj = {
+ 'user': {
+ 'application': {},
+ 'dashboard': {}
+ },
+ 'group': {
+ 'application': {},
+ 'dashboard': {}
+ }
+ };
+ _.each(data, function (item) {
+
+ var section = tmpObj[item.type][item.resource_type];
+ if (typeof section[item.resource_id] == 'undefined'){
+ section[item.resource_id] = {
+ self:item,
+ permissions: []
+ }
+ }
+ section[item.resource_id].permissions.push(item.perm_name);
+
+ });
+ vm.resourcePermissions = tmpObj;
+ });
+
+ }
+ else {
+ var userId = null;
+ vm.user = {
+ status: true
+ }
+ }
+
+ var formResponse = function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.profileForm, response.data);
+ }
+ vm.loading.user = false;
+ }
+
+ vm.createUser = function () {
+ vm.loading.user = true;
+
+ if (userId) {
+ usersResource.update({userId: vm.user.id}, vm.user, function (data) {
+ setServerValidation(vm.profileForm);
+ vm.loading.user = false;
+ }, formResponse);
+ }
+ else {
+ usersResource.save(vm.user, function (data) {
+ $state.go('admin.user.update', {userId: data.id});
+ }, formResponse);
+ }
+ }
+
+ vm.generatePassword = function () {
+ var length = 8;
+ var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ vm.gen_pass = "";
+ for (var i = 0, n = charset.length; i < length; ++i) {
+ vm.gen_pass += charset.charAt(Math.floor(Math.random() * n));
+ }
+ vm.user.user_password = '' + vm.gen_pass;
+
+ }
+
+ vm.reloginUser = function () {
+ sectionViewResource.get({
+ section: 'admin_section', view: 'relogin_user',
+ user_id: vm.user.id
+ }, function () {
+ window.location = AeConfig.urls.baseUrl;
+ });
+
+ }
+};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -8993,47 +8913,40 @@ function ApplicationsListController(applicationsResource) {
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers')
- .controller('ApplicationsPurgeLogsController', ApplicationsPurgeLogsController)
+angular.module('appenlight.controllers').controller('AdminUsersController', AdminUsersController);
-ApplicationsPurgeLogsController.$inject = ['applicationsResource', 'sectionViewResource', 'logsNoIdResource'];
+AdminUsersController.$inject = ['usersResource'];
-function ApplicationsPurgeLogsController(applicationsResource, sectionViewResource, logsNoIdResource) {
+function AdminUsersController(usersResource) {
var vm = this;
- vm.loading = {applications: true};
-
- vm.namespace = null;
- vm.selectedResource = null;
- vm.commonNamespaces = [];
+ vm.loading = {users: true};
- vm.applications = applicationsResource.query({'type':'update_reports'}, function () {
- vm.loading.applications = false;
- vm.selectedResource = vm.applications[0].resource_id;
- vm.getCommonKeys();
+ vm.users = usersResource.query({}, function (data) {
+ vm.loading = {users: false};
+ vm.activeUsers = _.reduce(vm.users, function(memo, val){
+ if (val.status == 1){
+ return memo + 1;
+ }
+ return memo;
+ }, 0);
+
});
- /**
- * Fetches most commonly used tags in logs
- */
- vm.getCommonKeys = function () {
- sectionViewResource.get({
- section: 'logs_section',
- view: 'common_tags',
- resource: vm.selectedResource
- }, function (data) {
- vm.commonNamespaces = data['namespaces']
- });
- };
- vm.purgeLogs = function () {
- vm.loading.applications = true;
- logsNoIdResource.delete({resource:vm.selectedResource,
- namespace: vm.namespace}, function(){
- vm.loading.applications = false;
+ vm.removeUser = function (user) {
+ usersResource.remove({userId: user.id}, function (data, responseHeaders) {
+
+ if (data) {
+ var index = vm.users.indexOf(user);
+ if (index !== -1) {
+ vm.users.splice(index, 1);
+ vm.activeUsers -= 1;
+ }
+ }
});
}
-}
+};
;// # Copyright (C) 2010-2016 RhodeCode GmbH
// #
@@ -9054,58 +8967,156 @@ function ApplicationsPurgeLogsController(applicationsResource, sectionViewResour
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('EventsController', EventsController);
+angular.module('appenlight.controllers')
+ .controller('ApplicationsUpdateController', ApplicationsUpdateController)
-EventsController.$inject = ['eventsNoIdResource', 'eventsResource'];
+ApplicationsUpdateController.$inject = ['$state', 'applicationsNoIdResource', 'applicationsResource', 'applicationsPropertyResource', 'stateHolder'];
-function EventsController(eventsNoIdResource, eventsResource) {
- console.info('EventsController');
+function ApplicationsUpdateController($state, applicationsNoIdResource, applicationsResource, applicationsPropertyResource, stateHolder) {
+ 'use strict';
+
var vm = this;
+ vm.loading = {application: false};
- vm.loading = {events: true};
+ vm.groupingOptions = [
+ ['url_type', 'Error Type + location'],
+ ['url_traceback', 'Traceback + location'],
+ ['traceback_server', 'Traceback + Server'],
+ ];
- vm.events = eventsNoIdResource.query(
- {key: 'events'},
- function (data) {
- vm.loading.events = false;
+ var resourceId = $state.params.resourceId;
+
+
+ var options = {};
+
+ vm.momentJs = moment;
+
+ vm.formTransferModel = {password:''};
+
+ // set initial data
+
+ if (resourceId === 'new') {
+ vm.resource = {
+ resource_id: null,
+ slow_report_threshold: 10,
+ error_report_threshold: 10,
+ allow_permanent_storage: true,
+ default_grouping: vm.groupingOptions[1][0]
+ };
+ }
+ else {
+ vm.loading.application = true;
+ vm.resource = applicationsResource.get({
+ 'resourceId': resourceId
+ }, function (data) {
+ vm.loading.application = false;
});
+ }
- vm.closeEvent = function (event) {
-
- eventsResource.update({eventId: event.id}, {status: 0}, function (data) {
- event.status = 0;
- });
- }
+ vm.updateBasicForm = function () {
+ vm.loading.application = true;
+ if (vm.resource.resource_id === null) {
+ applicationsNoIdResource.save(null, vm.resource, function (data) {
+ stateHolder.AeUser.addApplication(data);
+ $state.go('applications.update', {resourceId: data.resource_id});
+ setServerValidation(vm.BasicForm);
+ }, function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.BasicForm, response.data);
+ }
+ vm.loading.application = false;
+
+ });
+ }
+ else {
+ applicationsResource.update({resourceId: vm.resource.resource_id},
+ vm.resource, function (data) {
+ vm.resource = data;
+ vm.loading.application = false;
+ setServerValidation(vm.BasicForm);
+ }, function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.BasicForm, response.data);
+ }
+ vm.loading.application = false;
+ });
+ }
+ };
-}
+ vm.addRule = function () {
+
+ applicationsPropertyResource.save({
+ resourceId: vm.resource.resource_id,
+ key: 'postprocessing_rules'
+ }, null,
+ function (data) {
+ vm.resource.postprocessing_rules.push(data);
+ }
+ );
+ };
-;// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see
.
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
+ vm.regenerateAPIKeys = function(){
+ vm.loading.application = true;
+ applicationsPropertyResource.save({
+ resourceId: vm.resource.resource_id,
+ key: 'api_key'
+ }, {password: vm.regenerateAPIKeysPassword},
+ function (data) {
+ vm.resource = data;
+ vm.loading.application = false;
+ vm.regenerateAPIKeysPassword = '';
+ setServerValidation(vm.regenerateAPIKeysForm);
+ },
+ function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.regenerateAPIKeysForm, response.data);
+
+ }
+ vm.loading.application = false;
+ }
+ )
+ };
-angular.module('appenlight.controllers').controller('IndexCtrl', IndexCtrl);
+ vm.deleteApplication = function(){
+ vm.loading.application = true;
+ applicationsPropertyResource.update({
+ resourceId: vm.resource.resource_id,
+ key: 'delete_resource'
+ }, vm.formDeleteModel,
+ function (data) {
+ stateHolder.AeUser.removeApplicationById(vm.resource.resource_id);
+ $state.go('applications.list');
+ },
+ function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.formDelete, response.data);
+
+ }
+ vm.loading.application = false;
+ }
+ );
+ };
-IndexCtrl.$inject = [IndexCtrl];
+ vm.transferApplication = function(){
+ vm.loading.application = true;
+ applicationsPropertyResource.update({
+ resourceId: vm.resource.resource_id,
+ key: 'owner'
+ }, vm.formTransferModel,
+ function (data) {
+ $state.go('applications.list');
+ },
+ function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.formTransfer, response.data);
+
+ }
+ vm.loading.application = false;
+ }
+ )
+ }
-function IndexCtrl() {
- var vm = this;
- vm.selected_section = 'errors';
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9128,78 +9139,72 @@ function IndexCtrl() {
// # https://rhodecode.com/licenses/
angular.module('appenlight.controllers')
- .controller('BitbucketIntegrationCtrl', BitbucketIntegrationCtrl)
+ .controller('IntegrationController', IntegrationController)
-BitbucketIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
+IntegrationController.$inject = ['$state', 'integrationResource'];
-function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+function IntegrationController($state, integrationResource) {
+
var vm = this;
- vm.loading = true;
- vm.assignees = [];
- vm.report = report;
- vm.integrationName = integrationName;
- vm.statuses = [];
- vm.priorities = [];
- vm.error_messages = [];
- vm.form = {
- content: '\n' +
- 'Issue created for report: ' +
- $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
- };
+ vm.loading = {integration: true};
+ vm.config = integrationResource.get(
+ {
+ integration: $state.params.integration,
+ action: 'setup',
+ resourceId: $state.params.resourceId
+ }, function (data) {
+ vm.loading.integration = false;
+ });
- vm.fetchInfo = function () {
- integrationResource.get({
- resourceId: vm.report.resource_id,
- action: 'info',
- integration: vm.integrationName
- }, null,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- vm.assignees = data.assignees;
- vm.priorities = data.priorities;
- vm.form.responsible = vm.assignees[0];
- vm.form.priority = vm.priorities[0];
- }, function (error_data) {
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
+ vm.configureIntegration = function () {
+ console.info('configureIntegration');
+ vm.loading.integration = true;
+ integrationResource.save(
+ {
+ integration: $state.params.integration,
+ action: 'setup',
+ resourceId: $state.params.resourceId
+ }, vm.config, function (data) {
+ vm.loading.integration = false;
+ setServerValidation(vm.integrationForm);
+ }, function (response) {
+ if (response.status == 422) {
+ setServerValidation(vm.integrationForm, response.data);
}
+ vm.loading.integration = false;
});
};
- vm.ok = function () {
- vm.loading = true;
- vm.form.group_id = vm.report.group_id;
- integrationResource.save({
- resourceId: vm.report.resource_id,
- action: 'create-issue',
- integration: vm.integrationName
- }, vm.form,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- if (data !== false) {
- $uibModalInstance.dismiss('success');
- }
- }, function (error_data) {
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
- }
+
+ vm.removeIntegration = function () {
+ console.info('removeIntegration');
+ integrationResource.remove({
+ integration: $state.params.integration,
+ resourceId: $state.params.resourceId,
+ action: 'delete'
+ },
+ function () {
+ $state.go('applications.integrations',
+ {resourceId: $state.params.resourceId});
+ }
+ );
+ }
+
+ vm.testIntegration = function(to_test){
+ console.info('testIntegration', to_test);
+ vm.loading.integration = true;
+ integrationResource.save(
+ {
+ integration: $state.params.integration,
+ action: 'test_'+ to_test,
+ resourceId: $state.params.resourceId
+ }, vm.config, function (data) {
+ vm.loading.integration = false;
+ }, function (response) {
+ vm.loading.integration = false;
});
- };
- vm.cancel = function () {
- $uibModalInstance.dismiss('cancel');
- };
- vm.fetchInfo();
+ }
+
+
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9222,80 +9227,51 @@ function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integration
// # https://rhodecode.com/licenses/
angular.module('appenlight.controllers')
- .controller('GithubIntegrationCtrl', GithubIntegrationCtrl);
+ .controller('IntegrationsListController', IntegrationsListController)
-GithubIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
+IntegrationsListController.$inject = ['$state', 'applicationsResource'];
-function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+function IntegrationsListController($state, applicationsResource) {
+
var vm = this;
- vm.loading = true;
- vm.assignees = [];
- vm.report = report;
- vm.integrationName = integrationName;
- vm.statuses = [];
- vm.assignees = [];
- vm.error_messages = [];
- vm.form = {
- content: '\n' +
- 'Issue created for report: ' +
- $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
- };
+ vm.loading = {application: true};
+ vm.resource = applicationsResource.get({resourceId: $state.params.resourceId}, function (data) {
+ vm.loading.application = false;
+ $state.current.data.resource = vm.resource;
+ });
+}
- vm.fetchInfo = function () {
- integrationResource.get({
- resourceId: vm.report.resource_id,
- action: 'info',
- integration: vm.integrationName
- }, null,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- else {
- vm.assignees = data.assignees;
- vm.statuses = data.statuses;
- vm.form.responsible = vm.assignees[0];
- vm.form.status = vm.statuses[0];
- }
- }, function (error_data) {
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
- }
- });
- };
- vm.ok = function () {
- vm.loading = true;
- vm.form.group_id = vm.report.group_id;
- integrationResource.save({
- resourceId: vm.report.resource_id,
- action: 'create-issue',
- integration: vm.integrationName
- }, vm.form,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- else {
- $uibModalInstance.dismiss('success');
- }
- }, function (error_data) {
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
- }
- });
- };
- vm.cancel = function () {
- $uibModalInstance.dismiss('cancel');
- };
- vm.fetchInfo();
+;// # Copyright (C) 2010-2016 RhodeCode GmbH
+// #
+// # This program is free software: you can redistribute it and/or modify
+// # it under the terms of the GNU Affero General Public License, version 3
+// # (only), as published by the Free Software Foundation.
+// #
+// # This program is distributed in the hope that it will be useful,
+// # but WITHOUT ANY WARRANTY; without even the implied warranty of
+// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// # GNU General Public License for more details.
+// #
+// # You should have received a copy of the GNU Affero General Public License
+// # along with this program. If not, see
.
+// #
+// # This program is dual-licensed. If you wish to learn more about the
+// # AppEnlight Enterprise Edition, including its added features, Support
+// # services, and proprietary license terms, please see
+// # https://rhodecode.com/licenses/
+
+angular.module('appenlight.controllers')
+ .controller('ApplicationsListController', ApplicationsListController)
+
+ApplicationsListController.$inject = ['applicationsResource'];
+
+function ApplicationsListController(applicationsResource) {
+
+ var vm = this;
+ vm.loading = {applications: true};
+ vm.applications = applicationsResource.query(null, function(){
+ vm.loading.applications = false;
+ });
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9318,82 +9294,90 @@ function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationNam
// # https://rhodecode.com/licenses/
angular.module('appenlight.controllers')
- .controller('JiraIntegrationCtrl', JiraIntegrationCtrl)
+ .controller('ApplicationsPurgeLogsController', ApplicationsPurgeLogsController)
-JiraIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
+ApplicationsPurgeLogsController.$inject = ['applicationsResource', 'sectionViewResource', 'logsNoIdResource'];
-function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+function ApplicationsPurgeLogsController(applicationsResource, sectionViewResource, logsNoIdResource) {
+
var vm = this;
- vm.loading = true;
- vm.assignees = [];
- vm.report = report;
- vm.integrationName = integrationName;
- vm.statuses = [];
- vm.priorities = [];
- vm.issue_types = [];
- vm.error_messages = [];
- vm.form = {
- content: '\n' +
- 'Issue created for report: ' +
- $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
- };
+ vm.loading = {applications: true};
- vm.fetchInfo = function () {
- integrationResource.get({
- resourceId: vm.report.resource_id,
- action: 'info',
- integration: vm.integrationName
- }, null,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- vm.assignees = data.assignees;
- vm.priorities = data.priorities;
- vm.issue_types = data.issue_types;
- vm.form.issue_type = vm.issue_types[0];
- vm.form.responsible = vm.assignees[0];
- vm.form.priority = vm.priorities[0];
- }, function (error_data) {
-
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
- }
- });
- };
- vm.ok = function () {
- vm.loading = true;
- vm.form.group_id = vm.report.group_id;
- integrationResource.save({
- resourceId: vm.report.resource_id,
- action: 'create-issue',
- integration: vm.integrationName
- }, vm.form,
- function (data) {
- vm.loading = false;
- if (data.error_messages) {
- vm.error_messages = data.error_messages;
- }
- if (data !== false) {
- $uibModalInstance.dismiss('success');
- }
- }, function (error_data) {
- if (error_data.data.error_messages) {
- vm.error_messages = error_data.data.error_messages;
- }
- else {
- vm.error_messages = ['There was a problem processing your request'];
- }
- });
- };
- vm.cancel = function () {
- $uibModalInstance.dismiss('cancel');
+ vm.namespace = null;
+ vm.selectedResource = null;
+ vm.commonNamespaces = [];
+
+ vm.applications = applicationsResource.query({'type':'update_reports'}, function () {
+ vm.loading.applications = false;
+ vm.selectedResource = vm.applications[0].resource_id;
+ vm.getCommonKeys();
+ });
+
+ /**
+ * Fetches most commonly used tags in logs
+ */
+ vm.getCommonKeys = function () {
+ sectionViewResource.get({
+ section: 'logs_section',
+ view: 'common_tags',
+ resource: vm.selectedResource
+ }, function (data) {
+ vm.commonNamespaces = data['namespaces']
+ });
};
- vm.fetchInfo();
+
+ vm.purgeLogs = function () {
+ vm.loading.applications = true;
+ logsNoIdResource.delete({resource:vm.selectedResource,
+ namespace: vm.namespace}, function(){
+ vm.loading.applications = false;
+ });
+ }
+}
+
+;// # Copyright (C) 2010-2016 RhodeCode GmbH
+// #
+// # This program is free software: you can redistribute it and/or modify
+// # it under the terms of the GNU Affero General Public License, version 3
+// # (only), as published by the Free Software Foundation.
+// #
+// # This program is distributed in the hope that it will be useful,
+// # but WITHOUT ANY WARRANTY; without even the implied warranty of
+// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// # GNU General Public License for more details.
+// #
+// # You should have received a copy of the GNU Affero General Public License
+// # along with this program. If not, see
.
+// #
+// # This program is dual-licensed. If you wish to learn more about the
+// # AppEnlight Enterprise Edition, including its added features, Support
+// # services, and proprietary license terms, please see
+// # https://rhodecode.com/licenses/
+
+angular.module('appenlight.controllers').controller('EventsController', EventsController);
+
+EventsController.$inject = ['eventsNoIdResource', 'eventsResource'];
+
+function EventsController(eventsNoIdResource, eventsResource) {
+ console.info('EventsController');
+ var vm = this;
+
+ vm.loading = {events: true};
+
+ vm.events = eventsNoIdResource.query(
+ {key: 'events'},
+ function (data) {
+ vm.loading.events = false;
+ });
+
+
+ vm.closeEvent = function (event) {
+
+ eventsResource.update({eventId: event.id}, {status: 0}, function (data) {
+ event.status = 0;
+ });
+ }
+
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9415,280 +9399,203 @@ function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName,
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('LogsController', LogsController);
+angular.module('appenlight.controllers').controller('IndexCtrl', IndexCtrl);
-LogsController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
+IndexCtrl.$inject = [IndexCtrl];
-function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
+function IndexCtrl() {
var vm = this;
- vm.logEventsChartConfig = {
- data: {
- json: [],
- xFormat: '%Y-%m-%dT%H:%M:%S'
- },
- color: {
- pattern: ['#6baed6', '#e6550d', '#74c476', '#fdd0a2', '#8c564b']
- },
- axis: {
- x: {
- type: 'timeseries',
- tick: {
- format: '%Y-%m-%d'
- }
- },
- y: {
- tick: {
- count: 5,
- format: d3.format('.2s')
- }
- }
- },
- subchart: {
- show: true,
- size: {
- height: 20
- }
- },
- size: {
- height: 250
- },
- zoom: {
- rescale: true
- },
- grid: {
- x: {
- show: true
- },
- y: {
- show: true
- }
- },
- tooltip: {
- format: {
- title: function (d) {
- return '' + d;
- },
- value: function (v) {
- return v
- }
- }
- }
- };
- vm.logEventsChartData = {};
- stateHolder.section = 'logs';
- vm.today = function () {
- vm.pickerDate = new Date();
- };
- vm.today();
-
- vm.applications = stateHolder.AeUser.applications_map;
- vm.logsPage = [];
- vm.itemCount = 0;
- vm.itemsPerPage = 250;
- vm.page = 1;
- vm.$location = $location;
- vm.isLoading = {
- logs: true,
- series: true
- };
- vm.filterTypeAheadOptions = [
- {
- type: 'message',
- text: 'message:',
- 'description': 'Full-text search in your logs',
- tag: 'Message',
- example: 'message:text-im-looking-for'
- },
- {
- type: 'namespace',
- text: 'namespace:',
- 'description': 'Query logs from specific namespace',
- tag: 'Namespace',
- example: "namespace:module.foo"
- },
- {
- type: 'resource',
- text: 'resource:',
- 'description': 'Restrict resultset to application',
- tag: 'Application',
- example: "resource:ID"
- },
- {
- type: 'request_id',
- text: 'request_id:',
- 'description': 'Show logs with specific request id',
- example: "request_id:883143dc572e4c38aceae92af0ea5ae0",
- tag: 'Request ID'
- },
- {
- type: 'level',
- text: 'level:',
- 'description': 'Show entries with specific log level',
- example: 'level:warning',
- tag: 'Level'
- },
- {
- type: 'server_name',
- text: 'server_name:',
- 'description': 'Show entries tagged with this key/value pair',
- example: 'server_name:hostname',
- tag: 'Tag'
- },
- {
- type: 'start_date',
- text: 'start_date:',
- 'description': 'Show results newer than this date (press TAB for dropdown)',
- example: 'start_date:2014-08-15T13:00',
- tag: 'Start Date'
- },
- {
- type: 'end_date',
- text: 'end_date:',
- 'description': 'Show results older than this date (press TAB for dropdown)',
- example: 'start_date:2014-08-15T23:59',
- tag: 'End Date'
- },
- {type: 'level', value: 'debug', text: 'level:debug'},
- {type: 'level', value: 'info', text: 'level:info'},
- {type: 'level', value: 'warning', text: 'level:warning'},
- {type: 'level', value: 'critical', text: 'level:critical'}
- ];
- vm.filterTypeAhead = null;
- vm.showDatePicker = false;
- vm.manualOpen = false;
- vm.aheadFilter = typeAheadTagHelper.aheadFilter;
- vm.removeSearchTag = function (tag) {
- $location.search(tag.type, null);
- vm.refresh();
- };
- vm.addSearchTag = function (tag) {
- $location.search(tag.type, tag.value);
- vm.refresh();
- };
-
- vm.paginationChange = function(){
- $location.search('page', vm.page);
- vm.refresh();
- };
+ vm.selected_section = 'errors';
+}
+;// # Copyright (C) 2010-2016 RhodeCode GmbH
+// #
+// # This program is free software: you can redistribute it and/or modify
+// # it under the terms of the GNU Affero General Public License, version 3
+// # (only), as published by the Free Software Foundation.
+// #
+// # This program is distributed in the hope that it will be useful,
+// # but WITHOUT ANY WARRANTY; without even the implied warranty of
+// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// # GNU General Public License for more details.
+// #
+// # You should have received a copy of the GNU Affero General Public License
+// # along with this program. If not, see
.
+// #
+// # This program is dual-licensed. If you wish to learn more about the
+// # AppEnlight Enterprise Edition, including its added features, Support
+// # services, and proprietary license terms, please see
+// # https://rhodecode.com/licenses/
- _.each(vm.applications, function (item) {
- vm.filterTypeAheadOptions.push({
- type: 'resource',
- text: 'resource:' + item.resource_id + ':' + item.resource_name,
- example: 'resource:' + item.resource_id,
- 'tag': item.resource_name,
- 'description': 'Restrict resultset to this application'
- });
- });
+angular.module('appenlight.controllers')
+ .controller('BitbucketIntegrationCtrl', BitbucketIntegrationCtrl)
- vm.typeAheadTag = function (event) {
- var text = vm.filterTypeAhead;
- if (_.isObject(vm.filterTypeAhead)) {
- text = vm.filterTypeAhead.text;
- };
- if (!vm.filterTypeAhead) {
- return
- }
- var parsed = text.split(':');
- var tag = {'type': null, 'value': null};
- // app tags have : twice
- if (parsed.length > 2 && parsed[0] == 'resource') {
- tag.type = 'resource';
- tag.value = parsed[1];
- }
- // normal tag:value
- else if (parsed.length > 1) {
- tag.type = parsed[0];
- tag.value = parsed.slice(1).join(':');
- }
- else {
- tag.type = 'message';
- tag.value = parsed.join(':');
- }
+BitbucketIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
- // set datepicker hour based on type of field
- if ('start_date:' == text) {
- vm.showDatePicker = true;
- vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
- }
- else if ('end_date:' == text) {
- vm.showDatePicker = true;
- vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
- }
+function BitbucketIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+ var vm = this;
+ vm.loading = true;
+ vm.assignees = [];
+ vm.report = report;
+ vm.integrationName = integrationName;
+ vm.statuses = [];
+ vm.priorities = [];
+ vm.error_messages = [];
+ vm.form = {
+ content: '\n' +
+ 'Issue created for report: ' +
+ $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
+ };
- if (event.keyCode != 13 || !tag.type || !tag.value) {
- return
- }
- vm.showDatePicker = false;
- // aka we selected one of main options
- vm.addSearchTag({type: tag.type, value: tag.value});
- // clear typeahead
- vm.filterTypeAhead = undefined;
+ vm.fetchInfo = function () {
+ integrationResource.get({
+ resourceId: vm.report.resource_id,
+ action: 'info',
+ integration: vm.integrationName
+ }, null,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ vm.assignees = data.assignees;
+ vm.priorities = data.priorities;
+ vm.form.responsible = vm.assignees[0];
+ vm.form.priority = vm.priorities[0];
+ }, function (error_data) {
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
+ };
+ vm.ok = function () {
+ vm.loading = true;
+ vm.form.group_id = vm.report.group_id;
+ integrationResource.save({
+ resourceId: vm.report.resource_id,
+ action: 'create-issue',
+ integration: vm.integrationName
+ }, vm.form,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ if (data !== false) {
+ $uibModalInstance.dismiss('success');
+ }
+ }, function (error_data) {
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
};
+ vm.cancel = function () {
+ $uibModalInstance.dismiss('cancel');
+ };
+ vm.fetchInfo();
+}
+;// # Copyright (C) 2010-2016 RhodeCode GmbH
+// #
+// # This program is free software: you can redistribute it and/or modify
+// # it under the terms of the GNU Affero General Public License, version 3
+// # (only), as published by the Free Software Foundation.
+// #
+// # This program is distributed in the hope that it will be useful,
+// # but WITHOUT ANY WARRANTY; without even the implied warranty of
+// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// # GNU General Public License for more details.
+// #
+// # You should have received a copy of the GNU Affero General Public License
+// # along with this program. If not, see
.
+// #
+// # This program is dual-licensed. If you wish to learn more about the
+// # AppEnlight Enterprise Edition, including its added features, Support
+// # services, and proprietary license terms, please see
+// # https://rhodecode.com/licenses/
- vm.pickerDateChanged = function(){
- if (vm.filterTypeAhead.indexOf('start_date:') == '0') {
- vm.filterTypeAhead = 'start_date:' + moment(vm.pickerDate).utc().format();
- }
- else if (vm.filterTypeAhead.indexOf('end_date:') == '0') {
- vm.filterTypeAhead = 'end_date:' + moment(vm.pickerDate).utc().hour(23).minute(59).format();
- }
- vm.showDatePicker = false;
- };
+angular.module('appenlight.controllers')
+ .controller('GithubIntegrationCtrl', GithubIntegrationCtrl);
- vm.fetchLogs = function (searchParams) {
- vm.isLoading.logs = true;
- logsNoIdResource.query(searchParams, function (data, getResponseHeaders) {
- vm.isLoading.logs = false;
- var headers = getResponseHeaders();
- vm.logsPage = data;
- vm.itemCount = headers['x-total-count'];
- vm.itemsPerPage = headers['x-items-per-page'];
- }, function () {
- vm.isLoading.logs = false;
- });
- };
+GithubIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
- vm.fetchSeriesData = function (searchParams) {
- searchParams['section'] = 'logs_section';
- searchParams['view'] = 'fetch_series';
- vm.isLoading.series = true;
- sectionViewResource.query(searchParams, function (data) {
-
- vm.logEventsChartData = {
- json: data,
- xFormat: '%Y-%m-%dT%H:%M:%S',
- keys: {
- x: 'x',
- value: ["logs"]
- },
- names: {
- logs: 'Log events'
- },
- type: 'bar'
- };
- vm.isLoading.series = false;
- }, function () {
- vm.isLoading.series = false;
- });
+function GithubIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+ var vm = this;
+ vm.loading = true;
+ vm.assignees = [];
+ vm.report = report;
+ vm.integrationName = integrationName;
+ vm.statuses = [];
+ vm.assignees = [];
+ vm.error_messages = [];
+ vm.form = {
+ content: '\n' +
+ 'Issue created for report: ' +
+ $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
};
- vm.filterId = function (log) {
- $location.search('request_id', log.request_id);
- vm.refresh();
+ vm.fetchInfo = function () {
+ integrationResource.get({
+ resourceId: vm.report.resource_id,
+ action: 'info',
+ integration: vm.integrationName
+ }, null,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ else {
+ vm.assignees = data.assignees;
+ vm.statuses = data.statuses;
+ vm.form.responsible = vm.assignees[0];
+ vm.form.status = vm.statuses[0];
+ }
+ }, function (error_data) {
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
};
-
- vm.refresh = function(){
- vm.searchParams = parseSearchToTags($location.search());
- vm.page = Number(vm.searchParams.page) || 1;
- var params = parseTagsToSearch(vm.searchParams);
- vm.fetchLogs(params);
- vm.fetchSeriesData(params);
+ vm.ok = function () {
+ vm.loading = true;
+ vm.form.group_id = vm.report.group_id;
+ integrationResource.save({
+ resourceId: vm.report.resource_id,
+ action: 'create-issue',
+ integration: vm.integrationName
+ }, vm.form,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ else {
+ $uibModalInstance.dismiss('success');
+ }
+ }, function (error_data) {
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
};
- console.info('page load');
- vm.refresh();
+ vm.cancel = function () {
+ $uibModalInstance.dismiss('cancel');
+ };
+ vm.fetchInfo();
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -9711,12 +9618,82 @@ function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdReso
// # https://rhodecode.com/licenses/
angular.module('appenlight.controllers')
- .controller('OverviewCtrl', OverviewCtrl);
+ .controller('JiraIntegrationCtrl', JiraIntegrationCtrl)
-OverviewCtrl.$inject = [];
+JiraIntegrationCtrl.$inject = ['$uibModalInstance', '$state', 'report', 'integrationName', 'integrationResource'];
-function OverviewCtrl() {
+function JiraIntegrationCtrl($uibModalInstance, $state, report, integrationName, integrationResource) {
+ var vm = this;
+ vm.loading = true;
+ vm.assignees = [];
+ vm.report = report;
+ vm.integrationName = integrationName;
+ vm.statuses = [];
+ vm.priorities = [];
+ vm.issue_types = [];
+ vm.error_messages = [];
+ vm.form = {
+ content: '\n' +
+ 'Issue created for report: ' +
+ $state.href('report.view_detail', {groupId:report.group_id, reportId:report.id}, {absolute:true})
+ };
+ vm.fetchInfo = function () {
+ integrationResource.get({
+ resourceId: vm.report.resource_id,
+ action: 'info',
+ integration: vm.integrationName
+ }, null,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ vm.assignees = data.assignees;
+ vm.priorities = data.priorities;
+ vm.issue_types = data.issue_types;
+ vm.form.issue_type = vm.issue_types[0];
+ vm.form.responsible = vm.assignees[0];
+ vm.form.priority = vm.priorities[0];
+ }, function (error_data) {
+
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
+ };
+ vm.ok = function () {
+ vm.loading = true;
+ vm.form.group_id = vm.report.group_id;
+ integrationResource.save({
+ resourceId: vm.report.resource_id,
+ action: 'create-issue',
+ integration: vm.integrationName
+ }, vm.form,
+ function (data) {
+ vm.loading = false;
+ if (data.error_messages) {
+ vm.error_messages = data.error_messages;
+ }
+ if (data !== false) {
+ $uibModalInstance.dismiss('success');
+ }
+ }, function (error_data) {
+ if (error_data.data.error_messages) {
+ vm.error_messages = error_data.data.error_messages;
+ }
+ else {
+ vm.error_messages = ['There was a problem processing your request'];
+ }
+ });
+ };
+ vm.cancel = function () {
+ $uibModalInstance.dismiss('cancel');
+ };
+ vm.fetchInfo();
}
;// # Copyright (C) 2010-2016 RhodeCode GmbH
@@ -12357,8 +12334,7 @@ angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun
$stateProvider.state('logs', {
url: '/ui/logs?resource',
- templateUrl: 'templates/logs.html',
- controller: 'LogsController as logs'
+ component: 'logsBrowserView'
});
$stateProvider.state('front_dashboard', {
diff --git a/frontend/src/app.js b/frontend/src/app.js
index 7c8f48f..b851f71 100644
--- a/frontend/src/app.js
+++ b/frontend/src/app.js
@@ -43,7 +43,8 @@ angular.module('appenlight.components', [
'appenlight.components.channelstream',
'appenlight.components.appenlightApp',
'appenlight.components.appenlightHeader',
- 'appenlight.components.indexDashboardView'
+ 'appenlight.components.indexDashboardView',
+ 'appenlight.components.logsBrowserView',
]);
angular.module('appenlight.directives', [
'appenlight.directives.c3chart',
diff --git a/frontend/src/templates/logs.html b/frontend/src/components/views/logs-browser/logs-browser.html
similarity index 64%
rename from frontend/src/templates/logs.html
rename to frontend/src/components/views/logs-browser/logs-browser.html
index 1a5acc3..41f6b6f 100644
--- a/frontend/src/templates/logs.html
+++ b/frontend/src/components/views/logs-browser/logs-browser.html
@@ -1,14 +1,14 @@
-
+
-
+
Search params:
-
+
{{tag.type}}
- {{ tag.type == 'resource' ? logs.applications[tag.value].resource_name : tag.value }}
+ {{ tag.type == 'resource' ? $ctrl.applications[tag.value].resource_name : tag.value }}
-
+
@@ -20,15 +20,15 @@
-
+
@@ -37,15 +37,15 @@
-
@@ -61,22 +61,22 @@
-
+
-
+
{{log.resource_name}}
|
-
+
level: {{log.log_level}}
-
+
namespace: {{log.namespace}}
-
+
{{tag}}: {{value}}
{{log.message}}
|
-
+
|
@@ -88,8 +88,8 @@
-
diff --git a/frontend/src/controllers/logs.js b/frontend/src/components/views/logs-browser/logs-browser.js
similarity index 90%
rename from frontend/src/controllers/logs.js
rename to frontend/src/components/views/logs-browser/logs-browser.js
index 4b50ef9..e0c24d4 100644
--- a/frontend/src/controllers/logs.js
+++ b/frontend/src/components/views/logs-browser/logs-browser.js
@@ -17,11 +17,15 @@
// # services, and proprietary license terms, please see
// # https://rhodecode.com/licenses/
-angular.module('appenlight.controllers').controller('LogsController', LogsController);
+angular.module('appenlight.components.logsBrowserView', [])
+ .component('logsBrowserView', {
+ templateUrl: 'components/views/logs-browser/logs-browser.html',
+ controller: LogsBrowserController
+ });
-LogsController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
+LogsBrowserController.$inject = ['$location', 'stateHolder', 'typeAheadTagHelper', 'logsNoIdResource', 'sectionViewResource'];
-function LogsController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
+function LogsBrowserController($location, stateHolder, typeAheadTagHelper, logsNoIdResource, sectionViewResource) {
var vm = this;
vm.logEventsChartConfig = {
data: {
diff --git a/frontend/src/controllers/overview.js b/frontend/src/controllers/overview.js
deleted file mode 100644
index e3bbe6b..0000000
--- a/frontend/src/controllers/overview.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// # Copyright (C) 2010-2016 RhodeCode GmbH
-// #
-// # This program is free software: you can redistribute it and/or modify
-// # it under the terms of the GNU Affero General Public License, version 3
-// # (only), as published by the Free Software Foundation.
-// #
-// # This program is distributed in the hope that it will be useful,
-// # but WITHOUT ANY WARRANTY; without even the implied warranty of
-// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// # GNU General Public License for more details.
-// #
-// # You should have received a copy of the GNU Affero General Public License
-// # along with this program. If not, see .
-// #
-// # This program is dual-licensed. If you wish to learn more about the
-// # AppEnlight Enterprise Edition, including its added features, Support
-// # services, and proprietary license terms, please see
-// # https://rhodecode.com/licenses/
-
-angular.module('appenlight.controllers')
- .controller('OverviewCtrl', OverviewCtrl);
-
-OverviewCtrl.$inject = [];
-
-function OverviewCtrl() {
-
-}
diff --git a/frontend/src/routes.js b/frontend/src/routes.js
index bf7cd5a..f480cb9 100644
--- a/frontend/src/routes.js
+++ b/frontend/src/routes.js
@@ -23,8 +23,7 @@ angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun
$stateProvider.state('logs', {
url: '/ui/logs?resource',
- templateUrl: 'templates/logs.html',
- controller: 'LogsController as logs'
+ component: 'logsBrowserView'
});
$stateProvider.state('front_dashboard', {