-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa47429
commit d71da6e
Showing
10 changed files
with
187 additions
and
22 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@implements IDialogContentComponent<long> | ||
|
||
@inject IAppsApi AppsApi | ||
@inject IToastService ToastService | ||
|
||
<FluentDialogHeader ShowDismiss="true"> | ||
<FluentStack VerticalAlignment="VerticalAlignment.Center"> | ||
<FluentIcon Value="@(new Icons.Regular.Size24.LockClosedKey())"/> | ||
<FluentLabel Typo="Typography.PaneHeader"> | ||
@(Resources.IDS_APPS_RESET_SECRET_DIALOG_TITLE) | ||
</FluentLabel> | ||
</FluentStack> | ||
</FluentDialogHeader> | ||
|
||
<FluentDialogBody> | ||
<FluentStack Orientation="Orientation.Vertical"> | ||
<FluentTextField Style="width: 100%" Required="true" | ||
Label="@(Resources.IDS_APPS_EDIT_LABEL_SECRET)" | ||
@bind-Value="Secret"/> | ||
<FluentLabel>@(Resources.IDS_APPS_RESET_SECRET_DIALOG_TIPS)</FluentLabel> | ||
</FluentStack> | ||
</FluentDialogBody> | ||
|
||
<FluentDialogFooter> | ||
<FluentButton Appearance="Appearance.Accent" OnClick="@SaveAsync" Loading="Loading">@(Resources.IDS_COMMON_SAVE)</FluentButton> | ||
<FluentButton Appearance="Appearance.Neutral" OnClick="@CancelAsync">@(Resources.IDS_COMMON_CANCEL)</FluentButton> | ||
</FluentDialogFooter> | ||
|
||
@code { | ||
|
||
[Parameter] | ||
public long Content { get; set; } | ||
|
||
[CascadingParameter] | ||
public FluentDialog Dialog { get; set; } = default!; | ||
|
||
private bool Loading { get; set; } | ||
|
||
private string Secret { get; set; } | ||
|
||
private async Task SaveAsync() | ||
{ | ||
try | ||
{ | ||
Loading = true; | ||
|
||
var data = new AppInfoSetSecretDto | ||
{ | ||
Secret = Secret | ||
}; | ||
|
||
await AppsApi.SetSecretAsync(Content, data) | ||
.ContinueWith(task => | ||
{ | ||
task.WaitAndUnwrapException(); | ||
task.Result.EnsureSuccess(); | ||
}); | ||
|
||
await Dialog.CloseAsync(Content); | ||
} | ||
catch (Exception exception) | ||
{ | ||
var message = exception.GetPromptMessage(); | ||
ToastService.ShowError(message); | ||
} | ||
finally | ||
{ | ||
Loading = false; | ||
} | ||
} | ||
|
||
private async Task CancelAsync() | ||
{ | ||
await Dialog.CancelAsync(); | ||
} | ||
|
||
} |
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
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
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