module installer

This commit is contained in:
Shaun Walker
2019-09-07 23:26:19 -04:00
parent a84eee8782
commit f60898dbc7
12 changed files with 170 additions and 6 deletions

View File

@ -2,9 +2,11 @@
@using Oqtane.Client.Modules.Controls
@using Oqtane.Modules
@using Oqtane.Services
@using Oqtane.Shared
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject IFileService FileService
@inject IModuleDefinitionService ModuleDefinitionService
<table class="table table-borderless">
<tr>
@ -16,15 +18,32 @@
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
@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("/Sites/Modules");
await FileService.UploadFilesAsync("Modules");
uploaded = true;
StateHasChanged();
}
private async Task InstallFile()
{
await ModuleDefinitionService.InstallModulesAsync();
PageState.Reload = Constants.ReloadApplication;
UriHelper.NavigateTo(NavigateUrl());
}
}

View File

@ -12,7 +12,7 @@
}
else
{
<ActionLink Action="Add" Text="Upload Module" />
<ActionLink Action="Add" Text="Install Module" />
<table class="table table-borderless">
<thead>
<tr>