Install Wizard
This commit is contained in:
@ -11,17 +11,19 @@ namespace Oqtane.Services
|
||||
public class AliasService : ServiceBase, IAliasService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public AliasService(HttpClient http, IUriHelper urihelper)
|
||||
public AliasService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(urihelper.GetAbsoluteUri(), "Alias"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Alias"); }
|
||||
}
|
||||
|
||||
public async Task<List<Alias>> GetAliasesAsync()
|
||||
|
12
Oqtane.Client/Services/IInstallationService.cs
Normal file
12
Oqtane.Client/Services/IInstallationService.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IInstallationService
|
||||
{
|
||||
Task<GenericResponse> IsInstalled();
|
||||
Task<GenericResponse> Install(string connectionstring);
|
||||
}
|
||||
}
|
39
Oqtane.Client/Services/InstallationService.cs
Normal file
39
Oqtane.Client/Services/InstallationService.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class InstallationService : ServiceBase, IInstallationService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public InstallationService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Installation"); }
|
||||
}
|
||||
|
||||
public async Task<GenericResponse> IsInstalled()
|
||||
{
|
||||
return await http.GetJsonAsync<GenericResponse>(apiurl + "/installed");
|
||||
}
|
||||
|
||||
public async Task<GenericResponse> Install(string connectionstring)
|
||||
{
|
||||
return await http.PostJsonAsync<GenericResponse>(apiurl, connectionstring);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,16 +14,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public ModuleDefinitionService(HttpClient http, SiteState sitestate)
|
||||
public ModuleDefinitionService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "ModuleDefinition"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "ModuleDefinition"); }
|
||||
}
|
||||
|
||||
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync()
|
||||
|
@ -12,16 +12,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public ModuleService(HttpClient http, SiteState sitestate)
|
||||
public ModuleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "Module"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Module"); }
|
||||
}
|
||||
|
||||
public async Task<List<Module>> GetModulesAsync(int PageId)
|
||||
|
@ -12,16 +12,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public PageModuleService(HttpClient http, SiteState sitestate)
|
||||
public PageModuleService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "PageModule"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, "PageModule", urihelper.GetAbsoluteUri()); }
|
||||
}
|
||||
|
||||
public async Task<List<PageModule>> GetPageModulesAsync()
|
||||
|
@ -12,16 +12,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public PageService(HttpClient http, SiteState sitestate)
|
||||
public PageService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "Page"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Page"); }
|
||||
}
|
||||
|
||||
public async Task<List<Page>> GetPagesAsync(int SiteId)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -6,21 +7,24 @@ namespace Oqtane.Services
|
||||
{
|
||||
public class ServiceBase
|
||||
{
|
||||
// method for alias agnostic api call
|
||||
public string CreateApiUrl(string absoluteUri, string serviceName)
|
||||
{
|
||||
Uri uri = new Uri(absoluteUri);
|
||||
string apiurl = uri.Scheme + "://" + uri.Authority + "/~/api/" + serviceName;
|
||||
return apiurl;
|
||||
}
|
||||
|
||||
// method for alias specific api call
|
||||
public string CreateApiUrl(Alias alias, string serviceName)
|
||||
public string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
||||
{
|
||||
string apiurl = alias.Url + "/";
|
||||
if (alias.Path == "")
|
||||
string apiurl = "";
|
||||
if (alias != null)
|
||||
{
|
||||
apiurl += "~/";
|
||||
// build a url which passes the alias that may include a subfolder for multi-tenancy
|
||||
apiurl = alias.Url + "/";
|
||||
if (alias.Path == "")
|
||||
{
|
||||
apiurl += "~/";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// build a url which ignores any subfolder for multi-tenancy
|
||||
Uri uri = new Uri(absoluteUri);
|
||||
apiurl = uri.Scheme + "://" + uri.Authority + "/~/";
|
||||
}
|
||||
apiurl += "api/" + serviceName;
|
||||
return apiurl;
|
||||
|
@ -12,16 +12,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public SiteService(HttpClient http, SiteState sitestate)
|
||||
public SiteService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "Site"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Site"); }
|
||||
}
|
||||
|
||||
public async Task<List<Site>> GetSitesAsync()
|
||||
|
@ -12,16 +12,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public TenantService(HttpClient http, SiteState sitestate)
|
||||
public TenantService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "Tenant"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Tenant"); }
|
||||
}
|
||||
|
||||
public async Task<List<Tenant>> GetTenantsAsync()
|
||||
|
@ -14,16 +14,18 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly SiteState sitestate;
|
||||
private readonly IUriHelper urihelper;
|
||||
|
||||
public ThemeService(HttpClient http, SiteState sitestate)
|
||||
public ThemeService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
this.sitestate = sitestate;
|
||||
this.urihelper = urihelper;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "Theme"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Theme"); }
|
||||
}
|
||||
|
||||
public async Task<List<Theme>> GetThemesAsync()
|
||||
|
@ -24,7 +24,7 @@ namespace Oqtane.Services
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(sitestate.Alias, "User"); }
|
||||
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "User"); }
|
||||
}
|
||||
|
||||
public async Task<List<User>> GetUsersAsync()
|
||||
|
Reference in New Issue
Block a user