Fixed my stupid mistakes
This commit is contained in:
parent
a0fecfdec9
commit
0a244ac474
3 changed files with 47 additions and 5 deletions
|
@ -259,7 +259,7 @@ public class ServerService
|
|||
}
|
||||
|
||||
public async Task<Server> Create(string name, int cpu, long memory, long disk, User u, Image i, Node? n = null,
|
||||
Action<Server>? modifyDetails = null, int allocations = 1)
|
||||
Action<Server>? modifyDetails = null)
|
||||
{
|
||||
var user = UserRepository
|
||||
.Get()
|
||||
|
@ -271,6 +271,8 @@ public class ServerService
|
|||
.Include(x => x.DockerImages)
|
||||
.First(x => x.Id == i.Id);
|
||||
|
||||
var allocations = image.Allocations;
|
||||
|
||||
Node node = n ?? NodeRepository.Get().First();
|
||||
|
||||
NodeAllocation[] freeAllocations;
|
||||
|
|
|
@ -109,6 +109,25 @@
|
|||
OnClick="CreateAllocation">
|
||||
</WButton>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<label class="form-label">
|
||||
<TL>Start</TL>
|
||||
</label>
|
||||
<input @bind="StartPort" type="number" class="col-auto form-control bg-transparent">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<label class="form-label">
|
||||
<TL>End</TL>
|
||||
</label>
|
||||
<input @bind="EndPort" type="number" class="col-auto form-control bg-transparent">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<WButton Text="@(SmartTranslateService.Translate("Add"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Adding"))"
|
||||
CssClasses="col-auto btn-success"
|
||||
OnClick="CreateAllocationRange">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Table TableItem="NodeAllocation" Items="Node.Allocations" PageSize="25" TableHeadClass="border-bottom border-gray-200 fs-6 text-gray-600 fw-bold bg-light bg-opacity-75">
|
||||
|
@ -142,6 +161,9 @@
|
|||
|
||||
private int Port = 2000;
|
||||
|
||||
private int StartPort = 2000;
|
||||
private int EndPort = 3000;
|
||||
|
||||
private Task Load(LazyLoader arg)
|
||||
{
|
||||
Node = NodeRepository
|
||||
|
@ -183,4 +205,24 @@
|
|||
|
||||
await LazyLoader.Reload();
|
||||
}
|
||||
|
||||
private async Task CreateAllocationRange()
|
||||
{
|
||||
for (int i = StartPort; i < EndPort; i++)
|
||||
{
|
||||
var nodeAllocation = new NodeAllocation()
|
||||
{
|
||||
Port = i
|
||||
};
|
||||
|
||||
Node!.Allocations.Add(nodeAllocation);
|
||||
}
|
||||
|
||||
NodeRepository.Update(Node);
|
||||
|
||||
StartPort = 2000;
|
||||
EndPort = 3000;
|
||||
|
||||
await LazyLoader.Reload();
|
||||
}
|
||||
}
|
|
@ -209,10 +209,8 @@
|
|||
disk,
|
||||
User,
|
||||
Model.Image,
|
||||
DeployNode,
|
||||
null,
|
||||
Model.Image.Allocations
|
||||
);
|
||||
DeployNode
|
||||
);
|
||||
|
||||
NavigationManager.NavigateTo($"/server/{server.Uuid}");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue