oasi-logs
v2.0.11
Published
oasi-logs UMD lib
Downloads
12
Readme
На примере ГПЗУ
let module = angular.module('oasi-gpzu-logs', ['ui.router']);
//server writer
module.run([function () {
ServerLogger.init('gpzu');
}]);
//js errors
module.config(globalExceptionHandlerConfig);
//http layer interceptors
module.factory('httpErrorInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new HttpErrorInterceptor($q);
}]);
module.factory('loginInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
два похожих запроса - поиск по АД и авторизация
return new LoginInterceptor(new UrlPatternMatcher('api/v1/user', ['users'], null));
}]);
module.factory('authenticationInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new LogoutInterceptor(new UrlPatternMatcher('api/v1/logout', null, null));
}]);
module.factory('activityTaskInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new ActivityTaskInterceptor($stateParams, new UrlPatternMatcher('activiti-rest/service/runtime/tasks', null, null));
}]);
module.factory('documentsSearchInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new DocumentsSearchInterceptor(new UrlPatternMatcher('api/v1/datatable/', null, ['allMyTasks']));
}]);
module.factory('documentUpdateInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new DocumentUpdateInterceptor($stateParams, new UrlPatternMatcher('api/v1/documents', null, null));
}]);
module.factory('fileUploadInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new FileUploadInterceptor($stateParams, new UrlPatternMatcher('api/v1/files',
['createFolder', 'changeFolderInfo', 'sign', 'hashhex', 'folderinfo', 'delete', 'folderContent', 'fileinfo', 'verify'],
null));
}]);
module.factory('fileDownloadInterceptor', ['$stateParams', '$q', function ($stateParams, $q) {
return new FileDownloadInterceptor($stateParams, new UrlPatternMatcher('api/v1/files',
['createFolder', 'changeFolderInfo', 'sign', 'hashhex', 'folderinfo', 'delete', 'folderContent', 'fileinfo', 'verify'],
null));
}]);
module.config(['$httpProvider', function ($httpProvider: ng.IHttpProvider) {
$httpProvider.interceptors.push('httpErrorInterceptor');
$httpProvider.interceptors.push('loginInterceptor');
$httpProvider.interceptors.push('authenticationInterceptor');
$httpProvider.interceptors.push('activityTaskInterceptor');
$httpProvider.interceptors.push('documentsSearchInterceptor');
$httpProvider.interceptors.push('documentUpdateInterceptor');
$httpProvider.interceptors.push('fileUploadInterceptor');
$httpProvider.interceptors.push('fileDownloadInterceptor');
}]);
//app transitions monitor
module.run(['$stateParams', '$state', '$rootScope', function ($stateParams, $state, $rootScope) {
let monitor = new RoutesTransitionMonitor($stateParams, $rootScope);
//showcases
monitor.statesMap.push(['app.gpzu.allMyTasks', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Витрина Мои Задачи')))
}]);
monitor.statesMap.push(['app.gpzu.requests', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Витрина Все Заявления')));
}]);
monitor.statesMap.push(['app.gpzu.myGpzu', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Витрина Мои ГПЗУ')));
}]);
monitor.statesMap.push(['app.gpzu.allGpzu', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Витрина Все ГПЗУ')));
}]);
//card
monitor.statesMap.push(['app.gpzu.request', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Карточка Заявления', $stateParams['requestId'])));
}]);
monitor.statesMap.push(['app.gpzu.card.main.view', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Карточка ГПЗУ', $stateParams['requestId'])));
}]);
monitor.statesMap.push(['app.gpzu.card.main.edit', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('Карточка ГПЗУ - Редактирование', $stateParams['requestId'])));
}]);
monitor.statesMap.push(['app.gpzu.card.json', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_FORM, new OpenFormMessage('JSON Editor', $stateParams['requestId'])));
}]);
//tasks
monitor.statesMap.push(['app.gpzu.task', ($stateParams) => {
serverLog(new Action(ActionType.OPEN_TASK, new OpenTaskMessage($stateParams['id'], $stateParams['taskId'], $stateParams['formKey'])))
}]);
monitor.start();
}]);