Add next steps (CI...)

master
Lilian BRETON 3 years ago
parent d9988ff396
commit 06fc14dc68

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "BlazorApp\BlazorApp.csproj", "{6C1A4035-8787-48D7-8042-3B17F3BD6BF7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorApp", "BlazorApp\BlazorApp.csproj", "{6C1A4035-8787-48D7-8042-3B17F3BD6BF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -1,12 +1,8 @@
<Router AppAssembly="@typeof(App).Assembly">
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
<p>Sorry, there's nothing at this address.</p>
</NotFound>
</Router>

@ -7,6 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Blazored.LocalStorage.TestExtensions" Version="4.2.0" />
<PackageReference Include="Blazorise.Bootstrap" Version="1.1.2" />
<PackageReference Include="Blazorise.DataGrid" Version="1.1.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.1.2" />

@ -1,13 +1,35 @@
@page "/list"
@using BlazorApp.Models;
@using BlazorApp.Models
<h3>List</h3>
<div>
<NavLink class="btn btn-primary" href="Add" Match="NavLinkMatch.All">
<i class="fa fa-plus"></i> Ajouter
</NavLink>
</div>
<DataGrid TItem="Item"
Data="@items"
PageSize="int.MaxValue"
ReadData="@OnReadData"
TotalItems="@totalItem"
PageSize="20"
ShowPager
Responsive>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" />
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image">
<DisplayTemplate>
@if (File.Exists($"{WebHostEnvironment.WebRootPath}/images/{context.Name}.png"))
{
<img src="images/@(context.Name).png" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="max-width: 100px"/>
}
else
{
<img src="images/default.png" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="max-width: 100px"/>
}
</DisplayTemplate>
</DataGridColumn>
<DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name" />
<DataGridColumn TItem="Item" Field="@nameof(Item.StackSize)" Caption="Stack size" />
<DataGridColumn TItem="Item" Field="@nameof(Item.MaxDurability)" Caption="Maximum durability" />

@ -1,21 +1,34 @@
using BlazorApp.Models;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using Blazored.LocalStorage;
namespace BlazorApp.Pages
{
public partial class List
{
private Item[] items;
private List<Item> items;
private int totalItem;
[Inject]
public HttpClient Http { get; set; }
public IDataService DataService { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public IWebHostEnvironment WebHostEnvironment { get; set; }
protected override async Task OnInitializedAsync()
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
{
items = await Http.GetFromJsonAsync<Item[]>($"{NavigationManager.BaseUri}fake-data.json");
if (e.CancellationToken.IsCancellationRequested)
{
return;
}
if (!e.CancellationToken.IsCancellationRequested)
{
items = await DataService.List(e.Page, e.PageSize);
totalItem = await DataService.Count();
}
}
}
}

@ -4,6 +4,7 @@ using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Blazored.LocalStorage;
var builder = WebApplication.CreateBuilder(args);
@ -19,6 +20,8 @@ builder.Services
.AddBootstrapProviders()
.AddFontAwesomeIcons();
builder.Services.AddBlazoredLocalStorage();
var app = builder.Build();
// Configure the HTTP request pipeline.

@ -9,4 +9,3 @@
@using BlazorApp
@using BlazorApp.Shared
@using Blazorise.DataGrid

Loading…
Cancel
Save