Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,22 @@
|
||||
<div class="portal-repo-bank-selector fill-height" ng-if="tab.active" ng-cloak layout="column" flex="100" ng-controller="LogBankCtrl">
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex="100">
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">System Logs</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="purge()" has-permission="{{Constants.Permissions.PURGE_LOGS}}">
|
||||
<md-icon >delete_sweep</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Purge Logs</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="toggleFiltering()">
|
||||
<md-icon >filter</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Filter Logs</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="logGrid" ui-grid-pagination ui-grid-selection ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns style="height:95%"></div>
|
||||
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,126 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.logBank', ['ui.router'])
|
||||
.controller('LogBankCtrl', LogBankCtrlController);
|
||||
|
||||
function LogBankCtrlController($scope, cache, appLogStores, uiGridConstants, $timeout, $mdDialog, Constants) {
|
||||
|
||||
$scope.logs = [];
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([new appLogStores.Logs()]).then(function(){
|
||||
$scope.logs = $scope.mCache.logs.data.values;
|
||||
for (var i = 0; i < $scope.logs.length; i++) {
|
||||
$scope.logs[i].formattedTime = moment($scope.logs[i].timestamp).format('MM/DD/Y HH:mm:ss');
|
||||
}
|
||||
});
|
||||
|
||||
$scope.logGrid = {
|
||||
data: 'logs',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterCsvFilename: 'RepoLogs.csv',
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: true,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
gridApi.selection.setModifierKeysToMultiSelect(true);
|
||||
$scope.logGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'loggedBy', displayName: 'Logged By', width: '*'},
|
||||
{field: 'eventName', displayName: 'Event Type'},
|
||||
{field: 'event', displayName: 'Event', width: '*****'},
|
||||
{field: 'severity', displayName: 'Severity'},
|
||||
{field: 'ipAddress', displayName: 'IP Address', width: '*' },
|
||||
{field: 'formattedTime', displayName: 'Timestamp', width: '*' },
|
||||
],
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.logGridApi.enableFiltering = !$scope.logGridApi.enableFiltering;
|
||||
$scope.logGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
var originatorEv;
|
||||
$scope.openMenu = function($mdOpenMenu, ev) {
|
||||
originatorEv = ev;
|
||||
$mdOpenMenu(ev);
|
||||
};
|
||||
|
||||
$scope.purge = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/templates/purge-logs.tmpl.html',
|
||||
multipe: true,
|
||||
skipHide: true,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
'title': 'Purge Logs',
|
||||
'message': 'Select the date to purge logs before'
|
||||
}
|
||||
},
|
||||
controller: ['$scope', 'modalInstance', '$mdDialog', 'portalUtils', 'appLogProvider',
|
||||
function($scope, modalInstance, $mdDialog, portalUtils, appLogProvider) {
|
||||
$scope.title = modalInstance.title;
|
||||
$scope.message = modalInstance.message;
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.model = {};
|
||||
|
||||
$scope.confirm = function() {
|
||||
$scope.error = '';
|
||||
if ($scope.model.purgeStartDate === undefined) {
|
||||
$scope.error = 'Purge start date is required';
|
||||
return;
|
||||
}
|
||||
if ($scope.model.purgeEndDate === undefined) {
|
||||
$scope.error = 'Purge end date is required';
|
||||
return;
|
||||
}
|
||||
portalUtils.confirmBox('purgeConfirm', 'Confirm Purge',
|
||||
['Are you sure you want to purge files between',
|
||||
moment($scope.model.purgeStartDate).format('MMMM Do, Y')
|
||||
+ ' and ' + moment($scope.model.purgeEndDate).format('MMMM Do, Y')], false,
|
||||
function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.loadingBlock = true;
|
||||
appLogProvider.purgeLogs($scope.model).then(function(value) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('Successfully purged ' + value + ' logs', ['top', 'left'], 2000);
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('Unable to purge logs: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
}]
|
||||
}).then(function() {
|
||||
new appLogStores.Logs().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
} //end LogBankCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user