Добавил BLAZORIES.Переписать все на него.
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 37s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 37s
This commit is contained in:
@@ -1,23 +1,72 @@
|
||||
@page "/database"
|
||||
@using Ministreliy.Models
|
||||
@using Newtonsoft.Json
|
||||
@using System.Text
|
||||
@inject IJSRuntime JS
|
||||
@inject NavigationManager NavManager
|
||||
|
||||
<PageTitle>База данных</PageTitle>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="database">Сводные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="database/type">Типы устройств</a>
|
||||
</li>
|
||||
<div>
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-10">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="database">Сводные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="database/type">Типы устройств</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="database/device">Устройства</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
@* <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addtype">
|
||||
Добавить тип
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#deltype">
|
||||
Удалить тип
|
||||
</button> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@if (listDeviceTypes.Count == 0 || listDeviceItems.Count == 0)
|
||||
{
|
||||
<p>@messageStatus</p>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
public static List<DeviceType>? listDeviceTypes = new();
|
||||
public static List<DeviceItem>? listDeviceItems = new();
|
||||
public static HttpClient httpClient = new();
|
||||
|
||||
private void IncrementCount()
|
||||
string? messageStatus = "Получаю данные...";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
currentCount++;
|
||||
httpClient.BaseAddress = new Uri("http://localhost:5262/api/");
|
||||
var devicetype = await httpClient.GetAsync("Device/GetTypes");
|
||||
var deviceitem = await httpClient.GetAsync("Device/GetDevices");
|
||||
listDeviceTypes = JsonConvert.DeserializeObject<List<DeviceType>>(await devicetype.Content.ReadAsStringAsync());
|
||||
listDeviceItems = JsonConvert.DeserializeObject<List<DeviceItem>>(await deviceitem.Content.ReadAsStringAsync());
|
||||
messageStatus = string.Empty;
|
||||
if (listDeviceTypes.Count == 0)
|
||||
{
|
||||
messageStatus += $"нет типов устройств\r\n";
|
||||
}
|
||||
if (listDeviceItems.Count == 0)
|
||||
{
|
||||
messageStatus += $"нет устройств\r\n";
|
||||
}
|
||||
DataStore.ListDeviceTypesStore = listDeviceTypes;
|
||||
DataStore.ListDeviceItemsStore = listDeviceItems;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user