Commit 4a24e53 1 parent cbb6d15 commit 4a24e53 Copy full SHA for 4a24e53
File tree 3 files changed +26
-2
lines changed
src/MaintenanceLog.Client
3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 54
54
public int ? AreaId { get ; set ; }
55
55
[Parameter ]
56
56
public int ? AssetId { get ; set ; }
57
+ [Parameter ]
58
+ public EventCallback <bool > OnDataUpdated { get ; set ; }
57
59
58
60
private List <TaskDefinition >? taskDefinitions ;
59
61
85
87
{
86
88
await TaskDefinitionService .DeleteAsync (id );
87
89
await LoadTaskDefinitions ();
90
+ if (OnDataUpdated .HasDelegate )
91
+ {
92
+ await OnDataUpdated .InvokeAsync (true );
93
+ }
88
94
}
89
95
}
90
96
98
104
// Status = TaskInstanceStatus.InProgress
99
105
};
100
106
await TaskInstanceService .AddAsync (taskInstance );
107
+ if (OnDataUpdated .HasDelegate )
108
+ {
109
+ await OnDataUpdated .InvokeAsync (true );
110
+ }
101
111
}
102
112
}
Original file line number Diff line number Diff line change 136
136
_userId = user .FindFirstValue (ClaimTypes .NameIdentifier );
137
137
}
138
138
139
- private async Task LoadTaskInstances ()
139
+ public async Task LoadTaskInstances ()
140
140
{
141
141
taskInstances = (await TaskInstanceService .GetAsync ())
142
142
.Where (t => ! TaskDefinitionId .HasValue || (t .TaskDefinitionId == TaskDefinitionId ))
Original file line number Diff line number Diff line change 1
1
@page " /"
2
+ @using MaintenanceLog .Client .Components .TaskDefinitions
2
3
@using MaintenanceLog .Client .Components .TaskInstances
3
4
4
5
@inject Blazored .LocalStorage .ILocalStorageService LocalStorage
18
19
<h2 class =" pt-4" >Tasks</h2 >
19
20
<input type =" checkbox" @bind =" onlyActive" /> Only Active
20
21
21
- <TaskInstanceGrid OnlyShowActive =" @onlyActive" />
22
+ <TaskInstanceGrid OnlyShowActive =" @onlyActive" @ref =" taskInstanceGrid" />
23
+
24
+ <h2 class =" pt-4" >Definitions</h2 >
25
+ <TaskDefinitionGrid OnDataUpdated =" OnTaskDefinitionsUpdated" />
22
26
</Authorized >
23
27
</AuthorizeView >
24
28
25
29
@code
26
30
{
27
31
private bool ? onlyActive = true ;
32
+ TaskInstanceGrid ? taskInstanceGrid ;
28
33
29
34
protected override async Task OnAfterRenderAsync (bool firstRender )
30
35
{
31
36
// onlyActive = await LocalStorage.GetItemAsync<bool?>(nameof(onlyActive));
32
37
await base .OnAfterRenderAsync (firstRender );
33
38
}
39
+
40
+ private async Task OnTaskDefinitionsUpdated (bool updated )
41
+ {
42
+ if (taskInstanceGrid is not null )
43
+ {
44
+ // may be a better way than component reference here
45
+ await taskInstanceGrid .LoadTaskInstances ();
46
+ }
47
+ }
34
48
}
You can’t perform that action at this time.
0 commit comments