/
onimor
/
ASWRemoteViewerRev
Обзор
Документация
Войти
/
onimor
/
ASWRemoteViewerRev
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
RemoteViewing/ASW.RemoteViewing/ASW.RemoteViewing.Client/Features/IntegrationUser/Components/CreateIntegrationUser.razor
50 строк
2 KB
onimor
Добавьте файлы проекта.
28 авг 2025, 13:00
28 авг 2025, 13:00
855ae9a
Код
Авторство
О чём код?
@inherits UiComponentBase @inject IDialogService DialogService @inject IntegrationUserClient IntegrationUserClient <MudDialog> <TitleContent> <MudText Typo="Typo.h6" Class="mb-2">Создание токена</MudText> </TitleContent> <DialogContent> <MudStack> <MudTextField @bind-Value="createIntegrationUserRequest.Name" Label="Наименование" /> </MudStack> </DialogContent> <DialogActions> <MudButton OnClick="Cancel">Отмена</MudButton> <MudButton Disabled="@Processing" Color="Color.Success" OnClick="CreateAsync"> @if (Processing) { <MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" /> } else { <MudText Typo="Typo.button">СОЗДАТЬ</MudText> } </MudButton> </DialogActions> </MudDialog> @code { [CascadingParameter] IMudDialogInstance? MudDialog { get; set; } private CreateIntegrationUserRequest createIntegrationUserRequest { get; set; } = new(); private DialogOptions _dialogOptions = new() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small, CloseOnEscapeKey = false, BackdropClick = false }; private async Task CreateAsync() => await RunSafe(async () => { if (string.IsNullOrEmpty(createIntegrationUserRequest.Name)) throw new ValidationException("Наименование не может быть пустым"); var result = await IntegrationUserClient.CreateAsync(createIntegrationUserRequest); var parameters = new DialogParameters { ["Token"] = result?.Token, }; MudDialog?.Close(); await DialogService.ShowAsync<ViewIntegrationUserToken>("Токен доступа", parameters, _dialogOptions); }, showProcessing: true); private void Cancel() { MudDialog?.Cancel(); } }