-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from michelin/issue_#58_add_loading_informatio…
…n_when_performing_an_action fix #58
- Loading branch information
Showing
3 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
src/AzureIoTHub.Portal/Client/Pages/Gateways/ConnectionString.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/AzureIoTHub.Portal/Client/Pages/Gateways/GatewayDeleteConfirmation.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@using AzureIoTHub.Portal.Shared.Models.Device | ||
@inject HttpClient Http | ||
@inject IJSRuntime JS | ||
@inject ISnackbar Snackbar | ||
@inject NavigationManager NavigationManager | ||
|
||
<MudDialog> | ||
<DialogContent> | ||
<MudCard Outlined="true" > | ||
<MudCardContent Style="" > | ||
<p>Delete @DeviceId ?</p><br /> | ||
<p><i>Warning : this cannot be undone.</i></p> | ||
</MudCardContent> | ||
</MudCard> | ||
</DialogContent> | ||
<DialogActions> | ||
<MudButton OnClick="Cancel">Cancel</MudButton> | ||
<MudButton Color="Color.Primary" OnClick="DeleteDevice">Confirm</MudButton> | ||
</DialogActions> | ||
</MudDialog> | ||
|
||
@code { | ||
[CascadingParameter] MudDialogInstance MudDialog { get; set; } | ||
[Parameter] public string DeviceId { get; set; } | ||
|
||
void Cancel() => MudDialog.Cancel(); | ||
|
||
private async Task DeleteDevice() | ||
{ | ||
var result = await Http.DeleteAsync($"api/Gateways/{DeviceId}"); | ||
|
||
if (!result.IsSuccessStatusCode) | ||
{ | ||
Snackbar.Add($"Oh oh, something went wrong while deleting device {DeviceId}... ", Severity.Error); | ||
} | ||
|
||
Snackbar.Add($"Device {DeviceId} has been successfully delete!", Severity.Success); | ||
MudDialog.Close(DialogResult.Ok(true)); | ||
} | ||
} |