Merge remote-tracking branch 'origin/master' into develop

# Conflicts:
#	backend/pom.xml
#	backend/src/main/java/ru/micord/ervu/controller/ExtractController.java
#	backend/src/main/java/ru/micord/ervu/kafka/service/impl/BaseReplyingKafkaService.java
#	backend/src/main/java/ru/micord/ervu/security/esia/service/EsiaAuthService.java
#	config/standalone/dev/standalone.xml
#	distribution/pom.xml
#	frontend/pom.xml
#	pom.xml
#	resources/pom.xml
This commit is contained in:
gulnaz 2025-02-24 17:28:43 +03:00
commit 46282d6283
40 changed files with 1384 additions and 99 deletions

View 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);
}
}
}

View file

@ -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) => {

View file

@ -0,0 +1,5 @@
export enum LinkEventTypeEnum {
NAVIGATION_TO_SOURCE = "Переход на другие источники",
DOWNLOAD_TEMPLATE = "Скачивание шаблона",
DOWNLOAD_EXAMPLE = "Скачивание примера заполнения формы"
}

View file

@ -35,7 +35,7 @@ export class InMemoryStaticGrid extends GridV2 {
protected initGrid() {
super.initGrid();
this.subscription = this.injector.get(ErvuDataService).message.subscribe(value => {
this.rowData = value[this.dataList];
this.rowData = value ? value[this.dataList] : null;
this.initDeferred.promise.then(() => {
this.refreshData();
});

View 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 = "Открытие страницы";
}

View file

@ -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,

View file

@ -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);
}
}
})
}