Esempio n. 1
0
        public async Task CreateInterface()
        {
            if (_form.EditContext.Validate() == false)
            {
                return;
            }

            _submitInProgress = true;
            _hasErrors        = false;

            Boolean result = await _service.CreateDHCPv6Interface(new CreateDHCPv6Listener
            {
                InterfaceId = _model.InterfaceId,
                IPv6Address = _model.IPv6Address,
                Name        = _model.Name,
            });

            _submitInProgress = false;

            if (result == true)
            {
                MudDialog.Close(DialogResult.Ok <Boolean>(result));
            }
            else
            {
                _hasErrors = true;
            }
        }
Esempio n. 2
0
        private async Task SaveAsync()
        {
            form.Validate();
            if (form.IsValid)
            {
                var request = new AddEditBrandCommand()
                {
                    Name = Name, Description = Description, Tax = Tax, Id = Id
                };
                var response = await _brandManager.SaveAsync(request);

                if (response.Succeeded)
                {
                    _snackBar.Add(localizer[response.Messages[0]], Severity.Success);
                    MudDialog.Close();
                }
                else
                {
                    foreach (var message in response.Messages)
                    {
                        _snackBar.Add(localizer[message], Severity.Error);
                    }
                }
                await hubConnection.SendAsync("UpdateDashboardAsync");
            }
        }
Esempio n. 3
0
        private async Task SaveAsync()
        {
            form.Validate();
            if (form.IsValid)
            {
                var roleRequest = new RoleRequest()
                {
                    Name = Name, Id = Id
                };
                var response = await _roleManager.SaveAsync(roleRequest);

                if (response.Succeeded)
                {
                    _snackBar.Add(localizer[response.Messages[0]], Severity.Success);
                    await hubConnection.SendAsync("UpdateDashboardAsync");

                    MudDialog.Close();
                }
                else
                {
                    foreach (var message in response.Messages)
                    {
                        _snackBar.Add(localizer[message], Severity.Error);
                    }
                }
            }
        }
        private async Task Add()
        {
            if (_nodeName == null)
            {
                return;
            }

            var dashboards = await HttpClient.GetFromJsonAsync <List <DashboardConfig> >("api/dashboards/configuration");

            var dashboardToModify = dashboards?.FirstOrDefault(d => d.DashboardId == DashboardId);

            if (dashboardToModify != null)
            {
                dashboardToModify.Nodes.Add(new NodeConfig()
                {
                    NodeName = _nodeName
                });
                await HttpClient.PutAsJsonAsync("api/dashboards/configuration", dashboards);

                Snackbar.Add($"\"{_nodeName}\" added to \"{dashboardToModify.DashboardName}\"", Severity.Success);
                MudDialog.Close(DialogResult.Ok(true));
            }
            else
            {
                Snackbar.Add($"Can't find dashboard \"{DashboardId}\"", Severity.Error);
                MudDialog.Close(DialogResult.Ok(false));
            }
        }
Esempio n. 5
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();



            if (this.Analytic.Id != Guid.Empty)
            {
                var analytic = new EditAnalyticCommand
                {
                    Id        = this.Analytic.Id,
                    Key       = this.Analytic.Key,
                    Dimension = this.Analytic.Dimension
                };

                bool success = await _microscopeClient.PutAnalyticAsync(analytic.Id, analytic);

                if (success)
                {
                    _snackBar.Add("Analytic updated", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.Analytic));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
            else
            {
                var analytic = new AddAnalyticCommand
                {
                    Key       = this.Analytic.Key,
                    Dimension = this.Analytic.Dimension
                };

                string id = await _microscopeClient.PostAnalyticAsync(analytic);

                if (!string.IsNullOrEmpty(id))
                {
                    this.Analytic.Id = Guid.Parse(id);
                    _snackBar.Add("Analytic added", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.Analytic));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
        }
Esempio n. 6
0
        private async Task CreateDashboard()
        {
            var config = await HttpClient.GetFromJsonAsync <List <DashboardConfig> >("api/dashboards/configuration");

            config.Add(new DashboardConfig {
                DashboardId = _dashboardName.Replace(" ", "-").Trim().ToLower(), DashboardName = _dashboardName
            });

            await HttpClient.PutAsJsonAsync("api/dashboards/configuration", config);

            Snackbar.Add(_dashboardName + " created", Severity.Success);
            MudDialog.Close(DialogResult.Ok(true));
        }
Esempio n. 7
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();

            if (this.RemoteConfig.Id != Guid.Empty)
            {
                var remote = new EditRemoteConfigCommand
                {
                    Id        = this.RemoteConfig.Id,
                    Key       = this.RemoteConfig.Key,
                    Dimension = this.RemoteConfig.Dimension
                };

                bool success = await _microscopeClient.PutRemoteConfigAsync(this.RemoteConfig.Id, remote);

                if (success)
                {
                    _snackBar.Add("Remote Config updated", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.RemoteConfig));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
            else
            {
                var remote = new AddRemoteConfigCommand
                {
                    Key       = this.RemoteConfig.Key,
                    Dimension = this.RemoteConfig.Dimension
                };

                string id = await _microscopeClient.PostRemoteConfigAsync(remote);

                if (!string.IsNullOrEmpty(id))
                {
                    this.RemoteConfig.Id = Guid.Parse(id);
                    _snackBar.Add("Remote Config added", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.RemoteConfig));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
        }
Esempio n. 8
0
 public void Submit()
 {
     if (ShowEntry)
     {
         if (!string.IsNullOrWhiteSpace(EnteredText) && EnteredText.Length >= 4)
         {
             MudDialog.Close(DialogResult.Ok(EnteredText));
         }
     }
     else
     {
         MudDialog.Close(DialogResult.Ok(true));
     }
 }
Esempio n. 9
0
        private async Task DeleteListener()
        {
            _sendingInProgress = true;
            _hasErrors         = false;

            Boolean result = await _service.SendDeleteDHCPv4InterfaceRequest(Entry.SystemId);

            _sendingInProgress = false;

            if (result == true)
            {
                MudDialog.Close(DialogResult.Ok <Boolean>(result));
            }
            else
            {
                _hasErrors = true;
            }
        }
Esempio n. 10
0
        private async Task SendDeleteRequest()
        {
            _sendingInProgress = true;
            _hasErrors         = false;

            Boolean result = await _service.SendDeleteNotificationPipelineRequest(Entry.Id);

            _hasErrors = !result;

            _sendingInProgress = false;

            if (result == true)
            {
                MudDialog.Close(DialogResult.Ok <Boolean>(result));
            }
            else
            {
                _hasErrors = true;
            }
        }
Esempio n. 11
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();

            var command = new AddContainerCommand {
                Name = this.StorageContainer.Name
            };
            bool success = await _microscopeClient.PostContainerAsync(command);

            if (success)
            {
                _snackBar.Add(localizer["Container Saved"], Severity.Success);
                MudDialog.Close(DialogResult.Ok(this.StorageContainer));
            }
            else
            {
                _snackBar.Add("Error add cotainer", Severity.Error);
                MudDialog.Close(DialogResult.Cancel());
            }
        }
        private async Task RenameNode()
        {
            var dashboardConfigs = await HttpClient.GetFromJsonAsync <List <DashboardConfig> >("api/dashboards/configuration");

            var dashboard = dashboardConfigs?.FirstOrDefault(d => d.DashboardId == DashboardId);
            var node      = dashboard?.Nodes.FirstOrDefault(n => n.NodeName == DashboardNode.Name);

            if (node != null)
            {
                node.NodeName = _newNodeName;
                await HttpClient.PutAsJsonAsync("api/dashboards/configuration", dashboardConfigs);

                Snackbar.Add($"Node renamed to \"{_newNodeName}\"", Severity.Success);
                MudDialog.Close(DialogResult.Ok(true));
            }
            else
            {
                Snackbar.Add($"Node \"{DashboardNode.Name}\" not found.", Severity.Error);
                MudDialog.Close(DialogResult.Ok(true));
            }
        }
        private async Task RenameProperty()
        {
            var dashboardConfigs = await HttpClient.GetFromJsonAsync <List <DashboardConfig> >("api/dashboards/configuration");

            var dashboard = dashboardConfigs?.FirstOrDefault(d => d.DashboardId == DashboardId);
            var node      = dashboard?.Nodes.FirstOrDefault(n => n.NodeName == DashboardNode.Name);
            var property  = node?.Properties.FirstOrDefault(p => p.PropertyName == DashboardProperty.AlternativeName && p.PropertyPath == DashboardProperty.ActualPropertyPath);

            if (property != null)
            {
                property.PropertyName = _newPropertyName;
                await HttpClient.PutAsJsonAsync("api/dashboards/configuration", dashboardConfigs);

                Snackbar.Add($"Property renamed to \"{_newPropertyName}\"", Severity.Success);
                MudDialog.Close(DialogResult.Ok(true));
            }
            else
            {
                Snackbar.Add($"Property \"{DashboardProperty.AlternativeName}\" not found.", Severity.Error);
                MudDialog.Close(DialogResult.Ok(true));
            }
        }
Esempio n. 14
0
        private async Task DeleteListener()
        {
            _sendingInProgress = true;
            _hasErrors         = false;

            Boolean result = await _service.SendDeleteDHCPv4ScopeRequest(new DHCPv4ScopeDeleteRequest
            {
                Id = Entry.Id,
                IncludeChildren = Entry.ChildScopes.Any() != false && IncludeChildren
            });

            _sendingInProgress = false;

            if (result == true)
            {
                MudDialog.Close(DialogResult.Ok <Boolean>(result));
            }
            else
            {
                _hasErrors = true;
            }
        }
        private async Task Rename()
        {
            var dashboardConfigs = await HttpClient.GetFromJsonAsync <List <DashboardConfig> >("api/dashboards/configuration");

            var dashboardConfig = dashboardConfigs?.FirstOrDefault(d => d.DashboardId == Dashboard.Id);

            if (dashboardConfig != null)
            {
                dashboardConfig.DashboardName = _newDashboardName;
                dashboardConfig.DashboardId   = _newDashboardName.Replace(" ", "-").Trim().ToLower();
                await HttpClient.PutAsJsonAsync("api/dashboards/configuration", dashboardConfigs);

                Snackbar.Add($"Dashboard renamed to \"{_newDashboardName}\"", Severity.Success);
                MudDialog.Close(DialogResult.Ok(true));

                NavigationManager.NavigateTo($"dashboards/{dashboardConfig.DashboardId}");
            }
            else
            {
                Snackbar.Add($"Dashboard \"{Dashboard.Id}\" not found.", Severity.Error);
                MudDialog.Close(DialogResult.Ok(true));
            }
        }
 /// <summary>
 /// This method is called whenever the user submits the dialog.
 /// </summary>
 /// <param name="context">The edit context to use for the operation.</param>
 private void OnValidSubmit(EditContext context)
 {
     MudDialog.Close(DialogResult.Ok(Model));
 }
Esempio n. 17
0
 void Delete() => MudDialog.Close(DialogResult.Ok(Speaker));
 void AddOrUpdate() => MudDialog.Close(DialogResult.Ok(Institution));
Esempio n. 19
0
 void Delete() => MudDialog.Close(DialogResult.Ok(Report));
 void AddOrUpdate() => MudDialog.Close(DialogResult.Ok(Сonference));
 void Delete() => MudDialog.Close(DialogResult.Ok(Сonference));
 public Task <TResult> Init(TInput initalData)
 => Show().Do(_ => { }, _ => MudDialog?.Cancel(), () => MudDialog?.Close()).ToTask();
Esempio n. 23
0
 void Delete() => MudDialog.Close(DialogResult.Ok(Institution));