@mediusinc/mng-commons-audit 3.0.0-rc.1 → 3.0.0-rc.11
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/assets/i18n/en.json +17 -1
- package/assets/i18n/sl.json +18 -2
- 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 +9 -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 +14 -10
- package/esm2022/lib/api/services/audit.service.mjs +3 -3
- package/esm2022/lib/audit.routes.mjs +39 -21
- package/esm2022/lib/components/entity-changes-field/entity-changes-field.component.mjs +59 -25
- package/esm2022/lib/components/pages/entity-revisions/audit-entity-revisions-page.component.mjs +70 -38
- package/esm2022/lib/components/pages/revisions/audit-revisions-page.component.mjs +34 -25
- 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/rev-entity-detailed.model.mjs +9 -0
- package/esm2022/lib/models/rev-entity.model.mjs +8 -0
- package/esm2022/lib/models/revEntityWithId.model.mjs +8 -7
- package/esm2022/lib/utils/audit.util.mjs +101 -187
- package/fesm2022/mediusinc-mng-commons-audit.mjs +402 -491
- 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 +5 -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 +7 -6
- package/lib/api/services/audit.service.d.ts +3 -3
- package/lib/audit.routes.d.ts +13 -1
- package/lib/components/entity-changes-field/entity-changes-field.component.d.ts +6 -3
- package/lib/components/pages/entity-revisions/audit-entity-revisions-page.component.d.ts +12 -11
- package/lib/components/pages/revisions/audit-revisions-page.component.d.ts +9 -8
- 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/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 +2 -2
- package/lib/utils/audit.util.d.ts +8 -4
- package/package.json +10 -2
- package/esm2022/lib/api/models/index.mjs +0 -9
- package/esm2022/lib/models/entity-changes.model.mjs +0 -8
- package/lib/api/models/index.d.ts +0 -8
- package/lib/models/entity-changes.model.d.ts +0 -4
|
@@ -1,124 +1,61 @@
|
|
|
1
|
-
import { TypeName, ObjectSerializer, MediusFilterMatchType, AMngBaseApiService, MngConfigurationService, AMngTableviewRouteComponent, LookupDataProvider, TableviewDescriptor,
|
|
1
|
+
import { TypeName, ObjectSerializer, MediusFilterMatchType, AMngBaseApiService, MngConfigurationService, MngInternalError, AMngTableviewRouteComponent, LookupDataProvider, TableviewDescriptor, TableviewDataProvider, MediusQueryResult, ActionEditorDescriptor, ActionPositionEnum, ActionDataProviderUtil, TableviewActionDefaultCategories, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, MngDropdownComponent, MngTableviewRouteComponent, AMngFormlyCustomFieldComponent, TableDescriptor, TablePaginationModeEnum, MngTableComponent, EditorDescriptor, TableviewEditorTypeEnum, TableFilterDisplayEnum, MngTableviewComponent, RouteBuilder, TableviewRouteBuilder, RoutesBuilder } from '@mediusinc/mng-commons';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject, Injectable, Component, signal, Input, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, Injectable, Component, DestroyRef, signal, Input, Injector, ChangeDetectionStrategy } from '@angular/core';
|
|
4
4
|
import { map } from 'rxjs/operators';
|
|
5
5
|
import { __decorate } from 'tslib';
|
|
6
|
-
import { shareReplay,
|
|
6
|
+
import { of, shareReplay, combineLatest, throwError, BehaviorSubject } from 'rxjs';
|
|
7
7
|
import * as i1 from '@angular/router';
|
|
8
8
|
import { RouterOutlet } from '@angular/router';
|
|
9
9
|
import { NgIf, AsyncPipe, NgForOf, JsonPipe } from '@angular/common';
|
|
10
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
11
|
import * as i2 from '@angular/forms';
|
|
11
12
|
import { FormsModule } from '@angular/forms';
|
|
12
13
|
import { FormlyModule } from '@ngx-formly/core';
|
|
13
14
|
import * as i3 from '@ngx-translate/core';
|
|
14
15
|
import { TranslateModule } from '@ngx-translate/core';
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
static {
|
|
17
|
+
var MngRevEntityWithStateDto_1;
|
|
18
|
+
let MngRevEntityWithStateDto = class MngRevEntityWithStateDto {
|
|
19
|
+
static { MngRevEntityWithStateDto_1 = this; }
|
|
19
20
|
static { this.attributeTypeMap = [
|
|
21
|
+
{
|
|
22
|
+
name: 'revEntity',
|
|
23
|
+
baseName: 'revEntity',
|
|
24
|
+
type: '{ [key: string]: any; }'
|
|
25
|
+
},
|
|
20
26
|
{
|
|
21
27
|
name: 'revType',
|
|
22
28
|
baseName: 'revType',
|
|
23
29
|
type: 'RevisionType'
|
|
24
30
|
},
|
|
25
31
|
{
|
|
26
|
-
name: '
|
|
27
|
-
baseName: '
|
|
28
|
-
type: '
|
|
32
|
+
name: 'entityClassName',
|
|
33
|
+
baseName: 'entityClassName',
|
|
34
|
+
type: 'string'
|
|
29
35
|
},
|
|
30
36
|
{
|
|
31
|
-
name: '
|
|
32
|
-
baseName: '
|
|
37
|
+
name: 'entityState',
|
|
38
|
+
baseName: 'entityState',
|
|
33
39
|
type: '{ [key: string]: any; }'
|
|
34
40
|
}
|
|
35
41
|
]; }
|
|
36
42
|
static getAttributeTypeMap() {
|
|
37
|
-
return
|
|
43
|
+
return MngRevEntityWithStateDto_1.attributeTypeMap;
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
|
-
|
|
41
|
-
TypeName('
|
|
42
|
-
],
|
|
43
|
-
ObjectSerializer.get().registerType(
|
|
46
|
+
MngRevEntityWithStateDto = MngRevEntityWithStateDto_1 = __decorate([
|
|
47
|
+
TypeName('MngRevEntityWithStateDto')
|
|
48
|
+
], MngRevEntityWithStateDto);
|
|
49
|
+
ObjectSerializer.get().registerType(MngRevEntityWithStateDto);
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
let GuiEntityModel = class GuiEntityModel {
|
|
47
|
-
static { GuiEntityModel_1 = this; }
|
|
48
|
-
static { this.attributeTypeMap = [
|
|
49
|
-
{
|
|
50
|
-
name: 'entityName',
|
|
51
|
-
baseName: 'entityName',
|
|
52
|
-
type: 'string'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'properties',
|
|
56
|
-
baseName: 'properties',
|
|
57
|
-
type: 'Array<GuiPropertyModel>'
|
|
58
|
-
}
|
|
59
|
-
]; }
|
|
60
|
-
static getAttributeTypeMap() {
|
|
61
|
-
return GuiEntityModel_1.attributeTypeMap;
|
|
62
|
-
}
|
|
51
|
+
let MngRevEntityWithId = class MngRevEntityWithId extends MngRevEntityWithStateDto {
|
|
63
52
|
};
|
|
64
|
-
|
|
65
|
-
TypeName('
|
|
66
|
-
],
|
|
67
|
-
ObjectSerializer.get().registerType(
|
|
53
|
+
MngRevEntityWithId = __decorate([
|
|
54
|
+
TypeName('MngRevEntityWithId')
|
|
55
|
+
], MngRevEntityWithId);
|
|
56
|
+
ObjectSerializer.get().registerType(MngRevEntityWithId);
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
let GuiPropertyModel = class GuiPropertyModel {
|
|
71
|
-
static { GuiPropertyModel_1 = this; }
|
|
72
|
-
static { this.attributeTypeMap = [
|
|
73
|
-
{
|
|
74
|
-
name: 'propertyName',
|
|
75
|
-
baseName: 'propertyName',
|
|
76
|
-
type: 'string'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'resolvedPropertyName',
|
|
80
|
-
baseName: 'resolvedPropertyName',
|
|
81
|
-
type: 'string'
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'enumClassSimpleName',
|
|
85
|
-
baseName: 'enumClassSimpleName',
|
|
86
|
-
type: 'string'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'possibleEnumValues',
|
|
90
|
-
baseName: 'possibleEnumValues',
|
|
91
|
-
type: 'Array<string>'
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: 'isId',
|
|
95
|
-
baseName: 'isId',
|
|
96
|
-
type: 'boolean'
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: 'propertyType',
|
|
100
|
-
baseName: 'propertyType',
|
|
101
|
-
type: 'GuiPropertyType'
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: 'relationModel',
|
|
105
|
-
baseName: 'relationModel',
|
|
106
|
-
type: 'GuiRelationModel'
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'id',
|
|
110
|
-
baseName: 'id',
|
|
111
|
-
type: 'boolean'
|
|
112
|
-
}
|
|
113
|
-
]; }
|
|
114
|
-
static getAttributeTypeMap() {
|
|
115
|
-
return GuiPropertyModel_1.attributeTypeMap;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
GuiPropertyModel = GuiPropertyModel_1 = __decorate([
|
|
119
|
-
TypeName('GuiPropertyModel')
|
|
120
|
-
], GuiPropertyModel);
|
|
121
|
-
ObjectSerializer.get().registerType(GuiPropertyModel);
|
|
58
|
+
const MNG_AUDIT_MODULE_CONFIG_IT = new InjectionToken('MngAuditModuleConfig');
|
|
122
59
|
|
|
123
60
|
/**
|
|
124
61
|
* Medius quarkus sampler
|
|
@@ -131,104 +68,17 @@ ObjectSerializer.get().registerType(GuiPropertyModel);
|
|
|
131
68
|
* https://openapi-generator.tech
|
|
132
69
|
* Do not edit the class manually.
|
|
133
70
|
*/
|
|
134
|
-
var
|
|
135
|
-
(function (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
})(
|
|
144
|
-
ObjectSerializer.get().registerEnum(
|
|
145
|
-
|
|
146
|
-
var GuiRelationModel_1;
|
|
147
|
-
let GuiRelationModel = class GuiRelationModel {
|
|
148
|
-
static { GuiRelationModel_1 = this; }
|
|
149
|
-
static { this.attributeTypeMap = [
|
|
150
|
-
{
|
|
151
|
-
name: 'idPropertyName',
|
|
152
|
-
baseName: 'idPropertyName',
|
|
153
|
-
type: 'string'
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'isAudited',
|
|
157
|
-
baseName: 'isAudited',
|
|
158
|
-
type: 'boolean'
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: 'audited',
|
|
162
|
-
baseName: 'audited',
|
|
163
|
-
type: 'boolean'
|
|
164
|
-
}
|
|
165
|
-
]; }
|
|
166
|
-
static getAttributeTypeMap() {
|
|
167
|
-
return GuiRelationModel_1.attributeTypeMap;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
GuiRelationModel = GuiRelationModel_1 = __decorate([
|
|
171
|
-
TypeName('GuiRelationModel')
|
|
172
|
-
], GuiRelationModel);
|
|
173
|
-
ObjectSerializer.get().registerType(GuiRelationModel);
|
|
174
|
-
|
|
175
|
-
var RevEntityWithChangesDto_1;
|
|
176
|
-
let RevEntityWithChangesDto = class RevEntityWithChangesDto {
|
|
177
|
-
static { RevEntityWithChangesDto_1 = this; }
|
|
178
|
-
static { this.attributeTypeMap = [
|
|
179
|
-
{
|
|
180
|
-
name: 'revEntity',
|
|
181
|
-
baseName: 'revEntity',
|
|
182
|
-
type: '{ [key: string]: any; }'
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'entityNameChangesMap',
|
|
186
|
-
baseName: 'entityNameChangesMap',
|
|
187
|
-
type: '{ [key: string]: Array<EntityChange>; }'
|
|
188
|
-
}
|
|
189
|
-
]; }
|
|
190
|
-
static getAttributeTypeMap() {
|
|
191
|
-
return RevEntityWithChangesDto_1.attributeTypeMap;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
RevEntityWithChangesDto = RevEntityWithChangesDto_1 = __decorate([
|
|
195
|
-
TypeName('RevEntityWithChangesDto')
|
|
196
|
-
], RevEntityWithChangesDto);
|
|
197
|
-
ObjectSerializer.get().registerType(RevEntityWithChangesDto);
|
|
198
|
-
|
|
199
|
-
var RevEntityWithStateDto_1;
|
|
200
|
-
let RevEntityWithStateDto = class RevEntityWithStateDto {
|
|
201
|
-
static { RevEntityWithStateDto_1 = this; }
|
|
202
|
-
static { this.attributeTypeMap = [
|
|
203
|
-
{
|
|
204
|
-
name: 'revEntity',
|
|
205
|
-
baseName: 'revEntity',
|
|
206
|
-
type: '{ [key: string]: any; }'
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'revType',
|
|
210
|
-
baseName: 'revType',
|
|
211
|
-
type: 'RevisionType'
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: 'entityClassName',
|
|
215
|
-
baseName: 'entityClassName',
|
|
216
|
-
type: 'string'
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: 'entityState',
|
|
220
|
-
baseName: 'entityState',
|
|
221
|
-
type: '{ [key: string]: any; }'
|
|
222
|
-
}
|
|
223
|
-
]; }
|
|
224
|
-
static getAttributeTypeMap() {
|
|
225
|
-
return RevEntityWithStateDto_1.attributeTypeMap;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
RevEntityWithStateDto = RevEntityWithStateDto_1 = __decorate([
|
|
229
|
-
TypeName('RevEntityWithStateDto')
|
|
230
|
-
], RevEntityWithStateDto);
|
|
231
|
-
ObjectSerializer.get().registerType(RevEntityWithStateDto);
|
|
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');
|
|
232
82
|
|
|
233
83
|
/**
|
|
234
84
|
* Medius quarkus sampler
|
|
@@ -241,19 +91,13 @@ ObjectSerializer.get().registerType(RevEntityWithStateDto);
|
|
|
241
91
|
* https://openapi-generator.tech
|
|
242
92
|
* Do not edit the class manually.
|
|
243
93
|
*/
|
|
244
|
-
var
|
|
245
|
-
(function (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
})(
|
|
250
|
-
ObjectSerializer.get().registerEnum(
|
|
251
|
-
|
|
252
|
-
let RevEntityWithId = class RevEntityWithId extends RevEntityWithStateDto {
|
|
253
|
-
};
|
|
254
|
-
RevEntityWithId = __decorate([
|
|
255
|
-
TypeName('RevEntityWithId')
|
|
256
|
-
], RevEntityWithId);
|
|
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');
|
|
257
101
|
|
|
258
102
|
var NewMediusFilterMatchType;
|
|
259
103
|
(function (NewMediusFilterMatchType) {
|
|
@@ -275,225 +119,142 @@ var NewMediusFilterMatchType;
|
|
|
275
119
|
})(NewMediusFilterMatchType || (NewMediusFilterMatchType = {}));
|
|
276
120
|
|
|
277
121
|
class AuditUtil {
|
|
278
|
-
static addColumnsFromModel(descriptor,
|
|
279
|
-
for (const property of
|
|
280
|
-
if (property.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
+
}
|
|
287
147
|
}
|
|
288
|
-
else if (property.propertyType ===
|
|
289
|
-
descriptor.addColumn(property.resolvedPropertyName).
|
|
148
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Number) {
|
|
149
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asNumber();
|
|
290
150
|
}
|
|
291
|
-
else if (property.propertyType ===
|
|
292
|
-
descriptor.addColumn(property.resolvedPropertyName).
|
|
151
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Boolean) {
|
|
152
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asBoolean();
|
|
293
153
|
}
|
|
294
|
-
else if (property.propertyType ===
|
|
295
|
-
descriptor.addColumn(property.resolvedPropertyName).
|
|
154
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.LocalDate) {
|
|
155
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asDate('dd. MM yyyy');
|
|
296
156
|
}
|
|
297
|
-
else if (property.propertyType ===
|
|
298
|
-
descriptor.addColumn(property.resolvedPropertyName).
|
|
157
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.OffsetDateTime) {
|
|
158
|
+
column = descriptor.addColumn(columnPrepend + property.resolvedPropertyName).asDate('dd. MM yyyy HH:mm');
|
|
299
159
|
}
|
|
300
160
|
else {
|
|
301
161
|
// string / wildcard
|
|
302
|
-
descriptor.addColumn(property.resolvedPropertyName).
|
|
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();
|
|
303
170
|
}
|
|
304
171
|
}
|
|
305
172
|
return descriptor;
|
|
306
173
|
}
|
|
307
|
-
static
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
+
}
|
|
314
197
|
}
|
|
315
|
-
else if (property.propertyType ===
|
|
198
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Number) {
|
|
316
199
|
descriptor
|
|
317
|
-
.addField(
|
|
318
|
-
.withLabel(property
|
|
200
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
201
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
319
202
|
.asNumber()
|
|
320
203
|
.withDisabled();
|
|
321
204
|
}
|
|
322
|
-
else if (property.propertyType ===
|
|
205
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.Boolean) {
|
|
323
206
|
descriptor
|
|
324
|
-
.addField(
|
|
325
|
-
.withLabel(property
|
|
207
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
208
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
326
209
|
.withDisabled();
|
|
327
210
|
}
|
|
328
|
-
else if (property.propertyType ===
|
|
211
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.LocalDate) {
|
|
329
212
|
descriptor
|
|
330
|
-
.addField(
|
|
331
|
-
.withLabel(property
|
|
213
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
214
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
332
215
|
.asDatePicker('dd. MMM yyyy')
|
|
333
216
|
.withDisabled();
|
|
334
217
|
}
|
|
335
|
-
else if (property.propertyType ===
|
|
218
|
+
else if (property.propertyType === MngGuiPropertyTypeDto.OffsetDateTime) {
|
|
336
219
|
descriptor
|
|
337
|
-
.addField(
|
|
338
|
-
.withLabel(property
|
|
220
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
221
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
339
222
|
.asDatePicker('dd. MM yy', undefined, undefined, true, false)
|
|
340
223
|
.withDisabled();
|
|
341
224
|
}
|
|
342
225
|
else {
|
|
343
226
|
// string / wildcard
|
|
344
227
|
descriptor
|
|
345
|
-
.addField(
|
|
346
|
-
.withLabel(property
|
|
228
|
+
.addField(fieldPrepend + property.resolvedPropertyName)
|
|
229
|
+
.withLabel(AuditUtil.getPropertyTitleKey(property, modelType))
|
|
347
230
|
.withDisabled();
|
|
348
231
|
}
|
|
349
232
|
}
|
|
350
233
|
return descriptor;
|
|
351
234
|
}
|
|
352
235
|
static buildDescriptorForEntityRevision(descriptor, revModel, entityModel) {
|
|
353
|
-
descriptor
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
.
|
|
357
|
-
.
|
|
358
|
-
descriptor.addFieldLookupEnum('revType', ObjectSerializer.get().findEnum('RevisionType'), [RevisionType.Add, RevisionType.Mod, RevisionType.Del]).withLabel('revType');
|
|
359
|
-
for (const property of revModel.properties) {
|
|
360
|
-
if (property.propertyType === GuiPropertyType.Enum) {
|
|
361
|
-
// TODO is there a nicer way than appending "Dto" at the end of the simple name to match
|
|
362
|
-
descriptor
|
|
363
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
364
|
-
.withTitle(property.resolvedPropertyName)
|
|
365
|
-
.asEnum(ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'))
|
|
366
|
-
.withSort()
|
|
367
|
-
.withFilterLookupEnum(property.possibleEnumValues);
|
|
368
|
-
descriptor
|
|
369
|
-
.addFieldLookupEnum('revEntity.' + property.resolvedPropertyName, ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'), property.possibleEnumValues)
|
|
370
|
-
.withLabel(property.resolvedPropertyName);
|
|
371
|
-
}
|
|
372
|
-
else if (property.propertyType === GuiPropertyType.Number) {
|
|
373
|
-
descriptor
|
|
374
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
375
|
-
.withTitle(property.resolvedPropertyName)
|
|
376
|
-
.asNumber()
|
|
377
|
-
.withSort()
|
|
378
|
-
.withFilter();
|
|
379
|
-
descriptor
|
|
380
|
-
.addField('revEntity.' + property.resolvedPropertyName)
|
|
381
|
-
.withLabel(property.resolvedPropertyName)
|
|
382
|
-
.asNumber();
|
|
383
|
-
}
|
|
384
|
-
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
385
|
-
descriptor
|
|
386
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
387
|
-
.withTitle(property.resolvedPropertyName)
|
|
388
|
-
.asBoolean()
|
|
389
|
-
.withSort()
|
|
390
|
-
.withFilter();
|
|
391
|
-
descriptor.addField('revEntity.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
392
|
-
}
|
|
393
|
-
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
394
|
-
descriptor
|
|
395
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
396
|
-
.withTitle(property.resolvedPropertyName)
|
|
397
|
-
.asDate('dd. MMM yyyy')
|
|
398
|
-
.withSort()
|
|
399
|
-
.withFilter();
|
|
400
|
-
descriptor
|
|
401
|
-
.addField('revEntity.' + property.resolvedPropertyName)
|
|
402
|
-
.withLabel(property.resolvedPropertyName)
|
|
403
|
-
.asDatePicker('dd. MMM yyyy');
|
|
404
|
-
}
|
|
405
|
-
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
406
|
-
descriptor
|
|
407
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
408
|
-
.withTitle(property.resolvedPropertyName)
|
|
409
|
-
.asDate('dd. MMM yyyy HH:mm')
|
|
410
|
-
.withSort()
|
|
411
|
-
.withFilter();
|
|
412
|
-
descriptor
|
|
413
|
-
.addField('revEntity.' + property.resolvedPropertyName)
|
|
414
|
-
.withLabel(property.resolvedPropertyName)
|
|
415
|
-
.asDatePicker('dd. MM yy', undefined, undefined, true, false);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
// string / wildcard
|
|
419
|
-
descriptor
|
|
420
|
-
.addColumn('revEntity.' + property.resolvedPropertyName)
|
|
421
|
-
.withTitle(property.resolvedPropertyName)
|
|
422
|
-
.withSort()
|
|
423
|
-
.withFilter();
|
|
424
|
-
descriptor.addField('revEntity.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
425
|
-
}
|
|
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');
|
|
426
241
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
descriptor
|
|
431
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
432
|
-
.withTitle(property.resolvedPropertyName)
|
|
433
|
-
.asEnum(ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'))
|
|
434
|
-
.withSort()
|
|
435
|
-
.withFilterLookupEnum(property.possibleEnumValues);
|
|
436
|
-
descriptor
|
|
437
|
-
.addFieldLookupEnum('entityState.' + property.resolvedPropertyName, ObjectSerializer.get().findEnum(property.enumClassSimpleName + 'Dto'), property.possibleEnumValues)
|
|
438
|
-
.withLabel(property.resolvedPropertyName);
|
|
439
|
-
}
|
|
440
|
-
else if (property.propertyType === GuiPropertyType.Number) {
|
|
441
|
-
descriptor
|
|
442
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
443
|
-
.withTitle(property.resolvedPropertyName)
|
|
444
|
-
.asNumber()
|
|
445
|
-
.withSort()
|
|
446
|
-
.withFilter();
|
|
447
|
-
descriptor
|
|
448
|
-
.addField('entityState.' + property.resolvedPropertyName)
|
|
449
|
-
.withLabel(property.resolvedPropertyName)
|
|
450
|
-
.asNumber();
|
|
451
|
-
}
|
|
452
|
-
else if (property.propertyType === GuiPropertyType.Boolean) {
|
|
453
|
-
descriptor
|
|
454
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
455
|
-
.withTitle(property.resolvedPropertyName)
|
|
456
|
-
.asBoolean()
|
|
457
|
-
.withSort()
|
|
458
|
-
.withFilter();
|
|
459
|
-
descriptor.addField('entityState.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
460
|
-
}
|
|
461
|
-
else if (property.propertyType === GuiPropertyType.LocalDate) {
|
|
462
|
-
descriptor
|
|
463
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
464
|
-
.withTitle(property.resolvedPropertyName)
|
|
465
|
-
.asDate('dd. MMM yyyy')
|
|
466
|
-
.withSort()
|
|
467
|
-
.withFilter();
|
|
468
|
-
descriptor
|
|
469
|
-
.addField('entityState.' + property.resolvedPropertyName)
|
|
470
|
-
.withLabel(property.resolvedPropertyName)
|
|
471
|
-
.asDatePicker('dd. MMM yyyy');
|
|
472
|
-
}
|
|
473
|
-
else if (property.propertyType === GuiPropertyType.OffsetDateTime) {
|
|
474
|
-
descriptor
|
|
475
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
476
|
-
.withTitle(property.resolvedPropertyName)
|
|
477
|
-
.asDate('dd. MMM yyyy HH:mm')
|
|
478
|
-
.withSort()
|
|
479
|
-
.withFilter();
|
|
480
|
-
descriptor
|
|
481
|
-
.addField('entityState.' + property.resolvedPropertyName)
|
|
482
|
-
.withLabel(property.resolvedPropertyName)
|
|
483
|
-
.asDatePicker('dd. MM yy', undefined, undefined, true, false);
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
// string / wildcard
|
|
487
|
-
descriptor
|
|
488
|
-
.addColumn('entityState.' + property.resolvedPropertyName)
|
|
489
|
-
.withTitle(property.resolvedPropertyName)
|
|
490
|
-
.withSort()
|
|
491
|
-
.withFilter();
|
|
492
|
-
descriptor.addField('entityState.' + property.resolvedPropertyName).withLabel(property.resolvedPropertyName);
|
|
493
|
-
}
|
|
242
|
+
if (entityModel.properties) {
|
|
243
|
+
AuditUtil.addColumnsFromModel(descriptor.table, entityModel.properties, 'entityState');
|
|
244
|
+
AuditUtil.addFieldsFromModel(descriptor.detailsEditor, entityModel.properties, 'entityState');
|
|
494
245
|
}
|
|
495
246
|
return descriptor;
|
|
496
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
|
+
}
|
|
497
258
|
static extractPropertyName(fullPropertyName) {
|
|
498
259
|
if (fullPropertyName?.includes('entityState.')) {
|
|
499
260
|
return fullPropertyName.replace('entityState.', '');
|
|
@@ -509,12 +270,7 @@ class AuditUtil {
|
|
|
509
270
|
url += '&sorts=';
|
|
510
271
|
const sortingQPs = [];
|
|
511
272
|
for (let i = 0; i < queryParams.sortProperty.length; i++) {
|
|
512
|
-
|
|
513
|
-
sortingQPs.push(`asc:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
516
|
-
sortingQPs.push(`desc:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
517
|
-
}
|
|
273
|
+
sortingQPs.push(`${queryParams.sortAsc?.[i] ?? true ? 'asc' : 'desc'}:${this.extractPropertyName(queryParams.sortProperty[i])}`);
|
|
518
274
|
}
|
|
519
275
|
url += sortingQPs.join(',');
|
|
520
276
|
}
|
|
@@ -571,8 +327,6 @@ class AuditUtil {
|
|
|
571
327
|
}
|
|
572
328
|
}
|
|
573
329
|
|
|
574
|
-
const MNG_AUDIT_MODULE_CONFIG_IT = new InjectionToken('MngAuditModuleConfig');
|
|
575
|
-
|
|
576
330
|
class MngAuditRevisionsApiService extends AMngBaseApiService {
|
|
577
331
|
constructor() {
|
|
578
332
|
super();
|
|
@@ -597,13 +351,17 @@ class MngAuditRevisionsApiService extends AMngBaseApiService {
|
|
|
597
351
|
listRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
598
352
|
return this.http
|
|
599
353
|
.get(this.getUrl(`/states/${entityType}`, AuditUtil.appendMediusQueryParamsToUrl(queryParams)))
|
|
600
|
-
.pipe(map(response => this.deserializeClassArray(response,
|
|
354
|
+
.pipe(map(response => this.deserializeClassArray(response, MngRevEntityWithStateDto)));
|
|
601
355
|
}
|
|
602
356
|
fetchRevisionsWithStateForEntityType(entityType, revId, itemId) {
|
|
603
|
-
return this.http.get(this.getUrl(`/states/${entityType}?rev=eq:${revId}&id=eq:${itemId}`)).pipe(map(response => {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
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 MngInternalError(`Entity revision ${revId} for ${entityType} with id ${itemId} was not found`);
|
|
607
365
|
}));
|
|
608
366
|
}
|
|
609
367
|
countRevisionsWithStateForEntityType(queryParams, entityType) {
|
|
@@ -616,6 +374,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
616
374
|
type: Injectable
|
|
617
375
|
}], ctorParameters: function () { return []; } });
|
|
618
376
|
|
|
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
|
+
|
|
619
401
|
class MngAuditService extends AMngBaseApiService {
|
|
620
402
|
constructor() {
|
|
621
403
|
super();
|
|
@@ -645,7 +427,7 @@ class MngAuditService extends AMngBaseApiService {
|
|
|
645
427
|
return this.http.get(this.getUrl('/rev-model'));
|
|
646
428
|
}
|
|
647
429
|
requestAuditModel() {
|
|
648
|
-
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response,
|
|
430
|
+
return this.http.get(this.getUrl('/audit-models')).pipe(map(response => this.deserializeClassArray(response, MngGuiEntityModelDto)));
|
|
649
431
|
}
|
|
650
432
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
651
433
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditService }); }
|
|
@@ -667,24 +449,33 @@ class MngAuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
|
667
449
|
constructor(router) {
|
|
668
450
|
super();
|
|
669
451
|
this.router = router;
|
|
452
|
+
this.destroyRef = inject(DestroyRef);
|
|
670
453
|
this.auditService = inject(MngAuditService);
|
|
671
454
|
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
672
|
-
this.
|
|
673
|
-
this.revisionEntitiesLookupProvider = new LookupDataProvider(
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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
|
+
}))));
|
|
677
467
|
}
|
|
678
468
|
ngOnInit() {
|
|
679
|
-
this.route.paramMap.subscribe(params => {
|
|
469
|
+
this.route.paramMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(params => {
|
|
680
470
|
const entityClass = params.get('entityClass');
|
|
681
471
|
if (entityClass) {
|
|
682
|
-
this.auditService.auditModel
|
|
472
|
+
combineLatest([this.auditService.auditModel$, this.auditService.revModel$]).subscribe(([entities, revModel]) => {
|
|
473
|
+
this.revModel = revModel;
|
|
683
474
|
for (const e of entities) {
|
|
684
475
|
if (e.entityName === entityClass) {
|
|
685
476
|
this.selectedRevisionEntity = e;
|
|
686
477
|
super.ngOnInit();
|
|
687
|
-
setTimeout(() => this.
|
|
478
|
+
setTimeout(() => this.showTableview.set(true));
|
|
688
479
|
}
|
|
689
480
|
}
|
|
690
481
|
});
|
|
@@ -692,7 +483,7 @@ class MngAuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
|
692
483
|
});
|
|
693
484
|
}
|
|
694
485
|
onRevisionEntityChange() {
|
|
695
|
-
this.
|
|
486
|
+
this.showTableview.set(false);
|
|
696
487
|
if (this.selectedRevisionEntity) {
|
|
697
488
|
this.router.navigate(['/audit/entity-revisions/' + this.selectedRevisionEntity.entityName]);
|
|
698
489
|
}
|
|
@@ -701,94 +492,183 @@ class MngAuditEntityRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
|
701
492
|
}
|
|
702
493
|
}
|
|
703
494
|
createTableviewDescriptor() {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
495
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
496
|
+
throw new MngInternalError('No revision model or revision entity is provided for tableview.');
|
|
497
|
+
}
|
|
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;
|
|
707
505
|
}
|
|
708
506
|
createTableviewDataProvider() {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
507
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
508
|
+
throw new MngInternalError('No revision model or revision entity is provided for tableview.');
|
|
509
|
+
}
|
|
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 MngInternalError('No revision entity is provided for list.')));
|
|
726
529
|
}
|
|
727
530
|
createActionDescriptors() {
|
|
531
|
+
if (!this.revModel || !this.selectedRevisionEntity?.entityName) {
|
|
532
|
+
throw new MngInternalError('No revision model or revision entity is provided for tableview.');
|
|
533
|
+
}
|
|
534
|
+
const entityName = this.selectedRevisionEntity.entityName;
|
|
728
535
|
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'entity-revision-details')
|
|
729
536
|
.withPosition(ActionPositionEnum.RowClick)
|
|
730
537
|
.withRouteTrigger(':itemId')
|
|
731
538
|
.withFetchFunction(ActionDataProviderUtil.runFetchOrFail)
|
|
732
539
|
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
733
540
|
.withFetchFunction(ctx => {
|
|
541
|
+
if (!entityName) {
|
|
542
|
+
return throwError(() => new MngInternalError('No revision entity is provided for details.'));
|
|
543
|
+
}
|
|
544
|
+
if (!ctx.parameters.itemId) {
|
|
545
|
+
return throwError(() => new MngInternalError('No item id for revision entity details is provided.'));
|
|
546
|
+
}
|
|
734
547
|
const revId = ctx.parameters.itemId.toString().split('_')[0];
|
|
735
548
|
const itemId = ctx.parameters.itemId.toString().split('_')[1];
|
|
736
|
-
return this.revisisonsApiService.fetchRevisionsWithStateForEntityType(
|
|
549
|
+
return this.revisisonsApiService.fetchRevisionsWithStateForEntityType(entityName, revId, itemId);
|
|
737
550
|
});
|
|
738
551
|
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
739
552
|
return [detailsAction];
|
|
740
553
|
}
|
|
741
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 }); }
|
|
742
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngAuditEntityRevisionsPageComponent, isStandalone: true, selector: "mng-audit-entity-revisions-page", usesInheritance: true, ngImport: i0, template: "<div class=\"card\">\n <div class=\"field mb-0\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [placeholder]=\"'pages.entityRevisions.dropdown.placeholder' | translate\"\n [itemsLabelProperty]=\"'entityName'\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n <small *ngIf=\"!selectedRevisionEntity\" class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n </div>\n</div>\n<div *ngIf=\"
|
|
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 }] }); }
|
|
743
556
|
}
|
|
744
557
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditEntityRevisionsPageComponent, decorators: [{
|
|
745
558
|
type: Component,
|
|
746
|
-
args: [{ standalone: true, selector: 'mng-audit-entity-revisions-page', imports: [MngDropdownComponent, MngTableviewRouteComponent, FormsModule, AsyncPipe, NgIf, TranslateModule, FormlyModule], template: "<div class=\"card\">\n <div class=\"field mb-0\">\n <mng-dropdown\n id=\"revisionEntityDropdown\"\n [placeholder]=\"'pages.entityRevisions.dropdown.placeholder' | translate\"\n [itemsLabelProperty]=\"'entityName'\"\n [(ngModel)]=\"selectedRevisionEntity\"\n (valueChange)=\"onRevisionEntityChange()\"\n [dataProvider]=\"revisionEntitiesLookupProvider\"></mng-dropdown>\n <small *ngIf=\"!selectedRevisionEntity\" class=\"block\">\n {{ 'pages.entityRevisions.dropdown.helpText' | translate }}\n </small>\n </div>\n</div>\n<div *ngIf=\"
|
|
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" }]
|
|
747
560
|
}], ctorParameters: function () { return [{ type: i1.Router }]; } });
|
|
748
561
|
|
|
749
|
-
|
|
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);
|
|
591
|
+
|
|
592
|
+
let MngRevEntityDetailed = class MngRevEntityDetailed extends MngRevEntity {
|
|
750
593
|
};
|
|
751
|
-
|
|
752
|
-
TypeName('
|
|
753
|
-
],
|
|
594
|
+
MngRevEntityDetailed = __decorate([
|
|
595
|
+
TypeName('MngRevEntityDetailed')
|
|
596
|
+
], MngRevEntityDetailed);
|
|
597
|
+
|
|
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);
|
|
754
609
|
|
|
755
610
|
class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
756
611
|
constructor() {
|
|
757
612
|
super(...arguments);
|
|
613
|
+
this.destroyRef = inject(DestroyRef);
|
|
758
614
|
this.entityChanges = [];
|
|
759
615
|
this.modelFetched = new BehaviorSubject(false);
|
|
616
|
+
this.auditModel = [];
|
|
760
617
|
}
|
|
761
618
|
ngOnInit() {
|
|
762
|
-
this.
|
|
619
|
+
this.fieldValue = this.formControl.value;
|
|
620
|
+
this.injector
|
|
621
|
+
?.get(MngAuditService, undefined, { optional: true })
|
|
622
|
+
?.auditModel$.pipe(takeUntilDestroyed(this.destroyRef))
|
|
623
|
+
.subscribe({
|
|
763
624
|
next: model => {
|
|
764
625
|
this.auditModel = model;
|
|
765
|
-
if (
|
|
766
|
-
for (const key of Object.keys(this.
|
|
767
|
-
const ec = new
|
|
626
|
+
if (this.fieldValue) {
|
|
627
|
+
for (const key of Object.keys(this.fieldValue)) {
|
|
628
|
+
const ec = new MngEntityRevisionChanges();
|
|
768
629
|
ec.entityType = key;
|
|
769
630
|
ec.items = [];
|
|
770
|
-
for (const change of this.
|
|
771
|
-
if (change.revType ===
|
|
772
|
-
|
|
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);
|
|
773
638
|
}
|
|
774
|
-
else if (change.revType ===
|
|
775
|
-
|
|
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);
|
|
776
645
|
}
|
|
777
|
-
else {
|
|
778
|
-
|
|
779
|
-
|
|
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);
|
|
780
657
|
}
|
|
781
658
|
}
|
|
782
659
|
this.entityChanges.push(ec);
|
|
783
660
|
}
|
|
784
661
|
this.modelFetched.next(true);
|
|
785
662
|
}
|
|
663
|
+
},
|
|
664
|
+
error: err => {
|
|
665
|
+
throw new MngInternalError('Error while trying to fetch audit model from audit service', { name: 'EntityChangesFieldComponentError', cause: err });
|
|
786
666
|
}
|
|
787
667
|
});
|
|
788
668
|
}
|
|
789
669
|
createDescriptor(entityChanges) {
|
|
790
670
|
const changedFields = [];
|
|
791
|
-
if (entityChanges.items && entityChanges.items[0].revType ===
|
|
671
|
+
if (entityChanges.items && entityChanges.items[0].revType === MngRevisionTypeDto.Mod) {
|
|
792
672
|
for (const key in entityChanges.items[0]) {
|
|
793
673
|
if (entityChanges.items[0][key] !== entityChanges.items[1][key]) {
|
|
794
674
|
changedFields.push(key);
|
|
@@ -796,25 +676,32 @@ class EntityChangesFieldComponent extends AMngFormlyCustomFieldComponent {
|
|
|
796
676
|
}
|
|
797
677
|
}
|
|
798
678
|
const guiEntityModel = this.auditModel.filter(m => m.entityName === entityChanges.entityType)[0];
|
|
799
|
-
const desc = new TableDescriptor(
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
679
|
+
const desc = new TableDescriptor(MngEntityRevisionChangeState, undefined, undefined, guiEntityModel.entityName).withClassName('py-2');
|
|
680
|
+
if (guiEntityModel.entityName) {
|
|
681
|
+
desc.withTitle(guiEntityModel.entityName);
|
|
682
|
+
}
|
|
683
|
+
desc.addColumn('revType').withTitle('MngEntityRevisionChangeState.properties.revType').asEnum(MngRevisionTypeDto);
|
|
684
|
+
if (guiEntityModel.properties) {
|
|
685
|
+
AuditUtil.addColumnsFromModel(desc, guiEntityModel.properties, undefined, false, false);
|
|
686
|
+
}
|
|
687
|
+
desc.withRowClassName(undefined, (_, item) => (item ? (item.color === 'green' ? 'audit-row-added' : 'audit-row-deleted') : ''));
|
|
803
688
|
desc.columns.forEach(col => {
|
|
804
|
-
col.withSort(false);
|
|
805
689
|
if (changedFields.length > 0 && changedFields.some(val => col.property === val)) {
|
|
806
690
|
col.withClassName('audit-cell');
|
|
807
691
|
}
|
|
808
692
|
});
|
|
809
693
|
desc.withPaginationMode(TablePaginationModeEnum.Pagination);
|
|
694
|
+
desc.withCurrentColumnsReorderable();
|
|
695
|
+
desc.withCurrentColumnsToggleable();
|
|
696
|
+
desc.withDataKey(`EntityChangeField_${entityChanges.entityType ?? 'default'}`);
|
|
810
697
|
return desc;
|
|
811
698
|
}
|
|
812
699
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityChangesFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
813
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: EntityChangesFieldComponent, isStandalone: true, selector: "mng-entity-changes-field", inputs: { injector: "injector" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"modelFetched | async\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n", styles: ["::ng-deep tr.audit-row-deleted{background:hsla(3,100%,60%,.1)!important}::ng-deep tr.audit-row-deleted .audit-cell{background:hsla(3,90%,63%,.3)!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:hsla(145,76%,44%,.3)!important}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
700
|
+
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" }] }); }
|
|
814
701
|
}
|
|
815
702
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: EntityChangesFieldComponent, decorators: [{
|
|
816
703
|
type: Component,
|
|
817
|
-
args: [{ standalone: true, selector: 'mng-entity-changes-field', imports: [NgForOf, MngTableComponent, NgIf, AsyncPipe], template: "<div *ngIf=\"modelFetched | async\">\n <mng-table *ngFor=\"let ec of entityChanges\" [items]=\"ec.items\" [descriptor]=\"createDescriptor(ec)\"></mng-table>\n</div>\n", styles: ["::ng-deep tr.audit-row-deleted{background:hsla(3,100%,60%,.1)!important}::ng-deep tr.audit-row-deleted .audit-cell{background:hsla(3,90%,63%,.3)!important}::ng-deep tr.audit-row-added{background-color:#1bc5621a!important}::ng-deep tr.audit-row-added .audit-cell{background:hsla(145,76%,44%,.3)!important}\n"] }]
|
|
704
|
+
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"] }]
|
|
818
705
|
}], propDecorators: { injector: [{
|
|
819
706
|
type: Input
|
|
820
707
|
}] } });
|
|
@@ -822,88 +709,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
822
709
|
class MngAuditRevisionsPageComponent extends AMngTableviewRouteComponent {
|
|
823
710
|
constructor() {
|
|
824
711
|
super(...arguments);
|
|
712
|
+
this.destroyRef = inject(DestroyRef);
|
|
713
|
+
this.injector = inject(Injector);
|
|
825
714
|
this.auditService = inject(MngAuditService);
|
|
826
715
|
this.revisisonsApiService = inject(MngAuditRevisionsApiService);
|
|
827
|
-
this.
|
|
828
|
-
this.showTable = signal(false);
|
|
716
|
+
this.showTableview = signal(false);
|
|
829
717
|
}
|
|
830
718
|
ngOnInit() {
|
|
831
|
-
this.auditService.revModel$.subscribe({
|
|
719
|
+
this.auditService.revModel$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
|
832
720
|
next: model => {
|
|
833
721
|
this.revModel = model;
|
|
834
722
|
super.ngOnInit();
|
|
835
|
-
setTimeout(() => this.
|
|
723
|
+
setTimeout(() => this.showTableview.set(true));
|
|
836
724
|
}
|
|
837
725
|
});
|
|
838
726
|
}
|
|
839
727
|
createTableviewDescriptor() {
|
|
840
728
|
if (this.revModel) {
|
|
841
729
|
const idProperty = this.revModel.properties?.filter(prop => prop.isId).map(prop => prop.resolvedPropertyName)[0];
|
|
842
|
-
const desc = new TableviewDescriptor(
|
|
843
|
-
const detailsDescriptor = new EditorDescriptor(
|
|
844
|
-
|
|
845
|
-
|
|
730
|
+
const desc = new TableviewDescriptor(MngRevEntity, idProperty, undefined, this.revModel.entityName);
|
|
731
|
+
const detailsDescriptor = new EditorDescriptor(MngRevEntityWithChangesDto, 'revEntity.' + idProperty, undefined, TableviewEditorTypeEnum.Details);
|
|
732
|
+
if (this.revModel.properties) {
|
|
733
|
+
AuditUtil.addColumnsFromModel(desc.table, this.revModel.properties);
|
|
734
|
+
AuditUtil.addFieldsFromModel(detailsDescriptor, this.revModel.properties);
|
|
735
|
+
}
|
|
846
736
|
detailsDescriptor.addField('entityNameChangesMap').asCustomComponent(EntityChangesFieldComponent, ['field-no-label'], { injector: this.injector }).withDisabled();
|
|
847
|
-
desc.withDetailsDescriptor(detailsDescriptor);
|
|
737
|
+
desc.withDetailsDescriptor(detailsDescriptor); // MngRevEntity is extended by MngRevEntityWithChangesDto, so no real harm here
|
|
848
738
|
desc.table.withFilterDisplay(TableFilterDisplayEnum.Row);
|
|
849
739
|
return desc;
|
|
850
740
|
}
|
|
851
|
-
return new TableviewDescriptor(
|
|
741
|
+
return new TableviewDescriptor(MngRevEntity);
|
|
852
742
|
}
|
|
853
743
|
createTableviewDataProvider() {
|
|
854
744
|
if (this.revModel) {
|
|
855
|
-
|
|
856
|
-
return new TableviewDataProvider({}).withGetAll(qp => this.revisisonsApiService.getRevisionCount(qp).pipe(switchMap(revisionsCount => {
|
|
857
|
-
allDataCount = revisionsCount;
|
|
858
|
-
return this.revisisonsApiService.getRevisionList(qp);
|
|
859
|
-
}), map(values => MediusQueryResult.fromArray(values, allDataCount))));
|
|
745
|
+
return new TableviewDataProvider(MngRevEntity).withGetAll(qp => combineLatest([this.revisisonsApiService.getRevisionCount(qp), this.revisisonsApiService.getRevisionList(qp)]).pipe(map(([count, values]) => MediusQueryResult.fromArray(values, count))));
|
|
860
746
|
}
|
|
861
|
-
return new TableviewDataProvider(
|
|
747
|
+
return new TableviewDataProvider(MngRevEntity);
|
|
862
748
|
}
|
|
863
749
|
createActionDescriptors() {
|
|
864
750
|
const detailsAction = new ActionEditorDescriptor(this.descriptor.detailsEditor, 'revision-details')
|
|
865
751
|
.withPosition(ActionPositionEnum.RowClick)
|
|
866
752
|
.withRouteTrigger(':itemId')
|
|
867
|
-
.withFetchFunction(ActionDataProviderUtil.runFetchOrFail)
|
|
868
753
|
.withTableviewCategory(TableviewActionDefaultCategories.DETAILS)
|
|
869
|
-
.withFetchFunction(ctx =>
|
|
754
|
+
.withFetchFunction(ctx => ctx.parameters.itemId
|
|
755
|
+
? this.revisisonsApiService.getAllChangesForRevision(ctx.parameters.itemId).pipe(map(item => {
|
|
756
|
+
const revEntityWithChanges = new MngRevEntityDetailed();
|
|
757
|
+
revEntityWithChanges.rev = ctx.parameters.itemId;
|
|
758
|
+
revEntityWithChanges.revEntity = item.revEntity;
|
|
759
|
+
revEntityWithChanges.entityNameChangesMap = item.entityNameChangesMap;
|
|
760
|
+
return revEntityWithChanges;
|
|
761
|
+
}))
|
|
762
|
+
: throwError(() => new MngInternalError('No revision id provided for fetch function')));
|
|
870
763
|
detailsAction.withEditorActions([new ActionEditorSubmitDescriptor(detailsAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
871
764
|
return [detailsAction];
|
|
872
765
|
}
|
|
873
766
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
874
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngAuditRevisionsPageComponent, isStandalone: true, selector: "mng-audit-revisions-page", usesInheritance: true, ngImport: i0, template: "<mng-tableview-route *ngIf=\"
|
|
767
|
+
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 }); }
|
|
875
768
|
}
|
|
876
769
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngAuditRevisionsPageComponent, decorators: [{
|
|
877
770
|
type: Component,
|
|
878
|
-
args: [{ standalone: true, selector: 'mng-audit-revisions-page', imports: [NgIf, MngTableviewComponent, AsyncPipe, MngTableviewComponent, RouterOutlet, JsonPipe, MngTableviewRouteComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-tableview-route *ngIf=\"
|
|
771
|
+
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" }]
|
|
879
772
|
}] });
|
|
880
773
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
774
|
+
/**
|
|
775
|
+
* Provides routes for the mng-commons-audit functionalities.
|
|
776
|
+
* @param config Module config for audit section.
|
|
777
|
+
* @param routeConfig Optionally provide route configs.
|
|
778
|
+
*/
|
|
779
|
+
function provideMngAuditRoutes(config, routeConfig) {
|
|
780
|
+
const routeBuilder = RouteBuilder.create('', MngAuditPageComponent)
|
|
781
|
+
.withProvider(MngAuditService)
|
|
884
782
|
.withProvider(MngAuditService)
|
|
885
783
|
.withProvider(MngAuditRevisionsApiService)
|
|
886
784
|
.withProvider({
|
|
887
785
|
provide: MNG_AUDIT_MODULE_CONFIG_IT,
|
|
888
786
|
useValue: config
|
|
889
787
|
})
|
|
890
|
-
.addChildBuilder(RouteBuilder.createRedirect('', 'revisions', 'full'))
|
|
891
|
-
|
|
892
|
-
.
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
.
|
|
897
|
-
.
|
|
898
|
-
.
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
.withMenuItem('pi pi-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
788
|
+
.addChildBuilder(RouteBuilder.createRedirect('', routeConfig?.defaultRedirect ?? 'revisions', 'full'));
|
|
789
|
+
if (routeConfig?.preRevisionRoutes?.length) {
|
|
790
|
+
routeConfig.preRevisionRoutes.forEach(r => routeBuilder.addChildBuilder(r));
|
|
791
|
+
}
|
|
792
|
+
const revisionsRouteBuilder = TableviewRouteBuilder.fromComponent('revisions', MngAuditRevisionsPageComponent)
|
|
793
|
+
.withTitle('pages.revisions.title')
|
|
794
|
+
.withAdd(false)
|
|
795
|
+
.withDelete(false)
|
|
796
|
+
.withEdit(false);
|
|
797
|
+
if (routeConfig?.revisionsMenuItem) {
|
|
798
|
+
revisionsRouteBuilder.withMngMenuItem(routeConfig.revisionsMenuItem);
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
revisionsRouteBuilder.withMenuItem('pi pi-book', 'pages.revisions.title');
|
|
802
|
+
}
|
|
803
|
+
const entityRevisionsRouteBuilder = RouteBuilder.create('entity-revisions', MngAuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title');
|
|
804
|
+
if (routeConfig?.entityRevisionsMenuItem) {
|
|
805
|
+
entityRevisionsRouteBuilder.withMngMenuItem(routeConfig.entityRevisionsMenuItem);
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
entityRevisionsRouteBuilder.withMenuItem('pi pi-building', 'pages.entityRevisions.title');
|
|
809
|
+
}
|
|
810
|
+
routeBuilder
|
|
811
|
+
.addChildBuilder(revisionsRouteBuilder)
|
|
812
|
+
.addChildBuilder(entityRevisionsRouteBuilder)
|
|
813
|
+
.addChildBuilder(TableviewRouteBuilder.fromComponent('entity-revisions/:entityClass', MngAuditEntityRevisionsPageComponent).withTitle('pages.entityRevisions.title'));
|
|
814
|
+
if (routeConfig?.postRevisionRoutes?.length) {
|
|
815
|
+
routeConfig.postRevisionRoutes.forEach(r => routeBuilder.addChildBuilder(r));
|
|
816
|
+
}
|
|
817
|
+
return RoutesBuilder.create().addRouteBuilder(routeBuilder).build();
|
|
907
818
|
}
|
|
908
819
|
|
|
909
820
|
/**
|