@juice-js/audit 0.0.0-stage → 1.0.0-alpha.2
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 +74 -2
- package/fesm2022/juice-js-audit-access-log.page-CrH7ib4K.mjs +291 -0
- package/fesm2022/juice-js-audit-access-log.page-CrH7ib4K.mjs.map +1 -0
- package/fesm2022/juice-js-audit-access-logs.page-BWEIcVKa.mjs +588 -0
- package/fesm2022/juice-js-audit-access-logs.page-BWEIcVKa.mjs.map +1 -0
- package/fesm2022/juice-js-audit-data-change.page-CuI9ccJb.mjs +269 -0
- package/fesm2022/juice-js-audit-data-change.page-CuI9ccJb.mjs.map +1 -0
- package/fesm2022/juice-js-audit-data-changes.page-C-k_Shce.mjs +435 -0
- package/fesm2022/juice-js-audit-data-changes.page-C-k_Shce.mjs.map +1 -0
- package/fesm2022/juice-js-audit-overview.page-DnP722u2.mjs +282 -0
- package/fesm2022/juice-js-audit-overview.page-DnP722u2.mjs.map +1 -0
- package/fesm2022/juice-js-audit-paging-D5-1J1rG.mjs +61 -0
- package/fesm2022/juice-js-audit-paging-D5-1J1rG.mjs.map +1 -0
- package/fesm2022/juice-js-audit-trace.page-Df6Sy2x8.mjs +229 -0
- package/fesm2022/juice-js-audit-trace.page-Df6Sy2x8.mjs.map +1 -0
- package/fesm2022/juice-js-audit-ui-DnfhiB6p.mjs +1123 -0
- package/fesm2022/juice-js-audit-ui-DnfhiB6p.mjs.map +1 -0
- package/fesm2022/juice-js-audit.mjs +313 -0
- package/fesm2022/juice-js-audit.mjs.map +1 -0
- package/package.json +45 -4
- package/styles/_audit.scss +142 -0
- package/types/juice-js-audit.d.ts +216 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { AuditApiService, AuditContextService } from "./juice-js-audit.mjs";
|
|
2
|
+
import { a as DataChangeTable, p as problemText, r as AuditContextBar } from "./juice-js-audit-ui-DnfhiB6p.mjs";
|
|
3
|
+
import { t as cursorList } from "./juice-js-audit-paging-D5-1J1rG.mjs";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal } from "@angular/core";
|
|
6
|
+
import * as i5 from "@angular/material/progress-bar";
|
|
7
|
+
import { MatProgressBarModule } from "@angular/material/progress-bar";
|
|
8
|
+
import * as i1 from "@angular/forms";
|
|
9
|
+
import { FormsModule } from "@angular/forms";
|
|
10
|
+
import * as i4 from "@angular/material/select";
|
|
11
|
+
import { MatSelectModule } from "@angular/material/select";
|
|
12
|
+
import * as i2 from "@angular/material/button";
|
|
13
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
14
|
+
import * as i3 from "@angular/material/input";
|
|
15
|
+
import { MatInputModule } from "@angular/material/input";
|
|
16
|
+
var DataChangesPage = class DataChangesPage {
|
|
17
|
+
api = inject(AuditApiService);
|
|
18
|
+
ctx = inject(AuditContextService);
|
|
19
|
+
table = input(...ngDevMode ? [void 0, { debugName: "table" }] : /* istanbul ignore next */ []);
|
|
20
|
+
key = input(...ngDevMode ? [void 0, { debugName: "key" }] : /* istanbul ignore next */ []);
|
|
21
|
+
action = input(...ngDevMode ? [void 0, { debugName: "action" }] : /* istanbul ignore next */ []);
|
|
22
|
+
user = input(...ngDevMode ? [void 0, { debugName: "user" }] : /* istanbul ignore next */ []);
|
|
23
|
+
schema = input(...ngDevMode ? [void 0, { debugName: "schema" }] : /* istanbul ignore next */ []);
|
|
24
|
+
actions = [
|
|
25
|
+
"Inserted",
|
|
26
|
+
"Modified",
|
|
27
|
+
"Deleted"
|
|
28
|
+
];
|
|
29
|
+
filters = computed(() => ({
|
|
30
|
+
table: this.table() ?? "",
|
|
31
|
+
key: this.key() ?? "",
|
|
32
|
+
action: this.action() ?? "",
|
|
33
|
+
user: this.user() ?? "",
|
|
34
|
+
schema: this.schema() ?? ""
|
|
35
|
+
}), ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
|
|
36
|
+
form = linkedSignal(() => ({ ...this.filters() }), ...ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []);
|
|
37
|
+
filtered = computed(() => Object.values(this.filters()).some((v) => v !== ""), ...ngDevMode ? [{ debugName: "filtered" }] : /* istanbul ignore next */ []);
|
|
38
|
+
changes = cursorList(() => ({
|
|
39
|
+
filters: this.filters(),
|
|
40
|
+
range: this.ctx.range(),
|
|
41
|
+
abs: this.ctx.absolute()
|
|
42
|
+
}), (p) => ({
|
|
43
|
+
...this.ctx.window(),
|
|
44
|
+
...p.filters,
|
|
45
|
+
limit: 50
|
|
46
|
+
}), (q) => this.api.dataChanges(q));
|
|
47
|
+
error = computed(() => problemText(this.changes.first.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
48
|
+
moreError = computed(() => problemText(this.changes.moreError()), ...ngDevMode ? [{ debugName: "moreError" }] : /* istanbul ignore next */ []);
|
|
49
|
+
apply() {
|
|
50
|
+
const f = this.form();
|
|
51
|
+
this.ctx.filter({
|
|
52
|
+
table: f.table.trim() || null,
|
|
53
|
+
key: f.key.trim() || null,
|
|
54
|
+
action: f.action || null,
|
|
55
|
+
user: f.user.trim() || null,
|
|
56
|
+
schema: f.schema.trim() || null
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
clear() {
|
|
60
|
+
this.ctx.filter({
|
|
61
|
+
table: null,
|
|
62
|
+
key: null,
|
|
63
|
+
action: null,
|
|
64
|
+
user: null,
|
|
65
|
+
schema: null
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
69
|
+
minVersion: "12.0.0",
|
|
70
|
+
version: "22.2.4",
|
|
71
|
+
ngImport: i0,
|
|
72
|
+
type: DataChangesPage,
|
|
73
|
+
deps: [],
|
|
74
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
75
|
+
});
|
|
76
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
77
|
+
minVersion: "17.0.0",
|
|
78
|
+
version: "22.2.4",
|
|
79
|
+
type: DataChangesPage,
|
|
80
|
+
isStandalone: true,
|
|
81
|
+
selector: "ng-component",
|
|
82
|
+
inputs: {
|
|
83
|
+
table: {
|
|
84
|
+
classPropertyName: "table",
|
|
85
|
+
publicName: "table",
|
|
86
|
+
isSignal: true,
|
|
87
|
+
isRequired: false,
|
|
88
|
+
transformFunction: null
|
|
89
|
+
},
|
|
90
|
+
key: {
|
|
91
|
+
classPropertyName: "key",
|
|
92
|
+
publicName: "key",
|
|
93
|
+
isSignal: true,
|
|
94
|
+
isRequired: false,
|
|
95
|
+
transformFunction: null
|
|
96
|
+
},
|
|
97
|
+
action: {
|
|
98
|
+
classPropertyName: "action",
|
|
99
|
+
publicName: "action",
|
|
100
|
+
isSignal: true,
|
|
101
|
+
isRequired: false,
|
|
102
|
+
transformFunction: null
|
|
103
|
+
},
|
|
104
|
+
user: {
|
|
105
|
+
classPropertyName: "user",
|
|
106
|
+
publicName: "user",
|
|
107
|
+
isSignal: true,
|
|
108
|
+
isRequired: false,
|
|
109
|
+
transformFunction: null
|
|
110
|
+
},
|
|
111
|
+
schema: {
|
|
112
|
+
classPropertyName: "schema",
|
|
113
|
+
publicName: "schema",
|
|
114
|
+
isSignal: true,
|
|
115
|
+
isRequired: false,
|
|
116
|
+
transformFunction: null
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
template: `
|
|
121
|
+
<ja-context-bar><h1>Data changes</h1></ja-context-bar>
|
|
122
|
+
<form class="ja-filter-form" (ngSubmit)="apply()">
|
|
123
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>Table</mat-label><input matInput name="table" [(ngModel)]="form().table"></mat-form-field>
|
|
124
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>Key value</mat-label><input matInput name="key" [(ngModel)]="form().key" placeholder="e.g. an order id"></mat-form-field>
|
|
125
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-xs">
|
|
126
|
+
<mat-label>Change</mat-label>
|
|
127
|
+
<mat-select name="action" [(ngModel)]="form().action">
|
|
128
|
+
<mat-option value="">Any</mat-option>
|
|
129
|
+
@for (a of actions; track a) { <mat-option [value]="a">{{ a }}</mat-option> }
|
|
130
|
+
</mat-select>
|
|
131
|
+
</mat-form-field>
|
|
132
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>User</mat-label><input matInput name="user" [(ngModel)]="form().user"></mat-form-field>
|
|
133
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-xs"><mat-label>Schema</mat-label><input matInput name="schema" [(ngModel)]="form().schema"></mat-form-field>
|
|
134
|
+
<button mat-flat-button type="submit">Search</button>
|
|
135
|
+
@if (filtered()) { <button mat-button type="button" (click)="clear()">Clear</button> }
|
|
136
|
+
</form>
|
|
137
|
+
|
|
138
|
+
@if (changes.first.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
|
|
139
|
+
@if (changes.first.error()) { <p class="ja-error">{{ error() }}</p> }
|
|
140
|
+
@if (changes.first.hasValue()) {
|
|
141
|
+
@if (changes.items().length === 0) { <p class="ja-muted">No data changes match in this window.</p> }
|
|
142
|
+
@else {
|
|
143
|
+
<ja-data-change-table [rows]="changes.items()" />
|
|
144
|
+
<div class="ja-more">
|
|
145
|
+
<span class="ja-muted">{{ changes.items().length }} change{{ changes.items().length === 1 ? '' : 's' }}{{ changes.hasMore() ? ', newest first' : '' }}</span>
|
|
146
|
+
@if (changes.hasMore()) {
|
|
147
|
+
<button mat-button (click)="changes.more()" [disabled]="changes.loadingMore()">{{ changes.loadingMore() ? 'Loading…' : 'Older changes' }}</button>
|
|
148
|
+
}
|
|
149
|
+
@if (changes.moreError()) { <span class="ja-error">{{ moreError() }}</span> }
|
|
150
|
+
</div>
|
|
151
|
+
}
|
|
152
|
+
}`,
|
|
153
|
+
isInline: true,
|
|
154
|
+
dependencies: [
|
|
155
|
+
{
|
|
156
|
+
kind: "ngmodule",
|
|
157
|
+
type: FormsModule
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
kind: "directive",
|
|
161
|
+
type: i1.ɵNgNoValidate,
|
|
162
|
+
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
kind: "directive",
|
|
166
|
+
type: i1.DefaultValueAccessor,
|
|
167
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
kind: "directive",
|
|
171
|
+
type: i1.NgControlStatus,
|
|
172
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
kind: "directive",
|
|
176
|
+
type: i1.NgControlStatusGroup,
|
|
177
|
+
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: "directive",
|
|
181
|
+
type: i1.NgModel,
|
|
182
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
183
|
+
inputs: [
|
|
184
|
+
"name",
|
|
185
|
+
"disabled",
|
|
186
|
+
"ngModel",
|
|
187
|
+
"ngModelOptions"
|
|
188
|
+
],
|
|
189
|
+
outputs: ["ngModelChange"],
|
|
190
|
+
exportAs: ["ngModel"]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
kind: "directive",
|
|
194
|
+
type: i1.NgForm,
|
|
195
|
+
selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
|
|
196
|
+
inputs: ["ngFormOptions"],
|
|
197
|
+
outputs: ["ngSubmit"],
|
|
198
|
+
exportAs: ["ngForm"]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
kind: "ngmodule",
|
|
202
|
+
type: MatButtonModule
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
kind: "component",
|
|
206
|
+
type: i2.MatButton,
|
|
207
|
+
selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
|
|
208
|
+
inputs: ["matButton"],
|
|
209
|
+
exportAs: ["matButton", "matAnchor"]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
kind: "ngmodule",
|
|
213
|
+
type: MatInputModule
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
kind: "directive",
|
|
217
|
+
type: i3.MatInput,
|
|
218
|
+
selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
|
|
219
|
+
inputs: [
|
|
220
|
+
"disabled",
|
|
221
|
+
"id",
|
|
222
|
+
"placeholder",
|
|
223
|
+
"name",
|
|
224
|
+
"required",
|
|
225
|
+
"type",
|
|
226
|
+
"errorStateMatcher",
|
|
227
|
+
"aria-describedby",
|
|
228
|
+
"value",
|
|
229
|
+
"readonly",
|
|
230
|
+
"disabledInteractive"
|
|
231
|
+
],
|
|
232
|
+
exportAs: ["matInput"]
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
kind: "component",
|
|
236
|
+
type: i4.MatFormField,
|
|
237
|
+
selector: "mat-form-field",
|
|
238
|
+
inputs: [
|
|
239
|
+
"hideRequiredMarker",
|
|
240
|
+
"color",
|
|
241
|
+
"floatLabel",
|
|
242
|
+
"appearance",
|
|
243
|
+
"subscriptSizing",
|
|
244
|
+
"hintLabel"
|
|
245
|
+
],
|
|
246
|
+
exportAs: ["matFormField"]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
kind: "directive",
|
|
250
|
+
type: i4.MatLabel,
|
|
251
|
+
selector: "mat-label"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
kind: "ngmodule",
|
|
255
|
+
type: MatProgressBarModule
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
kind: "component",
|
|
259
|
+
type: i5.MatProgressBar,
|
|
260
|
+
selector: "mat-progress-bar",
|
|
261
|
+
inputs: [
|
|
262
|
+
"color",
|
|
263
|
+
"value",
|
|
264
|
+
"bufferValue",
|
|
265
|
+
"mode"
|
|
266
|
+
],
|
|
267
|
+
outputs: ["animationEnd"],
|
|
268
|
+
exportAs: ["matProgressBar"]
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
kind: "ngmodule",
|
|
272
|
+
type: MatSelectModule
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
kind: "component",
|
|
276
|
+
type: i4.MatSelect,
|
|
277
|
+
selector: "mat-select",
|
|
278
|
+
inputs: [
|
|
279
|
+
"aria-describedby",
|
|
280
|
+
"panelClass",
|
|
281
|
+
"disabled",
|
|
282
|
+
"disableRipple",
|
|
283
|
+
"tabIndex",
|
|
284
|
+
"hideSingleSelectionIndicator",
|
|
285
|
+
"placeholder",
|
|
286
|
+
"required",
|
|
287
|
+
"multiple",
|
|
288
|
+
"disableOptionCentering",
|
|
289
|
+
"compareWith",
|
|
290
|
+
"value",
|
|
291
|
+
"aria-label",
|
|
292
|
+
"aria-labelledby",
|
|
293
|
+
"errorStateMatcher",
|
|
294
|
+
"typeaheadDebounceInterval",
|
|
295
|
+
"sortComparator",
|
|
296
|
+
"id",
|
|
297
|
+
"panelWidth",
|
|
298
|
+
"canSelectNullableOptions"
|
|
299
|
+
],
|
|
300
|
+
outputs: [
|
|
301
|
+
"openedChange",
|
|
302
|
+
"opened",
|
|
303
|
+
"closed",
|
|
304
|
+
"selectionChange",
|
|
305
|
+
"valueChange"
|
|
306
|
+
],
|
|
307
|
+
exportAs: ["matSelect"]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
kind: "component",
|
|
311
|
+
type: i4.MatOption,
|
|
312
|
+
selector: "mat-option",
|
|
313
|
+
inputs: [
|
|
314
|
+
"value",
|
|
315
|
+
"id",
|
|
316
|
+
"disabled"
|
|
317
|
+
],
|
|
318
|
+
outputs: ["onSelectionChange"],
|
|
319
|
+
exportAs: ["matOption"]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
kind: "component",
|
|
323
|
+
type: AuditContextBar,
|
|
324
|
+
selector: "ja-context-bar",
|
|
325
|
+
inputs: ["showRange"]
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
kind: "component",
|
|
329
|
+
type: DataChangeTable,
|
|
330
|
+
selector: "ja-data-change-table",
|
|
331
|
+
inputs: ["rows", "compact"]
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
338
|
+
minVersion: "12.0.0",
|
|
339
|
+
version: "22.2.4",
|
|
340
|
+
ngImport: i0,
|
|
341
|
+
type: DataChangesPage,
|
|
342
|
+
decorators: [{
|
|
343
|
+
type: Component,
|
|
344
|
+
args: [{
|
|
345
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
346
|
+
imports: [
|
|
347
|
+
FormsModule,
|
|
348
|
+
MatButtonModule,
|
|
349
|
+
MatInputModule,
|
|
350
|
+
MatProgressBarModule,
|
|
351
|
+
MatSelectModule,
|
|
352
|
+
AuditContextBar,
|
|
353
|
+
DataChangeTable
|
|
354
|
+
],
|
|
355
|
+
template: `
|
|
356
|
+
<ja-context-bar><h1>Data changes</h1></ja-context-bar>
|
|
357
|
+
<form class="ja-filter-form" (ngSubmit)="apply()">
|
|
358
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>Table</mat-label><input matInput name="table" [(ngModel)]="form().table"></mat-form-field>
|
|
359
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>Key value</mat-label><input matInput name="key" [(ngModel)]="form().key" placeholder="e.g. an order id"></mat-form-field>
|
|
360
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-xs">
|
|
361
|
+
<mat-label>Change</mat-label>
|
|
362
|
+
<mat-select name="action" [(ngModel)]="form().action">
|
|
363
|
+
<mat-option value="">Any</mat-option>
|
|
364
|
+
@for (a of actions; track a) { <mat-option [value]="a">{{ a }}</mat-option> }
|
|
365
|
+
</mat-select>
|
|
366
|
+
</mat-form-field>
|
|
367
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-sm"><mat-label>User</mat-label><input matInput name="user" [(ngModel)]="form().user"></mat-form-field>
|
|
368
|
+
<mat-form-field subscriptSizing="dynamic" class="ja-field-xs"><mat-label>Schema</mat-label><input matInput name="schema" [(ngModel)]="form().schema"></mat-form-field>
|
|
369
|
+
<button mat-flat-button type="submit">Search</button>
|
|
370
|
+
@if (filtered()) { <button mat-button type="button" (click)="clear()">Clear</button> }
|
|
371
|
+
</form>
|
|
372
|
+
|
|
373
|
+
@if (changes.first.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
|
|
374
|
+
@if (changes.first.error()) { <p class="ja-error">{{ error() }}</p> }
|
|
375
|
+
@if (changes.first.hasValue()) {
|
|
376
|
+
@if (changes.items().length === 0) { <p class="ja-muted">No data changes match in this window.</p> }
|
|
377
|
+
@else {
|
|
378
|
+
<ja-data-change-table [rows]="changes.items()" />
|
|
379
|
+
<div class="ja-more">
|
|
380
|
+
<span class="ja-muted">{{ changes.items().length }} change{{ changes.items().length === 1 ? '' : 's' }}{{ changes.hasMore() ? ', newest first' : '' }}</span>
|
|
381
|
+
@if (changes.hasMore()) {
|
|
382
|
+
<button mat-button (click)="changes.more()" [disabled]="changes.loadingMore()">{{ changes.loadingMore() ? 'Loading…' : 'Older changes' }}</button>
|
|
383
|
+
}
|
|
384
|
+
@if (changes.moreError()) { <span class="ja-error">{{ moreError() }}</span> }
|
|
385
|
+
</div>
|
|
386
|
+
}
|
|
387
|
+
}`
|
|
388
|
+
}]
|
|
389
|
+
}],
|
|
390
|
+
propDecorators: {
|
|
391
|
+
table: [{
|
|
392
|
+
type: i0.Input,
|
|
393
|
+
args: [{
|
|
394
|
+
isSignal: true,
|
|
395
|
+
alias: "table",
|
|
396
|
+
required: false
|
|
397
|
+
}]
|
|
398
|
+
}],
|
|
399
|
+
key: [{
|
|
400
|
+
type: i0.Input,
|
|
401
|
+
args: [{
|
|
402
|
+
isSignal: true,
|
|
403
|
+
alias: "key",
|
|
404
|
+
required: false
|
|
405
|
+
}]
|
|
406
|
+
}],
|
|
407
|
+
action: [{
|
|
408
|
+
type: i0.Input,
|
|
409
|
+
args: [{
|
|
410
|
+
isSignal: true,
|
|
411
|
+
alias: "action",
|
|
412
|
+
required: false
|
|
413
|
+
}]
|
|
414
|
+
}],
|
|
415
|
+
user: [{
|
|
416
|
+
type: i0.Input,
|
|
417
|
+
args: [{
|
|
418
|
+
isSignal: true,
|
|
419
|
+
alias: "user",
|
|
420
|
+
required: false
|
|
421
|
+
}]
|
|
422
|
+
}],
|
|
423
|
+
schema: [{
|
|
424
|
+
type: i0.Input,
|
|
425
|
+
args: [{
|
|
426
|
+
isSignal: true,
|
|
427
|
+
alias: "schema",
|
|
428
|
+
required: false
|
|
429
|
+
}]
|
|
430
|
+
}]
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
export { DataChangesPage };
|
|
434
|
+
|
|
435
|
+
//# sourceMappingURL=juice-js-audit-data-changes.page-C-k_Shce.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"juice-js-audit-data-changes.page-C-k_Shce.mjs","names":[],"sources":["../../../../projects/juice-js/audit/src/lib/pages/data-changes.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { AuditApiService } from '../core/api.service';\nimport { AuditContextService } from '../core/context.service';\nimport { problemText } from '../shared/format';\nimport { cursorList } from '../shared/paging';\nimport { AuditContextBar, DataChangeTable } from '../shared/ui';\n\n/**\n * The row changes in the window, newest first: which table, which row (its keys), who and in which trace. Searching\n * by key finds a row's history.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, MatButtonModule, MatInputModule, MatProgressBarModule, MatSelectModule, AuditContextBar, DataChangeTable],\n template: `\n <ja-context-bar><h1>Data changes</h1></ja-context-bar>\n <form class=\"ja-filter-form\" (ngSubmit)=\"apply()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"ja-field-sm\"><mat-label>Table</mat-label><input matInput name=\"table\" [(ngModel)]=\"form().table\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"ja-field-sm\"><mat-label>Key value</mat-label><input matInput name=\"key\" [(ngModel)]=\"form().key\" placeholder=\"e.g. an order id\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"ja-field-xs\">\n <mat-label>Change</mat-label>\n <mat-select name=\"action\" [(ngModel)]=\"form().action\">\n <mat-option value=\"\">Any</mat-option>\n @for (a of actions; track a) { <mat-option [value]=\"a\">{{ a }}</mat-option> }\n </mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"ja-field-sm\"><mat-label>User</mat-label><input matInput name=\"user\" [(ngModel)]=\"form().user\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"ja-field-xs\"><mat-label>Schema</mat-label><input matInput name=\"schema\" [(ngModel)]=\"form().schema\"></mat-form-field>\n <button mat-flat-button type=\"submit\">Search</button>\n @if (filtered()) { <button mat-button type=\"button\" (click)=\"clear()\">Clear</button> }\n </form>\n\n @if (changes.first.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (changes.first.error()) { <p class=\"ja-error\">{{ error() }}</p> }\n @if (changes.first.hasValue()) {\n @if (changes.items().length === 0) { <p class=\"ja-muted\">No data changes match in this window.</p> }\n @else {\n <ja-data-change-table [rows]=\"changes.items()\" />\n <div class=\"ja-more\">\n <span class=\"ja-muted\">{{ changes.items().length }} change{{ changes.items().length === 1 ? '' : 's' }}{{ changes.hasMore() ? ', newest first' : '' }}</span>\n @if (changes.hasMore()) {\n <button mat-button (click)=\"changes.more()\" [disabled]=\"changes.loadingMore()\">{{ changes.loadingMore() ? 'Loading…' : 'Older changes' }}</button>\n }\n @if (changes.moreError()) { <span class=\"ja-error\">{{ moreError() }}</span> }\n </div>\n }\n }`,\n})\nexport class DataChangesPage {\n private readonly api = inject(AuditApiService);\n protected readonly ctx = inject(AuditContextService);\n\n readonly table = input<string>();\n readonly key = input<string>();\n readonly action = input<string>();\n readonly user = input<string>();\n readonly schema = input<string>();\n\n protected readonly actions = ['Inserted', 'Modified', 'Deleted'];\n\n private readonly filters = computed(() => ({\n table: this.table() ?? '', key: this.key() ?? '', action: this.action() ?? '', user: this.user() ?? '', schema: this.schema() ?? '',\n }));\n protected readonly form = linkedSignal(() => ({ ...this.filters() }));\n protected readonly filtered = computed(() => Object.values(this.filters()).some(v => v !== ''));\n\n protected readonly changes = cursorList(\n () => ({ filters: this.filters(), range: this.ctx.range(), abs: this.ctx.absolute() }),\n p => ({ ...this.ctx.window(), ...p.filters, limit: 50 }),\n q => this.api.dataChanges(q));\n protected readonly error = computed(() => problemText(this.changes.first.error()));\n protected readonly moreError = computed(() => problemText(this.changes.moreError()));\n\n apply() {\n const f = this.form();\n this.ctx.filter({\n table: f.table.trim() || null, key: f.key.trim() || null, action: f.action || null, user: f.user.trim() || null,\n schema: f.schema.trim() || null,\n });\n }\n\n clear() { this.ctx.filter({ table: null, key: null, action: null, user: null, schema: null }); }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqDA,IAAa,kBAAb,MAAa,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