File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed
src/dashboard/Synapse.Dashboard Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 125
125
protected override async Task OnInitializedAsync ()
126
126
{
127
127
await base .OnInitializedAsync ().ConfigureAwait (false );
128
+ this .Store .IsSaving .Subscribe (saving => this .OnStateChanged (cmp => this .OnSavingChanged (saving )), token : this .CancellationTokenSource .Token );
128
129
this .Store .Resource .Subscribe (resource => this .OnStateChanged (cmp => cmp .resource = resource ), token : this .CancellationTokenSource .Token );
129
130
this .Store .IsUpdating .Subscribe (updating => this .OnStateChanged (cmp => cmp .isUpdating = updating ), token : this .CancellationTokenSource .Token );
130
- this .Store .IsSaving .Subscribe (OnSavingChanged , token : this .CancellationTokenSource .Token );
131
131
this .Store .ProblemDetails .Subscribe (problemDetails => this .OnStateChanged (cmp => cmp .problemDetails = problemDetails ), token : this .CancellationTokenSource .Token );
132
132
this .textEditorInput
133
133
.Throttle (TimeSpan .FromMilliseconds (300 ))
148
148
{
149
149
this .resource = this .Resource ; // should happen in this.Store.Resource.Subscribe but prevents possible race when multiple params are set
150
150
this .Store .SetResource (this .Resource );
151
+ this .Store .SetProblemDetails (null );
151
152
}
152
153
if (this .isCluster != this .IsCluster )
153
154
{
178
179
{
179
180
this .isSaving = saving ;
180
181
if (this .textBasedEditor != null ) this .textBasedEditor .UpdateOptions (new EditorUpdateOptions () { ReadOnly = saving });
181
- this .StateHasChanged ();
182
182
}
183
183
184
184
/// <summary >
199
199
await this .SetTextEditorValueAsync ();
200
200
await this .SetTextBasedEditorLanguageAsync ();
201
201
}
202
- this .StateHasChanged ();
202
+ this .OnStateChanged ();
203
203
}
204
204
205
205
/// <summary >
Original file line number Diff line number Diff line change @@ -236,15 +236,16 @@ protected virtual Task OnShowResourceDetailsAsync(TResource resource)
236
236
/// Opens the targeted <see cref="Resource"/>'s edition
237
237
/// </summary>
238
238
/// <param name="resource">The <see cref="Resource"/> to edit</param>
239
- protected virtual Task OnShowResourceEditorAsync ( TResource ? resource = null )
239
+ protected virtual async Task OnShowResourceEditorAsync ( TResource ? resource = null )
240
240
{
241
- if ( this . EditorOffCanvas == null ) return Task . CompletedTask ;
241
+ if ( this . EditorOffCanvas == null ) return ;
242
242
var parameters = new Dictionary < string , object >
243
243
{
244
244
{ nameof ( ResourceEditor < TResource > . Resource ) , resource ! }
245
245
} ;
246
246
string actionType = resource == null ? "creation" : "edition" ;
247
- return this . EditorOffCanvas . ShowAsync < ResourceEditor < TResource > > ( title : typeof ( TResource ) . Name + " " + actionType , parameters : parameters ) ;
247
+ await this . EditorOffCanvas . ShowAsync < ResourceEditor < TResource > > ( title : typeof ( TResource ) . Name + " " + actionType ) ;
248
+ await this . EditorOffCanvas . ShowAsync < ResourceEditor < TResource > > ( title : typeof ( TResource ) . Name + " " + actionType , parameters : parameters ) ;
248
249
}
249
250
250
251
}
Original file line number Diff line number Diff line change 95
95
/// Opens the targeted <see cref =" Resource" />'s edition
96
96
/// </summary >
97
97
/// <param name =" resource" >The <see cref =" Resource" /> to edit</param >
98
- protected override Task OnShowResourceEditorAsync (Namespace ? resource = null )
98
+ protected override async Task OnShowResourceEditorAsync (Namespace ? resource = null )
99
99
{
100
- if (this .EditorOffCanvas == null ) return Task . CompletedTask ;
100
+ if (this .EditorOffCanvas == null ) return ;
101
101
var parameters = new Dictionary <string , object >
102
102
{
103
103
{ nameof (ResourceEditor <Namespace >.Resource ), resource ! },
104
104
{ nameof (ResourceEditor <Namespace >.IsCluster ), true }
105
105
};
106
106
string actionType = resource == null ? " creation" : " edition" ;
107
- return this .EditorOffCanvas .ShowAsync <ResourceEditor <Namespace >>(title : typeof (Namespace ).Name + " " + actionType , parameters : parameters );
107
+ await this .EditorOffCanvas .ShowAsync <ResourceEditor <Namespace >>(title : typeof (Namespace ).Name + " " + actionType );
108
+ await this .EditorOffCanvas .ShowAsync <ResourceEditor <Namespace >>(title : typeof (Namespace ).Name + " " + actionType , parameters : parameters );
108
109
}
109
110
}
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ protected override async Task OnInitializedAsync()
61
61
/// Patches the component fields after a change
62
62
/// </summary>
63
63
/// <param name="patch">The patch to apply</param>
64
- protected void OnStateChanged ( Action < TComponent > patch )
64
+ protected void OnStateChanged ( Action < TComponent > ? patch = null )
65
65
{
66
- patch ( ( TComponent ) this ) ;
66
+ if ( patch != null ) patch ( ( TComponent ) this ) ;
67
67
this . shouldRender = true ;
68
68
this . StateHasChanged ( ) ;
69
69
}
You can’t perform that action at this time.
0 commit comments