Merge remote-tracking branch 'origin/hotfix/1.9.8' into feature/SUPPORT-8897_fix_handler
This commit is contained in:
commit
cb6b472268
49 changed files with 1425 additions and 121 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ru.micord.ervu.lkrp</groupId>
|
||||
<artifactId>fl</artifactId>
|
||||
<version>1.9.5-SNAPSHOT</version>
|
||||
<version>1.9.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.micord.ervu.lkrp.fl</groupId>
|
||||
|
|
|
|||
42
frontend/src/ts/ervu/LinkClickHandler.ts
Normal file
42
frontend/src/ts/ervu/LinkClickHandler.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import {AnalyticalScope, Behavior, Control, NotNull} from "@webbpm/base-package";
|
||||
import {ElementRef} from "@angular/core";
|
||||
import {AuditService} from "./service/AuditService";
|
||||
import {LinkEventTypeEnum} from "./component/enum/LinkEventTypeEnum";
|
||||
|
||||
@AnalyticalScope(Control)
|
||||
export class LinkClickHandler extends Behavior {
|
||||
@NotNull()
|
||||
public eventType: LinkEventTypeEnum;
|
||||
private control: Control;
|
||||
private auditService: AuditService;
|
||||
private el: ElementRef;
|
||||
|
||||
initialize() {
|
||||
this.control = this.getScript(Control);
|
||||
this.el = this.control.getEl();
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
bindEvents() {
|
||||
super.bindEvents();
|
||||
if (this.el) {
|
||||
this.el.nativeElement.addEventListener('click',
|
||||
(event: MouseEvent) => this.onClickFunction(event));
|
||||
}
|
||||
}
|
||||
|
||||
unbindEvents() {
|
||||
super.unbindEvents()
|
||||
if (this.el) {
|
||||
this.el.nativeElement.removeEventListener('click',
|
||||
(event: MouseEvent) => this.onClickFunction(event));
|
||||
}
|
||||
}
|
||||
|
||||
private onClickFunction(event: MouseEvent) {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === 'A') {
|
||||
this.auditService.logActionAudit(this.eventType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,8 +29,12 @@ export class ExtractLoadService extends Behavior {
|
|||
this.errorEvent.subscribe(() => console.log("error event occurred", this.errorEvent));
|
||||
this.onClickFunction = () => {
|
||||
console.log("click event occurred");
|
||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
this.httpClient.get('extract/' + this.formatRegistry, {
|
||||
responseType: 'blob',
|
||||
headers: {
|
||||
"Client-Time-Zone": timeZone,
|
||||
},
|
||||
observe: 'response'
|
||||
}).toPromise()
|
||||
.then((response) => {
|
||||
|
|
|
|||
5
frontend/src/ts/ervu/component/enum/LinkEventTypeEnum.ts
Normal file
5
frontend/src/ts/ervu/component/enum/LinkEventTypeEnum.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export enum LinkEventTypeEnum {
|
||||
NAVIGATION_TO_SOURCE = "Переход на другие источники",
|
||||
DOWNLOAD_TEMPLATE = "Скачивание шаблона",
|
||||
DOWNLOAD_EXAMPLE = "Скачивание примера заполнения формы"
|
||||
}
|
||||
|
|
@ -36,6 +36,9 @@ export class InMemoryStaticGrid extends GridV2 {
|
|||
super.initGrid();
|
||||
this.subscription = this.injector.get(ErvuDataService).message.subscribe(value => {
|
||||
this.rowData = value ? value[this.dataList] : null;
|
||||
this.initDeferred.promise.then(() => {
|
||||
this.refreshData();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
43
frontend/src/ts/ervu/service/AuditService.ts
Normal file
43
frontend/src/ts/ervu/service/AuditService.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import {Injectable} from "@angular/core";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuditService {
|
||||
|
||||
constructor(private httpClient: HttpClient, private router: Router) {
|
||||
}
|
||||
|
||||
public logActionAudit(eventType: string, fileName?: string): void {
|
||||
const currentRoute = this.router.url;
|
||||
const sourceUrl = window.location.href;
|
||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
const data: AuditAction = {
|
||||
eventType: eventType,
|
||||
sourceUrl: sourceUrl,
|
||||
route: currentRoute,
|
||||
fileName: fileName
|
||||
};
|
||||
|
||||
this.httpClient.post("audit/action", data, {
|
||||
headers: {
|
||||
"Client-Time-Zone": timeZone,
|
||||
}
|
||||
}).toPromise();
|
||||
}
|
||||
}
|
||||
|
||||
export interface AuditAction {
|
||||
eventType: string;
|
||||
sourceUrl: string;
|
||||
route: string;
|
||||
fileName?: string;
|
||||
}
|
||||
|
||||
export class AuditConstants {
|
||||
public static readonly OPEN_PAGE_EVENT = "Открытие страницы";
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ import {LogOutComponent} from "./component/logout.component";
|
|||
import {LoadForm} from "../../ervu/component/container/LoadForm";
|
||||
import {InMemoryStaticGrid} from "../../ervu/component/grid/InMemoryStaticGrid";
|
||||
import {AuthenticationService} from "../security/authentication.service";
|
||||
import {AuditService} from "../../ervu/service/AuditService";
|
||||
import {HomeLandingComponent} from "./component/home-landing.component";
|
||||
|
||||
registerLocaleData(localeRu);
|
||||
|
|
@ -64,7 +65,7 @@ export function checkAuthentication(authService: AuthenticationService): () => P
|
|||
DIRECTIVES
|
||||
],
|
||||
providers: [
|
||||
AuthenticationService,
|
||||
AuthenticationService, AuditService,
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: checkAuthentication,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
Router
|
||||
} from "@angular/router";
|
||||
import {ProgressIndicationService} from "@webbpm/base-package";
|
||||
import {AuditConstants, AuditService} from "../../../ervu/service/AuditService";
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
|
|
@ -21,7 +22,8 @@ export class WebbpmComponent {
|
|||
|
||||
constructor(private router: Router,
|
||||
private progressIndicationService: ProgressIndicationService,
|
||||
private cd: ChangeDetectorRef) {
|
||||
private cd: ChangeDetectorRef,
|
||||
private auditService: AuditService) {
|
||||
router.events.subscribe((event: Event) => {
|
||||
if (event instanceof NavigationStart) {
|
||||
progressIndicationService.showProgressBar();
|
||||
|
|
@ -29,9 +31,15 @@ export class WebbpmComponent {
|
|||
this.cd.markForCheck();
|
||||
}
|
||||
else if (event instanceof NavigationEnd
|
||||
|| event instanceof NavigationError
|
||||
|| event instanceof NavigationCancel) {
|
||||
|| event instanceof NavigationError
|
||||
|| event instanceof NavigationCancel) {
|
||||
progressIndicationService.hideProgressBar();
|
||||
|
||||
if (event instanceof NavigationEnd
|
||||
&& event.url != '/home'
|
||||
&& event.url != '/access-denied') {
|
||||
this.auditService.logActionAudit(AuditConstants.OPEN_PAGE_EVENT);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue