dce-reactkit 3.2.2-beta.16 → 3.2.2-beta.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.16",
3
+ "version": "3.2.2-beta.18",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,6 +34,7 @@ import LogType from '../types/LogType';
34
34
  import LogAction from '../types/LogAction';
35
35
  import ParamType from '../types/ParamType';
36
36
  import IntelliTableColumn from '../types/IntelliTableColumn';
37
+ import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
37
38
 
38
39
  // Import shared components
39
40
  import SimpleDateChooser from './SimpleDateChooser';
@@ -256,6 +257,17 @@ const style = `
256
257
  }
257
258
  `;
258
259
 
260
+ /*------------------------------------------------------------------------*/
261
+ /* Constants */
262
+ /*------------------------------------------------------------------------*/
263
+
264
+ const builtInContextToName = {
265
+ [LogBuiltInMetadata.Context.Uncategorized]: 'Uncategorized',
266
+ [LogBuiltInMetadata.Context.ServerRenderedErrorPage]: 'Server Rendered Error Page',
267
+ [LogBuiltInMetadata.Context.ServerEndpointError]: 'Server Endpoint Error',
268
+ [LogBuiltInMetadata.Context.ClientFatalError]: 'Client Fatal Error',
269
+ };
270
+
259
271
  /*------------------------------------------------------------------------*/
260
272
  /* Static Functions */
261
273
  /*------------------------------------------------------------------------*/
@@ -548,8 +560,12 @@ const LogReviewer: React.FC<Props> = (props) => {
548
560
  const subcontextValue = contextValue[subcontext];
549
561
  (initContextFilterState[contextValue._] as { [k: string]: boolean })[subcontextValue] = true;
550
562
  });
563
+ // Add uncategorized subcontext
564
+ (initContextFilterState[contextValue._] as { [k: string]: boolean })[LogBuiltInMetadata.Context.Uncategorized] = true;
551
565
  }
552
566
  });
567
+ // Add uncategorized context
568
+ initContextFilterState[LogBuiltInMetadata.Context.Uncategorized] = true;
553
569
 
554
570
  // Create initial tag filter state
555
571
  const initTagFilterState: TagFilterState = {};
@@ -966,7 +982,10 @@ const LogReviewer: React.FC<Props> = (props) => {
966
982
  );
967
983
  const item: PickableItem = {
968
984
  id: context,
969
- name: context,
985
+ name: (
986
+ builtInContextToName[context]
987
+ ?? genHumanReadableName(context)
988
+ ),
970
989
  isGroup: true,
971
990
  children,
972
991
  };
@@ -980,6 +999,8 @@ const LogReviewer: React.FC<Props> = (props) => {
980
999
  title="Context"
981
1000
  items={pickableItems}
982
1001
  onChanged={(updatedItems) => {
1002
+ console.log('Items before:', pickableItems);
1003
+ console.log('Updated Items:', updatedItems);
983
1004
  // Update our state
984
1005
  updatedItems.forEach((pickableItem) => {
985
1006
  if (pickableItem.isGroup) {
@@ -1601,8 +1622,10 @@ const LogReviewer: React.FC<Props> = (props) => {
1601
1622
 
1602
1623
  // Subcontext doesn't match
1603
1624
  if (
1625
+ // Log context is not "uncategorized" (no point in further filters)
1626
+ log.context !== LogBuiltInMetadata.Context.Uncategorized
1604
1627
  // Log has a subcontext
1605
- log.subcontext
1628
+ && log.subcontext
1606
1629
  // Context has subcontexts
1607
1630
  && (
1608
1631
  contextFilterState[log.context]