module installer
This commit is contained in:
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Upload Module" />
|
||||
<ActionLink Action="Add" Text="Install Module" />
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user