@@ -9,17 +9,32 @@ import { type WorkflowHistoryEventDetailsConfig } from '../workflow-history-even
99import WorkflowHistoryEventDetailsJson from '../workflow-history-event-details-json/workflow-history-event-details-json' ;
1010import WorkflowHistoryEventDetailsPlaceholderText from '../workflow-history-event-details-placeholder-text/workflow-history-event-details-placeholder-text' ;
1111
12+ /**
13+ * Configuration array for customizing how workflow history event details are rendered.
14+ * Each config entry defines matching criteria and rendering behavior for specific event fields.
15+ * Configs are evaluated in order, and the first matching config is applied to each field.
16+ */
1217const workflowHistoryEventDetailsConfig = [
18+ /**
19+ * Hides fields with null or undefined values from the event details display.
20+ */
1321 {
1422 name : 'Filter empty value' ,
1523 customMatcher : ( { value } ) => value === null || value === undefined ,
1624 hide : ( ) => true ,
1725 } ,
26+ /**
27+ * Hides internal fields (taskId, eventType) that are not useful for display.
28+ */
1829 {
1930 name : 'Filter unneeded values' ,
2031 pathRegex : '(taskId|eventType)$' ,
2132 hide : ( ) => true ,
2233 } ,
34+ /**
35+ * Displays a placeholder text for timeout/retry fields that are set to 0 (not configured).
36+ * Also removes the "Seconds" suffix from labels since formatted durations may be in minutes/hours.
37+ */
2338 {
2439 name : 'Not set placeholder' ,
2540 customMatcher : ( { value, path } ) => {
@@ -34,11 +49,17 @@ const workflowHistoryEventDetailsConfig = [
3449 valueComponent : ( ) =>
3550 createElement ( WorkflowHistoryEventDetailsPlaceholderText ) ,
3651 } ,
52+ /**
53+ * Formats Date objects as human-readable time strings.
54+ */
3755 {
3856 name : 'Date object as time string' ,
3957 customMatcher : ( { value } ) => value instanceof Date ,
4058 valueComponent : ( { entryValue } ) => formatDate ( entryValue ) ,
4159 } ,
60+ /**
61+ * Renders task list names as clickable links that navigate to the task list view.
62+ */
4263 {
4364 name : 'Tasklists as links' ,
4465 key : 'taskList' ,
@@ -50,20 +71,32 @@ const workflowHistoryEventDetailsConfig = [
5071 } ) ;
5172 } ,
5273 } ,
74+ /**
75+ * Renders JSON fields (input, result, details, etc.) as formatted PrettyJson components.
76+ * Uses forceWrap to ensure proper wrapping of long JSON content.
77+ */
5378 {
5479 name : 'Json as PrettyJson' ,
5580 pathRegex :
5681 '(input|result|details|failureDetails|Error|lastCompletionResult|heartbeatDetails|lastFailureDetails)$' ,
5782 valueComponent : WorkflowHistoryEventDetailsJson ,
5883 forceWrap : true ,
5984 } ,
85+ /**
86+ * Formats duration fields (ending in TimeoutSeconds, BackoffSeconds, or InSeconds) as human-readable durations.
87+ * Removes the "Seconds" suffix from labels since formatted durations may be in minutes/hours.
88+ */
6089 {
6190 name : 'Duration & interval seconds' ,
6291 pathRegex : '(TimeoutSeconds|BackoffSeconds|InSeconds)$' ,
6392 getLabel : ( { key } ) => key . replace ( / I n S e c o n d s | S e c o n d s | $ / , '' ) , // remove seconds suffix from label as formatted duration can be minutes/hours etc.
6493 valueComponent : ( { entryValue } ) =>
6594 formatDuration ( { seconds : entryValue > 0 ? entryValue : 0 , nanos : 0 } ) ,
6695 } ,
96+ /**
97+ * Renders workflow execution objects as clickable links that navigate to the workflow view.
98+ * Applies to parentWorkflowExecution, externalWorkflowExecution, and workflowExecution fields.
99+ */
67100 {
68101 name : 'WorkflowExecution as link' ,
69102 pathRegex :
@@ -77,6 +110,10 @@ const workflowHistoryEventDetailsConfig = [
77110 } ) ;
78111 } ,
79112 } ,
113+ /**
114+ * Renders run ID fields as clickable links that navigate to the corresponding workflow run.
115+ * Applies to firstExecutionRunId, originalExecutionRunId, newExecutionRunId, and continuedExecutionRunId.
116+ */
80117 {
81118 name : 'RunIds as link' ,
82119 pathRegex :
@@ -90,6 +127,9 @@ const workflowHistoryEventDetailsConfig = [
90127 } ) ;
91128 } ,
92129 } ,
130+ /**
131+ * Renames the "attempt" field label to "retryAttempt" for better clarity.
132+ */
93133 {
94134 name : 'Retry config attempt as retryAttempt' ,
95135 key : 'attempt' ,
0 commit comments