fix #2366 - populate new UrlParameters property
This commit is contained in:
parent
282a0b0c44
commit
51e2e2966f
|
@ -130,7 +130,7 @@
|
|||
private string _properties = string.Empty;
|
||||
private string _server = string.Empty;
|
||||
|
||||
public override string RouteTemplate => "/{id}";
|
||||
public override string UrlParameterTemplate => "/{id}";
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
|
|
@ -99,10 +99,10 @@ else
|
|||
private List<Log> _logs;
|
||||
private string _retention = "";
|
||||
|
||||
public override string RouteTemplate => "/{level}/{function}/{rows}/{page}";
|
||||
public override string UrlParameterTemplate => "/{level}/{function}/{rows}/{page}";
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Oqtane.Modules
|
|||
public abstract class ModuleBase : ComponentBase, IModuleControl
|
||||
{
|
||||
private Logger _logger;
|
||||
private string _urlparametersstate;
|
||||
private Dictionary<string, string> _urlparameters;
|
||||
|
||||
protected Logger logger => _logger ?? (_logger = new Logger(this));
|
||||
|
@ -49,14 +50,15 @@ namespace Oqtane.Modules
|
|||
public virtual List<Resource> Resources { get; set; }
|
||||
|
||||
// url parameters
|
||||
public virtual string RouteTemplate { get; set; }
|
||||
public virtual string UrlParameterTemplate { get; set; }
|
||||
|
||||
public Dictionary<string, string> UrlParameters {
|
||||
get
|
||||
{
|
||||
if (_urlparameters == null)
|
||||
if (_urlparametersstate == null || _urlparametersstate != PageState.UrlParameters)
|
||||
{
|
||||
_urlparameters = GetUrlParameters(RouteTemplate);
|
||||
_urlparametersstate = PageState.UrlParameters;
|
||||
_urlparameters = GetUrlParameters(UrlParameterTemplate);
|
||||
}
|
||||
return _urlparameters;
|
||||
}
|
||||
|
@ -183,7 +185,7 @@ namespace Oqtane.Modules
|
|||
public virtual Dictionary<string, string> GetUrlParameters(string template = "")
|
||||
{
|
||||
var urlParameters = new Dictionary<string, string>();
|
||||
var parameters = PageState.UrlParameters.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
var parameters = _urlparametersstate.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (string.IsNullOrEmpty(template))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user