Merge pull request #1 from oqtane/master

Sync Base
This commit is contained in:
Shaun Walker 2019-09-16 00:03:02 +02:00 committed by GitHub
commit add3728a84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 215 additions and 176 deletions

View File

@ -7,7 +7,7 @@
@using Oqtane.Shared
@namespace Oqtane.Modules.Admin.Login
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IJSRuntime jsRuntime
@inject IUserService UserService
@inject IServiceProvider ServiceProvider
@ -36,8 +36,8 @@
<input type="checkbox" class="form-check-input" name="Remember" @bind="@Remember" />
</div>
</div>
<button type="button" class="btn btn-primary" @onclick="@Login">Login</button>
<button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button>
<button type="button" class="btn btn-primary" @onclick="Login">Login</button>
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
</div>
</NotAuthorized>
</AuthorizeView>
@ -88,7 +88,7 @@
{
authstateprovider.NotifyAuthenticationChanged();
PageState.Reload = Constants.ReloadSite;
UriHelper.NavigateTo(NavigateUrl(ReturnUrl));
NavigationManager.NavigateTo(NavigateUrl(ReturnUrl));
}
else
{
@ -100,6 +100,6 @@
private void Cancel()
{
string ReturnUrl = PageState.QueryString["returnurl"];
UriHelper.NavigateTo(ReturnUrl);
NavigationManager.NavigateTo(ReturnUrl);
}
}

View File

@ -5,7 +5,7 @@
@using Oqtane.Shared
@namespace Oqtane.Modules.Admin.ModuleDefinitions
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IFileService FileService
@inject IModuleDefinitionService ModuleDefinitionService
@ -45,6 +45,6 @@ else
{
await ModuleDefinitionService.InstallModulesAsync();
PageState.Reload = Constants.ReloadApplication;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
}

View File

@ -7,7 +7,7 @@
@using Oqtane.Modules.Controls
@namespace Oqtane.Modules.Admin.ModuleSettings
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IThemeService ThemeService
@inject IModuleService ModuleService
@inject IPageModuleService PageModuleService
@ -64,7 +64,7 @@
@DynamicComponent
<button type="button" class="btn btn-success" @onclick="@SaveModule">Save</button>
<button type="button" class="btn btn-success" @onclick="SaveModule">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@ -121,7 +121,7 @@
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
}

View File

@ -7,7 +7,7 @@
@using Oqtane.Security
@namespace Oqtane.Modules.Admin.Pages
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IPageService PageService
@inject IThemeService ThemeService
@ -27,7 +27,7 @@
<label for="Name" class="control-label">Parent: </label>
</td>
<td>
<select class="form-control" @onchange="@(e => ParentChanged(e))">
<select class="form-control" @onchange="(e => ParentChanged(e))">
<option value="">&lt;Site Root&gt;</option>
@foreach (Page page in pages)
{
@ -129,7 +129,7 @@
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="@SavePage">Save</button>
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code {
@ -176,7 +176,7 @@
}
}
private void ParentChanged(UIChangeEventArgs e)
private void ParentChanged(ChangeEventArgs e)
{
try
{
@ -254,7 +254,7 @@
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
PageState.Reload = Constants.ReloadSite;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
catch (Exception ex)
{

View File

@ -7,7 +7,7 @@
@using Oqtane.Security
@namespace Oqtane.Modules.Admin.Pages
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IPageService PageService
@inject IThemeService ThemeService
@ -111,7 +111,7 @@
</td>
</tr>
</table>
<button type="button" class="btn btn-danger" @onclick="@DeletePage">Delete</button>
<button type="button" class="btn btn-danger" @onclick="DeletePage">Delete</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br />
<br />
@ -181,11 +181,11 @@
PageState.Reload = Constants.ReloadSite;
if (PageState.Page.Name == "Page Management")
{
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
else
{
UriHelper.NavigateTo(NavigateUrl(""));
NavigationManager.NavigateTo(NavigateUrl(""));
}
}
catch (Exception ex)

View File

@ -7,7 +7,7 @@
@using Oqtane.Security
@namespace Oqtane.Modules.Admin.Pages
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IPageService PageService
@inject IThemeService ThemeService
@ -35,7 +35,7 @@
<label for="Name" class="control-label">Parent: </label>
</td>
<td>
<select class="form-control" @onchange="@(e => ParentChanged(e))">
<select class="form-control" @onchange="(e => ParentChanged(e))">
<option value="">&lt;Site Root&gt;</option>
@foreach (Page page in pages)
{
@ -138,7 +138,7 @@
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="@SavePage">Save</button>
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br />
<br />
@ -215,7 +215,7 @@
}
}
private void ParentChanged(UIChangeEventArgs e)
private void ParentChanged(ChangeEventArgs e)
{
try
{
@ -298,7 +298,7 @@
await PageService.UpdatePageOrderAsync(page.SiteId, currentparentid);
PageState.Reload = Constants.ReloadSite;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
catch (Exception ex)
{

View File

@ -5,7 +5,7 @@
@using Oqtane.Services
@namespace Oqtane.Modules.Admin.Profile
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IProfileService ProfileService
@inject ISettingService SettingService
@ -49,13 +49,13 @@
<label for="@p.Name" class="control-label">@p.Title: </label>
</td>
<td>
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="(e => ProfileChanged(e, p.Name))" />
</td>
</tr>
}
</table>
<button type="button" class="btn btn-primary" @onclick="@SaveUser">Save</button>
<button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button>
<button type="button" class="btn btn-primary" @onclick="SaveUser">Save</button>
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
<br />
<br />
}
@ -107,7 +107,7 @@
await UserService.UpdateUserAsync(user);
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
UriHelper.NavigateTo("");
NavigationManager.NavigateTo("");
}
catch (Exception ex)
{
@ -117,10 +117,10 @@
private void Cancel()
{
UriHelper.NavigateTo(NavigateUrl(""));
NavigationManager.NavigateTo(NavigateUrl(""));
}
private void ProfileChanged(UIChangeEventArgs e, string SettingName)
private void ProfileChanged(ChangeEventArgs e, string SettingName)
{
string value = (string)e.Value;
settings = SettingService.SetSetting(settings, SettingName, value);

View File

@ -4,7 +4,7 @@
@using Oqtane.Services
@namespace Oqtane.Modules.Admin.Register
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IUserService UserService
<div class="container">
@ -16,8 +16,8 @@
<label for="Password" class="control-label">Password: </label>
<input type="password" name="Password" class="form-control" placeholder="Password" @bind="@Password" />
</div>
<button type="button" class="btn btn-primary" @onclick="@RegisterUser">Register</button>
<button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button>
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
</div>
@code {
@ -36,11 +36,11 @@
user.IsHost = false;
user.Password = Password;
await UserService.AddUserAsync(user);
UriHelper.NavigateTo("");
NavigationManager.NavigateTo("");
}
private void Cancel()
{
UriHelper.NavigateTo(NavigateUrl("")); // navigate to home
NavigationManager.NavigateTo(NavigateUrl("")); // navigate to home
}
}

View File

@ -6,7 +6,7 @@
@using Oqtane.Security
@namespace Oqtane.Modules.Admin.Sites
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject ITenantService TenantService
@inject IAliasService AliasService
@inject ISiteService SiteService
@ -58,7 +58,7 @@ else
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="@SaveSite">Save</button>
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
}
@ -113,6 +113,6 @@ else
await PageService.AddPageAsync(p);
UriHelper.NavigateTo(url, true);
NavigationManager.NavigateTo(url, true);
}
}

View File

@ -70,7 +70,7 @@
<tr>
<td style="text-align: right;"><label for="Username" class="control-label">User: </label></td>
<td><input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@username" /></td>
<td style="text-align: left;"><button type="button" class="btn btn-primary" @onclick="@AddUser">Add</button></td>
<td style="text-align: left;"><button type="button" class="btn btn-primary" @onclick="AddUser">Add</button></td>
</tr>
</tbody>
</table>

View File

@ -3,7 +3,7 @@
@inherits ModuleBase
Current count: @currentCount
<br />
<button type="button" class="btn btn-primary" @onclick="@IncrementCount">Click me</button>
<button type="button" class="btn btn-primary" @onclick="IncrementCount">Click me</button>
<br />
<br />

View File

@ -7,7 +7,7 @@
@using Oqtane.Shared;
@namespace Oqtane.Modules.HtmlText
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject HttpClient http
@inject SiteState sitestate
@ -23,7 +23,7 @@
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="@SaveContent">Save</button>
<button type="button" class="btn btn-success" @onclick="SaveContent">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br />
<br />
@ -44,7 +44,7 @@
{
try
{
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
HtmlTextInfo htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null)
{
@ -65,7 +65,7 @@
{
try
{
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
HtmlTextInfo htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null)
{
@ -80,7 +80,7 @@
await htmltextservice.AddHtmlTextAsync(htmltext);
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
catch (Exception ex)
{

View File

@ -6,7 +6,7 @@
@using Oqtane.Shared;
@namespace Oqtane.Modules.HtmlText
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject HttpClient http
@inject SiteState sitestate
@ -27,7 +27,7 @@
{
try
{
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
HtmlTextInfo htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null)
{

View File

@ -13,18 +13,18 @@ namespace Oqtane.Modules.HtmlText.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public HtmlTextService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public HtmlTextService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "HtmlText"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "HtmlText"); }
}
public async Task<HtmlTextInfo> GetHtmlTextAsync(int ModuleId)

View File

@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<RestoreAdditionalProjectSources>
<TargetFramework>netcoreapp3.0</TargetFramework>
<!--<RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
</RestoreAdditionalProjectSources>
<LangVersion>7.3</LangVersion>
</RestoreAdditionalProjectSources>-->
<RazorLangVersion>3.0</RazorLangVersion>
<Configurations>Debug;Release;Wasm</Configurations>
<Version>0.0.1</Version>
@ -27,13 +26,17 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview8.19405.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19424.4" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19424.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
</ItemGroup>
<PropertyGroup>
<!-- there may be other elements here -->
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
</PropertyGroup>
</Project>

View File

@ -3,6 +3,7 @@ using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Oqtane.Models;
using Oqtane.Services;
using Oqtane.Shared;
@ -11,20 +12,20 @@ namespace Oqtane.Providers
{
public class IdentityAuthenticationStateProvider : AuthenticationStateProvider
{
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
private readonly SiteState sitestate;
public IdentityAuthenticationStateProvider(IUriHelper urihelper, SiteState sitestate)
public IdentityAuthenticationStateProvider(NavigationManager NavigationManager, SiteState sitestate)
{
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
this.sitestate = sitestate;
}
public override async Task<AuthenticationState> GetAuthenticationStateAsync()
{
// hack: create a new HttpClient rather than relying on the registered service as the AuthenticationStateProvider is initialized prior to IUriHelper ( https://github.com/aspnet/AspNetCore/issues/11867 )
// hack: create a new HttpClient rather than relying on the registered service as the AuthenticationStateProvider is initialized prior to NavigationManager ( https://github.com/aspnet/AspNetCore/issues/11867 )
HttpClient http = new HttpClient();
string apiurl = ServiceBase.CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "User") + "/authenticate";
string apiurl = ServiceBase.CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "User") + "/authenticate";
User user = await http.GetJsonAsync<User>(apiurl);
ClaimsIdentity identity = new ClaimsIdentity();

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public AliasService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public AliasService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Alias"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Alias"); }
}
public async Task<List<Alias>> GetAliasesAsync()

View File

@ -8,19 +8,19 @@ namespace Oqtane.Services
public class FileService : ServiceBase, IFileService
{
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
private readonly IJSRuntime jsRuntime;
public FileService(SiteState sitestate, IUriHelper urihelper, IJSRuntime jsRuntime)
public FileService(SiteState sitestate, NavigationManager NavigationManager, IJSRuntime jsRuntime)
{
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
this.jsRuntime = jsRuntime;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "File"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "File"); }
}
public async Task UploadFilesAsync(string Folder)

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public InstallationService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public InstallationService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Installation"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Installation"); }
}
public async Task<GenericResponse> IsInstalled()

View File

@ -14,18 +14,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public ModuleDefinitionService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public ModuleDefinitionService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "ModuleDefinition"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "ModuleDefinition"); }
}
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public ModuleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public ModuleService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Module"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Module"); }
}
public async Task<List<Module>> GetModulesAsync(int PageId)

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public PageModuleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public PageModuleService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "PageModule"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "PageModule"); }
}
public async Task<List<PageModule>> GetPageModulesAsync()

View File

@ -13,18 +13,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public PageService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public PageService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Page"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Page"); }
}
public async Task<List<Page>> GetPagesAsync(int SiteId)

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public ProfileService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public ProfileService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Profile"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Profile"); }
}
public async Task<List<Profile>> GetProfilesAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public RoleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public RoleService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Role"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Role"); }
}
public async Task<List<Role>> GetRolesAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public SettingService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public SettingService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Setting"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Setting"); }
}
public async Task<Dictionary<string, string>> GetHostSettingsAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public SiteService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public SiteService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Site"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Site"); }
}
public async Task<List<Site>> GetSitesAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public TenantService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public TenantService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Tenant"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Tenant"); }
}
public async Task<List<Tenant>> GetTenantsAsync()

View File

@ -14,18 +14,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public ThemeService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public ThemeService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Theme"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Theme"); }
}
public async Task<List<Theme>> GetThemesAsync()

View File

@ -12,18 +12,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public UserRoleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public UserRoleService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "UserRole"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "UserRole"); }
}
public async Task<List<UserRole>> GetUserRolesAsync()

View File

@ -13,18 +13,18 @@ namespace Oqtane.Services
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly NavigationManager NavigationManager;
public UserService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
public UserService(HttpClient http, SiteState sitestate, NavigationManager NavigationManager)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
this.NavigationManager = NavigationManager;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "User"); }
get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "User"); }
}
public async Task<List<User>> GetUsersAsync(int SiteId)

View File

@ -2,7 +2,7 @@
@using Oqtane.Models
@using Oqtane.Shared
@namespace Oqtane.Shared
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IInstallationService InstallationService
@inject IUserService UserService
@ -50,7 +50,7 @@
<label for="Title" class="control-label" style="font-weight: bold">Integrated Security: </label>
</td>
<td>
<select class="custom-select" @onchange="@SetIntegratedSecurity">
<select class="custom-select" @onchange="SetIntegratedSecurity">
<option value="true" selected>True</option>
<option value="false">False</option>
</select>
@ -104,7 +104,7 @@
</div>
<div class="row">
<div class="mx-auto text-center">
<button type="button" class="btn btn-success" @onclick="@Install">Install Now</button><br /><br />
<button type="button" class="btn btn-success" @onclick="Install">Install Now</button><br /><br />
@((MarkupString)@Message)
</div>
<div class="loading" style="@LoadingDisplay"></div>
@ -124,7 +124,7 @@
private string IntegratedSecurityDisplay = "display:none;";
private string LoadingDisplay = "display:none;";
private void SetIntegratedSecurity(UIChangeEventArgs e)
private void SetIntegratedSecurity(ChangeEventArgs e)
{
if (Convert.ToBoolean(e.Value))
{
@ -173,7 +173,7 @@
user.Password = HostPassword;
user = await UserService.AddUserAsync(user);
UriHelper.NavigateTo("", true);
NavigationManager.NavigateTo("", true);
}
else
{

View File

@ -28,7 +28,7 @@ namespace Oqtane.Shared
}
}
public Task<string> GetCookie(string name)
public ValueTask<string> GetCookie(string name)
{
try
{
@ -38,7 +38,7 @@ namespace Oqtane.Shared
}
catch
{
return Task.FromResult(string.Empty);
return new ValueTask<string>(Task.FromResult(string.Empty));
}
}
@ -57,7 +57,7 @@ namespace Oqtane.Shared
}
}
public Task<string> GetElementByName(string name)
public ValueTask<string> GetElementByName(string name)
{
try
{
@ -67,7 +67,7 @@ namespace Oqtane.Shared
}
catch
{
return Task.FromResult(string.Empty);
return new ValueTask<string>(Task.FromResult(string.Empty));
}
}

View File

@ -6,13 +6,13 @@
@using System.Collections.Generic
@using Oqtane.Shared
@using Oqtane.Security
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Routing
@namespace Oqtane.Shared
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject SiteState SiteState
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject INavigationInterception NavigationInterception
@inject IComponentContext ComponentContext
@inject IAliasService AliasService
@inject ITenantService TenantService
@inject ISiteService SiteService
@ -41,8 +41,8 @@
protected override void OnInitialized()
{
_absoluteUri = UriHelper.GetAbsoluteUri();
UriHelper.OnLocationChanged += OnLocationChanged;
_absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri;
NavigationManager.LocationChanged += LocationChanged;
DynamicComponent = builder =>
{
@ -56,7 +56,7 @@
public void Dispose()
{
UriHelper.OnLocationChanged -= OnLocationChanged;
NavigationManager.LocationChanged -= LocationChanged;
}
protected override async Task OnParametersSetAsync()
@ -268,7 +268,7 @@
}
}
private async void OnLocationChanged(object sender, LocationChangedEventArgs args)
private async void LocationChanged(object sender, LocationChangedEventArgs args)
{
_absoluteUri = args.Location;
await Refresh();
@ -276,7 +276,7 @@
Task IHandleAfterRender.OnAfterRenderAsync()
{
if (!_navigationInterceptionEnabled && ComponentContext.IsConnected)
if (!_navigationInterceptionEnabled)
{
_navigationInterceptionEnabled = true;
return NavigationInterception.EnableNavigationInterceptionAsync();

View File

@ -10,6 +10,7 @@ using Oqtane.Modules;
using Oqtane.Shared;
using Oqtane.Providers;
using Microsoft.AspNetCore.Blazor.Http;
using Microsoft.AspNetCore.Components.Authorization;
namespace Oqtane.Client
{

View File

@ -6,7 +6,7 @@
@using Oqtane.Security
@namespace Oqtane.Themes.Controls
@inherits ThemeObjectBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IModuleDefinitionService ModuleDefinitionService
@inject IThemeService ThemeService
@ -68,7 +68,7 @@
}
</select>
</div>
<button type="button" class="btn btn-primary" @onclick="@AddModule">Add Module To Page</button>
<button type="button" class="btn btn-primary" @onclick="AddModule">Add Module To Page</button>
</div>
</div>
</div>
@ -140,7 +140,7 @@
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl());
}
}
@ -180,7 +180,7 @@
PageState.DesignMode = true;
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + PageState.EditMode.ToString().ToLower()));
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + PageState.EditMode.ToString().ToLower()));
}
}
}

View File

@ -5,7 +5,7 @@
@using Microsoft.JSInterop
@namespace Oqtane.Themes.Controls
@inherits ThemeObjectBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IJSRuntime jsRuntime
@inject IServiceProvider ServiceProvider
@ -15,10 +15,10 @@
<text>...</text>
</Authorizing>
<Authorized>
<button type="button" class="btn btn-primary" @onclick="@LogoutUser">Logout</button>
<button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button>
</Authorized>
<NotAuthorized>
<button type="button" class="btn btn-primary" @onclick="@LoginUser">Login</button>
<button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
</NotAuthorized>
</AuthorizeView>
@ -31,7 +31,7 @@
{
returnurl += "/" + PageState.Page.Path;
}
UriHelper.NavigateTo("login?returnurl=" + returnurl);
NavigationManager.NavigateTo("login?returnurl=" + returnurl);
}
private async Task LogoutUser()
@ -52,7 +52,7 @@
// client-side Blazor
authstateprovider.NotifyAuthenticationChanged();
PageState.Reload = Constants.ReloadSite;
UriHelper.NavigateTo(NavigateUrl(PageState.Page.Path, "logout"));
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "logout"));
}
}
}

View File

@ -5,7 +5,7 @@
@using Oqtane.Security
@namespace Oqtane.Themes.Controls
@inherits ContainerBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IPageModuleService PageModuleService
@ -16,7 +16,7 @@
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@foreach (var action in actions)
{
<a class="dropdown-item" @onclick="@(async () => await ModuleAction(action.Action))">@action.Name</a>
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action.Action))">@action.Name</a>
}
</div>
</div>
@ -104,7 +104,7 @@
break;
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(url);
NavigationManager.NavigateTo(url);
}
}

View File

@ -1,17 +1,18 @@
@using Oqtane.Themes
@using Microsoft.AspNetCore.Components.Authorization
@namespace Oqtane.Themes.Controls
@inherits ThemeObjectBase
@inject IUriHelper UriHelper
@inject NavigationManager NavigationManager
<AuthorizeView>
<Authorizing>
<text>...</text>
</Authorizing>
<Authorized>
<button type="button" class="btn btn-primary" @onclick="@UpdateProfile">@context.User.Identity.Name</button>
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
</Authorized>
<NotAuthorized>
<button type="button" class="btn btn-primary" @onclick="@RegisterUser">Register</button>
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
</NotAuthorized>
</AuthorizeView>
@ -20,12 +21,12 @@
private void RegisterUser()
{
UriHelper.NavigateTo(NavigateUrl("register"));
NavigationManager.NavigateTo(NavigateUrl("register"));
}
private void UpdateProfile()
{
UriHelper.NavigateTo(NavigateUrl("profile"));
NavigationManager.NavigateTo(NavigateUrl("profile"));
}
}

View File

@ -2,11 +2,10 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<RestoreAdditionalProjectSources>
<!--<RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
</RestoreAdditionalProjectSources>
</RestoreAdditionalProjectSources>-->
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<Configurations>Debug;Release;Wasm</Configurations>
<Version>0.0.1</Version>
@ -38,11 +37,11 @@
<ItemGroup>
<PackageReference Include="dbup" Version="4.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview8.19405.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.0.0-preview9.19424.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview9.19424.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview9.19424.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview9.19423.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview9.19423.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
</ItemGroup>

View File

@ -15,7 +15,7 @@
</head>
<body>
@(Html.AntiForgeryToken())
<app>@(await Html.RenderComponentAsync<App>())</app>
<app>@(await Html.RenderComponentAsync<App>(RenderMode.Server))</app>
<script src="js/site.js"></script>
<script src="js/interop.js"></script>

View File

@ -56,7 +56,7 @@ namespace Oqtane.Server
services.AddScoped<HttpClient>(s =>
{
// creating the URI helper needs to wait until the JS Runtime is initialized, so defer it.
var uriHelper = s.GetRequiredService<IUriHelper>();
var NavigationManager = s.GetRequiredService<NavigationManager>();
var httpContextAccessor = s.GetRequiredService<IHttpContextAccessor>();
var authToken = httpContextAccessor.HttpContext.Request.Cookies[".AspNetCore.Identity.Application"];
var client = new HttpClient(new HttpClientHandler { UseCookies = false });
@ -64,7 +64,7 @@ namespace Oqtane.Server
{
client.DefaultRequestHeaders.Add("Cookie", ".AspNetCore.Identity.Application=" + authToken);
}
client.BaseAddress = new Uri(uriHelper.GetBaseUri());
client.BaseAddress = new Uri(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri);
return client;
});
}

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<Configurations>Debug;Release;Wasm</Configurations>
<Version>0.0.1</Version>
<Product>Oqtane</Product>
@ -21,8 +20,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
<PackageReference Include="System.Text.Json" Version="4.6.0-preview8.19405.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0-preview9.19421.4" />
<PackageReference Include="System.Text.Json" Version="4.6.0-preview9.19421.4" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@ Oqtane uses Blazor, a new web framework for .NET Core that lets you build intera
**To get started with Oqtane:**
1.&nbsp;Oqtane is currently compatible with **[.NET Core 3.0 Preview 6 SDK (3.0.0-preview6.19307.2)](https://dotnet.microsoft.com/download/dotnet-core/3.0)**. Microsoft continues to release new versions of .NET Core 3.0 on a regular basis and we do our best to keep up; however, for the best results you should use the most compatible .NET Core 3.0 version.
1.&nbsp;Oqtane is currently compatible with **[.NET Core 3.0 Preview 8 SDK (3.0.0-preview8.19405.7)](https://dotnet.microsoft.com/download/dotnet-core/3.0)**. Microsoft continues to release new versions of .NET Core 3.0 on a regular basis and we do our best to keep up; however, for the best results you should use the most compatible .NET Core 3.0 version.
2.&nbsp;Install the latest **Preview** edition of [Visual Studio 2019](https://visualstudio.com/preview) with the **ASP.NET and web development** workload.
@ -17,6 +17,41 @@ Oqtane uses Blazor, a new web framework for .NET Core that lets you build intera
5.&nbsp;Download or Clone the Oqtane source code to your local system. Open the **Oqtane.sln** solution file. If you want to develop using **server-side** Blazor ( which includes a full debugging experience in Visual Studio ) you should choose to Build the solution using the default Debug configuration. If you want to develop using **client-side** Blazor ( WebAssembly ) you should first choose the "Wasm" configuration option in the Visual Studio toolbar and then Build.
NOTE: If you have already installed a previous version of Oqtane and you wish to install a newer version, there is currently no upgrade path from one version to the next. The recommended upgrade approach is to get the latest code and build it, and then reset the DefaultConnection value to "" in the appsettings.json file in the Oqtane.server project. This will trigger a re-install when you run the application which will execute the latest database scripts.
# Roadmap
This project is a work in progress and the schedule for implementing the items identified below is dependent upon the availability of community members who are able to assist.
Security
- Logging
Design
- Need modern Admin UI theme
- Need to cleanly separate site.css
- CSS registration for modules and skins
Packaging
- Need ability to package/install Modules
- Need ability to package/install Themes
Admin
- Need fully functional administrative modules for all core entities ( user, role, site, etc… )
- Need ability to create a new Site and auto provision Admin pages/modules
- Need ability to soft delete core entities
- Re-ordering of modules in panes
- Drag and Drop modules
Upgrade
- Need ability to upgrade application seamlessly
- integrated store/catalog of extensions
- auto update - provide url to check for updates, perhaps even download in background - core and extensions
Multi-Tenant
- Need ability to provision a new tenant DB
Database
- Need ability to run on SQLite
# Background
Oqtane was created by [Shaun Walker](https://www.linkedin.com/in/shaunbrucewalker/) and is inspired by the DotNetNuke web application framework. Initially created as a proof of concept, Oqtane is a native Blazor application written from the ground up using modern .NET Core technology. It is a modular framework offering a fully dynamic page compositing model, multi-site support, designer friendly templates ( skins ), and extensibility via third party modules.
@ -28,7 +63,7 @@ At this point Oqtane offers a minimum of desired functionality and is not recomm
# Example Screenshots
A simplistic login flow ( note that a full authentication story has not been implemented at this point ):
A seamless login flow utilizing .NET Core Identity services:
![Login](https://github.com/oqtane/framework/blob/master/screenshot1.png?raw=true "Login")