@mediusinc/mng-commons-audit 5.0.0-rc.0-c31d5206 → 5.0.0-rc.0
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 +12 -26
- package/esm2022/lib/api/models/entityChange.mjs +10 -10
- package/esm2022/lib/api/models/guiEntityModel.mjs +10 -10
- package/esm2022/lib/api/models/guiPropertyModel.mjs +10 -10
- package/esm2022/lib/api/models/guiPropertyType.mjs +13 -13
- package/esm2022/lib/api/models/guiRelationModel.mjs +10 -10
- package/esm2022/lib/api/models/revEntityWithChangesDto.mjs +10 -10
- package/esm2022/lib/api/models/revEntityWithStateDto.mjs +10 -10
- package/esm2022/lib/api/models/revisionType.mjs +11 -10
- package/esm2022/lib/api/services/audit-revisions-api.service.mjs +15 -15
- package/esm2022/lib/api/services/audit.service.mjs +12 -12
- package/esm2022/lib/audit.routes.mjs +17 -16
- package/esm2022/lib/components/entity-changes-field/entity-changes-field.component.mjs +15 -12
- package/esm2022/lib/components/pages/audit/audit.page.component.mjs +5 -5
- package/esm2022/lib/components/pages/entity-revisions/audit-entity-revisions.page.component.mjs +24 -20
- package/esm2022/lib/components/pages/revisions/audit-revisions.page.component.mjs +22 -19
- package/esm2022/lib/models/config.model.mjs +1 -1
- package/esm2022/lib/models/entity-revision-change-state.model.mjs +6 -6
- package/esm2022/lib/models/entity-revision-changes.model.mjs +6 -6
- package/esm2022/lib/models/guiEntityModelWithI18n.model.mjs +7 -7
- package/esm2022/lib/models/rev-entity-detailed.model.mjs +7 -7
- package/esm2022/lib/models/rev-entity.model.mjs +6 -6
- package/esm2022/lib/models/revEntityWithId.model.mjs +8 -8
- package/esm2022/lib/service/module-config.token.mjs +2 -2
- package/esm2022/lib/utils/audit.util.mjs +26 -24
- package/fesm2022/mediusinc-mng-commons-audit.mjs +150 -143
- package/fesm2022/mediusinc-mng-commons-audit.mjs.map +1 -1
- package/lib/api/models/entityChange.d.ts +4 -4
- package/lib/api/models/guiEntityModel.d.ts +4 -4
- package/lib/api/models/guiPropertyModel.d.ts +6 -6
- package/lib/api/models/guiPropertyType.d.ts +1 -1
- package/lib/api/models/guiRelationModel.d.ts +2 -2
- package/lib/api/models/revEntityWithChangesDto.d.ts +4 -4
- package/lib/api/models/revEntityWithStateDto.d.ts +4 -4
- package/lib/api/models/revisionType.d.ts +2 -2
- package/lib/api/services/audit-revisions-api.service.d.ts +13 -13
- package/lib/api/services/audit.service.d.ts +7 -7
- package/lib/audit.routes.d.ts +5 -5
- package/lib/components/entity-changes-field/entity-changes-field.component.d.ts +6 -6
- package/lib/components/pages/audit/audit.page.component.d.ts +3 -3
- package/lib/components/pages/entity-revisions/audit-entity-revisions.page.component.d.ts +15 -14
- package/lib/components/pages/revisions/audit-revisions.page.component.d.ts +9 -9
- package/lib/models/config.model.d.ts +1 -1
- package/lib/models/entity-revision-change-state.model.d.ts +3 -3
- package/lib/models/entity-revision-changes.model.d.ts +3 -3
- package/lib/models/guiEntityModelWithI18n.model.d.ts +2 -2
- package/lib/models/rev-entity-detailed.model.d.ts +4 -4
- package/lib/models/rev-entity.model.d.ts +2 -2
- package/lib/models/revEntityWithId.model.d.ts +2 -2
- package/lib/service/module-config.token.d.ts +2 -2
- package/lib/utils/audit.util.d.ts +15 -13
- package/package.json +3 -2
- /package/{assets/i18n → i18n}/en.json +0 -0
- /package/{assets/i18n → i18n}/sl.json +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TypeName, TypeRegistry,
|
|
1
|
+
import { TypeName, TypeRegistry, CommonsConfigurationService, DataListParamsUtil, CommonsInternalError, itemIdToDefined, RouteBuilder, RoutesBuilder } from '@mediusinc/mng-commons/core';
|
|
2
|
+
import { TableviewComponent, TableviewRouteBuilder } from '@mediusinc/mng-commons/tableview';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
4
|
import { InjectionToken, inject, Injectable, Component, ChangeDetectionStrategy, computed, signal, effect, DestroyRef, Input, Injector } from '@angular/core';
|
|
4
5
|
import { shareReplay, throwError, BehaviorSubject } from 'rxjs';
|
|
5
6
|
import { map } from 'rxjs/operators';
|
|
6
|
-
import {
|
|
7
|
+
import { ACommonsBaseV1ApiService } from '@mediusinc/mng-commons-data-api-class/v1';
|
|
7
8
|
import { __decorate } from 'tslib';
|
|
8
9
|
import { RouterOutlet, Router, ActivatedRoute } from '@angular/router';
|
|
9
10
|
import { AsyncPipe, JsonPipe } from '@angular/common';
|
|
@@ -13,13 +14,19 @@ import { FormsModule } from '@angular/forms';
|
|
|
13
14
|
import { FormlyModule } from '@ngx-formly/core';
|
|
14
15
|
import * as i2 from '@ngx-translate/core';
|
|
15
16
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
17
|
+
import { DropdownComponent } from '@mediusinc/mng-commons/form';
|
|
18
|
+
import { LookupDataProvider } from '@mediusinc/mng-commons/form/api';
|
|
19
|
+
import { TableviewDescriptor, TableviewDataProvider, ActionEditorDetailsDescriptor, AFormlyCustomFieldComponent, EditorDescriptor, TableviewEditorTypeEnum } from '@mediusinc/mng-commons/tableview/api';
|
|
16
20
|
import { HttpParams } from '@angular/common/http';
|
|
21
|
+
import { enumModel, enumModelGeneric, ModelDescriptor } from '@mediusinc/mng-commons/model';
|
|
22
|
+
import { TableComponent } from '@mediusinc/mng-commons/table';
|
|
23
|
+
import { TableDescriptor, TablePaginationModeEnum } from '@mediusinc/mng-commons/table/api';
|
|
17
24
|
|
|
18
|
-
const
|
|
25
|
+
const COMMONS_AUDIT_MODULE_CONFIG_IT = new InjectionToken('CommonsAuditModuleConfig');
|
|
19
26
|
|
|
20
|
-
var
|
|
21
|
-
let
|
|
22
|
-
static {
|
|
27
|
+
var GuiEntityModelDto_1;
|
|
28
|
+
let GuiEntityModelDto = class GuiEntityModelDto {
|
|
29
|
+
static { GuiEntityModelDto_1 = this; }
|
|
23
30
|
static { this.attributeTypeMap = [
|
|
24
31
|
{
|
|
25
32
|
name: 'entityName',
|
|
@@ -33,20 +40,20 @@ let MngGuiEntityModelDto = class MngGuiEntityModelDto {
|
|
|
33
40
|
}
|
|
34
41
|
]; }
|
|
35
42
|
static getAttributeTypeMap() {
|
|
36
|
-
return
|
|
43
|
+
return GuiEntityModelDto_1.attributeTypeMap;
|
|
37
44
|
}
|
|
38
45
|
};
|
|
39
|
-
|
|
46
|
+
GuiEntityModelDto = GuiEntityModelDto_1 = __decorate([
|
|
40
47
|
TypeName('MngGuiEntityModelDto')
|
|
41
|
-
],
|
|
42
|
-
TypeRegistry.get().registerType(
|
|
48
|
+
], GuiEntityModelDto);
|
|
49
|
+
TypeRegistry.get().registerType(GuiEntityModelDto);
|
|
43
50
|
|
|
44
|
-
class
|
|
51
|
+
class AuditService extends ACommonsBaseV1ApiService {
|
|
45
52
|
constructor() {
|
|
46
53
|
super();
|
|
47
54
|
this.CACHE_SIZE = 1;
|
|
48
|
-
this.moduleConfig = inject(
|
|
49
|
-
this.configService =
|
|
55
|
+
this.moduleConfig = inject(COMMONS_AUDIT_MODULE_CONFIG_IT);
|
|
56
|
+
this.configService = CommonsConfigurationService.get();
|
|
50
57
|
}
|
|
51
58
|
getServiceBasePath() {
|
|
52
59
|
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
@@ -70,27 +77,27 @@ class MngAuditService extends AMngBaseObsoleteV1ApiService {
|
|
|
70
77
|
return this.http.get(this.getUrl('/rev-model'));
|
|
71
78
|
}
|
|
72
79
|
requestAuditModel() {
|
|
73
|
-
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response,
|
|
80
|
+
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response, GuiEntityModelDto)));
|
|
74
81
|
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
76
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
83
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditService }); }
|
|
77
84
|
}
|
|
78
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditService, decorators: [{
|
|
79
86
|
type: Injectable
|
|
80
87
|
}], ctorParameters: () => [] });
|
|
81
88
|
|
|
82
|
-
class
|
|
83
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
84
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type:
|
|
89
|
+
class AuditPageComponent {
|
|
90
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
91
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: AuditPageComponent, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
85
92
|
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditPageComponent, decorators: [{
|
|
87
94
|
type: Component,
|
|
88
95
|
args: [{ standalone: true, selector: 'mng-audit-page', imports: [RouterOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<router-outlet></router-outlet>\n" }]
|
|
89
96
|
}] });
|
|
90
97
|
|
|
91
|
-
var
|
|
92
|
-
let
|
|
93
|
-
static {
|
|
98
|
+
var RevEntityWithStateDto_1;
|
|
99
|
+
let RevEntityWithStateDto = class RevEntityWithStateDto {
|
|
100
|
+
static { RevEntityWithStateDto_1 = this; }
|
|
94
101
|
static { this.attributeTypeMap = [
|
|
95
102
|
{
|
|
96
103
|
name: 'revEntity',
|
|
@@ -114,20 +121,20 @@ let MngRevEntityWithStateDto = class MngRevEntityWithStateDto {
|
|
|
114
121
|
}
|
|
115
122
|
]; }
|
|
116
123
|
static getAttributeTypeMap() {
|
|
117
|
-
return
|
|
124
|
+
return RevEntityWithStateDto_1.attributeTypeMap;
|
|
118
125
|
}
|
|
119
126
|
};
|
|
120
|
-
|
|
127
|
+
RevEntityWithStateDto = RevEntityWithStateDto_1 = __decorate([
|
|
121
128
|
TypeName('MngRevEntityWithStateDto')
|
|
122
|
-
],
|
|
123
|
-
TypeRegistry.get().registerType(
|
|
129
|
+
], RevEntityWithStateDto);
|
|
130
|
+
TypeRegistry.get().registerType(RevEntityWithStateDto);
|
|
124
131
|
|
|
125
|
-
let
|
|
132
|
+
let RevEntityWithId = class RevEntityWithId extends RevEntityWithStateDto {
|
|
126
133
|
};
|
|
127
|
-
|
|
134
|
+
RevEntityWithId = __decorate([
|
|
128
135
|
TypeName('MngRevEntityWithId')
|
|
129
|
-
],
|
|
130
|
-
TypeRegistry.get().registerType(
|
|
136
|
+
], RevEntityWithId);
|
|
137
|
+
TypeRegistry.get().registerType(RevEntityWithId);
|
|
131
138
|
|
|
132
139
|
/**
|
|
133
140
|
* Medius quarkus sampler
|
|
@@ -140,17 +147,17 @@ TypeRegistry.get().registerType(MngRevEntityWithId);
|
|
|
140
147
|
* https://openapi-generator.tech
|
|
141
148
|
* Do not edit the class manually.
|
|
142
149
|
*/
|
|
143
|
-
var
|
|
144
|
-
(function (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})(
|
|
153
|
-
TypeRegistry.get().registerEnum(
|
|
150
|
+
var GuiPropertyTypeDto;
|
|
151
|
+
(function (GuiPropertyTypeDto) {
|
|
152
|
+
GuiPropertyTypeDto["LocalDate"] = "LOCAL_DATE";
|
|
153
|
+
GuiPropertyTypeDto["OffsetDateTime"] = "OFFSET_DATE_TIME";
|
|
154
|
+
GuiPropertyTypeDto["String"] = "STRING";
|
|
155
|
+
GuiPropertyTypeDto["Number"] = "NUMBER";
|
|
156
|
+
GuiPropertyTypeDto["Boolean"] = "BOOLEAN";
|
|
157
|
+
GuiPropertyTypeDto["Enum"] = "ENUM";
|
|
158
|
+
GuiPropertyTypeDto["Wildcard"] = "WILDCARD";
|
|
159
|
+
})(GuiPropertyTypeDto || (GuiPropertyTypeDto = {}));
|
|
160
|
+
TypeRegistry.get().registerEnum(GuiPropertyTypeDto, 'MngGuiPropertyTypeDto');
|
|
154
161
|
|
|
155
162
|
/**
|
|
156
163
|
* Medius quarkus sampler
|
|
@@ -163,26 +170,26 @@ TypeRegistry.get().registerEnum(MngGuiPropertyTypeDto, 'MngGuiPropertyTypeDto');
|
|
|
163
170
|
* https://openapi-generator.tech
|
|
164
171
|
* Do not edit the class manually.
|
|
165
172
|
*/
|
|
166
|
-
var
|
|
167
|
-
(function (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})(
|
|
172
|
-
TypeRegistry.get().registerEnum(
|
|
173
|
-
const revisionTypeEnum = enumModel(
|
|
173
|
+
var RevisionTypeDto;
|
|
174
|
+
(function (RevisionTypeDto) {
|
|
175
|
+
RevisionTypeDto["Add"] = "ADD";
|
|
176
|
+
RevisionTypeDto["Mod"] = "MOD";
|
|
177
|
+
RevisionTypeDto["Del"] = "DEL";
|
|
178
|
+
})(RevisionTypeDto || (RevisionTypeDto = {}));
|
|
179
|
+
TypeRegistry.get().registerEnum(RevisionTypeDto, 'MngRevisionTypeDto');
|
|
180
|
+
const revisionTypeEnum = enumModel(RevisionTypeDto.Add, RevisionTypeDto, 'MngRevisionTypeDto');
|
|
174
181
|
|
|
175
|
-
let
|
|
182
|
+
let EntityRevisionChangeState = class EntityRevisionChangeState {
|
|
176
183
|
};
|
|
177
|
-
|
|
184
|
+
EntityRevisionChangeState = __decorate([
|
|
178
185
|
TypeName('MngEntityRevisionChangeState')
|
|
179
|
-
],
|
|
186
|
+
], EntityRevisionChangeState);
|
|
180
187
|
|
|
181
|
-
let
|
|
188
|
+
let EntityRevisionChanges = class EntityRevisionChanges {
|
|
182
189
|
};
|
|
183
|
-
|
|
190
|
+
EntityRevisionChanges = __decorate([
|
|
184
191
|
TypeName('MngEntityChanges')
|
|
185
|
-
],
|
|
192
|
+
], EntityRevisionChanges);
|
|
186
193
|
|
|
187
194
|
class AuditUtil {
|
|
188
195
|
static { this._dateRegex = /\d{4}-[01]\d-[0-3]\d/; }
|
|
@@ -191,7 +198,7 @@ class AuditUtil {
|
|
|
191
198
|
if (!property.resolvedPropertyName) {
|
|
192
199
|
continue;
|
|
193
200
|
}
|
|
194
|
-
const isEnum = property.propertyType ===
|
|
201
|
+
const isEnum = property.propertyType === GuiPropertyTypeDto.Enum;
|
|
195
202
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
196
203
|
let column = null;
|
|
197
204
|
if (isEnum) {
|
|
@@ -212,16 +219,16 @@ class AuditUtil {
|
|
|
212
219
|
}
|
|
213
220
|
}
|
|
214
221
|
}
|
|
215
|
-
else if (property.propertyType ===
|
|
222
|
+
else if (property.propertyType === GuiPropertyTypeDto.Number) {
|
|
216
223
|
column = descriptor.addColumnUnsafe(property.resolvedPropertyName).asNumber();
|
|
217
224
|
}
|
|
218
|
-
else if (property.propertyType ===
|
|
225
|
+
else if (property.propertyType === GuiPropertyTypeDto.Boolean) {
|
|
219
226
|
column = descriptor.addColumnUnsafe(property.resolvedPropertyName).asBoolean();
|
|
220
227
|
}
|
|
221
|
-
else if (property.propertyType ===
|
|
228
|
+
else if (property.propertyType === GuiPropertyTypeDto.LocalDate) {
|
|
222
229
|
column = descriptor.addColumnUnsafe(property.resolvedPropertyName).asDate('dd. MM yyyy');
|
|
223
230
|
}
|
|
224
|
-
else if (property.propertyType ===
|
|
231
|
+
else if (property.propertyType === GuiPropertyTypeDto.OffsetDateTime) {
|
|
225
232
|
column = descriptor.addColumnUnsafe(property.resolvedPropertyName).asDate('dd. MM yyyy HH:mm');
|
|
226
233
|
}
|
|
227
234
|
else {
|
|
@@ -253,7 +260,7 @@ class AuditUtil {
|
|
|
253
260
|
continue;
|
|
254
261
|
}
|
|
255
262
|
const fieldPrepend = `${modelType}.`;
|
|
256
|
-
if (property.propertyType ===
|
|
263
|
+
if (property.propertyType === GuiPropertyTypeDto.Enum) {
|
|
257
264
|
const enumModel = AuditUtil.findEnum(property);
|
|
258
265
|
if (enumModel) {
|
|
259
266
|
if (!property.possibleEnumValues) {
|
|
@@ -265,27 +272,27 @@ class AuditUtil {
|
|
|
265
272
|
descriptor.addFieldUnsafe(fieldPrepend + property.resolvedPropertyName).withLabel(AuditUtil.getPropertyTitleKey(property, modelType));
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
|
-
else if (property.propertyType ===
|
|
275
|
+
else if (property.propertyType === GuiPropertyTypeDto.Number) {
|
|
269
276
|
descriptor
|
|
270
277
|
.addFieldUnsafe(fieldPrepend + property.resolvedPropertyName)
|
|
271
278
|
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
272
279
|
.asNumber()
|
|
273
280
|
.withDisabled();
|
|
274
281
|
}
|
|
275
|
-
else if (property.propertyType ===
|
|
282
|
+
else if (property.propertyType === GuiPropertyTypeDto.Boolean) {
|
|
276
283
|
descriptor
|
|
277
284
|
.addFieldUnsafe(fieldPrepend + property.resolvedPropertyName)
|
|
278
285
|
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
279
286
|
.withDisabled();
|
|
280
287
|
}
|
|
281
|
-
else if (property.propertyType ===
|
|
288
|
+
else if (property.propertyType === GuiPropertyTypeDto.LocalDate) {
|
|
282
289
|
descriptor
|
|
283
290
|
.addFieldUnsafe(fieldPrepend + property.resolvedPropertyName)
|
|
284
291
|
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
285
292
|
.asDatePicker({ format: 'dd. MMM yyyy' })
|
|
286
293
|
.withDisabled();
|
|
287
294
|
}
|
|
288
|
-
else if (property.propertyType ===
|
|
295
|
+
else if (property.propertyType === GuiPropertyTypeDto.OffsetDateTime) {
|
|
289
296
|
descriptor
|
|
290
297
|
.addFieldUnsafe(fieldPrepend + property.resolvedPropertyName)
|
|
291
298
|
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
@@ -365,30 +372,30 @@ class AuditUtil {
|
|
|
365
372
|
static mapItemsToEntityChangesArray(fieldValue) {
|
|
366
373
|
const entityChanges = [];
|
|
367
374
|
for (const key of Object.keys(fieldValue)) {
|
|
368
|
-
const ec = new
|
|
375
|
+
const ec = new EntityRevisionChanges();
|
|
369
376
|
ec.entityType = key;
|
|
370
377
|
ec.items = [];
|
|
371
378
|
for (const change of fieldValue[key]) {
|
|
372
|
-
if (change.revType ===
|
|
373
|
-
const item = new
|
|
379
|
+
if (change.revType === RevisionTypeDto.Add && change.entityNewState) {
|
|
380
|
+
const item = new EntityRevisionChangeState();
|
|
374
381
|
item.revType = change.revType;
|
|
375
382
|
item.color = 'green';
|
|
376
383
|
Object.entries(change.entityNewState).forEach(([key, value]) => (item[key] = value));
|
|
377
384
|
ec.items.push(item);
|
|
378
385
|
}
|
|
379
|
-
else if (change.revType ===
|
|
380
|
-
const item = new
|
|
386
|
+
else if (change.revType === RevisionTypeDto.Del && change.entityOldState) {
|
|
387
|
+
const item = new EntityRevisionChangeState();
|
|
381
388
|
item.revType = change.revType;
|
|
382
389
|
item.color = 'red';
|
|
383
390
|
Object.entries(change.entityOldState).forEach(([key, value]) => (item[key] = value));
|
|
384
391
|
ec.items.push(item);
|
|
385
392
|
}
|
|
386
|
-
else if (change.revType ===
|
|
387
|
-
const itemOld = new
|
|
393
|
+
else if (change.revType === RevisionTypeDto.Mod && change.entityOldState && change.entityNewState) {
|
|
394
|
+
const itemOld = new EntityRevisionChangeState();
|
|
388
395
|
itemOld.revType = change.revType;
|
|
389
396
|
itemOld.color = 'red';
|
|
390
397
|
Object.entries(change.entityOldState).forEach(([key, value]) => (itemOld[key] = value));
|
|
391
|
-
const itemNew = new
|
|
398
|
+
const itemNew = new EntityRevisionChangeState();
|
|
392
399
|
itemNew.revType = change.revType;
|
|
393
400
|
itemNew.color = 'green';
|
|
394
401
|
Object.entries(change.entityNewState).forEach(([key, value]) => (itemNew[key] = value));
|
|
@@ -402,11 +409,11 @@ class AuditUtil {
|
|
|
402
409
|
}
|
|
403
410
|
}
|
|
404
411
|
|
|
405
|
-
class
|
|
412
|
+
class AuditRevisionsApiService extends ACommonsBaseV1ApiService {
|
|
406
413
|
constructor() {
|
|
407
414
|
super();
|
|
408
|
-
this.moduleConfig = inject(
|
|
409
|
-
this.configService =
|
|
415
|
+
this.moduleConfig = inject(COMMONS_AUDIT_MODULE_CONFIG_IT);
|
|
416
|
+
this.configService = CommonsConfigurationService.get();
|
|
410
417
|
}
|
|
411
418
|
getServiceBasePath() {
|
|
412
419
|
return this.moduleConfig.apiServiceBasePath ?? '';
|
|
@@ -429,41 +436,41 @@ class MngAuditRevisionsApiService extends AMngBaseObsoleteV1ApiService {
|
|
|
429
436
|
})
|
|
430
437
|
.pipe(map(res => {
|
|
431
438
|
return {
|
|
432
|
-
data: this.deserializeClassArray(res.data,
|
|
439
|
+
data: this.deserializeClassArray(res.data, RevEntityWithStateDto),
|
|
433
440
|
totalCount: res.totalCount
|
|
434
441
|
};
|
|
435
442
|
}));
|
|
436
443
|
}
|
|
437
444
|
fetchRevisionsWithStateForEntityType(entityType, revId, itemId) {
|
|
438
|
-
return this.http.get(this.getUrl(`/states/${entityType}?rev=eq:${revId}&id=eq:${itemId}`)).pipe(map(res => this.deserializeClassArray(res.data,
|
|
445
|
+
return this.http.get(this.getUrl(`/states/${entityType}?rev=eq:${revId}&id=eq:${itemId}`)).pipe(map(res => this.deserializeClassArray(res.data, RevEntityWithId).map(i => {
|
|
439
446
|
i.mergedId = i.revEntity?.['rev'] + '_' + i.entityState?.['id'];
|
|
440
447
|
return i;
|
|
441
448
|
})), map(items => {
|
|
442
449
|
if (items.length > 0) {
|
|
443
450
|
return items[0];
|
|
444
451
|
}
|
|
445
|
-
throw new
|
|
452
|
+
throw new CommonsInternalError(`Entity revision ${revId} for ${entityType} with id ${itemId} was not found`);
|
|
446
453
|
}));
|
|
447
454
|
}
|
|
448
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
449
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
455
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditRevisionsApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
456
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditRevisionsApiService }); }
|
|
450
457
|
}
|
|
451
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
458
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditRevisionsApiService, decorators: [{
|
|
452
459
|
type: Injectable
|
|
453
460
|
}], ctorParameters: () => [] });
|
|
454
461
|
|
|
455
|
-
let
|
|
462
|
+
let GuiEntityModelWithI18n = class GuiEntityModelWithI18n extends GuiEntityModelDto {
|
|
456
463
|
};
|
|
457
|
-
|
|
464
|
+
GuiEntityModelWithI18n = __decorate([
|
|
458
465
|
TypeName('MngGuiEntityModelWithI18n')
|
|
459
|
-
],
|
|
466
|
+
], GuiEntityModelWithI18n);
|
|
460
467
|
|
|
461
|
-
class
|
|
468
|
+
class AuditEntityRevisionsPageComponent {
|
|
462
469
|
constructor() {
|
|
463
470
|
this.router = inject(Router);
|
|
464
471
|
this.route = inject(ActivatedRoute);
|
|
465
472
|
this.translate = inject(TranslateService);
|
|
466
|
-
this.auditService = inject(
|
|
473
|
+
this.auditService = inject(AuditService);
|
|
467
474
|
this.revModel = toSignal(this.auditService.revModel$);
|
|
468
475
|
this.auditModel = toSignal(this.auditService.auditModel$);
|
|
469
476
|
this.entityClass = toSignal(this.route.paramMap.pipe(map(pm => pm.get('entityClass') ?? undefined)));
|
|
@@ -485,7 +492,7 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
485
492
|
if (!revModel || !selectedRevisionEntity?.entityName) {
|
|
486
493
|
return undefined;
|
|
487
494
|
}
|
|
488
|
-
const desc = TableviewDescriptor.fromClass(
|
|
495
|
+
const desc = TableviewDescriptor.fromClass(RevEntityWithId, 'mergedId', undefined, selectedRevisionEntity.entityName);
|
|
489
496
|
AuditUtil.buildDescriptorForEntityRevision(desc, revModel, selectedRevisionEntity);
|
|
490
497
|
desc.table.withColumnsResizable();
|
|
491
498
|
desc.table.withCurrentColumnsReorderable();
|
|
@@ -500,11 +507,11 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
500
507
|
}
|
|
501
508
|
const entityName = selectedRevisionEntity.entityName;
|
|
502
509
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
503
|
-
return TableviewDataProvider.fromClassWithService(
|
|
510
|
+
return TableviewDataProvider.fromClassWithService(RevEntityWithId, AuditRevisionsApiService).withGetAll((params, service) => selectedRevisionEntity.entityName
|
|
504
511
|
? service.listRevisionsWithStateForEntityType(params, entityName).pipe(map(res => {
|
|
505
512
|
const revEntityWithStateAndIdList = [];
|
|
506
513
|
for (const revEntityWithState of res.data) {
|
|
507
|
-
const revEntityWithStateAndId = new
|
|
514
|
+
const revEntityWithStateAndId = new RevEntityWithId();
|
|
508
515
|
revEntityWithStateAndId.mergedId = revEntityWithState.revEntity?.['rev'] + '_' + revEntityWithState.entityState?.['id'];
|
|
509
516
|
revEntityWithStateAndId.revType = revEntityWithState.revType;
|
|
510
517
|
revEntityWithStateAndId.revEntity = revEntityWithState.revEntity;
|
|
@@ -514,7 +521,7 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
514
521
|
}
|
|
515
522
|
return { data: revEntityWithStateAndIdList, totalCount: res.totalCount };
|
|
516
523
|
}))
|
|
517
|
-
: throwError(() => new
|
|
524
|
+
: throwError(() => new CommonsInternalError('No revision entity is provided for list.')));
|
|
518
525
|
});
|
|
519
526
|
this.actions = computed(() => {
|
|
520
527
|
const selectedRevisionEntity = this.selectedRevisionEntity();
|
|
@@ -523,13 +530,13 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
523
530
|
return [];
|
|
524
531
|
}
|
|
525
532
|
const entityName = selectedRevisionEntity.entityName;
|
|
526
|
-
const detailsAction = ActionEditorDetailsDescriptor.createWithProvider(descriptor.detailsEditor,
|
|
533
|
+
const detailsAction = ActionEditorDetailsDescriptor.createWithProvider(descriptor.detailsEditor, AuditRevisionsApiService)
|
|
527
534
|
.withFetchFunction(ctx => {
|
|
528
535
|
if (!entityName) {
|
|
529
|
-
return throwError(() => new
|
|
536
|
+
return throwError(() => new CommonsInternalError('No revision entity is provided for details.'));
|
|
530
537
|
}
|
|
531
538
|
if (!ctx.parameters.itemId) {
|
|
532
|
-
return throwError(() => new
|
|
539
|
+
return throwError(() => new CommonsInternalError('No item id for revision entity details is provided.'));
|
|
533
540
|
}
|
|
534
541
|
const revId = ctx.parameters.itemId.toString().split('_')[0];
|
|
535
542
|
const itemId = ctx.parameters.itemId.toString().split('_')[1];
|
|
@@ -538,7 +545,7 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
538
545
|
.withEditorTitle('pages.entityRevisions.actions.details.editor.title');
|
|
539
546
|
return [detailsAction];
|
|
540
547
|
});
|
|
541
|
-
this.revisionEntitiesLookupProvider = LookupDataProvider.fromClass(
|
|
548
|
+
this.revisionEntitiesLookupProvider = LookupDataProvider.fromClass(GuiEntityModelWithI18n).withLookup(() => this.auditService.auditModel$.pipe(map(model => {
|
|
542
549
|
const modelI18n = model;
|
|
543
550
|
modelI18n.sort((m1, m2) => {
|
|
544
551
|
if (m1.entityName && m2.entityName) {
|
|
@@ -576,17 +583,17 @@ class MngAuditEntityRevisionsPageComponent {
|
|
|
576
583
|
this.router.navigate(['/audit/entity-revisions/']);
|
|
577
584
|
}
|
|
578
585
|
}
|
|
579
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
580
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type:
|
|
586
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditEntityRevisionsPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
587
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type: AuditEntityRevisionsPageComponent, isStandalone: true, selector: "mng-audit-entity-revisions-page", providers: [AuditRevisionsApiService], 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 optionsLabelProperty=\"entityNameI18n\"\n [ngModel]=\"selectedRevisionEntity()\"\n (valueChange)=\"onRevisionEntityChange($event)\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"\n [showClear]=\"true\"></mng-dropdown>\n @if (!selectedRevisionEntity()) {\n <small class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n }\n </div>\n</div>\n@if (showTableview() && descriptor()) {\n <mng-tableview [descriptor]=\"descriptor()!\" [dataProvider]=\"dataProvider()\" [actions]=\"actions()\"></mng-tableview>\n}\n", dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur"], outputs: ["valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: TableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
581
588
|
}
|
|
582
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditEntityRevisionsPageComponent, decorators: [{
|
|
583
590
|
type: Component,
|
|
584
|
-
args: [{ standalone: true, selector: 'mng-audit-entity-revisions-page', imports: [
|
|
591
|
+
args: [{ standalone: true, selector: 'mng-audit-entity-revisions-page', imports: [DropdownComponent, FormsModule, AsyncPipe, TranslateModule, FormlyModule, TableviewComponent], providers: [AuditRevisionsApiService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"card\">\n <div class=\"field mb-0\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [placeholder]=\"'pages.entityRevisions.dropdown.placeholder' | translate\"\n optionsLabelProperty=\"entityNameI18n\"\n [ngModel]=\"selectedRevisionEntity()\"\n (valueChange)=\"onRevisionEntityChange($event)\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"\n [showClear]=\"true\"></mng-dropdown>\n @if (!selectedRevisionEntity()) {\n <small class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n }\n </div>\n</div>\n@if (showTableview() && descriptor()) {\n <mng-tableview [descriptor]=\"descriptor()!\" [dataProvider]=\"dataProvider()\" [actions]=\"actions()\"></mng-tableview>\n}\n" }]
|
|
585
592
|
}], ctorParameters: () => [] });
|
|
586
593
|
|
|
587
|
-
var
|
|
588
|
-
let
|
|
589
|
-
static {
|
|
594
|
+
var RevEntityWithChangesDto_1;
|
|
595
|
+
let RevEntityWithChangesDto = class RevEntityWithChangesDto {
|
|
596
|
+
static { RevEntityWithChangesDto_1 = this; }
|
|
590
597
|
static { this.attributeTypeMap = [
|
|
591
598
|
{
|
|
592
599
|
name: 'revEntity',
|
|
@@ -600,27 +607,27 @@ let MngRevEntityWithChangesDto = class MngRevEntityWithChangesDto {
|
|
|
600
607
|
}
|
|
601
608
|
]; }
|
|
602
609
|
static getAttributeTypeMap() {
|
|
603
|
-
return
|
|
610
|
+
return RevEntityWithChangesDto_1.attributeTypeMap;
|
|
604
611
|
}
|
|
605
612
|
};
|
|
606
|
-
|
|
613
|
+
RevEntityWithChangesDto = RevEntityWithChangesDto_1 = __decorate([
|
|
607
614
|
TypeName('MngRevEntityWithChangesDto')
|
|
608
|
-
],
|
|
609
|
-
TypeRegistry.get().registerType(
|
|
615
|
+
], RevEntityWithChangesDto);
|
|
616
|
+
TypeRegistry.get().registerType(RevEntityWithChangesDto);
|
|
610
617
|
|
|
611
|
-
let
|
|
618
|
+
let RevEntity = class RevEntity {
|
|
612
619
|
};
|
|
613
|
-
|
|
620
|
+
RevEntity = __decorate([
|
|
614
621
|
TypeName('MngRevEntity')
|
|
615
|
-
],
|
|
622
|
+
], RevEntity);
|
|
616
623
|
|
|
617
|
-
let
|
|
624
|
+
let RevEntityDetailed = class RevEntityDetailed extends RevEntity {
|
|
618
625
|
};
|
|
619
|
-
|
|
626
|
+
RevEntityDetailed = __decorate([
|
|
620
627
|
TypeName('MngRevEntityDetailed')
|
|
621
|
-
],
|
|
628
|
+
], RevEntityDetailed);
|
|
622
629
|
|
|
623
|
-
class EntityChangesFieldComponent extends
|
|
630
|
+
class EntityChangesFieldComponent extends AFormlyCustomFieldComponent {
|
|
624
631
|
constructor() {
|
|
625
632
|
super(...arguments);
|
|
626
633
|
this.destroyRef = inject(DestroyRef);
|
|
@@ -631,7 +638,7 @@ class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
|
631
638
|
ngOnInit() {
|
|
632
639
|
this.fieldValue = this.formControl.value;
|
|
633
640
|
this.injector
|
|
634
|
-
?.get(
|
|
641
|
+
?.get(AuditService, undefined, { optional: true })
|
|
635
642
|
?.auditModel$.pipe(takeUntilDestroyed(this.destroyRef))
|
|
636
643
|
.subscribe({
|
|
637
644
|
next: model => {
|
|
@@ -642,13 +649,13 @@ class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
|
642
649
|
}
|
|
643
650
|
},
|
|
644
651
|
error: err => {
|
|
645
|
-
throw new
|
|
652
|
+
throw new CommonsInternalError('Error while trying to fetch audit model from audit service', { name: 'EntityChangesFieldComponentError', cause: err });
|
|
646
653
|
}
|
|
647
654
|
});
|
|
648
655
|
}
|
|
649
656
|
createDescriptor(entityChanges) {
|
|
650
657
|
const changedFields = [];
|
|
651
|
-
if (entityChanges.items && entityChanges.items[0].revType ===
|
|
658
|
+
if (entityChanges.items && entityChanges.items[0].revType === RevisionTypeDto.Mod) {
|
|
652
659
|
for (const key in entityChanges.items[0]) {
|
|
653
660
|
if (entityChanges.items[0][key] !== entityChanges.items[1][key]) {
|
|
654
661
|
changedFields.push(key);
|
|
@@ -656,7 +663,7 @@ class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
|
656
663
|
}
|
|
657
664
|
}
|
|
658
665
|
const guiEntityModel = this.auditModel.filter(m => m.entityName === entityChanges.entityType)[0];
|
|
659
|
-
const desc = TableDescriptor.fromClass(
|
|
666
|
+
const desc = TableDescriptor.fromClass(EntityRevisionChangeState, undefined, undefined, guiEntityModel.entityName).withClassName('py-2');
|
|
660
667
|
if (guiEntityModel.entityName) {
|
|
661
668
|
desc.withTitle(guiEntityModel.entityName);
|
|
662
669
|
}
|
|
@@ -677,32 +684,32 @@ class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
|
677
684
|
return desc;
|
|
678
685
|
}
|
|
679
686
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: EntityChangesFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
680
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type: EntityChangesFieldComponent, isStandalone: true, selector: "mng-entity-changes-field", inputs: { injector: "injector" }, usesInheritance: true, ngImport: i0, template: "@if (modelFetched | async) {\n <div>\n @for (ec of entityChanges; track ec) {\n <mng-table [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n }\n </div>\n} @else {\n <div class=\"text-center\">\n <i class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\n </div>\n}\n", styles: ["::ng-deep tr.audit-row-deleted{background:#ff3d331a!important}::ng-deep tr.audit-row-deleted .audit-cell{background:#f6544c4d!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:#1bc5624d!important}\n"], dependencies: [{ kind: "component", type:
|
|
687
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type: EntityChangesFieldComponent, isStandalone: true, selector: "mng-entity-changes-field", inputs: { injector: "injector" }, usesInheritance: true, ngImport: i0, template: "@if (modelFetched | async) {\n <div>\n @for (ec of entityChanges; track ec) {\n <mng-table [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n }\n </div>\n} @else {\n <div class=\"text-center\">\n <i class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\n </div>\n}\n", styles: ["::ng-deep tr.audit-row-deleted{background:#ff3d331a!important}::ng-deep tr.audit-row-deleted .audit-cell{background:#f6544c4d!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:#1bc5624d!important}\n"], dependencies: [{ kind: "component", type: TableComponent, selector: "mng-table", inputs: ["descriptor", "items", "result", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "columnLastMinWidth", "captionComponent", "columnCustomLastComponent", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnCustomLastComponentInstance"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
681
688
|
}
|
|
682
689
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: EntityChangesFieldComponent, decorators: [{
|
|
683
690
|
type: Component,
|
|
684
|
-
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [
|
|
691
|
+
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [TableComponent, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (modelFetched | async) {\n <div>\n @for (ec of entityChanges; track ec) {\n <mng-table [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n }\n </div>\n} @else {\n <div class=\"text-center\">\n <i class=\"pi pi-spin pi-spinner\" style=\"font-size: 2rem\"></i>\n </div>\n}\n", styles: ["::ng-deep tr.audit-row-deleted{background:#ff3d331a!important}::ng-deep tr.audit-row-deleted .audit-cell{background:#f6544c4d!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:#1bc5624d!important}\n"] }]
|
|
685
692
|
}], propDecorators: { injector: [{
|
|
686
693
|
type: Input
|
|
687
694
|
}] } });
|
|
688
695
|
|
|
689
|
-
class
|
|
696
|
+
class AuditRevisionsPageComponent {
|
|
690
697
|
constructor() {
|
|
691
698
|
this.injector = inject(Injector);
|
|
692
|
-
this.auditService = inject(
|
|
699
|
+
this.auditService = inject(AuditService);
|
|
693
700
|
this.revModel = toSignal(this.auditService.revModel$);
|
|
694
701
|
this.showTableview = computed(() => this.revModel() != null);
|
|
695
702
|
this.descriptor = computed(() => {
|
|
696
703
|
const revModel = this.revModel();
|
|
697
704
|
if (revModel) {
|
|
698
705
|
const idProperty = revModel.properties?.filter(prop => prop.isId).map(prop => prop.resolvedPropertyName)[0];
|
|
699
|
-
const model = ModelDescriptor.fromClass(
|
|
706
|
+
const model = ModelDescriptor.fromClass(RevEntity);
|
|
700
707
|
if (revModel.entityName)
|
|
701
708
|
model.withI18nBase(revModel.entityName);
|
|
702
709
|
if (idProperty)
|
|
703
710
|
model.withIdPropertyUnsafe(idProperty);
|
|
704
711
|
const desc = TableviewDescriptor.fromModel(model);
|
|
705
|
-
const detailsDescriptor = EditorDescriptor.fromClass(
|
|
712
|
+
const detailsDescriptor = EditorDescriptor.fromClass(RevEntityWithChangesDto, undefined, undefined, undefined, TableviewEditorTypeEnum.Details);
|
|
706
713
|
detailsDescriptor.model.withIdPropertyUnsafe('revEntity.' + idProperty);
|
|
707
714
|
if (revModel.properties) {
|
|
708
715
|
AuditUtil.addColumnsFromModel(desc.table, revModel.properties);
|
|
@@ -718,15 +725,15 @@ class MngAuditRevisionsPageComponent {
|
|
|
718
725
|
desc.withDetailsDescriptor(detailsDescriptor); // MngRevEntity is extended by MngRevEntityWithChangesDto, so no real harm here
|
|
719
726
|
return desc;
|
|
720
727
|
}
|
|
721
|
-
return TableviewDescriptor.fromClass(
|
|
728
|
+
return TableviewDescriptor.fromClass(RevEntity);
|
|
722
729
|
});
|
|
723
|
-
this.dataProvider = signal(TableviewDataProvider.fromClassWithService(
|
|
730
|
+
this.dataProvider = signal(TableviewDataProvider.fromClassWithService(RevEntity, AuditRevisionsApiService).withGetAll((params, service) => service.getRevisionList(params).pipe(map(res => ({ data: res.data, totalCount: res.totalCount })))));
|
|
724
731
|
this.actions = computed(() => {
|
|
725
732
|
console.log(this.descriptor());
|
|
726
|
-
const detailsAction = ActionEditorDetailsDescriptor.createWithProvider(this.descriptor().detailsEditor,
|
|
733
|
+
const detailsAction = ActionEditorDetailsDescriptor.createWithProvider(this.descriptor().detailsEditor, AuditRevisionsApiService).withFetchFunction(ctx => {
|
|
727
734
|
console.log(ctx);
|
|
728
735
|
return ctx.serviceInstance.getAllChangesForRevision(itemIdToDefined(ctx.parameters.itemId)).pipe(map(item => {
|
|
729
|
-
const revEntityWithChanges = new
|
|
736
|
+
const revEntityWithChanges = new RevEntityDetailed();
|
|
730
737
|
revEntityWithChanges.rev = ctx.parameters.itemId;
|
|
731
738
|
revEntityWithChanges.revEntity = item.revEntity;
|
|
732
739
|
revEntityWithChanges.entityNameChangesMap = item.entityNameChangesMap;
|
|
@@ -736,12 +743,12 @@ class MngAuditRevisionsPageComponent {
|
|
|
736
743
|
return [detailsAction];
|
|
737
744
|
});
|
|
738
745
|
}
|
|
739
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
740
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type:
|
|
746
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditRevisionsPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
747
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.1", type: AuditRevisionsPageComponent, isStandalone: true, selector: "mng-audit-revisions-page", providers: [AuditRevisionsApiService], ngImport: i0, template: "@if (showTableview()) {\n <mng-tableview [descriptor]=\"descriptor()\" [dataProvider]=\"dataProvider()\" [actions]=\"actions()\"></mng-tableview>\n}\n", dependencies: [{ kind: "component", type: TableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
741
748
|
}
|
|
742
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
749
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditRevisionsPageComponent, decorators: [{
|
|
743
750
|
type: Component,
|
|
744
|
-
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [
|
|
751
|
+
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [TableviewComponent, AsyncPipe, RouterOutlet, JsonPipe], providers: [AuditRevisionsApiService], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showTableview()) {\n <mng-tableview [descriptor]=\"descriptor()\" [dataProvider]=\"dataProvider()\" [actions]=\"actions()\"></mng-tableview>\n}\n" }]
|
|
745
752
|
}] });
|
|
746
753
|
|
|
747
754
|
/**
|
|
@@ -749,31 +756,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
749
756
|
* @param config Module config for audit section.
|
|
750
757
|
* @param routeConfig Optionally provide route configs.
|
|
751
758
|
*/
|
|
752
|
-
function
|
|
753
|
-
const routeBuilder = RouteBuilder.create('', config.rootPageComponent ??
|
|
754
|
-
.withProvider(
|
|
759
|
+
function provideAuditRoutes(config, routeConfig) {
|
|
760
|
+
const routeBuilder = RouteBuilder.create('', config.rootPageComponent ?? AuditPageComponent)
|
|
761
|
+
.withProvider(AuditService)
|
|
755
762
|
.withProvider({
|
|
756
|
-
provide:
|
|
763
|
+
provide: COMMONS_AUDIT_MODULE_CONFIG_IT,
|
|
757
764
|
useValue: config
|
|
758
765
|
})
|
|
759
766
|
.addChildBuilder(RouteBuilder.createRedirect('', routeConfig?.defaultRedirect ?? 'revisions', 'full'));
|
|
760
767
|
if (routeConfig?.preRevisionRoutes?.length) {
|
|
761
768
|
routeConfig.preRevisionRoutes.forEach(r => routeBuilder.addChildBuilder(r));
|
|
762
769
|
}
|
|
763
|
-
const revisionsRouteBuilder = TableviewRouteBuilder.fromComponent('revisions', config.revisionsPageComponent ??
|
|
770
|
+
const revisionsRouteBuilder = TableviewRouteBuilder.fromComponent('revisions', config.revisionsPageComponent ?? AuditRevisionsPageComponent)
|
|
764
771
|
.withTitle('pages.revisions.title')
|
|
765
772
|
.withAdd(false)
|
|
766
773
|
.withDelete(false)
|
|
767
774
|
.withEdit(false);
|
|
768
775
|
if (routeConfig?.revisionsMenuItem) {
|
|
769
|
-
revisionsRouteBuilder.
|
|
776
|
+
revisionsRouteBuilder.withCommonsMenuItem(routeConfig.revisionsMenuItem);
|
|
770
777
|
}
|
|
771
778
|
else {
|
|
772
779
|
revisionsRouteBuilder.withMenuItem('pi pi-book', 'pages.revisions.title');
|
|
773
780
|
}
|
|
774
|
-
const entityRevisionsRouteBuilder = RouteBuilder.create('entity-revisions', config.entityRevisionsPageComponent ??
|
|
781
|
+
const entityRevisionsRouteBuilder = RouteBuilder.create('entity-revisions', config.entityRevisionsPageComponent ?? AuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title');
|
|
775
782
|
if (routeConfig?.entityRevisionsMenuItem) {
|
|
776
|
-
entityRevisionsRouteBuilder.
|
|
783
|
+
entityRevisionsRouteBuilder.withCommonsMenuItem(routeConfig.entityRevisionsMenuItem);
|
|
777
784
|
}
|
|
778
785
|
else {
|
|
779
786
|
entityRevisionsRouteBuilder.withMenuItem('pi pi-building', 'pages.entityRevisions.title');
|
|
@@ -781,7 +788,7 @@ function provideMngAuditRoutes(config, routeConfig) {
|
|
|
781
788
|
routeBuilder
|
|
782
789
|
.addChildBuilder(revisionsRouteBuilder)
|
|
783
790
|
.addChildBuilder(entityRevisionsRouteBuilder)
|
|
784
|
-
.addChildBuilder(TableviewRouteBuilder.fromComponent('entity-revisions/:entityClass', config.entityRevisionsPageComponent ??
|
|
791
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('entity-revisions/:entityClass', config.entityRevisionsPageComponent ?? AuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title'));
|
|
785
792
|
if (routeConfig?.postRevisionRoutes?.length) {
|
|
786
793
|
routeConfig.postRevisionRoutes.forEach(r => routeBuilder.addChildBuilder(r));
|
|
787
794
|
}
|
|
@@ -792,5 +799,5 @@ function provideMngAuditRoutes(config, routeConfig) {
|
|
|
792
799
|
* Generated bundle index. Do not edit.
|
|
793
800
|
*/
|
|
794
801
|
|
|
795
|
-
export {
|
|
802
|
+
export { AuditEntityRevisionsPageComponent, AuditPageComponent, AuditRevisionsPageComponent, EntityChangesFieldComponent, provideAuditRoutes };
|
|
796
803
|
//# sourceMappingURL=mediusinc-mng-commons-audit.mjs.map
|