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 7171 <DocumentDetails Label =' Output' Reference =" @TaskInstance.OutputReference" />
7272 }
7373 </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- }
10074 <h6 class =" pt-3" >Runs </h6 >
10175 @if (TaskInstance .Runs == null || TaskInstance .Runs .Count == 0 )
10276 {
163137
164138@code {
165139 [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- }
175140}
Original file line number Diff line number Diff line change 1818
1919@if (TaskInstance != null ) {
2020 < 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 >
2132 < td > @TaskInstance .Reference < / td >
2233 < td class = " text-center" >< span class = " badge rounded-pill badge rounded-pill border @TaskInstance.Status.GetColorClass()" > @(TaskInstance .Status ?? TaskInstanceStatus .Pending )< / span >< / td >
2334 < td class = " text-center" > @(TaskInstance .StartedAt ? .RelativeFormat () ?? " -" )< / td >
3849 < tr >
3950 < td colspan = " 999" >
4051 < Collapse @ref = " collapse" >
41- < TaskInstanceDetails TaskInstance = " @TaskInstance" Tasks = " @Tasks " / >
52+ < TaskInstanceDetails TaskInstance = " @TaskInstance" / >
4253 < / Collapse >
4354 < / td >
4455 < / tr >
4758
4859@code {
4960 [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 ; }
5164 bool isOpen = false ;
5265 Collapse ? collapse ;
66+ bool showChildren = false ;
5367
5468 async Task OnToggleRow ()
5569 {
6276 }
6377 StateHasChanged ();
6478 }
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+ }
6588}
Original file line number Diff line number Diff line change 7777 <table class =" table table-hover" >
7878 <thead >
7979 <tr >
80+ <th ></th >
8081 <th >Name </th >
8182 <th class =" text-center" >Status </th >
8283 <th class =" text-center" >Start Time </th >
8687 </tr >
8788 </thead >
8889 <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 ) ) )
9091 {
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 " />
9293 }
9394 </tbody >
9495 </table >
186187@code {
187188 private WorkflowInstance ? workflowInstance ;
188189 [Parameter ] public WorkflowInstance ? WorkflowInstance { get ; set ; }
190+ private Dictionary <string , int > expandedTasks = new ();
189191
190192 protected override void OnParametersSet ()
191193 {
204206 shouldRender = false ;
205207 return true ;
206208 }
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+ }
207232}
You can’t perform that action at this time.
0 commit comments