File tree Expand file tree Collapse file tree 3 files changed +52
-39
lines changed
src/dashboard/Synapse.Dashboard/Components Expand file tree Collapse file tree 3 files changed +52
-39
lines changed Original file line number Diff line number Diff line change 71
71
<DocumentDetails Label =' Output' Reference =" @TaskInstance.OutputReference" />
72
72
}
73
73
</div >
74
- <h6 class =" pt-3" >Executed Tasks </h6 >
75
- @if (SubTasks == null || SubTasks .Count () == 0 )
76
- {
77
- @( " -" )
78
- }
79
- else
80
- {
81
- <table class =" table table-hover" >
82
- <thead >
83
- <tr >
84
- <th >Name </th >
85
- <th class =" text-center" >Status </th >
86
- <th class =" text-center" >Start Time </th >
87
- <th class =" text-center" >End Time </th >
88
- <th class =" text-center" >Duration </th >
89
- <th ></th >
90
- </tr >
91
- </thead >
92
- <tbody >
93
- @foreach ( var task in SubTasks )
94
- {
95
- <TaskInstanceRow TaskInstance =" @task" Tasks =" @Tasks" />
96
- }
97
- </tbody >
98
- </table >
99
- }
100
74
<h6 class =" pt-3" >Runs </h6 >
101
75
@if (TaskInstance .Runs == null || TaskInstance .Runs .Count == 0 )
102
76
{
163
137
164
138
@code {
165
139
[Parameter ] public TaskInstance ? TaskInstance { get ; set ; }
166
- [Parameter ] public IEnumerable <TaskInstance >? Tasks { get ; set ; }
167
-
168
- IEnumerable <TaskInstance > SubTasks
169
- {
170
- get
171
- {
172
- return TaskInstance == null ? [] : (this .Tasks ?? []).Where (t => t .ParentId == TaskInstance .Id );
173
- }
174
- }
175
140
}
Original file line number Diff line number Diff line change 18
18
19
19
@if (TaskInstance != null ) {
20
20
< tr @onclick = " async _ => await OnToggleRow()" class = " cursor-pointer" >
21
+ < td >
22
+ @if (HasChildren ) {
23
+ @for (var i = 0 ; i < Depth ; i ++ )
24
+ {
25
+ < span class = " ps-2" >< / span >
26
+ }
27
+ < span @onclick = " ToggleChildrenVisibility" @onclick : stopPropagation = " true" >
28
+ < Icon Name = " showChildren ? IconName.Dash : IconName.Plus" Class = " cursor-pointer" / >
29
+ < / span >
30
+ }
31
+ < / td >
21
32
< td > @TaskInstance .Reference < / td >
22
33
< td class = " text-center" >< span class = " badge rounded-pill badge rounded-pill border @TaskInstance.Status.GetColorClass()" > @(TaskInstance .Status ?? TaskInstanceStatus .Pending )< / span >< / td >
23
34
< td class = " text-center" > @(TaskInstance .StartedAt ? .RelativeFormat () ?? " -" )< / td >
38
49
< tr >
39
50
< td colspan = " 999" >
40
51
< Collapse @ref = " collapse" >
41
- < TaskInstanceDetails TaskInstance = " @TaskInstance" Tasks = " @Tasks " / >
52
+ < TaskInstanceDetails TaskInstance = " @TaskInstance" / >
42
53
< / Collapse >
43
54
< / td >
44
55
< / tr >
47
58
48
59
@code {
49
60
[Parameter ] public TaskInstance ? TaskInstance { get ; set ; }
50
- [Parameter ] public IEnumerable <TaskInstance >? Tasks { get ; set ; }
61
+ [Parameter ] public bool HasChildren { get ; set ; }
62
+ [Parameter ] public EventCallback < ( string , int )> OnToggleChildrenClick { get ; set ; }
63
+ [Parameter ] public int Depth { get ; set ; }
51
64
bool isOpen = false ;
52
65
Collapse ? collapse ;
66
+ bool showChildren = false ;
53
67
54
68
async Task OnToggleRow ()
55
69
{
62
76
}
63
77
StateHasChanged ();
64
78
}
79
+
80
+ async Task ToggleChildrenVisibility ()
81
+ {
82
+ showChildren = ! showChildren ;
83
+ if (OnToggleChildrenClick .HasDelegate && TaskInstance != null )
84
+ {
85
+ await OnToggleChildrenClick .InvokeAsync ((TaskInstance .Id , Depth ));
86
+ }
87
+ }
65
88
}
Original file line number Diff line number Diff line change 77
77
<table class =" table table-hover" >
78
78
<thead >
79
79
<tr >
80
+ <th ></th >
80
81
<th >Name </th >
81
82
<th class =" text-center" >Status </th >
82
83
<th class =" text-center" >Start Time </th >
86
87
</tr >
87
88
</thead >
88
89
<tbody >
89
- @foreach ( var task in workflowInstance .Status .Tasks .Where (task => string .IsNullOrWhiteSpace (task .ParentId )) )
90
+ @foreach ( var task in workflowInstance .Status .Tasks .Where (task => string .IsNullOrWhiteSpace (task .ParentId ) || expandedTasks . ContainsKey ( task . ParentId ) ) )
90
91
{
91
- <TaskInstanceRow TaskInstance =" @task" Tasks = " @ workflowInstance.Status.Tasks" />
92
+ <TaskInstanceRow TaskInstance =" @task" Depth = " string.IsNullOrWhiteSpace(task.ParentId) ? 0 : (expandedTasks[task.ParentId] + 1) " HasChildren = " workflowInstance.Status.Tasks.Any(t => t.ParentId == task.Id) " OnToggleChildrenClick = " ToggleChildrenTask " />
92
93
}
93
94
</tbody >
94
95
</table >
186
187
@code {
187
188
private WorkflowInstance ? workflowInstance ;
188
189
[Parameter ] public WorkflowInstance ? WorkflowInstance { get ; set ; }
190
+ private Dictionary <string , int > expandedTasks = new ();
189
191
190
192
protected override void OnParametersSet ()
191
193
{
204
206
shouldRender = false ;
205
207
return true ;
206
208
}
209
+
210
+ protected void CloseChildrenTask (string taskId )
211
+ {
212
+ if (expandedTasks .ContainsKey (taskId ))
213
+ {
214
+ expandedTasks .Remove (taskId );
215
+ }
216
+ foreach (var child in workflowInstance ? .Status ? .Tasks ? .Where (task => task .ParentId == taskId ) ?? [])
217
+ {
218
+ CloseChildrenTask (child .Id );
219
+ }
220
+ }
221
+
222
+ protected void ToggleChildrenTask ((string , int ) e )
223
+ {
224
+ (string taskId , int depth ) = e ;
225
+ if (expandedTasks .ContainsKey (taskId ))
226
+ {
227
+ CloseChildrenTask (taskId );
228
+ }
229
+ else expandedTasks .Add (taskId , depth );
230
+ shouldRender = true ;
231
+ }
207
232
}
You can’t perform that action at this time.
0 commit comments