Merge pull request #656 from sbwalker/master
modifications to ActionLink and ActionDialog controls, added logic to prevent IHostedService from blocking startup, made controller route prefix consistent in module template
This commit is contained in:
commit
50d74cbcee
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool _visible = false;
|
private bool _visible = false;
|
||||||
private bool _editmode = true;
|
private bool _editmode = false;
|
||||||
private bool _authorized = false;
|
private bool _authorized = false;
|
||||||
private string _iconSpan = string.Empty;
|
private string _iconSpan = string.Empty;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
public bool Disabled { get; set; } // optional
|
public bool Disabled { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
public string EditMode { get; set; } // optional - specifies if an authorized user must be in edit mode to see the action - default is false
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
|
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
{
|
{
|
||||||
Class = "btn btn-success";
|
Class = "btn btn-success";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(EditMode))
|
if (!string.IsNullOrEmpty(EditMode))
|
||||||
{
|
{
|
||||||
_editmode = bool.Parse(EditMode);
|
_editmode = bool.Parse(EditMode);
|
||||||
|
@ -100,7 +101,7 @@
|
||||||
private bool IsAuthorized()
|
private bool IsAuthorized()
|
||||||
{
|
{
|
||||||
bool authorized = false;
|
bool authorized = false;
|
||||||
if (PageState.EditMode || _editmode)
|
if (PageState.EditMode || !_editmode)
|
||||||
{
|
{
|
||||||
SecurityAccessLevel security = SecurityAccessLevel.Host;
|
SecurityAccessLevel security = SecurityAccessLevel.Host;
|
||||||
if (Security == null)
|
if (Security == null)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
private string _parameters = string.Empty;
|
private string _parameters = string.Empty;
|
||||||
private string _classname = "btn btn-primary";
|
private string _classname = "btn btn-primary";
|
||||||
private string _style = string.Empty;
|
private string _style = string.Empty;
|
||||||
private bool _editmode = true;
|
private bool _editmode = false;
|
||||||
private bool _authorized = false;
|
private bool _authorized = false;
|
||||||
private string _iconSpan = string.Empty;
|
private string _iconSpan = string.Empty;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
public bool Disabled { get; set; } // optional
|
public bool Disabled { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
public string EditMode { get; set; } // optional - specifies if an authorized user must be in edit mode to see the action - default is false.
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
|
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
private bool IsAuthorized()
|
private bool IsAuthorized()
|
||||||
{
|
{
|
||||||
var authorized = false;
|
var authorized = false;
|
||||||
if (PageState.EditMode || _editmode)
|
if (PageState.EditMode || !_editmode)
|
||||||
{
|
{
|
||||||
var security = SecurityAccessLevel.Host;
|
var security = SecurityAccessLevel.Host;
|
||||||
if (Security == null)
|
if (Security == null)
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
@if (PageState.EditMode)
|
@if (PageState.EditMode)
|
||||||
{
|
{
|
||||||
<br /><ActionLink Action="Edit" EditMode="false" /><br /><br />
|
<br /><ActionLink Action="Edit" EditMode="true" /><br /><br />
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override List<Resource> Resources => new List<Resource>()
|
public override List<Resource> Resources => new List<Resource>()
|
||||||
{
|
{
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
protected async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
|
await Task.Yield(); // required so that this method does not block startup
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
|
|
@ -10,7 +10,7 @@ using [Owner].[Module]s.Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
namespace [Owner].[Module]s.Controllers
|
||||||
{
|
{
|
||||||
[Route("{site}/api/[controller]")]
|
[Route("{alias}/api/[controller]")]
|
||||||
public class [Module]Controller : Controller
|
public class [Module]Controller : Controller
|
||||||
{
|
{
|
||||||
private readonly I[Module]Repository _[Module]s;
|
private readonly I[Module]Repository _[Module]s;
|
||||||
|
|
|
@ -10,7 +10,7 @@ using [Owner].[Module]s.Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
namespace [Owner].[Module]s.Controllers
|
||||||
{
|
{
|
||||||
[Route("{site}/api/[controller]")]
|
[Route("{alias}/api/[controller]")]
|
||||||
public class [Module]Controller : Controller
|
public class [Module]Controller : Controller
|
||||||
{
|
{
|
||||||
private readonly I[Module]Repository _[Module]s;
|
private readonly I[Module]Repository _[Module]s;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user