Server post model, server creation form
This commit is contained in:
@@ -4,11 +4,12 @@
|
||||
@inject IHttpContextAccessor _httpContextAccessor
|
||||
@attribute [Authorize]
|
||||
|
||||
<ServerCreationForm/>
|
||||
|
||||
@code {
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
string token = await _httpContextAccessor.HttpContext.GetTokenAsync("access_token");
|
||||
var t = 2;
|
||||
base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
}
|
||||
18
Web/Shared/Forms/ServerCreationForm.razor
Normal file
18
Web/Shared/Forms/ServerCreationForm.razor
Normal file
@@ -0,0 +1,18 @@
|
||||
@using Web.Shared.Models
|
||||
<EditForm Model="@_serverModel" OnValidSubmit="@HandleValidSubmit">
|
||||
<DataAnnotationsValidator/>
|
||||
<ValidationSummary/>
|
||||
|
||||
<InputText @bind-Value="_serverModel.Name"/>
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
private ServerModel _serverModel = new();
|
||||
|
||||
private void HandleValidSubmit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
38
Web/Shared/Models/ServerModels.cs
Normal file
38
Web/Shared/Models/ServerModels.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Web.Shared.Models
|
||||
{
|
||||
public class ServerLimitsModel
|
||||
{
|
||||
public int Memory { get; set; }
|
||||
public int Swap { get; set; }
|
||||
public int Disk { get; set; }
|
||||
public int Io { get; set; }
|
||||
public int Cpu { get; set; }
|
||||
}
|
||||
public class ServerFeatureLimits
|
||||
{
|
||||
public int Databases { get; set; }
|
||||
public int Backups { get; set; }
|
||||
public int Allocations { get; set; }
|
||||
}
|
||||
public class ServerAllocationModel
|
||||
{
|
||||
public int Default { get; set; }
|
||||
}
|
||||
public class ServerModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int User { get; set; }
|
||||
public int Egg { get; set; }
|
||||
[JsonPropertyName("docker_image")]
|
||||
public string DockerImage { get; set; }
|
||||
public string Startup { get; set; }
|
||||
public Dictionary<string, string> Environment { get; set; }
|
||||
public ServerLimitsModel Limits { get; set; }
|
||||
[JsonPropertyName("feature_limits")]
|
||||
public ServerFeatureLimits FeatureLimits { get; set; }
|
||||
public ServerAllocationModel Allocation { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ namespace Web
|
||||
options.ResponseType = OpenIdConnectResponseType.Code;
|
||||
options.GetClaimsFromUserInfoEndpoint = true;
|
||||
options.SaveTokens = true;
|
||||
options.UseTokenLifetime = true;
|
||||
options.Scope.Add("openid");
|
||||
options.Scope.Add("profile");
|
||||
options.Scope.Add("email");
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
@using Microsoft.JSInterop
|
||||
@using Web
|
||||
@using Web.Shared
|
||||
@using Web.Shared.Forms
|
||||
Reference in New Issue
Block a user