dce-reactkit 3.2.2-beta.46 → 3.2.2-beta.47
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/dist/cjs/index.js +95 -66
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataType.d.ts +6 -12
- package/dist/esm/index.js +95 -66
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataType.d.ts +6 -12
- package/dist/index.d.ts +30 -12
- package/package.json +1 -1
- package/src/components/LogReviewer.tsx +113 -78
- package/src/types/LogMetadataContextMap.ts +15 -0
- package/src/types/LogMetadataTagMap.ts +9 -0
- package/src/types/LogMetadataTargetMap.ts +9 -0
- package/src/types/LogMetadataType.ts +8 -15
|
@@ -1,19 +1,13 @@
|
|
|
1
|
+
import LogMetadataContextMap from './LogMetadataContextMap';
|
|
2
|
+
import LogMetadataTagMap from './LogMetadataTagMap';
|
|
3
|
+
import LogMetadataTargetMap from './LogMetadataTargetMap';
|
|
1
4
|
/**
|
|
2
5
|
* Type of a LogMetadata file
|
|
3
6
|
* @author Gabe Abrams
|
|
4
7
|
*/
|
|
5
8
|
declare type LogMetadataType = {
|
|
6
|
-
Context?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[k: string]: string;
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
Tag?: {
|
|
13
|
-
[k: string]: string;
|
|
14
|
-
};
|
|
15
|
-
Target?: {
|
|
16
|
-
[k: string]: string;
|
|
17
|
-
};
|
|
9
|
+
Context?: LogMetadataContextMap;
|
|
10
|
+
Tag?: LogMetadataTagMap;
|
|
11
|
+
Target?: LogMetadataTargetMap;
|
|
18
12
|
};
|
|
19
13
|
export default LogMetadataType;
|
package/dist/esm/index.js
CHANGED
|
@@ -3123,34 +3123,34 @@ const LogReviewer = (props) => {
|
|
|
3123
3123
|
/*------------------------------------------------------------------------*/
|
|
3124
3124
|
/* Setup */
|
|
3125
3125
|
/*------------------------------------------------------------------------*/
|
|
3126
|
-
var _a, _b, _c, _d, _e, _f
|
|
3126
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3127
3127
|
/* -------------- Props ------------- */
|
|
3128
3128
|
// Destructure props
|
|
3129
3129
|
const { LogMetadata, onClose, } = props;
|
|
3130
|
-
//
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
if (LogMetadata.Context) {
|
|
3145
|
-
LogMetadata.Context[context] = context;
|
|
3146
|
-
}
|
|
3130
|
+
// Create complete map of contexts
|
|
3131
|
+
const contextMap = {};
|
|
3132
|
+
[
|
|
3133
|
+
((_a = LogMetadata.Context) !== null && _a !== void 0 ? _a : {}),
|
|
3134
|
+
LogBuiltInMetadata.Context,
|
|
3135
|
+
].forEach((contextMap) => {
|
|
3136
|
+
Object.keys(contextMap).forEach((context) => {
|
|
3137
|
+
// Add context
|
|
3138
|
+
contextMap[context] = context;
|
|
3139
|
+
// If context has children, add an "uncategorized" subcontext
|
|
3140
|
+
if (typeof contextMap[context] !== 'string') {
|
|
3141
|
+
contextMap[context][LogBuiltInMetadata.Context.Uncategorized] = (LogBuiltInMetadata.Context.Uncategorized);
|
|
3142
|
+
}
|
|
3143
|
+
});
|
|
3147
3144
|
});
|
|
3148
|
-
//
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3145
|
+
// Create complete map of targets
|
|
3146
|
+
const targetMap = {};
|
|
3147
|
+
[
|
|
3148
|
+
((_b = LogMetadata.Target) !== null && _b !== void 0 ? _b : {}),
|
|
3149
|
+
LogBuiltInMetadata.Target,
|
|
3150
|
+
].forEach((targetMap) => {
|
|
3151
|
+
Object.keys(targetMap).forEach((target) => {
|
|
3152
|
+
targetMap[target] = target;
|
|
3153
|
+
});
|
|
3154
3154
|
});
|
|
3155
3155
|
/* -------------- State ------------- */
|
|
3156
3156
|
// Create initial date filter state
|
|
@@ -3171,7 +3171,7 @@ const LogReviewer = (props) => {
|
|
|
3171
3171
|
};
|
|
3172
3172
|
// Create initial context filter state
|
|
3173
3173
|
const initContextFilterState = {};
|
|
3174
|
-
Object.keys((
|
|
3174
|
+
Object.keys((_c = LogMetadata.Context) !== null && _c !== void 0 ? _c : {}).forEach((context) => {
|
|
3175
3175
|
var _a, _b;
|
|
3176
3176
|
const contextValue = ((_a = LogMetadata.Context) !== null && _a !== void 0 ? _a : {})[context];
|
|
3177
3177
|
if (typeof contextValue === 'string') {
|
|
@@ -3193,7 +3193,7 @@ const LogReviewer = (props) => {
|
|
|
3193
3193
|
});
|
|
3194
3194
|
// Create initial tag filter state
|
|
3195
3195
|
const initTagFilterState = {};
|
|
3196
|
-
Object.keys((
|
|
3196
|
+
Object.keys((_d = LogMetadata.Tag) !== null && _d !== void 0 ? _d : {}).forEach((tag) => {
|
|
3197
3197
|
initTagFilterState[tag] = false;
|
|
3198
3198
|
});
|
|
3199
3199
|
// Create advanced filter state
|
|
@@ -3220,7 +3220,7 @@ const LogReviewer = (props) => {
|
|
|
3220
3220
|
target: {},
|
|
3221
3221
|
action: {},
|
|
3222
3222
|
};
|
|
3223
|
-
Object.values((
|
|
3223
|
+
Object.values((_e = LogMetadata.Target) !== null && _e !== void 0 ? _e : {}).forEach((target) => {
|
|
3224
3224
|
initActionErrorFilterState.target[target] = true;
|
|
3225
3225
|
});
|
|
3226
3226
|
Object.values(LogAction$1).forEach((action) => {
|
|
@@ -3414,7 +3414,7 @@ const LogReviewer = (props) => {
|
|
|
3414
3414
|
initDateFilterState,
|
|
3415
3415
|
initTagFilterState,
|
|
3416
3416
|
});
|
|
3417
|
-
} }, "Reset
|
|
3417
|
+
} }, "Reset"))));
|
|
3418
3418
|
// Filter drawer
|
|
3419
3419
|
let filterDrawer;
|
|
3420
3420
|
if (expandedFilterDrawer) {
|
|
@@ -3442,10 +3442,16 @@ const LogReviewer = (props) => {
|
|
|
3442
3442
|
}
|
|
3443
3443
|
else if (expandedFilterDrawer === FilterDrawer.Context) {
|
|
3444
3444
|
// Create item picker items
|
|
3445
|
-
const
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3445
|
+
const builtInPickableItem = {
|
|
3446
|
+
id: '_',
|
|
3447
|
+
name: 'Auto-logged',
|
|
3448
|
+
isGroup: true,
|
|
3449
|
+
children: [],
|
|
3450
|
+
};
|
|
3451
|
+
const pickableItems = [];
|
|
3452
|
+
Object.keys(contextMap)
|
|
3453
|
+
.forEach((context) => {
|
|
3454
|
+
const value = (contextMap)[context];
|
|
3449
3455
|
if (typeof value === 'string') {
|
|
3450
3456
|
// No subcategories
|
|
3451
3457
|
const item = {
|
|
@@ -3454,13 +3460,24 @@ const LogReviewer = (props) => {
|
|
|
3454
3460
|
isGroup: false,
|
|
3455
3461
|
checked: !!contextFilterState[context],
|
|
3456
3462
|
};
|
|
3457
|
-
|
|
3463
|
+
// Add built-in items to its own folder
|
|
3464
|
+
const isBuiltIn = context in LogBuiltInMetadata.Context;
|
|
3465
|
+
if (isBuiltIn) {
|
|
3466
|
+
// Add to built-in pickable item
|
|
3467
|
+
builtInPickableItem.children.push(item);
|
|
3468
|
+
}
|
|
3469
|
+
else {
|
|
3470
|
+
// Add to pickable items list
|
|
3471
|
+
pickableItems.push(item);
|
|
3472
|
+
}
|
|
3458
3473
|
}
|
|
3459
3474
|
// Has subcategories
|
|
3460
3475
|
const children = (Object.keys(value)
|
|
3476
|
+
// Remove parent name
|
|
3461
3477
|
.filter((subcontext) => {
|
|
3462
3478
|
return subcontext !== '_';
|
|
3463
3479
|
})
|
|
3480
|
+
// Create child pickable items
|
|
3464
3481
|
.map((subcontext) => {
|
|
3465
3482
|
return {
|
|
3466
3483
|
id: subcontext,
|
|
@@ -3475,19 +3492,32 @@ const LogReviewer = (props) => {
|
|
|
3475
3492
|
isGroup: true,
|
|
3476
3493
|
children,
|
|
3477
3494
|
};
|
|
3478
|
-
|
|
3479
|
-
})
|
|
3495
|
+
pickableItems.push(item);
|
|
3496
|
+
});
|
|
3497
|
+
// Add built-in contexts to end ofl ist
|
|
3498
|
+
pickableItems.push(builtInPickableItem);
|
|
3480
3499
|
// Create filter UI
|
|
3481
3500
|
filterDrawer = (React.createElement(ItemPicker, { title: "Context", items: pickableItems, onChanged: (updatedItems) => {
|
|
3482
3501
|
// Update our state
|
|
3483
3502
|
updatedItems.forEach((pickableItem) => {
|
|
3484
3503
|
if (pickableItem.isGroup) {
|
|
3485
3504
|
// Has subcontexts
|
|
3486
|
-
pickableItem.
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3505
|
+
if (pickableItem.id === '_') {
|
|
3506
|
+
// Built-in
|
|
3507
|
+
// Treat as if these were top-level contexts
|
|
3508
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
3509
|
+
contextFilterState[subcontextItem.id] = ('checked' in subcontextItem
|
|
3510
|
+
&& subcontextItem.checked);
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
else {
|
|
3514
|
+
// Not built-in
|
|
3515
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
3516
|
+
if (!subcontextItem.isGroup) {
|
|
3517
|
+
contextFilterState[pickableItem.id][subcontextItem.id] = (subcontextItem.checked);
|
|
3518
|
+
}
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3491
3521
|
}
|
|
3492
3522
|
else {
|
|
3493
3523
|
// No subcontexts
|
|
@@ -3502,17 +3532,19 @@ const LogReviewer = (props) => {
|
|
|
3502
3532
|
}
|
|
3503
3533
|
else if (expandedFilterDrawer === FilterDrawer.Tag) {
|
|
3504
3534
|
// Create filter UI
|
|
3505
|
-
filterDrawer = (React.createElement(TabBox, { title: "Tags" },
|
|
3506
|
-
.
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3535
|
+
filterDrawer = (React.createElement(TabBox, { title: "Tags" },
|
|
3536
|
+
React.createElement("div", null, "If any are selected, logs must contain at least one but not necessarily all of the selected tags."),
|
|
3537
|
+
Object.keys((_f = LogMetadata.Tag) !== null && _f !== void 0 ? _f : {})
|
|
3538
|
+
.map((tag, i) => {
|
|
3539
|
+
const description = genHumanReadableName(tag);
|
|
3540
|
+
return (React.createElement(CheckboxButton, { id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, noMarginOnRight: i === Object.keys(tagFilterState).length - 1, checked: tagFilterState[tag], onChanged: (checked) => {
|
|
3541
|
+
tagFilterState[tag] = checked;
|
|
3542
|
+
dispatch({
|
|
3543
|
+
type: ActionType.UpdateTagFilterState,
|
|
3544
|
+
tagFilterState,
|
|
3545
|
+
});
|
|
3546
|
+
} }));
|
|
3547
|
+
})));
|
|
3516
3548
|
}
|
|
3517
3549
|
else if (expandedFilterDrawer === FilterDrawer.Action) {
|
|
3518
3550
|
// Create filter UI
|
|
@@ -3553,21 +3585,18 @@ const LogReviewer = (props) => {
|
|
|
3553
3585
|
});
|
|
3554
3586
|
} }));
|
|
3555
3587
|
})),
|
|
3556
|
-
React.createElement(ButtonInputGroup, { label: "Target" },
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
});
|
|
3569
|
-
}, noMarginOnRight: i === Object.keys((_a = LogMetadata.Target) !== null && _a !== void 0 ? _a : {}).length - 1 }));
|
|
3570
|
-
})))),
|
|
3588
|
+
React.createElement(ButtonInputGroup, { label: "Target" }, Object.keys(targetMap)
|
|
3589
|
+
.map((target, i) => {
|
|
3590
|
+
const description = genHumanReadableName(target);
|
|
3591
|
+
return (React.createElement(CheckboxButton, { key: target, id: `LogReviewer-target-${target}-checkbox`, text: description, ariaLabel: `include logs with target "${description}" in results`, checked: actionErrorFilterState.target[target], onChanged: (checked) => {
|
|
3592
|
+
actionErrorFilterState.target[target] = checked;
|
|
3593
|
+
console.log(actionErrorFilterState, target, checked);
|
|
3594
|
+
dispatch({
|
|
3595
|
+
type: ActionType.UpdateActionErrorFilterState,
|
|
3596
|
+
actionErrorFilterState,
|
|
3597
|
+
});
|
|
3598
|
+
}, noMarginOnRight: i === Object.keys(targetMap).length - 1 }));
|
|
3599
|
+
})))),
|
|
3571
3600
|
(actionErrorFilterState.type === undefined
|
|
3572
3601
|
|| actionErrorFilterState.type === LogType$1.Error) && (React.createElement(TabBox, { title: "Error Log Details" },
|
|
3573
3602
|
React.createElement("div", { className: "input-group mb-2" },
|