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/index.d.ts
CHANGED
|
@@ -369,23 +369,41 @@ declare type Props$3 = {
|
|
|
369
369
|
};
|
|
370
370
|
declare const ItemPicker: React.FC<Props$3>;
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Type of the context map in a LogMetadata file
|
|
374
|
+
* @author Gabe Abrams
|
|
375
|
+
*/
|
|
376
|
+
declare type LogMetadataContextMap = {
|
|
377
|
+
[k: string]: (string | {
|
|
378
|
+
_: string;
|
|
379
|
+
[k: string]: string;
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Type of the tag map inside a LogMetadata file
|
|
385
|
+
* @author Gabe Abrams
|
|
386
|
+
*/
|
|
387
|
+
declare type LogMetadataTagMap = {
|
|
388
|
+
[k: string]: string;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Type of the target map inside a LogMetadata file
|
|
393
|
+
* @author Gabe Abrams
|
|
394
|
+
*/
|
|
395
|
+
declare type LogMetadataTargetMap = {
|
|
396
|
+
[k: string]: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
372
399
|
/**
|
|
373
400
|
* Type of a LogMetadata file
|
|
374
401
|
* @author Gabe Abrams
|
|
375
402
|
*/
|
|
376
403
|
declare type LogMetadataType = {
|
|
377
|
-
Context?:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
[k: string]: string;
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
Tag?: {
|
|
384
|
-
[k: string]: string;
|
|
385
|
-
};
|
|
386
|
-
Target?: {
|
|
387
|
-
[k: string]: string;
|
|
388
|
-
};
|
|
404
|
+
Context?: LogMetadataContextMap;
|
|
405
|
+
Tag?: LogMetadataTagMap;
|
|
406
|
+
Target?: LogMetadataTargetMap;
|
|
389
407
|
};
|
|
390
408
|
|
|
391
409
|
/**
|
package/package.json
CHANGED
|
@@ -36,6 +36,8 @@ import LogAction from '../types/LogAction';
|
|
|
36
36
|
import ParamType from '../types/ParamType';
|
|
37
37
|
import IntelliTableColumn from '../types/IntelliTableColumn';
|
|
38
38
|
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
39
|
+
import LogMetadataContextMap from '../types/LogMetadataContextMap';
|
|
40
|
+
import LogMetadataTargetMap from '../types/LogMetadataTargetMap';
|
|
39
41
|
|
|
40
42
|
// Import shared components
|
|
41
43
|
import SimpleDateChooser from './SimpleDateChooser';
|
|
@@ -712,33 +714,34 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
712
714
|
onClose,
|
|
713
715
|
} = props;
|
|
714
716
|
|
|
715
|
-
//
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
)
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
if (LogMetadata.Context) {
|
|
733
|
-
LogMetadata.Context[context] = context;
|
|
734
|
-
}
|
|
717
|
+
// Create complete map of contexts
|
|
718
|
+
const contextMap: LogMetadataContextMap = {};
|
|
719
|
+
[
|
|
720
|
+
(LogMetadata.Context ?? {}),
|
|
721
|
+
LogBuiltInMetadata.Context,
|
|
722
|
+
].forEach((contextMap) => {
|
|
723
|
+
Object.keys(contextMap).forEach((context) => {
|
|
724
|
+
// Add context
|
|
725
|
+
contextMap[context] = context;
|
|
726
|
+
|
|
727
|
+
// If context has children, add an "uncategorized" subcontext
|
|
728
|
+
if (typeof contextMap[context] !== 'string') {
|
|
729
|
+
(contextMap[context] as any)[LogBuiltInMetadata.Context.Uncategorized] = (
|
|
730
|
+
LogBuiltInMetadata.Context.Uncategorized
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
735
734
|
});
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
735
|
+
|
|
736
|
+
// Create complete map of targets
|
|
737
|
+
const targetMap: LogMetadataTargetMap = {};
|
|
738
|
+
[
|
|
739
|
+
(LogMetadata.Target ?? {}),
|
|
740
|
+
LogBuiltInMetadata.Target,
|
|
741
|
+
].forEach((targetMap) => {
|
|
742
|
+
Object.keys(targetMap).forEach((target) => {
|
|
743
|
+
targetMap[target] = target;
|
|
744
|
+
});
|
|
742
745
|
});
|
|
743
746
|
|
|
744
747
|
/* -------------- State ------------- */
|
|
@@ -1125,7 +1128,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1125
1128
|
});
|
|
1126
1129
|
}}
|
|
1127
1130
|
>
|
|
1128
|
-
Reset
|
|
1131
|
+
Reset
|
|
1129
1132
|
</button>
|
|
1130
1133
|
</div>
|
|
1131
1134
|
</div>
|
|
@@ -1187,45 +1190,63 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1187
1190
|
);
|
|
1188
1191
|
} else if (expandedFilterDrawer === FilterDrawer.Context) {
|
|
1189
1192
|
// Create item picker items
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
return item;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
// Has subcategories
|
|
1206
|
-
const children: PickableItem[] = (
|
|
1207
|
-
Object.keys(value)
|
|
1208
|
-
.filter((subcontext) => {
|
|
1209
|
-
return subcontext !== '_';
|
|
1210
|
-
})
|
|
1211
|
-
.map((subcontext) => {
|
|
1212
|
-
return {
|
|
1213
|
-
id: subcontext,
|
|
1214
|
-
name: genHumanReadableName(subcontext),
|
|
1215
|
-
isGroup: false,
|
|
1216
|
-
checked: (contextFilterState[context] as any)[subcontext],
|
|
1217
|
-
};
|
|
1218
|
-
})
|
|
1219
|
-
);
|
|
1193
|
+
const builtInPickableItem: PickableItem = {
|
|
1194
|
+
id: '_',
|
|
1195
|
+
name: 'Auto-logged',
|
|
1196
|
+
isGroup: true,
|
|
1197
|
+
children: [],
|
|
1198
|
+
};
|
|
1199
|
+
const pickableItems: PickableItem[] = [];
|
|
1200
|
+
Object.keys(contextMap)
|
|
1201
|
+
.forEach((context) => {
|
|
1202
|
+
const value = (contextMap)[context];
|
|
1203
|
+
if (typeof value === 'string') {
|
|
1204
|
+
// No subcategories
|
|
1220
1205
|
const item: PickableItem = {
|
|
1221
1206
|
id: context,
|
|
1222
1207
|
name: genHumanReadableName(context),
|
|
1223
|
-
isGroup:
|
|
1224
|
-
|
|
1208
|
+
isGroup: false,
|
|
1209
|
+
checked: !!contextFilterState[context],
|
|
1225
1210
|
};
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1211
|
+
|
|
1212
|
+
// Add built-in items to its own folder
|
|
1213
|
+
const isBuiltIn = context in LogBuiltInMetadata.Context;
|
|
1214
|
+
if (isBuiltIn) {
|
|
1215
|
+
// Add to built-in pickable item
|
|
1216
|
+
builtInPickableItem.children.push(item);
|
|
1217
|
+
} else {
|
|
1218
|
+
// Add to pickable items list
|
|
1219
|
+
pickableItems.push(item);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// Has subcategories
|
|
1224
|
+
const children: PickableItem[] = (
|
|
1225
|
+
Object.keys(value)
|
|
1226
|
+
// Remove parent name
|
|
1227
|
+
.filter((subcontext) => {
|
|
1228
|
+
return subcontext !== '_';
|
|
1229
|
+
})
|
|
1230
|
+
// Create child pickable items
|
|
1231
|
+
.map((subcontext) => {
|
|
1232
|
+
return {
|
|
1233
|
+
id: subcontext,
|
|
1234
|
+
name: genHumanReadableName(subcontext),
|
|
1235
|
+
isGroup: false,
|
|
1236
|
+
checked: (contextFilterState[context] as any)[subcontext],
|
|
1237
|
+
};
|
|
1238
|
+
})
|
|
1239
|
+
);
|
|
1240
|
+
const item: PickableItem = {
|
|
1241
|
+
id: context,
|
|
1242
|
+
name: genHumanReadableName(context),
|
|
1243
|
+
isGroup: true,
|
|
1244
|
+
children,
|
|
1245
|
+
};
|
|
1246
|
+
pickableItems.push(item);
|
|
1247
|
+
});
|
|
1248
|
+
// Add built-in contexts to end ofl ist
|
|
1249
|
+
pickableItems.push(builtInPickableItem);
|
|
1229
1250
|
|
|
1230
1251
|
// Create filter UI
|
|
1231
1252
|
filterDrawer = (
|
|
@@ -1237,15 +1258,30 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1237
1258
|
updatedItems.forEach((pickableItem) => {
|
|
1238
1259
|
if (pickableItem.isGroup) {
|
|
1239
1260
|
// Has subcontexts
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
if (pickableItem.id === '_') {
|
|
1264
|
+
// Built-in
|
|
1265
|
+
|
|
1266
|
+
// Treat as if these were top-level contexts
|
|
1267
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
1268
|
+
contextFilterState[subcontextItem.id] = (
|
|
1269
|
+
'checked' in subcontextItem
|
|
1270
|
+
&& subcontextItem.checked
|
|
1246
1271
|
);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1272
|
+
});
|
|
1273
|
+
} else {
|
|
1274
|
+
// Not built-in
|
|
1275
|
+
pickableItem.children.forEach((subcontextItem) => {
|
|
1276
|
+
if (!subcontextItem.isGroup) {
|
|
1277
|
+
(
|
|
1278
|
+
contextFilterState[pickableItem.id] as { [k: string]: boolean }
|
|
1279
|
+
)[subcontextItem.id] = (
|
|
1280
|
+
subcontextItem.checked
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1249
1285
|
} else {
|
|
1250
1286
|
// No subcontexts
|
|
1251
1287
|
(contextFilterState as any)[pickableItem.id] = (
|
|
@@ -1264,6 +1300,11 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1264
1300
|
// Create filter UI
|
|
1265
1301
|
filterDrawer = (
|
|
1266
1302
|
<TabBox title="Tags">
|
|
1303
|
+
<div>
|
|
1304
|
+
If any are selected, logs must contain at least one
|
|
1305
|
+
but not necessarily all of the
|
|
1306
|
+
selected tags.
|
|
1307
|
+
</div>
|
|
1267
1308
|
{
|
|
1268
1309
|
Object.keys(LogMetadata.Tag ?? {})
|
|
1269
1310
|
.map((tag, i) => {
|
|
@@ -1374,15 +1415,9 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1374
1415
|
</ButtonInputGroup>
|
|
1375
1416
|
{/* Target */}
|
|
1376
1417
|
<ButtonInputGroup label="Target">
|
|
1377
|
-
{/* Nothing here */}
|
|
1378
|
-
{(Object.keys(LogMetadata.Target ?? {}).length === 0) && (
|
|
1379
|
-
<div>
|
|
1380
|
-
This app does not have any targets yet.
|
|
1381
|
-
</div>
|
|
1382
|
-
)}
|
|
1383
1418
|
{/* List of targets */}
|
|
1384
1419
|
{
|
|
1385
|
-
Object.keys(
|
|
1420
|
+
Object.keys(targetMap)
|
|
1386
1421
|
.map((target, i) => {
|
|
1387
1422
|
const description = genHumanReadableName(target);
|
|
1388
1423
|
return (
|
|
@@ -1400,7 +1435,7 @@ const LogReviewer: React.FC<Props> = (props) => {
|
|
|
1400
1435
|
actionErrorFilterState,
|
|
1401
1436
|
});
|
|
1402
1437
|
}}
|
|
1403
|
-
noMarginOnRight={i === Object.keys(
|
|
1438
|
+
noMarginOnRight={i === Object.keys(targetMap).length - 1}
|
|
1404
1439
|
/>
|
|
1405
1440
|
);
|
|
1406
1441
|
})
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import LogMetadataContextMap from './LogMetadataContextMap';
|
|
3
|
+
import LogMetadataTagMap from './LogMetadataTagMap';
|
|
4
|
+
import LogMetadataTargetMap from './LogMetadataTargetMap';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Type of a LogMetadata file
|
|
3
8
|
* @author Gabe Abrams
|
|
4
9
|
*/
|
|
5
10
|
type LogMetadataType = {
|
|
6
|
-
Context?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| {
|
|
10
|
-
_: string,
|
|
11
|
-
[k: string]: string
|
|
12
|
-
}
|
|
13
|
-
)
|
|
14
|
-
},
|
|
15
|
-
Tag?: {
|
|
16
|
-
[k: string]: string
|
|
17
|
-
},
|
|
18
|
-
Target?: {
|
|
19
|
-
[k: string]: string
|
|
20
|
-
},
|
|
11
|
+
Context?: LogMetadataContextMap,
|
|
12
|
+
Tag?: LogMetadataTagMap,
|
|
13
|
+
Target?: LogMetadataTargetMap,
|
|
21
14
|
};
|
|
22
15
|
|
|
23
16
|
export default LogMetadataType;
|