@mediusinc/mng-commons-audit 3.0.0-rc.0 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -4
- package/assets/i18n/en.json +23 -21
- package/assets/i18n/sl.json +25 -14
- package/esm2022/lib/api/models/guiPropertyModel.mjs +6 -1
- package/esm2022/lib/api/models/index.mjs +1 -4
- package/esm2022/lib/api/services/audit-revisions-api.service.mjs +38 -21
- package/esm2022/lib/api/services/audit.service.mjs +45 -0
- package/esm2022/lib/audit.routes.mjs +33 -10
- package/esm2022/lib/components/entity-changes-field/entity-changes-field.component.mjs +49 -35
- package/esm2022/lib/components/pages/audit/audit-page.component.mjs +12 -0
- package/esm2022/lib/components/pages/entity-revisions/audit-entity-revisions-page.component.mjs +90 -32
- package/esm2022/lib/components/pages/revisions/audit-revisions-page.component.mjs +41 -45
- package/esm2022/lib/models/config.model.mjs +2 -0
- package/esm2022/lib/models/new-filter-match-type.model.mjs +19 -0
- package/esm2022/lib/models/revEntityWithId.model.mjs +9 -0
- package/esm2022/lib/service/module-config.token.mjs +3 -0
- package/esm2022/lib/utils/audit.util.mjs +300 -0
- package/fesm2022/mediusinc-mng-commons-audit.mjs +615 -306
- package/fesm2022/mediusinc-mng-commons-audit.mjs.map +1 -1
- package/lib/api/models/guiPropertyModel.d.ts +1 -0
- package/lib/api/models/index.d.ts +0 -3
- package/lib/api/services/audit-revisions-api.service.d.ts +16 -10
- package/lib/api/services/audit.service.d.ts +20 -0
- package/lib/audit.routes.d.ts +3 -2
- package/lib/components/entity-changes-field/entity-changes-field.component.d.ts +9 -6
- package/lib/components/pages/audit/audit-page.component.d.ts +5 -0
- package/lib/components/pages/entity-revisions/audit-entity-revisions-page.component.d.ts +21 -12
- package/lib/components/pages/revisions/audit-revisions-page.component.d.ts +8 -5
- package/lib/models/config.model.d.ts +4 -0
- package/lib/models/new-filter-match-type.model.d.ts +17 -0
- package/lib/models/revEntityWithId.model.d.ts +4 -0
- package/lib/service/module-config.token.d.ts +3 -0
- package/lib/utils/audit.util.d.ts +9 -0
- package/package.json +2 -3
- package/esm2022/lib/api/models/revEntityChangeDto.mjs +0 -52
- package/esm2022/lib/api/models/revEntityDto.mjs +0 -42
- package/esm2022/lib/api/models/revisionTypeEnumDto.mjs +0 -20
- package/esm2022/lib/api/services/audit-entity-revisions-api.service.mjs +0 -47
- package/esm2022/lib/components/pages/entity-revisions/entity-dropdown-page.component.mjs +0 -32
- package/lib/api/models/revEntityChangeDto.d.ts +0 -25
- package/lib/api/models/revEntityDto.d.ts +0 -20
- package/lib/api/models/revisionTypeEnumDto.d.ts +0 -5
- package/lib/api/services/audit-entity-revisions-api.service.d.ts +0 -14
- package/lib/components/pages/entity-revisions/entity-dropdown-page.component.d.ts +0 -12
|
@@ -1,118 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeName, ObjectSerializer, MediusFilterMatchType, AMngBaseApiService, MngConfigurationService, AMngTableviewRouteComponent, LookupDataProvider, TableviewDescriptor, TableFilterDisplayEnum, TableviewDataProvider, MediusQueryResult, ActionEditorDescriptor, ActionPositionEnum, ActionDataProviderUtil, TableviewActionDefaultCategories, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, MngDropdownComponent, MngTableviewRouteComponent, AMngFormlyCustomFieldComponent, TableDescriptor, TablePaginationModeEnum, MngTableComponent, EditorDescriptor, TableviewEditorTypeEnum, MngTableviewComponent, RoutesBuilder, RouteBuilder, TableviewRouteBuilder } from '@mediusinc/mng-commons';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Injectable, Component, ChangeDetectionStrategy } from '@angular/core';
|
|
4
|
-
import { map
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import * as i2 from '@angular/forms';
|
|
8
|
-
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { InjectionToken, inject, Injectable, Component, signal, Input, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { __decorate } from 'tslib';
|
|
6
|
+
import { shareReplay, switchMap, BehaviorSubject } from 'rxjs';
|
|
9
7
|
import * as i1 from '@angular/router';
|
|
10
8
|
import { RouterOutlet } from '@angular/router';
|
|
11
|
-
import { NgIf, AsyncPipe,
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
super({}, {});
|
|
18
|
-
this.configService = inject(MngConfigurationService);
|
|
19
|
-
}
|
|
20
|
-
getModels() {
|
|
21
|
-
const url = this.getUrl('/model');
|
|
22
|
-
return this.http.get(url);
|
|
23
|
-
}
|
|
24
|
-
getAllRevisionsForEntity(revisionEntity, queryParamBody, params, locale) {
|
|
25
|
-
const url = this.getUrl(revisionEntity, this.getGetAllPostPath());
|
|
26
|
-
if (params && locale) {
|
|
27
|
-
params = params.set('lang', locale);
|
|
28
|
-
}
|
|
29
|
-
else if (locale) {
|
|
30
|
-
params = new HttpParams().set('lang', locale);
|
|
31
|
-
}
|
|
32
|
-
return this.http
|
|
33
|
-
.post(url, queryParamBody ? this.serializeQueryParam(queryParamBody) : undefined, {
|
|
34
|
-
withCredentials: true,
|
|
35
|
-
observe: 'body',
|
|
36
|
-
reportProgress: false,
|
|
37
|
-
params: params
|
|
38
|
-
})
|
|
39
|
-
.pipe(map(res => this.deserializeQueryResult(res, this.queryResultType)));
|
|
40
|
-
}
|
|
41
|
-
getServiceBasePath() {
|
|
42
|
-
return 'revision/entity';
|
|
43
|
-
}
|
|
44
|
-
getBasePath() {
|
|
45
|
-
return this.configService.getConfigValue('coreBasePath');
|
|
46
|
-
}
|
|
47
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
48
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsApiService, providedIn: 'root' }); }
|
|
49
|
-
}
|
|
50
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsApiService, decorators: [{
|
|
51
|
-
type: Injectable,
|
|
52
|
-
args: [{
|
|
53
|
-
providedIn: 'root'
|
|
54
|
-
}]
|
|
55
|
-
}], ctorParameters: function () { return []; } });
|
|
56
|
-
|
|
57
|
-
class EntityDropdownPageComponent {
|
|
58
|
-
constructor(router, route) {
|
|
59
|
-
this.router = router;
|
|
60
|
-
this.route = route;
|
|
61
|
-
// this.revisionEntitiesLookupProvider = new LookupDataProvider<string, MngAuditEntityRevisionsApiService>(
|
|
62
|
-
// {} as ClassType<string>,
|
|
63
|
-
// MngAuditEntityRevisionsApiService
|
|
64
|
-
// ).withLookup((qp, service) => (service as MngAuditEntityRevisionsApiService).getModels());
|
|
65
|
-
}
|
|
66
|
-
onRevisionEntityChange() {
|
|
67
|
-
if (this.selectedRevisionEntity) {
|
|
68
|
-
this.router.navigate([this.selectedRevisionEntity], { relativeTo: this.route });
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.router.navigate(['/audit/entity-revisions']);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityDropdownPageComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
75
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: EntityDropdownPageComponent, isStandalone: true, selector: "mng-audit-entity-dropdown-component", ngImport: i0, template: "<div class=\"card\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n</div>\n<router-outlet></router-outlet>\n", dependencies: [{ kind: "component", type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsLabelTranslate", "itemsValueProperty", "itemsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur"], outputs: ["valueChange"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
76
|
-
}
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityDropdownPageComponent, decorators: [{
|
|
78
|
-
type: Component,
|
|
79
|
-
args: [{ standalone: true, selector: 'mng-audit-entity-dropdown-component', imports: [MngDropdownComponent, RouterOutlet, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n</div>\n<router-outlet></router-outlet>\n" }]
|
|
80
|
-
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }]; } });
|
|
81
|
-
|
|
82
|
-
class AuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
83
|
-
constructor(dropdownPage, mngAuditEntityRevisionsApiService) {
|
|
84
|
-
super();
|
|
85
|
-
this.dropdownPage = dropdownPage;
|
|
86
|
-
this.mngAuditEntityRevisionsApiService = mngAuditEntityRevisionsApiService;
|
|
87
|
-
this.dropdownPage.selectedRevisionEntity = this.route.snapshot.params['entityClass'];
|
|
88
|
-
}
|
|
89
|
-
createTableviewDataProvider() {
|
|
90
|
-
return new DynamicTableviewDataProvider().withGetAll(qp => this.mngAuditEntityRevisionsApiService.getAllRevisionsForEntity(this.dropdownPage.selectedRevisionEntity, qp));
|
|
91
|
-
}
|
|
92
|
-
createTableviewDescriptor() {
|
|
93
|
-
const descriptor = new TableviewDynamicDescriptor('rev', 'rev', this.dropdownPage.selectedRevisionEntity);
|
|
94
|
-
descriptor.table.withDefaultSort('rev').withColumnsExcluded(['revDate']).withPaginationMode(TablePaginationModeEnum.Pagination);
|
|
95
|
-
return descriptor;
|
|
96
|
-
}
|
|
97
|
-
createActionDescriptors() {
|
|
98
|
-
return [
|
|
99
|
-
this.createActionDescriptorForDetails()
|
|
100
|
-
.withFetchFunction(ctx => {
|
|
101
|
-
const queryParamBuilder = ctx.parameters.queryParam ? MediusQueryParamBuilder.createFromExisting(ctx.parameters.queryParam) : MediusQueryParamBuilder.create();
|
|
102
|
-
queryParamBuilder.withFilter('rev', ctx.parameters.itemId, ctx.parameters.itemId, MediusFilterMatchType.Equals);
|
|
103
|
-
ctx.parameters.withQueryParam(queryParamBuilder.build());
|
|
104
|
-
return ActionDataProviderUtil.runGetAllOrFail(ctx).pipe(map$1(res => (res.pageData ? res.pageData[0] : {})));
|
|
105
|
-
})
|
|
106
|
-
.withEditorTitle('entityRevisionDetails.title', { revEntity: this.dropdownPage.selectedRevisionEntity })
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: AuditEntityRevisionsPageComponent, deps: [{ token: EntityDropdownPageComponent }, { token: MngAuditEntityRevisionsApiService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
110
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: AuditEntityRevisionsPageComponent, isStandalone: true, selector: "mng-audit-entity-revisions-page", usesInheritance: true, ngImport: i0, template: "<mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n", dependencies: [{ kind: "component", type: MngTableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }] }); }
|
|
111
|
-
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: AuditEntityRevisionsPageComponent, decorators: [{
|
|
113
|
-
type: Component,
|
|
114
|
-
args: [{ standalone: true, selector: 'mng-audit-entity-revisions-page', imports: [MngTableviewComponent], template: "<mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n" }]
|
|
115
|
-
}], ctorParameters: function () { return [{ type: EntityDropdownPageComponent }, { type: MngAuditEntityRevisionsApiService }]; } });
|
|
9
|
+
import { NgIf, AsyncPipe, NgForOf, JsonPipe } from '@angular/common';
|
|
10
|
+
import * as i2 from '@angular/forms';
|
|
11
|
+
import { FormsModule } from '@angular/forms';
|
|
12
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
13
|
+
import * as i3 from '@ngx-translate/core';
|
|
14
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
116
15
|
|
|
117
16
|
var EntityChange_1;
|
|
118
17
|
let EntityChange = class EntityChange {
|
|
@@ -181,6 +80,11 @@ let GuiPropertyModel = class GuiPropertyModel {
|
|
|
181
80
|
baseName: 'resolvedPropertyName',
|
|
182
81
|
type: 'string'
|
|
183
82
|
},
|
|
83
|
+
{
|
|
84
|
+
name: 'enumClassSimpleName',
|
|
85
|
+
baseName: 'enumClassSimpleName',
|
|
86
|
+
type: 'string'
|
|
87
|
+
},
|
|
184
88
|
{
|
|
185
89
|
name: 'possibleEnumValues',
|
|
186
90
|
baseName: 'possibleEnumValues',
|
|
@@ -268,74 +172,6 @@ GuiRelationModel = GuiRelationModel_1 = __decorate([
|
|
|
268
172
|
], GuiRelationModel);
|
|
269
173
|
ObjectSerializer.get().registerType(GuiRelationModel);
|
|
270
174
|
|
|
271
|
-
var RevEntityChangeDto_1;
|
|
272
|
-
let RevEntityChangeDto = class RevEntityChangeDto {
|
|
273
|
-
static { RevEntityChangeDto_1 = this; }
|
|
274
|
-
static { this.attributeTypeMap = [
|
|
275
|
-
{
|
|
276
|
-
name: 'rev',
|
|
277
|
-
baseName: 'rev',
|
|
278
|
-
type: 'number'
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
name: 'revDate',
|
|
282
|
-
baseName: 'revDate',
|
|
283
|
-
type: 'Date'
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: 'revUsername',
|
|
287
|
-
baseName: 'revUsername',
|
|
288
|
-
type: 'string'
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: 'revType',
|
|
292
|
-
baseName: 'revType',
|
|
293
|
-
type: 'RevisionTypeEnumDto'
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: 'state',
|
|
297
|
-
baseName: 'state',
|
|
298
|
-
type: '{ [key: string]: any; }'
|
|
299
|
-
}
|
|
300
|
-
]; }
|
|
301
|
-
static getAttributeTypeMap() {
|
|
302
|
-
return RevEntityChangeDto_1.attributeTypeMap;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
RevEntityChangeDto = RevEntityChangeDto_1 = __decorate([
|
|
306
|
-
TypeName('RevEntityChangeDto')
|
|
307
|
-
], RevEntityChangeDto);
|
|
308
|
-
ObjectSerializer.get().registerType(RevEntityChangeDto);
|
|
309
|
-
|
|
310
|
-
var RevEntityDto_1;
|
|
311
|
-
let RevEntityDto = class RevEntityDto {
|
|
312
|
-
static { RevEntityDto_1 = this; }
|
|
313
|
-
static { this.attributeTypeMap = [
|
|
314
|
-
{
|
|
315
|
-
name: 'rev',
|
|
316
|
-
baseName: 'rev',
|
|
317
|
-
type: 'number'
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: 'revDate',
|
|
321
|
-
baseName: 'revDate',
|
|
322
|
-
type: 'Date'
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
name: 'revUsername',
|
|
326
|
-
baseName: 'revUsername',
|
|
327
|
-
type: 'string'
|
|
328
|
-
}
|
|
329
|
-
]; }
|
|
330
|
-
static getAttributeTypeMap() {
|
|
331
|
-
return RevEntityDto_1.attributeTypeMap;
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
RevEntityDto = RevEntityDto_1 = __decorate([
|
|
335
|
-
TypeName('RevEntityDto')
|
|
336
|
-
], RevEntityDto);
|
|
337
|
-
ObjectSerializer.get().registerType(RevEntityDto);
|
|
338
|
-
|
|
339
175
|
var RevEntityWithChangesDto_1;
|
|
340
176
|
let RevEntityWithChangesDto = class RevEntityWithChangesDto {
|
|
341
177
|
static { RevEntityWithChangesDto_1 = this; }
|
|
@@ -413,128 +249,502 @@ var RevisionType;
|
|
|
413
249
|
})(RevisionType || (RevisionType = {}));
|
|
414
250
|
ObjectSerializer.get().registerEnum(RevisionType, 'RevisionType');
|
|
415
251
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
252
|
+
let RevEntityWithId = class RevEntityWithId extends RevEntityWithStateDto {
|
|
253
|
+
};
|
|
254
|
+
RevEntityWithId = __decorate([
|
|
255
|
+
TypeName('RevEntityWithId')
|
|
256
|
+
], RevEntityWithId);
|
|
257
|
+
|
|
258
|
+
var NewMediusFilterMatchType;
|
|
259
|
+
(function (NewMediusFilterMatchType) {
|
|
260
|
+
NewMediusFilterMatchType["Equals"] = "eq";
|
|
261
|
+
NewMediusFilterMatchType["NotEquals"] = "ne";
|
|
262
|
+
NewMediusFilterMatchType["Between"] = "bt";
|
|
263
|
+
NewMediusFilterMatchType["Contains"] = "cn";
|
|
264
|
+
NewMediusFilterMatchType["NotContains"] = "nc";
|
|
265
|
+
NewMediusFilterMatchType["StartsWith"] = "sw";
|
|
266
|
+
NewMediusFilterMatchType["EndsWith"] = "ew";
|
|
267
|
+
NewMediusFilterMatchType["In"] = "in";
|
|
268
|
+
NewMediusFilterMatchType["NotIn"] = "ni";
|
|
269
|
+
NewMediusFilterMatchType["LessThan"] = "lt";
|
|
270
|
+
NewMediusFilterMatchType["LessThanOrEqualTo"] = "le";
|
|
271
|
+
NewMediusFilterMatchType["GreaterThan"] = "gt";
|
|
272
|
+
NewMediusFilterMatchType["GreaterThanOrEqualTo"] = "ge";
|
|
273
|
+
NewMediusFilterMatchType["Exists"] = "ex";
|
|
274
|
+
NewMediusFilterMatchType["DoesNotExist"] = "nx";
|
|
275
|
+
})(NewMediusFilterMatchType || (NewMediusFilterMatchType = {}));
|
|
276
|
+
|
|
277
|
+
class AuditUtil {
|
|
278
|
+
static addColumnsFromModel(descriptor, propertyList) {
|
|
279
|
+
for (const property of propertyList) {
|
|
280
|
+
if (property.propertyType === GuiPropertyType.Enum) {
|
|
281
|
+
// TODO is there a nicer way than appending "Dto" at the end of the simple name to match
|
|
282
|
+
descriptor
|
|
283
|
+
.addColumn(property.resolvedPropertyName)
|
|
284
|
+
.withSort()
|
|
285
|
+
.asEnum(ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'))
|
|
286
|
+
.withFilterLookupEnum(property.possibleEnumValues);
|
|
287
|
+
}
|
|
288
|
+
else if (property.propertyType === GuiPropertyType.Number) {
|
|
289
|
+
descriptor.addColumn(property.resolvedPropertyName).withSort().asNumber().withFilter();
|
|
290
|
+
}
|
|
291
|
+
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
292
|
+
descriptor.addColumn(property.resolvedPropertyName).withSort().asBoolean().withFilter();
|
|
293
|
+
}
|
|
294
|
+
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
295
|
+
descriptor.addColumn(property.resolvedPropertyName).withSort().asDate('dd. MMM yyyy').withFilter();
|
|
296
|
+
}
|
|
297
|
+
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
298
|
+
descriptor.addColumn(property.resolvedPropertyName).withSort().asDate('dd. MMM yyyy HH:mm').withFilter();
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
// string / wildcard
|
|
302
|
+
descriptor.addColumn(property.resolvedPropertyName).withSort().withFilter();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return descriptor;
|
|
306
|
+
}
|
|
307
|
+
static addFieldsFromModel(descriptor, revModel) {
|
|
308
|
+
for (const property of revModel.properties) {
|
|
309
|
+
if (property.propertyType === GuiPropertyType.Enum) {
|
|
310
|
+
descriptor
|
|
311
|
+
.addFieldLookupEnum('revEntity.' + property.resolvedPropertyName, ObjectSerializer.get().findEnum(property.enumClassSimpleName), property.possibleEnumValues)
|
|
312
|
+
.withLabel(property.resolvedPropertyName)
|
|
313
|
+
.withDisabled();
|
|
314
|
+
}
|
|
315
|
+
else if (property.propertyType === GuiPropertyType.Number) {
|
|
316
|
+
descriptor
|
|
317
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
318
|
+
.withLabel(property.resolvedPropertyName)
|
|
319
|
+
.asNumber()
|
|
320
|
+
.withDisabled();
|
|
321
|
+
}
|
|
322
|
+
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
323
|
+
descriptor
|
|
324
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
325
|
+
.withLabel(property.resolvedPropertyName)
|
|
326
|
+
.withDisabled();
|
|
327
|
+
}
|
|
328
|
+
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
329
|
+
descriptor
|
|
330
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
331
|
+
.withLabel(property.resolvedPropertyName)
|
|
332
|
+
.asDatePicker('dd. MMM yyyy')
|
|
333
|
+
.withDisabled();
|
|
334
|
+
}
|
|
335
|
+
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
336
|
+
descriptor
|
|
337
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
338
|
+
.withLabel(property.resolvedPropertyName)
|
|
339
|
+
.asDatePicker('dd. MM yy', undefined, undefined, true, false)
|
|
340
|
+
.withDisabled();
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
// string / wildcard
|
|
344
|
+
descriptor
|
|
345
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
346
|
+
.withLabel(property.resolvedPropertyName)
|
|
347
|
+
.withDisabled();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return descriptor;
|
|
351
|
+
}
|
|
352
|
+
static buildDescriptorForEntityRevision(descriptor, revModel, entityModel) {
|
|
353
|
+
descriptor
|
|
354
|
+
.addColumn('revType')
|
|
355
|
+
.withTitle('revType')
|
|
356
|
+
.asEnum(ObjectSerializer.get().findEnum('RevisionType'))
|
|
357
|
+
.withFilterLookupEnum([RevisionType.Add, RevisionType.Mod, RevisionType.Del]);
|
|
358
|
+
descriptor.addFieldLookupEnum('revType', ObjectSerializer.get().findEnum('RevisionType'), [RevisionType.Add, RevisionType.Mod, RevisionType.Del]).withLabel('revType');
|
|
359
|
+
for (const property of revModel.properties) {
|
|
360
|
+
if (property.propertyType === GuiPropertyType.Enum) {
|
|
361
|
+
// TODO is there a nicer way than appending "Dto" at the end of the simple name to match
|
|
362
|
+
descriptor
|
|
363
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
364
|
+
.withTitle(property.resolvedPropertyName)
|
|
365
|
+
.asEnum(ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'))
|
|
366
|
+
.withSort()
|
|
367
|
+
.withFilterLookupEnum(property.possibleEnumValues);
|
|
368
|
+
descriptor
|
|
369
|
+
.addFieldLookupEnum('revEntity.' + property.resolvedPropertyName, ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'), property.possibleEnumValues)
|
|
370
|
+
.withLabel(property.resolvedPropertyName);
|
|
371
|
+
}
|
|
372
|
+
else if (property.propertyType === GuiPropertyType.Number) {
|
|
373
|
+
descriptor
|
|
374
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
375
|
+
.withTitle(property.resolvedPropertyName)
|
|
376
|
+
.asNumber()
|
|
377
|
+
.withSort()
|
|
378
|
+
.withFilter();
|
|
379
|
+
descriptor
|
|
380
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
381
|
+
.withLabel(property.resolvedPropertyName)
|
|
382
|
+
.asNumber();
|
|
383
|
+
}
|
|
384
|
+
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
385
|
+
descriptor
|
|
386
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
387
|
+
.withTitle(property.resolvedPropertyName)
|
|
388
|
+
.asBoolean()
|
|
389
|
+
.withSort()
|
|
390
|
+
.withFilter();
|
|
391
|
+
descriptor.addField('revEntity.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
392
|
+
}
|
|
393
|
+
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
394
|
+
descriptor
|
|
395
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
396
|
+
.withTitle(property.resolvedPropertyName)
|
|
397
|
+
.asDate('dd. MMM yyyy')
|
|
398
|
+
.withSort()
|
|
399
|
+
.withFilter();
|
|
400
|
+
descriptor
|
|
401
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
402
|
+
.withLabel(property.resolvedPropertyName)
|
|
403
|
+
.asDatePicker('dd. MMM yyyy');
|
|
404
|
+
}
|
|
405
|
+
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
406
|
+
descriptor
|
|
407
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
408
|
+
.withTitle(property.resolvedPropertyName)
|
|
409
|
+
.asDate('dd. MMM yyyy HH:mm')
|
|
410
|
+
.withSort()
|
|
411
|
+
.withFilter();
|
|
412
|
+
descriptor
|
|
413
|
+
.addField('revEntity.' + property.resolvedPropertyName)
|
|
414
|
+
.withLabel(property.resolvedPropertyName)
|
|
415
|
+
.asDatePicker('dd. MM yy', undefined, undefined, true, false);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
// string / wildcard
|
|
419
|
+
descriptor
|
|
420
|
+
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
421
|
+
.withTitle(property.resolvedPropertyName)
|
|
422
|
+
.withSort()
|
|
423
|
+
.withFilter();
|
|
424
|
+
descriptor.addField('revEntity.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
for (const property of entityModel.properties) {
|
|
428
|
+
if (property.propertyType === GuiPropertyType.Enum) {
|
|
429
|
+
// TODO is there a nicer way than appending "Dto" at the end of the simple name to match
|
|
430
|
+
descriptor
|
|
431
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
432
|
+
.withTitle(property.resolvedPropertyName)
|
|
433
|
+
.asEnum(ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'))
|
|
434
|
+
.withSort()
|
|
435
|
+
.withFilterLookupEnum(property.possibleEnumValues);
|
|
436
|
+
descriptor
|
|
437
|
+
.addFieldLookupEnum('entityState.' + property.resolvedPropertyName, ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'), property.possibleEnumValues)
|
|
438
|
+
.withLabel(property.resolvedPropertyName);
|
|
439
|
+
}
|
|
440
|
+
else if (property.propertyType === GuiPropertyType.Number) {
|
|
441
|
+
descriptor
|
|
442
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
443
|
+
.withTitle(property.resolvedPropertyName)
|
|
444
|
+
.asNumber()
|
|
445
|
+
.withSort()
|
|
446
|
+
.withFilter();
|
|
447
|
+
descriptor
|
|
448
|
+
.addField('entityState.' + property.resolvedPropertyName)
|
|
449
|
+
.withLabel(property.resolvedPropertyName)
|
|
450
|
+
.asNumber();
|
|
451
|
+
}
|
|
452
|
+
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
453
|
+
descriptor
|
|
454
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
455
|
+
.withTitle(property.resolvedPropertyName)
|
|
456
|
+
.asBoolean()
|
|
457
|
+
.withSort()
|
|
458
|
+
.withFilter();
|
|
459
|
+
descriptor.addField('entityState.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
460
|
+
}
|
|
461
|
+
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
462
|
+
descriptor
|
|
463
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
464
|
+
.withTitle(property.resolvedPropertyName)
|
|
465
|
+
.asDate('dd. MMM yyyy')
|
|
466
|
+
.withSort()
|
|
467
|
+
.withFilter();
|
|
468
|
+
descriptor
|
|
469
|
+
.addField('entityState.' + property.resolvedPropertyName)
|
|
470
|
+
.withLabel(property.resolvedPropertyName)
|
|
471
|
+
.asDatePicker('dd. MMM yyyy');
|
|
472
|
+
}
|
|
473
|
+
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
474
|
+
descriptor
|
|
475
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
476
|
+
.withTitle(property.resolvedPropertyName)
|
|
477
|
+
.asDate('dd. MMM yyyy HH:mm')
|
|
478
|
+
.withSort()
|
|
479
|
+
.withFilter();
|
|
480
|
+
descriptor
|
|
481
|
+
.addField('entityState.' + property.resolvedPropertyName)
|
|
482
|
+
.withLabel(property.resolvedPropertyName)
|
|
483
|
+
.asDatePicker('dd. MM yy', undefined, undefined, true, false);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
// string / wildcard
|
|
487
|
+
descriptor
|
|
488
|
+
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
489
|
+
.withTitle(property.resolvedPropertyName)
|
|
490
|
+
.withSort()
|
|
491
|
+
.withFilter();
|
|
492
|
+
descriptor.addField('entityState.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return descriptor;
|
|
496
|
+
}
|
|
497
|
+
static extractPropertyName(fullPropertyName) {
|
|
498
|
+
if (fullPropertyName?.includes('entityState.')) {
|
|
499
|
+
return fullPropertyName.replace('entityState.', '');
|
|
500
|
+
}
|
|
501
|
+
else if (fullPropertyName?.includes('revEntity.')) {
|
|
502
|
+
return fullPropertyName?.replace('revEntity.', '');
|
|
503
|
+
}
|
|
504
|
+
return fullPropertyName;
|
|
505
|
+
}
|
|
506
|
+
static appendMediusQueryParamsToUrl(queryParams) {
|
|
507
|
+
let url = `?firstResult=${queryParams.itemsOffset}&maxResults=${queryParams.itemsPerPage}`;
|
|
508
|
+
if (queryParams.sortProperty && queryParams.sortProperty.length > 0) {
|
|
509
|
+
url += '&sorts=';
|
|
510
|
+
const sortingQPs = [];
|
|
511
|
+
for (let i = 0; i < queryParams.sortProperty.length; i++) {
|
|
512
|
+
if (queryParams.sortAsc[i]) {
|
|
513
|
+
sortingQPs.push(`asc:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
sortingQPs.push(`desc:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
url += sortingQPs.join(',');
|
|
520
|
+
}
|
|
521
|
+
if (queryParams.filterParams && queryParams.filterParams.length > 0) {
|
|
522
|
+
const filterQPs = [];
|
|
523
|
+
for (const mfp of queryParams.filterParams) {
|
|
524
|
+
switch (mfp.filterMatchType) {
|
|
525
|
+
case MediusFilterMatchType.Equals: {
|
|
526
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Equals}:${mfp.filterValue}`);
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
case MediusFilterMatchType.NotEquals: {
|
|
530
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.NotEquals}:${mfp.filterValue}`);
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
case MediusFilterMatchType.FromTo: {
|
|
534
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Between}:${mfp.filterValue},${mfp.filterValueTo}`);
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
case MediusFilterMatchType.Contains: {
|
|
538
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Contains}:${mfp.filterValue}`);
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
case MediusFilterMatchType.StartsWith: {
|
|
542
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.StartsWith}:${mfp.filterValue}`);
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
case MediusFilterMatchType.EndsWith: {
|
|
546
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.EndsWith}:${mfp.filterValue}`);
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
case MediusFilterMatchType.In: {
|
|
550
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.In}:${mfp.filterValue}`);
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
case MediusFilterMatchType.NotIn: {
|
|
554
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.NotIn}:${mfp.filterValue}`);
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
case MediusFilterMatchType.SmallerThan: {
|
|
558
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.LessThan}:${mfp.filterValue}`);
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
case MediusFilterMatchType.GreaterThan: {
|
|
562
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.GreaterThan}:${mfp.filterValue}`);
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
url += '&';
|
|
568
|
+
url += filterQPs.join('&');
|
|
569
|
+
}
|
|
570
|
+
return url;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const MNG_AUDIT_MODULE_CONFIG_IT = new InjectionToken('MngAuditModuleConfig');
|
|
434
575
|
|
|
435
|
-
class MngAuditRevisionsApiService {
|
|
576
|
+
class MngAuditRevisionsApiService extends AMngBaseApiService {
|
|
436
577
|
constructor() {
|
|
437
|
-
|
|
438
|
-
this.
|
|
578
|
+
super();
|
|
579
|
+
this.moduleConfig = inject(MNG_AUDIT_MODULE_CONFIG_IT);
|
|
580
|
+
this.configService = MngConfigurationService.get();
|
|
439
581
|
}
|
|
440
|
-
|
|
441
|
-
return this.
|
|
582
|
+
getServiceBasePath() {
|
|
583
|
+
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
442
584
|
}
|
|
443
|
-
|
|
444
|
-
return
|
|
585
|
+
getBasePath() {
|
|
586
|
+
return `${this.configService.getConfigValue(this.moduleConfig.apiBasePathConfigKey)}`;
|
|
445
587
|
}
|
|
446
|
-
getRevisionList() {
|
|
447
|
-
return this.http.get(
|
|
588
|
+
getRevisionList(queryParams) {
|
|
589
|
+
return this.http.get(this.getUrl(AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
448
590
|
}
|
|
449
|
-
getRevisionCount() {
|
|
450
|
-
return this.http.get(
|
|
591
|
+
getRevisionCount(queryParams) {
|
|
592
|
+
return this.http.get(this.getUrl('/count', AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
451
593
|
}
|
|
452
594
|
getAllChangesForRevision(revId) {
|
|
453
|
-
return this.http.get(
|
|
595
|
+
return this.http.get(this.getUrl(`/changes/${revId}`));
|
|
596
|
+
}
|
|
597
|
+
listRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
598
|
+
return this.http
|
|
599
|
+
.get(this.getUrl(`/states/${entityType}`, AuditUtil.appendMediusQueryParamsToUrl(queryParams)))
|
|
600
|
+
.pipe(map(response => this.deserializeClassArray(response, RevEntityWithStateDto)));
|
|
601
|
+
}
|
|
602
|
+
fetchRevisionsWithStateForEntityType(entityType, revId, itemId) {
|
|
603
|
+
return this.http.get(this.getUrl(`/states/${entityType}?rev=eq:${revId}&id=eq:${itemId}`)).pipe(map(response => {
|
|
604
|
+
const item = this.deserializeClass(response[0], RevEntityWithId);
|
|
605
|
+
item.mergedId = response[0].revEntity['rev'] + '_' + response[0].entityState['id'];
|
|
606
|
+
return item;
|
|
607
|
+
}));
|
|
608
|
+
}
|
|
609
|
+
countRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
610
|
+
return this.http.get(this.getUrl(`/states/${entityType}/count`, AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
454
611
|
}
|
|
455
612
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
456
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService
|
|
613
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService }); }
|
|
457
614
|
}
|
|
458
615
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService, decorators: [{
|
|
459
|
-
type: Injectable
|
|
460
|
-
|
|
461
|
-
providedIn: 'root'
|
|
462
|
-
}]
|
|
463
|
-
}] });
|
|
616
|
+
type: Injectable
|
|
617
|
+
}], ctorParameters: function () { return []; } });
|
|
464
618
|
|
|
465
|
-
class
|
|
619
|
+
class MngAuditService extends AMngBaseApiService {
|
|
466
620
|
constructor() {
|
|
467
|
-
super(
|
|
468
|
-
this.
|
|
469
|
-
this.
|
|
621
|
+
super();
|
|
622
|
+
this.CACHE_SIZE = 1;
|
|
623
|
+
this.moduleConfig = inject(MNG_AUDIT_MODULE_CONFIG_IT);
|
|
624
|
+
this.configService = MngConfigurationService.get();
|
|
625
|
+
}
|
|
626
|
+
getServiceBasePath() {
|
|
627
|
+
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
628
|
+
}
|
|
629
|
+
getBasePath() {
|
|
630
|
+
return `${this.configService.getConfigValue(this.moduleConfig.apiBasePathConfigKey)}`;
|
|
631
|
+
}
|
|
632
|
+
get revModel$() {
|
|
633
|
+
if (!this.revModelObs) {
|
|
634
|
+
this.revModelObs = this.requestRevModel().pipe(shareReplay(this.CACHE_SIZE));
|
|
635
|
+
}
|
|
636
|
+
return this.revModelObs;
|
|
637
|
+
}
|
|
638
|
+
get auditModel$() {
|
|
639
|
+
if (!this.auditModelObs) {
|
|
640
|
+
this.auditModelObs = this.requestAuditModel().pipe(shareReplay(this.CACHE_SIZE));
|
|
641
|
+
}
|
|
642
|
+
return this.auditModelObs;
|
|
643
|
+
}
|
|
644
|
+
requestRevModel() {
|
|
645
|
+
return this.http.get(this.getUrl('/rev-model'));
|
|
646
|
+
}
|
|
647
|
+
requestAuditModel() {
|
|
648
|
+
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response, GuiEntityModel)));
|
|
649
|
+
}
|
|
650
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
651
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService }); }
|
|
652
|
+
}
|
|
653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService, decorators: [{
|
|
654
|
+
type: Injectable
|
|
655
|
+
}], ctorParameters: function () { return []; } });
|
|
656
|
+
|
|
657
|
+
class MngAuditPageComponent {
|
|
658
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
659
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngAuditPageComponent, isStandalone: true, selector: "mng-audit-page", ngImport: i0, template: "<router-outlet></router-outlet>\n", dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
660
|
+
}
|
|
661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditPageComponent, decorators: [{
|
|
662
|
+
type: Component,
|
|
663
|
+
args: [{ standalone: true, selector: 'mng-audit-page', imports: [RouterOutlet], template: "<router-outlet></router-outlet>\n" }]
|
|
664
|
+
}] });
|
|
665
|
+
|
|
666
|
+
class MngAuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
667
|
+
constructor(router) {
|
|
668
|
+
super();
|
|
669
|
+
this.router = router;
|
|
670
|
+
this.auditService = inject(MngAuditService);
|
|
671
|
+
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
672
|
+
this.showTable = signal(false);
|
|
673
|
+
this.revisionEntitiesLookupProvider = new LookupDataProvider(GuiEntityModel).withLookup(() => this.auditService.auditModel$);
|
|
674
|
+
this.auditService.revModel$.subscribe({
|
|
675
|
+
next: model => (this.revModel = model)
|
|
676
|
+
});
|
|
470
677
|
}
|
|
471
678
|
ngOnInit() {
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
this.
|
|
476
|
-
|
|
477
|
-
|
|
679
|
+
this.route.paramMap.subscribe(params => {
|
|
680
|
+
const entityClass = params.get('entityClass');
|
|
681
|
+
if (entityClass) {
|
|
682
|
+
this.auditService.auditModel$.subscribe(entities => {
|
|
683
|
+
for (const e of entities) {
|
|
684
|
+
if (e.entityName === entityClass) {
|
|
685
|
+
this.selectedRevisionEntity = e;
|
|
686
|
+
super.ngOnInit();
|
|
687
|
+
setTimeout(() => this.showTable.set(true));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
});
|
|
478
691
|
}
|
|
479
692
|
});
|
|
480
693
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
.withFilterLookupEnum(property.possibleEnumValues);
|
|
489
|
-
}
|
|
490
|
-
else if (property.propertyType === GuiPropertyType.Number) {
|
|
491
|
-
desc.addColumn(property.resolvedPropertyName).asNumber();
|
|
492
|
-
}
|
|
493
|
-
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
494
|
-
desc.addColumn(property.resolvedPropertyName).asBoolean();
|
|
495
|
-
}
|
|
496
|
-
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
497
|
-
desc.addColumn(property.resolvedPropertyName).asDate('dd. MMM yyyy');
|
|
498
|
-
}
|
|
499
|
-
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
500
|
-
desc.addColumn(property.resolvedPropertyName).asDate('dd. MMM yyyy HH:mm');
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
// string / wildcard
|
|
504
|
-
desc.addColumn(property.resolvedPropertyName);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return desc;
|
|
694
|
+
onRevisionEntityChange() {
|
|
695
|
+
this.showTable.set(false);
|
|
696
|
+
if (this.selectedRevisionEntity) {
|
|
697
|
+
this.router.navigate(['/audit/entity-revisions/' + this.selectedRevisionEntity.entityName]);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
this.router.navigate(['/audit/entity-revisions/']);
|
|
508
701
|
}
|
|
509
|
-
|
|
702
|
+
}
|
|
703
|
+
createTableviewDescriptor() {
|
|
704
|
+
const desc = new TableviewDescriptor(RevEntityWithId, 'mergedId', undefined, this.selectedRevisionEntity.entityName);
|
|
705
|
+
desc.table.withFilterDisplay(TableFilterDisplayEnum.Row);
|
|
706
|
+
return AuditUtil.buildDescriptorForEntityRevision(desc, this.revModel, this.selectedRevisionEntity);
|
|
510
707
|
}
|
|
511
708
|
createTableviewDataProvider() {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
709
|
+
let allDataCount = 0;
|
|
710
|
+
return new TableviewDataProvider(RevEntityWithId).withGetAll(qp => this.revisisonsApiService.countRevisionsWithStateForEntityType(qp, this.selectedRevisionEntity.entityName).pipe(switchMap(revisionCount => {
|
|
711
|
+
allDataCount = revisionCount;
|
|
712
|
+
return this.revisisonsApiService.listRevisionsWithStateForEntityType(qp, this.selectedRevisionEntity.entityName);
|
|
713
|
+
}), map(values => {
|
|
714
|
+
const revEntityWithStateAndIdList = [];
|
|
715
|
+
for (const revEntityWithState of values) {
|
|
716
|
+
const revEntityWithStateAndId = new RevEntityWithId();
|
|
717
|
+
revEntityWithStateAndId.mergedId = revEntityWithState.revEntity['rev'] + '_' + revEntityWithState.entityState['id'];
|
|
718
|
+
revEntityWithStateAndId.revType = revEntityWithState.revType;
|
|
719
|
+
revEntityWithStateAndId.revEntity = revEntityWithState.revEntity;
|
|
720
|
+
revEntityWithStateAndId.entityState = revEntityWithState.entityState;
|
|
721
|
+
revEntityWithStateAndId.entityClassName = revEntityWithState.entityClassName;
|
|
722
|
+
revEntityWithStateAndIdList.push(revEntityWithStateAndId);
|
|
723
|
+
}
|
|
724
|
+
return MediusQueryResult.fromArray(revEntityWithStateAndIdList, allDataCount);
|
|
725
|
+
})));
|
|
522
726
|
}
|
|
523
|
-
|
|
524
|
-
|
|
727
|
+
createActionDescriptors() {
|
|
728
|
+
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'entity-revision-details')
|
|
729
|
+
.withPosition(ActionPositionEnum.RowClick)
|
|
730
|
+
.withRouteTrigger(':itemId')
|
|
731
|
+
.withFetchFunction(ActionDataProviderUtil.runFetchOrFail)
|
|
732
|
+
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
733
|
+
.withFetchFunction(ctx => {
|
|
734
|
+
const revId = ctx.parameters.itemId.toString().split('_')[0];
|
|
735
|
+
const itemId = ctx.parameters.itemId.toString().split('_')[1];
|
|
736
|
+
return this.revisisonsApiService.fetchRevisionsWithStateForEntityType(this.selectedRevisionEntity.entityName, revId, itemId);
|
|
737
|
+
});
|
|
738
|
+
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
739
|
+
return [detailsAction];
|
|
740
|
+
}
|
|
741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsPageComponent, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
742
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngAuditEntityRevisionsPageComponent, isStandalone: true, selector: "mng-audit-entity-revisions-page", usesInheritance: true, ngImport: i0, template: "<div class=\"card\">\n <div class=\"field mb-0\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [placeholder]=\"'pages.entityRevisions.dropdown.placeholder' | translate\"\n [itemsLabelProperty]=\"'entityName'\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n <small *ngIf=\"!selectedRevisionEntity\" class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n </div>\n</div>\n<div *ngIf=\"showTable()\">\n <mng-tableview-route [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n</div>\n", dependencies: [{ kind: "component", type: MngDropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "dataKeyProperty", "itemsLabelProperty", "itemsLabelTranslate", "itemsValueProperty", "itemsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur"], outputs: ["valueChange"] }, { kind: "component", type: MngTableviewRouteComponent, selector: "mng-tableview-route", inputs: ["descriptor", "dataProvider", "actions"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }] }); }
|
|
525
743
|
}
|
|
526
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type:
|
|
744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsPageComponent, decorators: [{
|
|
527
745
|
type: Component,
|
|
528
|
-
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [
|
|
529
|
-
}] });
|
|
530
|
-
|
|
531
|
-
const auditRouteBuilder = RoutesBuilder.create()
|
|
532
|
-
.addRouteBuilder(RouteBuilder.createRedirect('', 'revisions', 'full'))
|
|
533
|
-
.addRouteBuilder(TableviewRouteBuilder.fromComponent('revisions', MngAuditRevisionsPageComponent).withMenuItem('pi pi-history', 'pages.revisions.title').withTitle('pages.revisions.title'))
|
|
534
|
-
.addRouteBuilder(RouteBuilder.create('entity-revisions', EntityDropdownPageComponent)
|
|
535
|
-
.withMenuItem('pi pi-history', 'pages.entityRevisions.title')
|
|
536
|
-
.withTitle('pages.entityRevisions.title')
|
|
537
|
-
.addChildBuilder(TableviewRouteBuilder.fromComponent(':entityClass', AuditEntityRevisionsPageComponent)));
|
|
746
|
+
args: [{ standalone: true, selector: 'mng-audit-entity-revisions-page', imports: [MngDropdownComponent, MngTableviewRouteComponent, FormsModule, AsyncPipe, NgIf, TranslateModule, FormlyModule], template: "<div class=\"card\">\n <div class=\"field mb-0\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [placeholder]=\"'pages.entityRevisions.dropdown.placeholder' | translate\"\n [itemsLabelProperty]=\"'entityName'\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n <small *ngIf=\"!selectedRevisionEntity\" class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n </div>\n</div>\n<div *ngIf=\"showTable()\">\n <mng-tableview-route [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n</div>\n" }]
|
|
747
|
+
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
538
748
|
|
|
539
749
|
let EntityChanges = class EntityChanges {
|
|
540
750
|
};
|
|
@@ -542,64 +752,163 @@ EntityChanges = __decorate([
|
|
|
542
752
|
TypeName('EntityChanges')
|
|
543
753
|
], EntityChanges);
|
|
544
754
|
|
|
545
|
-
class EntityChangesFieldComponent extends
|
|
755
|
+
class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
546
756
|
constructor() {
|
|
547
757
|
super(...arguments);
|
|
548
758
|
this.entityChanges = [];
|
|
759
|
+
this.modelFetched = new BehaviorSubject(false);
|
|
549
760
|
}
|
|
550
761
|
ngOnInit() {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
762
|
+
this.injector?.get(MngAuditService, undefined, { optional: true })?.auditModel$.subscribe({
|
|
763
|
+
next: model => {
|
|
764
|
+
this.auditModel = model;
|
|
765
|
+
if ('entityNameChangesMap' in this.model) {
|
|
766
|
+
for (const key of Object.keys(this.model['entityNameChangesMap'])) {
|
|
767
|
+
const ec = new EntityChanges();
|
|
768
|
+
ec.entityType = key;
|
|
769
|
+
ec.items = [];
|
|
770
|
+
for (const change of this.model['entityNameChangesMap'][key]) {
|
|
771
|
+
if (change.revType === RevisionType.Add) {
|
|
772
|
+
ec.items.push({ revType: change.revType, ...change.entityNewState, color: 'green' });
|
|
773
|
+
}
|
|
774
|
+
else if (change.revType === RevisionType.Del) {
|
|
775
|
+
ec.items.push({ revType: change.revType, ...change.entityOldState, color: 'red' });
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
ec.items.push({ revType: change.revType, ...change.entityOldState, color: 'red' });
|
|
779
|
+
ec.items.push({ revType: change.revType, ...change.entityNewState, color: 'green' });
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
this.entityChanges.push(ec);
|
|
783
|
+
}
|
|
784
|
+
this.modelFetched.next(true);
|
|
565
785
|
}
|
|
566
786
|
}
|
|
567
|
-
|
|
568
|
-
}
|
|
787
|
+
});
|
|
569
788
|
}
|
|
570
|
-
|
|
789
|
+
createDescriptor(entityChanges) {
|
|
571
790
|
const changedFields = [];
|
|
572
|
-
if (entityChanges.items && entityChanges.items[0].revType ===
|
|
791
|
+
if (entityChanges.items && entityChanges.items[0].revType === RevisionType.Mod) {
|
|
573
792
|
for (const key in entityChanges.items[0]) {
|
|
574
793
|
if (entityChanges.items[0][key] !== entityChanges.items[1][key]) {
|
|
575
794
|
changedFields.push(key);
|
|
576
795
|
}
|
|
577
796
|
}
|
|
578
797
|
}
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
798
|
+
const guiEntityModel = this.auditModel.filter(m => m.entityName === entityChanges.entityType)[0];
|
|
799
|
+
const desc = new TableDescriptor({}, undefined, undefined, guiEntityModel.entityName).withTitle(guiEntityModel.entityName).withClassName('py-2');
|
|
800
|
+
desc.addColumn('revType').asEnum(RevisionType);
|
|
801
|
+
AuditUtil.addColumnsFromModel(desc, guiEntityModel.properties);
|
|
802
|
+
desc.withRowClassName(undefined, (_, item) => (item.color === 'green' ? 'audit-row-added' : 'audit-row-deleted'));
|
|
803
|
+
desc.columns.forEach(col => {
|
|
585
804
|
col.withSort(false);
|
|
586
805
|
if (changedFields.length > 0 && changedFields.some(val => col.property === val)) {
|
|
587
806
|
col.withClassName('audit-cell');
|
|
588
807
|
}
|
|
589
808
|
});
|
|
590
|
-
|
|
809
|
+
desc.withPaginationMode(TablePaginationModeEnum.Pagination);
|
|
810
|
+
return desc;
|
|
591
811
|
}
|
|
592
812
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityChangesFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
593
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: EntityChangesFieldComponent, isStandalone: true, selector: "mng-entity-changes-field", usesInheritance: true, ngImport: i0, template: "<mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"
|
|
813
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: EntityChangesFieldComponent, isStandalone: true, selector: "mng-entity-changes-field", inputs: { injector: "injector" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"modelFetched | async\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n", styles: ["::ng-deep tr.audit-row-deleted{background:hsla(3,100%,60%,.1)!important}::ng-deep tr.audit-row-deleted .audit-cell{background:hsla(3,90%,63%,.3)!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:hsla(145,76%,44%,.3)!important}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
594
814
|
}
|
|
595
815
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityChangesFieldComponent, decorators: [{
|
|
596
816
|
type: Component,
|
|
597
|
-
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [NgForOf, MngTableComponent], template: "<mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"
|
|
817
|
+
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [NgForOf, MngTableComponent, NgIf, AsyncPipe], template: "<div *ngIf=\"modelFetched | async\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n", styles: ["::ng-deep tr.audit-row-deleted{background:hsla(3,100%,60%,.1)!important}::ng-deep tr.audit-row-deleted .audit-cell{background:hsla(3,90%,63%,.3)!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:hsla(145,76%,44%,.3)!important}\n"] }]
|
|
818
|
+
}], propDecorators: { injector: [{
|
|
819
|
+
type: Input
|
|
820
|
+
}] } });
|
|
821
|
+
|
|
822
|
+
class MngAuditRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
823
|
+
constructor() {
|
|
824
|
+
super(...arguments);
|
|
825
|
+
this.auditService = inject(MngAuditService);
|
|
826
|
+
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
827
|
+
this.injector = inject(Injector);
|
|
828
|
+
this.showTable = signal(false);
|
|
829
|
+
}
|
|
830
|
+
ngOnInit() {
|
|
831
|
+
this.auditService.revModel$.subscribe({
|
|
832
|
+
next: model => {
|
|
833
|
+
this.revModel = model;
|
|
834
|
+
super.ngOnInit();
|
|
835
|
+
setTimeout(() => this.showTable.set(true));
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
createTableviewDescriptor() {
|
|
840
|
+
if (this.revModel) {
|
|
841
|
+
const idProperty = this.revModel.properties?.filter(prop => prop.isId).map(prop => prop.resolvedPropertyName)[0];
|
|
842
|
+
const desc = new TableviewDescriptor({}, idProperty, undefined, this.revModel.entityName);
|
|
843
|
+
const detailsDescriptor = new EditorDescriptor(RevEntityWithChangesDto, 'revEntity.' + idProperty, undefined, TableviewEditorTypeEnum.Details);
|
|
844
|
+
AuditUtil.addColumnsFromModel(desc.table, this.revModel.properties);
|
|
845
|
+
AuditUtil.addFieldsFromModel(detailsDescriptor, this.revModel);
|
|
846
|
+
detailsDescriptor.addField('entityNameChangesMap').asCustomComponent(EntityChangesFieldComponent, ['field-no-label'], { injector: this.injector }).withDisabled();
|
|
847
|
+
desc.withDetailsDescriptor(detailsDescriptor);
|
|
848
|
+
desc.table.withFilterDisplay(TableFilterDisplayEnum.Row);
|
|
849
|
+
return desc;
|
|
850
|
+
}
|
|
851
|
+
return new TableviewDescriptor({});
|
|
852
|
+
}
|
|
853
|
+
createTableviewDataProvider() {
|
|
854
|
+
if (this.revModel) {
|
|
855
|
+
let allDataCount = 0;
|
|
856
|
+
return new TableviewDataProvider({}).withGetAll(qp => this.revisisonsApiService.getRevisionCount(qp).pipe(switchMap(revisionsCount => {
|
|
857
|
+
allDataCount = revisionsCount;
|
|
858
|
+
return this.revisisonsApiService.getRevisionList(qp);
|
|
859
|
+
}), map(values => MediusQueryResult.fromArray(values, allDataCount))));
|
|
860
|
+
}
|
|
861
|
+
return new TableviewDataProvider({});
|
|
862
|
+
}
|
|
863
|
+
createActionDescriptors() {
|
|
864
|
+
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'revision-details')
|
|
865
|
+
.withPosition(ActionPositionEnum.RowClick)
|
|
866
|
+
.withRouteTrigger(':itemId')
|
|
867
|
+
.withFetchFunction(ActionDataProviderUtil.runFetchOrFail)
|
|
868
|
+
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
869
|
+
.withFetchFunction(ctx => this.revisisonsApiService.getAllChangesForRevision(ctx.parameters.itemId));
|
|
870
|
+
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
871
|
+
return [detailsAction];
|
|
872
|
+
}
|
|
873
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
874
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngAuditRevisionsPageComponent, isStandalone: true, selector: "mng-audit-revisions-page", usesInheritance: true, ngImport: i0, template: "<mng-tableview-route *ngIf=\"showTable()\" [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MngTableviewRouteComponent, selector: "mng-tableview-route", inputs: ["descriptor", "dataProvider", "actions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
875
|
+
}
|
|
876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, decorators: [{
|
|
877
|
+
type: Component,
|
|
878
|
+
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [NgIf, MngTableviewComponent, AsyncPipe, MngTableviewComponent, RouterOutlet, JsonPipe, MngTableviewRouteComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-tableview-route *ngIf=\"showTable()\" [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n" }]
|
|
598
879
|
}] });
|
|
599
880
|
|
|
881
|
+
function provideMngAuditRoutes(config) {
|
|
882
|
+
return RoutesBuilder.create()
|
|
883
|
+
.addRouteBuilder(RouteBuilder.create('', MngAuditPageComponent)
|
|
884
|
+
.withProvider(MngAuditService)
|
|
885
|
+
.withProvider(MngAuditRevisionsApiService)
|
|
886
|
+
.withProvider({
|
|
887
|
+
provide: MNG_AUDIT_MODULE_CONFIG_IT,
|
|
888
|
+
useValue: config
|
|
889
|
+
})
|
|
890
|
+
.addChildBuilder(RouteBuilder.createRedirect('', 'revisions', 'full'))
|
|
891
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('revisions', MngAuditRevisionsPageComponent)
|
|
892
|
+
.withProvider({
|
|
893
|
+
useValue: 'zamenjajMeZInjectionTokenom',
|
|
894
|
+
provide: config
|
|
895
|
+
})
|
|
896
|
+
.withMenuItem('pi pi-history', 'pages.revisions.title')
|
|
897
|
+
.withTitle('pages.revisions.title'))
|
|
898
|
+
.addChildBuilder(RouteBuilder.create('entity-revisions', MngAuditEntityRevisionsPageComponent)
|
|
899
|
+
.withProvider({
|
|
900
|
+
useValue: 'zamenjajMeZInjectionTokenom',
|
|
901
|
+
provide: config
|
|
902
|
+
})
|
|
903
|
+
.withMenuItem('pi pi-history', 'pages.entityRevisions.title')
|
|
904
|
+
.withTitle('pages.entityRevisions.title'))
|
|
905
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('entity-revisions/:entityClass', MngAuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title')))
|
|
906
|
+
.build();
|
|
907
|
+
}
|
|
908
|
+
|
|
600
909
|
/**
|
|
601
910
|
* Generated bundle index. Do not edit.
|
|
602
911
|
*/
|
|
603
912
|
|
|
604
|
-
export { EntityChangesFieldComponent,
|
|
913
|
+
export { EntityChangesFieldComponent, provideMngAuditRoutes };
|
|
605
914
|
//# sourceMappingURL=mediusinc-mng-commons-audit.mjs.map
|