Optimized page reloading

This commit is contained in:
Shaun Walker
2019-09-16 16:14:17 -04:00
parent 779446b39a
commit 35b9b9e89b
29 changed files with 304 additions and 89 deletions

View File

@ -0,0 +1,50 @@
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Oqtane.Modules.Controls
@using Oqtane.Modules
@using Oqtane.Services
@using Oqtane.Shared
@namespace Oqtane.Modules.Admin.Themes
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IFileService FileService
@inject IThemeService ThemeService
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Theme: </label>
</td>
<td>
<FileUpload Filter=".nupkg"></FileUpload>
</td>
</tr>
</table>
@if (uploaded)
{
<button type="button" class="btn btn-success" @onclick="InstallFile">Install</button>
}
else
{
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
}
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
bool uploaded = false;
private async Task UploadFile()
{
await FileService.UploadFilesAsync("Themes");
uploaded = true;
StateHasChanged();
}
private async Task InstallFile()
{
await ThemeService.InstallThemesAsync();
NavigationManager.NavigateTo(NavigateUrl(Reload.Application));
}
}

View File

@ -2,9 +2,9 @@
@using Oqtane.Services
@using Oqtane.Models
@using Oqtane.Modules
@using Oqtane.Modules.Controls
@namespace Oqtane.Modules.Admin.Themes
@inherits ModuleBase
@inject IThemeService ThemeService
@if (Themes == null)
@ -13,6 +13,7 @@
}
else
{
<ActionLink Action="Add" Text="Install Theme" />
<table class="table table-borderless">
<thead>
<tr>