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

@ -89,8 +89,7 @@
if (user.IsAuthenticated)
{
authstateprovider.NotifyAuthenticationChanged();
PageState.Reload = Constants.ReloadSite;
NavigationManager.NavigateTo(NavigateUrl(ReturnUrl));
NavigationManager.NavigateTo(NavigateUrl(ReturnUrl, Reload.Site));
}
else
{

View File

@ -45,7 +45,6 @@ else
private async Task InstallFile()
{
await ModuleDefinitionService.InstallModulesAsync();
PageState.Reload = Constants.ReloadApplication;
NavigationManager.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl(Reload.Application));
}
}

View File

@ -121,8 +121,7 @@
moduleType.GetMethod("UpdateSettings").Invoke(settings, null); // method must be public in settings component
}
PageState.Reload = Constants.ReloadPage;
NavigationManager.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl(Reload.Page));
}
}

View File

@ -278,8 +278,7 @@
await PageService.AddPageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
PageState.Reload = Constants.ReloadSite;
NavigationManager.NavigateTo(NavigateUrl(page.Path));
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
}
catch (Exception ex)
{

View File

@ -179,15 +179,7 @@
try
{
await PageService.DeletePageAsync(Int32.Parse(PageState.QueryString["id"]));
PageState.Reload = Constants.ReloadSite;
if (PageState.Page.Name == "Page Management")
{
NavigationManager.NavigateTo(NavigateUrl());
}
else
{
NavigationManager.NavigateTo(NavigateUrl(""));
}
NavigationManager.NavigateTo(NavigateUrl("", Reload.Site));
}
catch (Exception ex)
{

View File

@ -354,8 +354,7 @@
}
}
PageState.Reload = Constants.ReloadSite;
NavigationManager.NavigateTo(NavigateUrl(page.Path));
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
}
catch (Exception ex)
{

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>