@mediusinc/mng-commons-audit 3.0.0-rc.0 → 3.0.0-rc.3
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 +39 -21
- package/assets/i18n/sl.json +41 -14
- package/esm2022/lib/api/models/entityChange.mjs +9 -9
- package/esm2022/lib/api/models/guiEntityModel.mjs +9 -9
- package/esm2022/lib/api/models/guiPropertyModel.mjs +14 -9
- package/esm2022/lib/api/models/guiPropertyType.mjs +12 -12
- package/esm2022/lib/api/models/guiRelationModel.mjs +9 -9
- package/esm2022/lib/api/models/revEntityWithChangesDto.mjs +9 -9
- package/esm2022/lib/api/models/revEntityWithStateDto.mjs +9 -9
- package/esm2022/lib/api/models/revisionType.mjs +8 -8
- package/esm2022/lib/api/services/audit-revisions-api.service.mjs +42 -21
- package/esm2022/lib/api/services/audit.service.mjs +45 -0
- package/esm2022/lib/audit.routes.mjs +26 -10
- package/esm2022/lib/components/entity-changes-field/entity-changes-field.component.mjs +82 -37
- 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 +122 -32
- package/esm2022/lib/components/pages/revisions/audit-revisions-page.component.mjs +52 -47
- package/esm2022/lib/models/config.model.mjs +2 -0
- package/esm2022/lib/models/entity-revision-change-state.model.mjs +8 -0
- package/esm2022/lib/models/entity-revision-changes.model.mjs +8 -0
- package/esm2022/lib/models/new-filter-match-type.model.mjs +19 -0
- package/esm2022/lib/models/rev-entity-detailed.model.mjs +9 -0
- package/esm2022/lib/models/rev-entity.model.mjs +8 -0
- package/esm2022/lib/models/revEntityWithId.model.mjs +10 -0
- package/esm2022/lib/service/module-config.token.mjs +3 -0
- package/esm2022/lib/utils/audit.util.mjs +214 -0
- package/fesm2022/mediusinc-mng-commons-audit.mjs +682 -490
- package/fesm2022/mediusinc-mng-commons-audit.mjs.map +1 -1
- package/lib/api/models/entityChange.d.ts +3 -3
- package/lib/api/models/guiEntityModel.d.ts +3 -3
- package/lib/api/models/guiPropertyModel.d.ts +6 -5
- package/lib/api/models/guiPropertyType.d.ts +1 -1
- package/lib/api/models/guiRelationModel.d.ts +1 -1
- package/lib/api/models/revEntityWithChangesDto.d.ts +3 -3
- package/lib/api/models/revEntityWithStateDto.d.ts +3 -3
- package/lib/api/models/revisionType.d.ts +1 -1
- package/lib/api/services/audit-revisions-api.service.d.ts +18 -11
- 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 +14 -8
- 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 +22 -12
- package/lib/components/pages/revisions/audit-revisions-page.component.d.ts +13 -9
- package/lib/models/config.model.d.ts +4 -0
- package/lib/models/entity-revision-change-state.model.d.ts +6 -0
- package/lib/models/entity-revision-changes.model.d.ts +5 -0
- package/lib/models/new-filter-match-type.model.d.ts +17 -0
- package/lib/models/rev-entity-detailed.model.d.ts +10 -0
- package/lib/models/rev-entity.model.d.ts +6 -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 +13 -0
- package/package.json +2 -3
- package/esm2022/lib/api/models/index.mjs +0 -12
- 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/esm2022/lib/models/entity-changes.model.mjs +0 -8
- package/lib/api/models/index.d.ts +0 -11
- 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
- package/lib/models/entity-changes.model.d.ts +0 -4
|
@@ -1,368 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeName, ObjectSerializer, MediusFilterMatchType, AMngBaseApiService, MngConfigurationService, MngErrorInternal, AMngTableviewRouteComponent, LookupDataProvider, TableviewDescriptor, TableviewDataProvider, MediusQueryResult, ActionEditorDescriptor, ActionPositionEnum, ActionDataProviderUtil, TableviewActionDefaultCategories, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, MngDropdownComponent, MngTableviewRouteComponent, AMngFormlyCustomFieldComponent, TableDescriptor, TablePaginationModeEnum, MngTableComponent, EditorDescriptor, TableviewEditorTypeEnum, TableFilterDisplayEnum, 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, DestroyRef, signal, Input, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { __decorate } from 'tslib';
|
|
6
|
+
import { of, shareReplay, combineLatest, throwError, 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
|
-
|
|
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 }]; } });
|
|
116
|
-
|
|
117
|
-
var EntityChange_1;
|
|
118
|
-
let EntityChange = class EntityChange {
|
|
119
|
-
static { EntityChange_1 = this; }
|
|
120
|
-
static { this.attributeTypeMap = [
|
|
121
|
-
{
|
|
122
|
-
name: 'revType',
|
|
123
|
-
baseName: 'revType',
|
|
124
|
-
type: 'RevisionType'
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'entityOldState',
|
|
128
|
-
baseName: 'entityOldState',
|
|
129
|
-
type: '{ [key: string]: any; }'
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'entityNewState',
|
|
133
|
-
baseName: 'entityNewState',
|
|
134
|
-
type: '{ [key: string]: any; }'
|
|
135
|
-
}
|
|
136
|
-
]; }
|
|
137
|
-
static getAttributeTypeMap() {
|
|
138
|
-
return EntityChange_1.attributeTypeMap;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
EntityChange = EntityChange_1 = __decorate([
|
|
142
|
-
TypeName('EntityChange')
|
|
143
|
-
], EntityChange);
|
|
144
|
-
ObjectSerializer.get().registerType(EntityChange);
|
|
145
|
-
|
|
146
|
-
var GuiEntityModel_1;
|
|
147
|
-
let GuiEntityModel = class GuiEntityModel {
|
|
148
|
-
static { GuiEntityModel_1 = this; }
|
|
149
|
-
static { this.attributeTypeMap = [
|
|
150
|
-
{
|
|
151
|
-
name: 'entityName',
|
|
152
|
-
baseName: 'entityName',
|
|
153
|
-
type: 'string'
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'properties',
|
|
157
|
-
baseName: 'properties',
|
|
158
|
-
type: 'Array<GuiPropertyModel>'
|
|
159
|
-
}
|
|
160
|
-
]; }
|
|
161
|
-
static getAttributeTypeMap() {
|
|
162
|
-
return GuiEntityModel_1.attributeTypeMap;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
GuiEntityModel = GuiEntityModel_1 = __decorate([
|
|
166
|
-
TypeName('GuiEntityModel')
|
|
167
|
-
], GuiEntityModel);
|
|
168
|
-
ObjectSerializer.get().registerType(GuiEntityModel);
|
|
169
|
-
|
|
170
|
-
var GuiPropertyModel_1;
|
|
171
|
-
let GuiPropertyModel = class GuiPropertyModel {
|
|
172
|
-
static { GuiPropertyModel_1 = this; }
|
|
173
|
-
static { this.attributeTypeMap = [
|
|
174
|
-
{
|
|
175
|
-
name: 'propertyName',
|
|
176
|
-
baseName: 'propertyName',
|
|
177
|
-
type: 'string'
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: 'resolvedPropertyName',
|
|
181
|
-
baseName: 'resolvedPropertyName',
|
|
182
|
-
type: 'string'
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'possibleEnumValues',
|
|
186
|
-
baseName: 'possibleEnumValues',
|
|
187
|
-
type: 'Array<string>'
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: 'isId',
|
|
191
|
-
baseName: 'isId',
|
|
192
|
-
type: 'boolean'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'propertyType',
|
|
196
|
-
baseName: 'propertyType',
|
|
197
|
-
type: 'GuiPropertyType'
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: 'relationModel',
|
|
201
|
-
baseName: 'relationModel',
|
|
202
|
-
type: 'GuiRelationModel'
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: 'id',
|
|
206
|
-
baseName: 'id',
|
|
207
|
-
type: 'boolean'
|
|
208
|
-
}
|
|
209
|
-
]; }
|
|
210
|
-
static getAttributeTypeMap() {
|
|
211
|
-
return GuiPropertyModel_1.attributeTypeMap;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
GuiPropertyModel = GuiPropertyModel_1 = __decorate([
|
|
215
|
-
TypeName('GuiPropertyModel')
|
|
216
|
-
], GuiPropertyModel);
|
|
217
|
-
ObjectSerializer.get().registerType(GuiPropertyModel);
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Medius quarkus sampler
|
|
221
|
-
* Sampler OPENAPI definition
|
|
222
|
-
*
|
|
223
|
-
* The version of the OpenAPI document: 1.0.0
|
|
224
|
-
* Contact: info@medius.si
|
|
225
|
-
*
|
|
226
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
227
|
-
* https://openapi-generator.tech
|
|
228
|
-
* Do not edit the class manually.
|
|
229
|
-
*/
|
|
230
|
-
var GuiPropertyType;
|
|
231
|
-
(function (GuiPropertyType) {
|
|
232
|
-
GuiPropertyType["LocalDate"] = "LOCAL_DATE";
|
|
233
|
-
GuiPropertyType["OffsetDateTime"] = "OFFSET_DATE_TIME";
|
|
234
|
-
GuiPropertyType["String"] = "STRING";
|
|
235
|
-
GuiPropertyType["Number"] = "NUMBER";
|
|
236
|
-
GuiPropertyType["Boolean"] = "BOOLEAN";
|
|
237
|
-
GuiPropertyType["Enum"] = "ENUM";
|
|
238
|
-
GuiPropertyType["Wildcard"] = "WILDCARD";
|
|
239
|
-
})(GuiPropertyType || (GuiPropertyType = {}));
|
|
240
|
-
ObjectSerializer.get().registerEnum(GuiPropertyType, 'GuiPropertyType');
|
|
241
|
-
|
|
242
|
-
var GuiRelationModel_1;
|
|
243
|
-
let GuiRelationModel = class GuiRelationModel {
|
|
244
|
-
static { GuiRelationModel_1 = this; }
|
|
245
|
-
static { this.attributeTypeMap = [
|
|
246
|
-
{
|
|
247
|
-
name: 'idPropertyName',
|
|
248
|
-
baseName: 'idPropertyName',
|
|
249
|
-
type: 'string'
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: 'isAudited',
|
|
253
|
-
baseName: 'isAudited',
|
|
254
|
-
type: 'boolean'
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'audited',
|
|
258
|
-
baseName: 'audited',
|
|
259
|
-
type: 'boolean'
|
|
260
|
-
}
|
|
261
|
-
]; }
|
|
262
|
-
static getAttributeTypeMap() {
|
|
263
|
-
return GuiRelationModel_1.attributeTypeMap;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
GuiRelationModel = GuiRelationModel_1 = __decorate([
|
|
267
|
-
TypeName('GuiRelationModel')
|
|
268
|
-
], GuiRelationModel);
|
|
269
|
-
ObjectSerializer.get().registerType(GuiRelationModel);
|
|
270
|
-
|
|
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
|
-
var RevEntityWithChangesDto_1;
|
|
340
|
-
let RevEntityWithChangesDto = class RevEntityWithChangesDto {
|
|
341
|
-
static { RevEntityWithChangesDto_1 = this; }
|
|
342
|
-
static { this.attributeTypeMap = [
|
|
343
|
-
{
|
|
344
|
-
name: 'revEntity',
|
|
345
|
-
baseName: 'revEntity',
|
|
346
|
-
type: '{ [key: string]: any; }'
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: 'entityNameChangesMap',
|
|
350
|
-
baseName: 'entityNameChangesMap',
|
|
351
|
-
type: '{ [key: string]: Array<EntityChange>; }'
|
|
352
|
-
}
|
|
353
|
-
]; }
|
|
354
|
-
static getAttributeTypeMap() {
|
|
355
|
-
return RevEntityWithChangesDto_1.attributeTypeMap;
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
RevEntityWithChangesDto = RevEntityWithChangesDto_1 = __decorate([
|
|
359
|
-
TypeName('RevEntityWithChangesDto')
|
|
360
|
-
], RevEntityWithChangesDto);
|
|
361
|
-
ObjectSerializer.get().registerType(RevEntityWithChangesDto);
|
|
9
|
+
import { NgIf, AsyncPipe, NgForOf, JsonPipe } from '@angular/common';
|
|
10
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
|
+
import * as i2 from '@angular/forms';
|
|
12
|
+
import { FormsModule } from '@angular/forms';
|
|
13
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
14
|
+
import * as i3 from '@ngx-translate/core';
|
|
15
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
362
16
|
|
|
363
|
-
var
|
|
364
|
-
let
|
|
365
|
-
static {
|
|
17
|
+
var MngRevEntityWithStateDto_1;
|
|
18
|
+
let MngRevEntityWithStateDto = class MngRevEntityWithStateDto {
|
|
19
|
+
static { MngRevEntityWithStateDto_1 = this; }
|
|
366
20
|
static { this.attributeTypeMap = [
|
|
367
21
|
{
|
|
368
22
|
name: 'revEntity',
|
|
@@ -386,13 +40,22 @@ let RevEntityWithStateDto = class RevEntityWithStateDto {
|
|
|
386
40
|
}
|
|
387
41
|
]; }
|
|
388
42
|
static getAttributeTypeMap() {
|
|
389
|
-
return
|
|
43
|
+
return MngRevEntityWithStateDto_1.attributeTypeMap;
|
|
390
44
|
}
|
|
391
45
|
};
|
|
392
|
-
|
|
393
|
-
TypeName('
|
|
394
|
-
],
|
|
395
|
-
ObjectSerializer.get().registerType(
|
|
46
|
+
MngRevEntityWithStateDto = MngRevEntityWithStateDto_1 = __decorate([
|
|
47
|
+
TypeName('MngRevEntityWithStateDto')
|
|
48
|
+
], MngRevEntityWithStateDto);
|
|
49
|
+
ObjectSerializer.get().registerType(MngRevEntityWithStateDto);
|
|
50
|
+
|
|
51
|
+
let MngRevEntityWithId = class MngRevEntityWithId extends MngRevEntityWithStateDto {
|
|
52
|
+
};
|
|
53
|
+
MngRevEntityWithId = __decorate([
|
|
54
|
+
TypeName('MngRevEntityWithId')
|
|
55
|
+
], MngRevEntityWithId);
|
|
56
|
+
ObjectSerializer.get().registerType(MngRevEntityWithId);
|
|
57
|
+
|
|
58
|
+
const MNG_AUDIT_MODULE_CONFIG_IT = new InjectionToken('MngAuditModuleConfig');
|
|
396
59
|
|
|
397
60
|
/**
|
|
398
61
|
* Medius quarkus sampler
|
|
@@ -405,13 +68,17 @@ ObjectSerializer.get().registerType(RevEntityWithStateDto);
|
|
|
405
68
|
* https://openapi-generator.tech
|
|
406
69
|
* Do not edit the class manually.
|
|
407
70
|
*/
|
|
408
|
-
var
|
|
409
|
-
(function (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
71
|
+
var MngGuiPropertyTypeDto;
|
|
72
|
+
(function (MngGuiPropertyTypeDto) {
|
|
73
|
+
MngGuiPropertyTypeDto["LocalDate"] = "LOCAL_DATE";
|
|
74
|
+
MngGuiPropertyTypeDto["OffsetDateTime"] = "OFFSET_DATE_TIME";
|
|
75
|
+
MngGuiPropertyTypeDto["String"] = "STRING";
|
|
76
|
+
MngGuiPropertyTypeDto["Number"] = "NUMBER";
|
|
77
|
+
MngGuiPropertyTypeDto["Boolean"] = "BOOLEAN";
|
|
78
|
+
MngGuiPropertyTypeDto["Enum"] = "ENUM";
|
|
79
|
+
MngGuiPropertyTypeDto["Wildcard"] = "WILDCARD";
|
|
80
|
+
})(MngGuiPropertyTypeDto || (MngGuiPropertyTypeDto = {}));
|
|
81
|
+
ObjectSerializer.get().registerEnum(MngGuiPropertyTypeDto, 'MngGuiPropertyTypeDto');
|
|
415
82
|
|
|
416
83
|
/**
|
|
417
84
|
* Medius quarkus sampler
|
|
@@ -424,182 +91,707 @@ ObjectSerializer.get().registerEnum(RevisionType, 'RevisionType');
|
|
|
424
91
|
* https://openapi-generator.tech
|
|
425
92
|
* Do not edit the class manually.
|
|
426
93
|
*/
|
|
427
|
-
var
|
|
428
|
-
(function (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
})(
|
|
433
|
-
ObjectSerializer.get().registerEnum(
|
|
94
|
+
var MngRevisionTypeDto;
|
|
95
|
+
(function (MngRevisionTypeDto) {
|
|
96
|
+
MngRevisionTypeDto["Add"] = "ADD";
|
|
97
|
+
MngRevisionTypeDto["Mod"] = "MOD";
|
|
98
|
+
MngRevisionTypeDto["Del"] = "DEL";
|
|
99
|
+
})(MngRevisionTypeDto || (MngRevisionTypeDto = {}));
|
|
100
|
+
ObjectSerializer.get().registerEnum(MngRevisionTypeDto, 'MngRevisionTypeDto');
|
|
101
|
+
|
|
102
|
+
var NewMediusFilterMatchType;
|
|
103
|
+
(function (NewMediusFilterMatchType) {
|
|
104
|
+
NewMediusFilterMatchType["Equals"] = "eq";
|
|
105
|
+
NewMediusFilterMatchType["NotEquals"] = "ne";
|
|
106
|
+
NewMediusFilterMatchType["Between"] = "bt";
|
|
107
|
+
NewMediusFilterMatchType["Contains"] = "cn";
|
|
108
|
+
NewMediusFilterMatchType["NotContains"] = "nc";
|
|
109
|
+
NewMediusFilterMatchType["StartsWith"] = "sw";
|
|
110
|
+
NewMediusFilterMatchType["EndsWith"] = "ew";
|
|
111
|
+
NewMediusFilterMatchType["In"] = "in";
|
|
112
|
+
NewMediusFilterMatchType["NotIn"] = "ni";
|
|
113
|
+
NewMediusFilterMatchType["LessThan"] = "lt";
|
|
114
|
+
NewMediusFilterMatchType["LessThanOrEqualTo"] = "le";
|
|
115
|
+
NewMediusFilterMatchType["GreaterThan"] = "gt";
|
|
116
|
+
NewMediusFilterMatchType["GreaterThanOrEqualTo"] = "ge";
|
|
117
|
+
NewMediusFilterMatchType["Exists"] = "ex";
|
|
118
|
+
NewMediusFilterMatchType["DoesNotExist"] = "nx";
|
|
119
|
+
})(NewMediusFilterMatchType || (NewMediusFilterMatchType = {}));
|
|
120
|
+
|
|
121
|
+
class AuditUtil {
|
|
122
|
+
static addColumnsFromModel(descriptor, properties, modelType = undefined, addFilters = true, addSorts = true) {
|
|
123
|
+
for (const property of properties) {
|
|
124
|
+
if (!property.resolvedPropertyName) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const columnPrepend = modelType ? `${modelType}.` : '';
|
|
128
|
+
const isEnum = property.propertyType === MngGuiPropertyTypeDto.Enum;
|
|
129
|
+
let column = null;
|
|
130
|
+
if (isEnum) {
|
|
131
|
+
if (!property.possibleEnumValues) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const enumType = AuditUtil.findEnumType(property);
|
|
135
|
+
if (enumType) {
|
|
136
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asEnum(enumType);
|
|
137
|
+
if (addFilters) {
|
|
138
|
+
column.withFilterLookupEnum(property.possibleEnumValues);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName);
|
|
143
|
+
if (addFilters) {
|
|
144
|
+
(column?.withFilterLookup()).withLookup(() => of(property.possibleEnumValues ?? []));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Number) {
|
|
149
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asNumber();
|
|
150
|
+
}
|
|
151
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Boolean) {
|
|
152
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asBoolean();
|
|
153
|
+
}
|
|
154
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.LocalDate) {
|
|
155
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asDate('dd. MM yyyy');
|
|
156
|
+
}
|
|
157
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.OffsetDateTime) {
|
|
158
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asDate('dd. MM yyyy HH:mm');
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// string / wildcard
|
|
162
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).withTitle(AuditUtil.getPropertyTitleKey(property, modelType));
|
|
163
|
+
}
|
|
164
|
+
column.withTitle(AuditUtil.getPropertyTitleKey(property, modelType));
|
|
165
|
+
if (!isEnum && addFilters) {
|
|
166
|
+
column?.withFilter();
|
|
167
|
+
}
|
|
168
|
+
if (addSorts) {
|
|
169
|
+
column?.withSort();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return descriptor;
|
|
173
|
+
}
|
|
174
|
+
static getPropertyTitleKey(property, modelType = undefined) {
|
|
175
|
+
if (modelType === 'revEntity') {
|
|
176
|
+
return 'MngRevEntity.properties.' + property.resolvedPropertyName;
|
|
177
|
+
}
|
|
178
|
+
return property.resolvedPropertyName ?? '';
|
|
179
|
+
}
|
|
180
|
+
static addFieldsFromModel(descriptor, properties, modelType = 'revEntity') {
|
|
181
|
+
for (const property of properties) {
|
|
182
|
+
if (!property.resolvedPropertyName) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const fieldPrepend = `${modelType}.`;
|
|
186
|
+
if (property.propertyType === MngGuiPropertyTypeDto.Enum) {
|
|
187
|
+
const enumType = AuditUtil.findEnumType(property);
|
|
188
|
+
if (enumType) {
|
|
189
|
+
if (!property.possibleEnumValues) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
descriptor.addFieldLookupEnum(fieldPrepend + property.resolvedPropertyName, enumType, property.possibleEnumValues).withDisabled();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
descriptor.addField(fieldPrepend + property.resolvedPropertyName).withLabel(AuditUtil.getPropertyTitleKey(property, modelType));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Number) {
|
|
199
|
+
descriptor
|
|
200
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
201
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
202
|
+
.asNumber()
|
|
203
|
+
.withDisabled();
|
|
204
|
+
}
|
|
205
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Boolean) {
|
|
206
|
+
descriptor
|
|
207
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
208
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
209
|
+
.withDisabled();
|
|
210
|
+
}
|
|
211
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.LocalDate) {
|
|
212
|
+
descriptor
|
|
213
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
214
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
215
|
+
.asDatePicker('dd. MMM yyyy')
|
|
216
|
+
.withDisabled();
|
|
217
|
+
}
|
|
218
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.OffsetDateTime) {
|
|
219
|
+
descriptor
|
|
220
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
221
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
222
|
+
.asDatePicker('dd. MM yy', undefined, undefined, true, false)
|
|
223
|
+
.withDisabled();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// string / wildcard
|
|
227
|
+
descriptor
|
|
228
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
229
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
230
|
+
.withDisabled();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return descriptor;
|
|
234
|
+
}
|
|
235
|
+
static buildDescriptorForEntityRevision(descriptor, revModel, entityModel) {
|
|
236
|
+
descriptor.addColumn('revType').withTitle('MngEntityRevisionChangeState.properties.revType').asEnum(MngRevisionTypeDto).withFilter();
|
|
237
|
+
descriptor.addFieldLookupEnum('revType', MngRevisionTypeDto).withLabel('MngEntityRevisionChangeState.properties.revType');
|
|
238
|
+
if (revModel.properties) {
|
|
239
|
+
AuditUtil.addColumnsFromModel(descriptor.table, revModel.properties, 'revEntity');
|
|
240
|
+
AuditUtil.addFieldsFromModel(descriptor.detailsEditor, revModel.properties, 'revEntity');
|
|
241
|
+
}
|
|
242
|
+
if (entityModel.properties) {
|
|
243
|
+
AuditUtil.addColumnsFromModel(descriptor.table, entityModel.properties, 'entityState');
|
|
244
|
+
AuditUtil.addFieldsFromModel(descriptor.detailsEditor, entityModel.properties, 'entityState');
|
|
245
|
+
}
|
|
246
|
+
return descriptor;
|
|
247
|
+
}
|
|
248
|
+
static findEnumType(property) {
|
|
249
|
+
if (!property.enumClassSimpleName) {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
let enumType = ObjectSerializer.get().findEnum(property.enumClassSimpleName);
|
|
253
|
+
if (!enumType) {
|
|
254
|
+
enumType = ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto');
|
|
255
|
+
}
|
|
256
|
+
return enumType;
|
|
257
|
+
}
|
|
258
|
+
static extractPropertyName(fullPropertyName) {
|
|
259
|
+
if (fullPropertyName?.includes('entityState.')) {
|
|
260
|
+
return fullPropertyName.replace('entityState.', '');
|
|
261
|
+
}
|
|
262
|
+
else if (fullPropertyName?.includes('revEntity.')) {
|
|
263
|
+
return fullPropertyName?.replace('revEntity.', '');
|
|
264
|
+
}
|
|
265
|
+
return fullPropertyName;
|
|
266
|
+
}
|
|
267
|
+
static appendMediusQueryParamsToUrl(queryParams) {
|
|
268
|
+
let url = `?firstResult=${queryParams.itemsOffset}&maxResults=${queryParams.itemsPerPage}`;
|
|
269
|
+
if (queryParams.sortProperty && queryParams.sortProperty.length > 0) {
|
|
270
|
+
url += '&sorts=';
|
|
271
|
+
const sortingQPs = [];
|
|
272
|
+
for (let i = 0; i < queryParams.sortProperty.length; i++) {
|
|
273
|
+
sortingQPs.push(`${queryParams.sortAsc?.[i] ?? true ? 'asc' : 'desc'}:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
274
|
+
}
|
|
275
|
+
url += sortingQPs.join(',');
|
|
276
|
+
}
|
|
277
|
+
if (queryParams.filterParams && queryParams.filterParams.length > 0) {
|
|
278
|
+
const filterQPs = [];
|
|
279
|
+
for (const mfp of queryParams.filterParams) {
|
|
280
|
+
switch (mfp.filterMatchType) {
|
|
281
|
+
case MediusFilterMatchType.Equals: {
|
|
282
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Equals}:${mfp.filterValue}`);
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case MediusFilterMatchType.NotEquals: {
|
|
286
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.NotEquals}:${mfp.filterValue}`);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case MediusFilterMatchType.FromTo: {
|
|
290
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Between}:${mfp.filterValue},${mfp.filterValueTo}`);
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
case MediusFilterMatchType.Contains: {
|
|
294
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.Contains}:${mfp.filterValue}`);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case MediusFilterMatchType.StartsWith: {
|
|
298
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.StartsWith}:${mfp.filterValue}`);
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case MediusFilterMatchType.EndsWith: {
|
|
302
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.EndsWith}:${mfp.filterValue}`);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
case MediusFilterMatchType.In: {
|
|
306
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.In}:${mfp.filterValue}`);
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
case MediusFilterMatchType.NotIn: {
|
|
310
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.NotIn}:${mfp.filterValue}`);
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case MediusFilterMatchType.SmallerThan: {
|
|
314
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.LessThan}:${mfp.filterValue}`);
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case MediusFilterMatchType.GreaterThan: {
|
|
318
|
+
filterQPs.push(`${this.extractPropertyName(mfp.property)}=${NewMediusFilterMatchType.GreaterThan}:${mfp.filterValue}`);
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
url += '&';
|
|
324
|
+
url += filterQPs.join('&');
|
|
325
|
+
}
|
|
326
|
+
return url;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
434
329
|
|
|
435
|
-
class MngAuditRevisionsApiService {
|
|
330
|
+
class MngAuditRevisionsApiService extends AMngBaseApiService {
|
|
436
331
|
constructor() {
|
|
437
|
-
|
|
438
|
-
this.
|
|
332
|
+
super();
|
|
333
|
+
this.moduleConfig = inject(MNG_AUDIT_MODULE_CONFIG_IT);
|
|
334
|
+
this.configService = MngConfigurationService.get();
|
|
439
335
|
}
|
|
440
|
-
|
|
441
|
-
return this.
|
|
336
|
+
getServiceBasePath() {
|
|
337
|
+
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
442
338
|
}
|
|
443
|
-
|
|
444
|
-
return
|
|
339
|
+
getBasePath() {
|
|
340
|
+
return `${this.configService.getConfigValue(this.moduleConfig.apiBasePathConfigKey)}`;
|
|
445
341
|
}
|
|
446
|
-
getRevisionList() {
|
|
447
|
-
return this.http.get(
|
|
342
|
+
getRevisionList(queryParams) {
|
|
343
|
+
return this.http.get(this.getUrl(AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
448
344
|
}
|
|
449
|
-
getRevisionCount() {
|
|
450
|
-
return this.http.get(
|
|
345
|
+
getRevisionCount(queryParams) {
|
|
346
|
+
return this.http.get(this.getUrl('/count', AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
451
347
|
}
|
|
452
348
|
getAllChangesForRevision(revId) {
|
|
453
|
-
return this.http.get(
|
|
349
|
+
return this.http.get(this.getUrl(`/changes/${revId}`));
|
|
350
|
+
}
|
|
351
|
+
listRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
352
|
+
return this.http
|
|
353
|
+
.get(this.getUrl(`/states/${entityType}`, AuditUtil.appendMediusQueryParamsToUrl(queryParams)))
|
|
354
|
+
.pipe(map(response => this.deserializeClassArray(response, MngRevEntityWithStateDto)));
|
|
355
|
+
}
|
|
356
|
+
fetchRevisionsWithStateForEntityType(entityType, revId, itemId) {
|
|
357
|
+
return this.http.get(this.getUrl(`/states/${entityType}?rev=eq:${revId}&id=eq:${itemId}`)).pipe(map(response => this.deserializeClassArray(response, MngRevEntityWithId).map(i => {
|
|
358
|
+
i.mergedId = i.revEntity?.['rev'] + '_' + i.entityState?.['id'];
|
|
359
|
+
return i;
|
|
360
|
+
})), map(items => {
|
|
361
|
+
if (items.length > 0) {
|
|
362
|
+
return items[0];
|
|
363
|
+
}
|
|
364
|
+
throw new MngErrorInternal(`Entity revision ${revId} for ${entityType} with id ${itemId} was not found`);
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
countRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
368
|
+
return this.http.get(this.getUrl(`/states/${entityType}/count`, AuditUtil.appendMediusQueryParamsToUrl(queryParams)));
|
|
454
369
|
}
|
|
455
370
|
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
|
|
371
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService }); }
|
|
457
372
|
}
|
|
458
373
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsApiService, decorators: [{
|
|
459
|
-
type: Injectable
|
|
460
|
-
|
|
461
|
-
providedIn: 'root'
|
|
462
|
-
}]
|
|
463
|
-
}] });
|
|
374
|
+
type: Injectable
|
|
375
|
+
}], ctorParameters: function () { return []; } });
|
|
464
376
|
|
|
465
|
-
|
|
377
|
+
var MngGuiEntityModelDto_1;
|
|
378
|
+
let MngGuiEntityModelDto = class MngGuiEntityModelDto {
|
|
379
|
+
static { MngGuiEntityModelDto_1 = this; }
|
|
380
|
+
static { this.attributeTypeMap = [
|
|
381
|
+
{
|
|
382
|
+
name: 'entityName',
|
|
383
|
+
baseName: 'entityName',
|
|
384
|
+
type: 'string'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'properties',
|
|
388
|
+
baseName: 'properties',
|
|
389
|
+
type: 'Array<GuiPropertyModel>'
|
|
390
|
+
}
|
|
391
|
+
]; }
|
|
392
|
+
static getAttributeTypeMap() {
|
|
393
|
+
return MngGuiEntityModelDto_1.attributeTypeMap;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
MngGuiEntityModelDto = MngGuiEntityModelDto_1 = __decorate([
|
|
397
|
+
TypeName('MngGuiEntityModelDto')
|
|
398
|
+
], MngGuiEntityModelDto);
|
|
399
|
+
ObjectSerializer.get().registerType(MngGuiEntityModelDto);
|
|
400
|
+
|
|
401
|
+
class MngAuditService extends AMngBaseApiService {
|
|
466
402
|
constructor() {
|
|
467
|
-
super(
|
|
468
|
-
this.
|
|
469
|
-
this.
|
|
403
|
+
super();
|
|
404
|
+
this.CACHE_SIZE = 1;
|
|
405
|
+
this.moduleConfig = inject(MNG_AUDIT_MODULE_CONFIG_IT);
|
|
406
|
+
this.configService = MngConfigurationService.get();
|
|
407
|
+
}
|
|
408
|
+
getServiceBasePath() {
|
|
409
|
+
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
410
|
+
}
|
|
411
|
+
getBasePath() {
|
|
412
|
+
return `${this.configService.getConfigValue(this.moduleConfig.apiBasePathConfigKey)}`;
|
|
413
|
+
}
|
|
414
|
+
get revModel$() {
|
|
415
|
+
if (!this.revModelObs) {
|
|
416
|
+
this.revModelObs = this.requestRevModel().pipe(shareReplay(this.CACHE_SIZE));
|
|
417
|
+
}
|
|
418
|
+
return this.revModelObs;
|
|
419
|
+
}
|
|
420
|
+
get auditModel$() {
|
|
421
|
+
if (!this.auditModelObs) {
|
|
422
|
+
this.auditModelObs = this.requestAuditModel().pipe(shareReplay(this.CACHE_SIZE));
|
|
423
|
+
}
|
|
424
|
+
return this.auditModelObs;
|
|
425
|
+
}
|
|
426
|
+
requestRevModel() {
|
|
427
|
+
return this.http.get(this.getUrl('/rev-model'));
|
|
428
|
+
}
|
|
429
|
+
requestAuditModel() {
|
|
430
|
+
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response, MngGuiEntityModelDto)));
|
|
431
|
+
}
|
|
432
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
433
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService }); }
|
|
434
|
+
}
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService, decorators: [{
|
|
436
|
+
type: Injectable
|
|
437
|
+
}], ctorParameters: function () { return []; } });
|
|
438
|
+
|
|
439
|
+
class MngAuditPageComponent {
|
|
440
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
441
|
+
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"] }] }); }
|
|
442
|
+
}
|
|
443
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditPageComponent, decorators: [{
|
|
444
|
+
type: Component,
|
|
445
|
+
args: [{ standalone: true, selector: 'mng-audit-page', imports: [RouterOutlet], template: "<router-outlet></router-outlet>\n" }]
|
|
446
|
+
}] });
|
|
447
|
+
|
|
448
|
+
class MngAuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
449
|
+
constructor(router) {
|
|
450
|
+
super();
|
|
451
|
+
this.router = router;
|
|
452
|
+
this.destroyRef = inject(DestroyRef);
|
|
453
|
+
this.auditService = inject(MngAuditService);
|
|
454
|
+
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
455
|
+
this.showTableview = signal(false);
|
|
456
|
+
this.revisionEntitiesLookupProvider = new LookupDataProvider(MngGuiEntityModelDto).withLookup(() => this.auditService.auditModel$.pipe(map(model => model.sort((m1, m2) => {
|
|
457
|
+
if (m1.entityName && m2.entityName) {
|
|
458
|
+
return m1.entityName.localeCompare(m2.entityName);
|
|
459
|
+
}
|
|
460
|
+
else if (m1.entityName && !m2.entityName) {
|
|
461
|
+
return 1;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
return -1;
|
|
465
|
+
}
|
|
466
|
+
}))));
|
|
470
467
|
}
|
|
471
468
|
ngOnInit() {
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
this.
|
|
476
|
-
|
|
477
|
-
|
|
469
|
+
this.route.paramMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(params => {
|
|
470
|
+
const entityClass = params.get('entityClass');
|
|
471
|
+
if (entityClass) {
|
|
472
|
+
combineLatest([this.auditService.auditModel$, this.auditService.revModel$]).subscribe(([entities, revModel]) => {
|
|
473
|
+
this.revModel = revModel;
|
|
474
|
+
for (const e of entities) {
|
|
475
|
+
if (e.entityName === entityClass) {
|
|
476
|
+
this.selectedRevisionEntity = e;
|
|
477
|
+
super.ngOnInit();
|
|
478
|
+
setTimeout(() => this.showTableview.set(true));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
478
482
|
}
|
|
479
483
|
});
|
|
480
484
|
}
|
|
485
|
+
onRevisionEntityChange() {
|
|
486
|
+
this.showTableview.set(false);
|
|
487
|
+
if (this.selectedRevisionEntity) {
|
|
488
|
+
this.router.navigate(['/audit/entity-revisions/' + this.selectedRevisionEntity.entityName]);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
this.router.navigate(['/audit/entity-revisions/']);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
481
494
|
createTableviewDescriptor() {
|
|
482
|
-
if (this.revModel) {
|
|
483
|
-
|
|
484
|
-
for (const property of this.revModel.properties) {
|
|
485
|
-
if (property.propertyType === GuiPropertyType.Enum) {
|
|
486
|
-
desc.addColumn(property.resolvedPropertyName)
|
|
487
|
-
.asEnum(ObjectSerializer.get().findEnum(property.resolvedPropertyName))
|
|
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;
|
|
495
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
496
|
+
throw new MngErrorInternal('No revision model or revision entity is provided for tableview.');
|
|
508
497
|
}
|
|
509
|
-
|
|
498
|
+
const desc = new TableviewDescriptor(MngRevEntityWithId, 'mergedId', undefined, this.selectedRevisionEntity.entityName);
|
|
499
|
+
AuditUtil.buildDescriptorForEntityRevision(desc, this.revModel, this.selectedRevisionEntity);
|
|
500
|
+
desc.table.withColumnsResizable();
|
|
501
|
+
desc.table.withCurrentColumnsReorderable();
|
|
502
|
+
desc.table.withCurrentColumnsToggleable();
|
|
503
|
+
desc.table.withDataKey(`EntityRevisionsPage_${this.selectedRevisionEntity.entityName}`);
|
|
504
|
+
return desc;
|
|
510
505
|
}
|
|
511
506
|
createTableviewDataProvider() {
|
|
512
|
-
if (this.revModel) {
|
|
513
|
-
|
|
514
|
-
return new TableviewDataProvider(ObjectSerializer.get().findType(this.revModel.entityName + 'Dto'), MngAuditRevisionsApiService).withGetAll((qp, service) => service
|
|
515
|
-
? service.getRevisionCount().pipe(switchMap(revisionsCount => {
|
|
516
|
-
allDataCount = revisionsCount;
|
|
517
|
-
return service.getRevisionList();
|
|
518
|
-
}), map$1(values => MediusQueryResult.fromArray(values, allDataCount)))
|
|
519
|
-
: of(MediusQueryResult.fromArray([], 0)));
|
|
507
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
508
|
+
throw new MngErrorInternal('No revision model or revision entity is provided for tableview.');
|
|
520
509
|
}
|
|
521
|
-
|
|
510
|
+
const entityName = this.selectedRevisionEntity.entityName;
|
|
511
|
+
return new TableviewDataProvider(MngRevEntityWithId).withGetAll(qp => this.selectedRevisionEntity?.entityName
|
|
512
|
+
? combineLatest([
|
|
513
|
+
this.revisisonsApiService.countRevisionsWithStateForEntityType(qp, entityName),
|
|
514
|
+
this.revisisonsApiService.listRevisionsWithStateForEntityType(qp, entityName)
|
|
515
|
+
]).pipe(map(([count, values]) => {
|
|
516
|
+
const revEntityWithStateAndIdList = [];
|
|
517
|
+
for (const revEntityWithState of values) {
|
|
518
|
+
const revEntityWithStateAndId = new MngRevEntityWithId();
|
|
519
|
+
revEntityWithStateAndId.mergedId = revEntityWithState.revEntity?.['rev'] + '_' + revEntityWithState.entityState?.['id'];
|
|
520
|
+
revEntityWithStateAndId.revType = revEntityWithState.revType;
|
|
521
|
+
revEntityWithStateAndId.revEntity = revEntityWithState.revEntity;
|
|
522
|
+
revEntityWithStateAndId.entityState = revEntityWithState.entityState;
|
|
523
|
+
revEntityWithStateAndId.entityClassName = revEntityWithState.entityClassName;
|
|
524
|
+
revEntityWithStateAndIdList.push(revEntityWithStateAndId);
|
|
525
|
+
}
|
|
526
|
+
return MediusQueryResult.fromArray(revEntityWithStateAndIdList, count);
|
|
527
|
+
}))
|
|
528
|
+
: throwError(() => new MngErrorInternal('No revision entity is provided for list.')));
|
|
522
529
|
}
|
|
523
|
-
|
|
524
|
-
|
|
530
|
+
createActionDescriptors() {
|
|
531
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
532
|
+
throw new MngErrorInternal('No revision model or revision entity is provided for tableview.');
|
|
533
|
+
}
|
|
534
|
+
const entityName = this.selectedRevisionEntity.entityName;
|
|
535
|
+
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'entity-revision-details')
|
|
536
|
+
.withPosition(ActionPositionEnum.RowClick)
|
|
537
|
+
.withRouteTrigger(':itemId')
|
|
538
|
+
.withFetchFunction(ActionDataProviderUtil.runFetchOrFail)
|
|
539
|
+
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
540
|
+
.withFetchFunction(ctx => {
|
|
541
|
+
if (!entityName) {
|
|
542
|
+
return throwError(() => new MngErrorInternal('No revision entity is provided for details.'));
|
|
543
|
+
}
|
|
544
|
+
if (!ctx.parameters.itemId) {
|
|
545
|
+
return throwError(() => new MngErrorInternal('No item id for revision entity details is provided.'));
|
|
546
|
+
}
|
|
547
|
+
const revId = ctx.parameters.itemId.toString().split('_')[0];
|
|
548
|
+
const itemId = ctx.parameters.itemId.toString().split('_')[1];
|
|
549
|
+
return this.revisisonsApiService.fetchRevisionsWithStateForEntityType(entityName, revId, itemId);
|
|
550
|
+
});
|
|
551
|
+
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
552
|
+
return [detailsAction];
|
|
553
|
+
}
|
|
554
|
+
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 }); }
|
|
555
|
+
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=\"showTableview()\">\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
556
|
}
|
|
526
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type:
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsPageComponent, decorators: [{
|
|
527
558
|
type: Component,
|
|
528
|
-
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [
|
|
529
|
-
}] });
|
|
559
|
+
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=\"showTableview()\">\n <mng-tableview-route [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n</div>\n" }]
|
|
560
|
+
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
530
561
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
.
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
562
|
+
var MngRevEntityWithChangesDto_1;
|
|
563
|
+
let MngRevEntityWithChangesDto = class MngRevEntityWithChangesDto {
|
|
564
|
+
static { MngRevEntityWithChangesDto_1 = this; }
|
|
565
|
+
static { this.attributeTypeMap = [
|
|
566
|
+
{
|
|
567
|
+
name: 'revEntity',
|
|
568
|
+
baseName: 'revEntity',
|
|
569
|
+
type: '{ [key: string]: any; }'
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'entityNameChangesMap',
|
|
573
|
+
baseName: 'entityNameChangesMap',
|
|
574
|
+
type: '{ [key: string]: Array<EntityChange>; }'
|
|
575
|
+
}
|
|
576
|
+
]; }
|
|
577
|
+
static getAttributeTypeMap() {
|
|
578
|
+
return MngRevEntityWithChangesDto_1.attributeTypeMap;
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
MngRevEntityWithChangesDto = MngRevEntityWithChangesDto_1 = __decorate([
|
|
582
|
+
TypeName('MngRevEntityWithChangesDto')
|
|
583
|
+
], MngRevEntityWithChangesDto);
|
|
584
|
+
ObjectSerializer.get().registerType(MngRevEntityWithChangesDto);
|
|
585
|
+
|
|
586
|
+
let MngRevEntity = class MngRevEntity {
|
|
587
|
+
};
|
|
588
|
+
MngRevEntity = __decorate([
|
|
589
|
+
TypeName('MngRevEntity')
|
|
590
|
+
], MngRevEntity);
|
|
538
591
|
|
|
539
|
-
let
|
|
592
|
+
let MngRevEntityDetailed = class MngRevEntityDetailed extends MngRevEntity {
|
|
540
593
|
};
|
|
541
|
-
|
|
542
|
-
TypeName('
|
|
543
|
-
],
|
|
594
|
+
MngRevEntityDetailed = __decorate([
|
|
595
|
+
TypeName('MngRevEntityDetailed')
|
|
596
|
+
], MngRevEntityDetailed);
|
|
544
597
|
|
|
545
|
-
|
|
598
|
+
let MngEntityRevisionChangeState = class MngEntityRevisionChangeState {
|
|
599
|
+
};
|
|
600
|
+
MngEntityRevisionChangeState = __decorate([
|
|
601
|
+
TypeName('MngEntityRevisionChangeState')
|
|
602
|
+
], MngEntityRevisionChangeState);
|
|
603
|
+
|
|
604
|
+
let MngEntityRevisionChanges = class MngEntityRevisionChanges {
|
|
605
|
+
};
|
|
606
|
+
MngEntityRevisionChanges = __decorate([
|
|
607
|
+
TypeName('MngEntityChanges')
|
|
608
|
+
], MngEntityRevisionChanges);
|
|
609
|
+
|
|
610
|
+
class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
546
611
|
constructor() {
|
|
547
612
|
super(...arguments);
|
|
613
|
+
this.destroyRef = inject(DestroyRef);
|
|
548
614
|
this.entityChanges = [];
|
|
615
|
+
this.modelFetched = new BehaviorSubject(false);
|
|
616
|
+
this.auditModel = [];
|
|
549
617
|
}
|
|
550
618
|
ngOnInit() {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
619
|
+
this.fieldValue = this.formControl.value;
|
|
620
|
+
this.injector
|
|
621
|
+
?.get(MngAuditService, undefined, { optional: true })
|
|
622
|
+
?.auditModel$.pipe(takeUntilDestroyed(this.destroyRef))
|
|
623
|
+
.subscribe({
|
|
624
|
+
next: model => {
|
|
625
|
+
this.auditModel = model;
|
|
626
|
+
if (this.fieldValue) {
|
|
627
|
+
for (const key of Object.keys(this.fieldValue)) {
|
|
628
|
+
const ec = new MngEntityRevisionChanges();
|
|
629
|
+
ec.entityType = key;
|
|
630
|
+
ec.items = [];
|
|
631
|
+
for (const change of this.fieldValue[key]) {
|
|
632
|
+
if (change.revType === MngRevisionTypeDto.Add && change.entityNewState) {
|
|
633
|
+
const item = new MngEntityRevisionChangeState();
|
|
634
|
+
item.revType = change.revType;
|
|
635
|
+
item.color = 'green';
|
|
636
|
+
Object.entries(change.entityNewState).forEach(([key, value]) => (item[key] = value));
|
|
637
|
+
ec.items.push(item);
|
|
638
|
+
}
|
|
639
|
+
else if (change.revType === MngRevisionTypeDto.Del && change.entityOldState) {
|
|
640
|
+
const item = new MngEntityRevisionChangeState();
|
|
641
|
+
item.revType = change.revType;
|
|
642
|
+
item.color = 'red';
|
|
643
|
+
Object.entries(change.entityOldState).forEach(([key, value]) => (item[key] = value));
|
|
644
|
+
ec.items.push(item);
|
|
645
|
+
}
|
|
646
|
+
else if (change.revType === MngRevisionTypeDto.Mod && change.entityOldState && change.entityNewState) {
|
|
647
|
+
const itemOld = new MngEntityRevisionChangeState();
|
|
648
|
+
itemOld.revType = change.revType;
|
|
649
|
+
itemOld.color = 'red';
|
|
650
|
+
Object.entries(change.entityOldState).forEach(([key, value]) => (itemOld[key] = value));
|
|
651
|
+
const itemNew = new MngEntityRevisionChangeState();
|
|
652
|
+
itemNew.revType = change.revType;
|
|
653
|
+
itemNew.color = 'green';
|
|
654
|
+
Object.entries(change.entityNewState).forEach(([key, value]) => (itemNew[key] = value));
|
|
655
|
+
ec.items.push(itemOld);
|
|
656
|
+
ec.items.push(itemNew);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
this.entityChanges.push(ec);
|
|
660
|
+
}
|
|
661
|
+
this.modelFetched.next(true);
|
|
565
662
|
}
|
|
566
663
|
}
|
|
567
|
-
|
|
568
|
-
}
|
|
664
|
+
});
|
|
569
665
|
}
|
|
570
|
-
|
|
666
|
+
createDescriptor(entityChanges) {
|
|
571
667
|
const changedFields = [];
|
|
572
|
-
if (entityChanges.items && entityChanges.items[0].revType ===
|
|
668
|
+
if (entityChanges.items && entityChanges.items[0].revType === MngRevisionTypeDto.Mod) {
|
|
573
669
|
for (const key in entityChanges.items[0]) {
|
|
574
670
|
if (entityChanges.items[0][key] !== entityChanges.items[1][key]) {
|
|
575
671
|
changedFields.push(key);
|
|
576
672
|
}
|
|
577
673
|
}
|
|
578
674
|
}
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
.
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
675
|
+
const guiEntityModel = this.auditModel.filter(m => m.entityName === entityChanges.entityType)[0];
|
|
676
|
+
const desc = new TableDescriptor(MngEntityRevisionChangeState, undefined, undefined, guiEntityModel.entityName).withClassName('py-2');
|
|
677
|
+
if (guiEntityModel.entityName) {
|
|
678
|
+
desc.withTitle(guiEntityModel.entityName);
|
|
679
|
+
}
|
|
680
|
+
desc.addColumn('revType').withTitle('MngEntityRevisionChangeState.properties.revType').asEnum(MngRevisionTypeDto);
|
|
681
|
+
if (guiEntityModel.properties) {
|
|
682
|
+
AuditUtil.addColumnsFromModel(desc, guiEntityModel.properties, undefined, false, false);
|
|
683
|
+
}
|
|
684
|
+
desc.withRowClassName(undefined, (_, item) => (item ? (item.color === 'green' ? 'audit-row-added' : 'audit-row-deleted') : ''));
|
|
685
|
+
desc.columns.forEach(col => {
|
|
586
686
|
if (changedFields.length > 0 && changedFields.some(val => col.property === val)) {
|
|
587
687
|
col.withClassName('audit-cell');
|
|
588
688
|
}
|
|
589
689
|
});
|
|
590
|
-
|
|
690
|
+
desc.withPaginationMode(TablePaginationModeEnum.Pagination);
|
|
691
|
+
desc.withCurrentColumnsReorderable();
|
|
692
|
+
desc.withCurrentColumnsToggleable();
|
|
693
|
+
desc.withDataKey(`EntityChangeField_${entityChanges.entityType ?? 'default'}`);
|
|
694
|
+
return desc;
|
|
591
695
|
}
|
|
592
696
|
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]=\"
|
|
697
|
+
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; else loading\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n<ng-template #loading>\n <div class=\"text-center\">\n <i class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\n </div>\n</ng-template>\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
698
|
}
|
|
595
699
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityChangesFieldComponent, decorators: [{
|
|
596
700
|
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]=\"
|
|
701
|
+
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [NgForOf, MngTableComponent, NgIf, AsyncPipe], template: "<div *ngIf=\"modelFetched | async; else loading\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n<ng-template #loading>\n <div class=\"text-center\">\n <i class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\n </div>\n</ng-template>\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"] }]
|
|
702
|
+
}], propDecorators: { injector: [{
|
|
703
|
+
type: Input
|
|
704
|
+
}] } });
|
|
705
|
+
|
|
706
|
+
class MngAuditRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
707
|
+
constructor() {
|
|
708
|
+
super(...arguments);
|
|
709
|
+
this.destroyRef = inject(DestroyRef);
|
|
710
|
+
this.injector = inject(Injector);
|
|
711
|
+
this.auditService = inject(MngAuditService);
|
|
712
|
+
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
713
|
+
this.showTableview = signal(false);
|
|
714
|
+
}
|
|
715
|
+
ngOnInit() {
|
|
716
|
+
this.auditService.revModel$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
|
717
|
+
next: model => {
|
|
718
|
+
this.revModel = model;
|
|
719
|
+
super.ngOnInit();
|
|
720
|
+
setTimeout(() => this.showTableview.set(true));
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
createTableviewDescriptor() {
|
|
725
|
+
if (this.revModel) {
|
|
726
|
+
const idProperty = this.revModel.properties?.filter(prop => prop.isId).map(prop => prop.resolvedPropertyName)[0];
|
|
727
|
+
const desc = new TableviewDescriptor(MngRevEntity, idProperty, undefined, this.revModel.entityName);
|
|
728
|
+
const detailsDescriptor = new EditorDescriptor(MngRevEntityWithChangesDto, 'revEntity.' + idProperty, undefined, TableviewEditorTypeEnum.Details);
|
|
729
|
+
if (this.revModel.properties) {
|
|
730
|
+
AuditUtil.addColumnsFromModel(desc.table, this.revModel.properties);
|
|
731
|
+
AuditUtil.addFieldsFromModel(detailsDescriptor, this.revModel.properties);
|
|
732
|
+
}
|
|
733
|
+
detailsDescriptor.addField('entityNameChangesMap').asCustomComponent(EntityChangesFieldComponent, ['field-no-label'], { injector: this.injector }).withDisabled();
|
|
734
|
+
desc.withDetailsDescriptor(detailsDescriptor); // MngRevEntity is extended by MngRevEntityWithChangesDto, so no real harm here
|
|
735
|
+
desc.table.withFilterDisplay(TableFilterDisplayEnum.Row);
|
|
736
|
+
return desc;
|
|
737
|
+
}
|
|
738
|
+
return new TableviewDescriptor(MngRevEntity);
|
|
739
|
+
}
|
|
740
|
+
createTableviewDataProvider() {
|
|
741
|
+
if (this.revModel) {
|
|
742
|
+
return new TableviewDataProvider(MngRevEntity).withGetAll(qp => combineLatest([this.revisisonsApiService.getRevisionCount(qp), this.revisisonsApiService.getRevisionList(qp)]).pipe(map(([count, values]) => MediusQueryResult.fromArray(values, count))));
|
|
743
|
+
}
|
|
744
|
+
return new TableviewDataProvider(MngRevEntity);
|
|
745
|
+
}
|
|
746
|
+
createActionDescriptors() {
|
|
747
|
+
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'revision-details')
|
|
748
|
+
.withPosition(ActionPositionEnum.RowClick)
|
|
749
|
+
.withRouteTrigger(':itemId')
|
|
750
|
+
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
751
|
+
.withFetchFunction(ctx => ctx.parameters.itemId
|
|
752
|
+
? this.revisisonsApiService.getAllChangesForRevision(ctx.parameters.itemId).pipe(map(item => {
|
|
753
|
+
const revEntityWithChanges = new MngRevEntityDetailed();
|
|
754
|
+
revEntityWithChanges.rev = ctx.parameters.itemId;
|
|
755
|
+
revEntityWithChanges.revEntity = item.revEntity;
|
|
756
|
+
revEntityWithChanges.entityNameChangesMap = item.entityNameChangesMap;
|
|
757
|
+
return revEntityWithChanges;
|
|
758
|
+
}))
|
|
759
|
+
: throwError(() => new MngErrorInternal('No revision id provided for fetch function')));
|
|
760
|
+
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
761
|
+
return [detailsAction];
|
|
762
|
+
}
|
|
763
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
764
|
+
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=\"showTableview()\" [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 }); }
|
|
765
|
+
}
|
|
766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, decorators: [{
|
|
767
|
+
type: Component,
|
|
768
|
+
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [NgIf, MngTableviewComponent, AsyncPipe, MngTableviewComponent, RouterOutlet, JsonPipe, MngTableviewRouteComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-tableview-route *ngIf=\"showTableview()\" [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview-route>\n" }]
|
|
598
769
|
}] });
|
|
599
770
|
|
|
771
|
+
function provideMngAuditRoutes(config) {
|
|
772
|
+
return RoutesBuilder.create()
|
|
773
|
+
.addRouteBuilder(RouteBuilder.create('', MngAuditPageComponent)
|
|
774
|
+
.withProvider(MngAuditService)
|
|
775
|
+
.withProvider(MngAuditService)
|
|
776
|
+
.withProvider(MngAuditRevisionsApiService)
|
|
777
|
+
.withProvider({
|
|
778
|
+
provide: MNG_AUDIT_MODULE_CONFIG_IT,
|
|
779
|
+
useValue: config
|
|
780
|
+
})
|
|
781
|
+
.addChildBuilder(RouteBuilder.createRedirect('', 'revisions', 'full'))
|
|
782
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('revisions', MngAuditRevisionsPageComponent)
|
|
783
|
+
.withMenuItem('pi pi-history', 'pages.revisions.title')
|
|
784
|
+
.withTitle('pages.revisions.title'))
|
|
785
|
+
.addChildBuilder(RouteBuilder.create('entity-revisions', MngAuditEntityRevisionsPageComponent)
|
|
786
|
+
.withMenuItem('pi pi-history', 'pages.entityRevisions.title')
|
|
787
|
+
.withTitle('pages.entityRevisions.title'))
|
|
788
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('entity-revisions/:entityClass', MngAuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title')))
|
|
789
|
+
.build();
|
|
790
|
+
}
|
|
791
|
+
|
|
600
792
|
/**
|
|
601
793
|
* Generated bundle index. Do not edit.
|
|
602
794
|
*/
|
|
603
795
|
|
|
604
|
-
export { EntityChangesFieldComponent,
|
|
796
|
+
export { EntityChangesFieldComponent, provideMngAuditRoutes };
|
|
605
797
|
//# sourceMappingURL=mediusinc-mng-commons-audit.mjs.map
|