Merge pull request #414 from chlupac/ComponentRefactoring
Theme base components refactoring - clear of async warnings
This commit is contained in:
commit
e0389f809b
@ -29,13 +29,12 @@ namespace Oqtane.Themes.Controls
|
||||
var actionList = new List<ActionViewModel>();
|
||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions))
|
||||
{
|
||||
|
||||
actionList.Add(new ActionViewModel {Name = "Manage Settings", Action = async (u,m) => Settings(u, m)});
|
||||
actionList.Add(new ActionViewModel {Name = "Manage Settings", Action = async (u, m) => await Settings(u, m)});
|
||||
|
||||
if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.ServerManagerType != "")
|
||||
{
|
||||
actionList.Add(new ActionViewModel {Name = "Import Content", Action = async(u,m)=> EditUrl(m.ModuleId, "Import")});
|
||||
actionList.Add(new ActionViewModel {Name = "Export Content", Action = async(u,m)=> EditUrl(m.ModuleId, "Export")});
|
||||
actionList.Add(new ActionViewModel {Name = "Import Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Import")});
|
||||
actionList.Add(new ActionViewModel {Name = "Export Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Export")});
|
||||
}
|
||||
|
||||
actionList.Add(new ActionViewModel {Name = "Delete Module", Action = async (u, m) => await DeleteModule(u, m)});
|
||||
@ -69,9 +68,17 @@ namespace Oqtane.Themes.Controls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actionList;
|
||||
}
|
||||
|
||||
private async Task<string> EditUrlAsync(string url, int moduleId, string import)
|
||||
{
|
||||
await Task.Yield();
|
||||
EditUrl(moduleId, import);
|
||||
return url;
|
||||
}
|
||||
|
||||
protected async Task ModuleAction(ActionViewModel action)
|
||||
{
|
||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions))
|
||||
@ -84,6 +91,7 @@ namespace Oqtane.Themes.Controls
|
||||
{
|
||||
url = await action.Action(url, pagemodule);
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(url);
|
||||
}
|
||||
}
|
||||
@ -107,8 +115,9 @@ namespace Oqtane.Themes.Controls
|
||||
return url;
|
||||
}
|
||||
|
||||
private string Settings(string url, PageModule pagemodule)
|
||||
private async Task<string> Settings(string url, PageModule pagemodule)
|
||||
{
|
||||
await Task.Yield();
|
||||
url = EditUrl(pagemodule.ModuleId, "Settings");
|
||||
return url;
|
||||
}
|
||||
@ -128,6 +137,7 @@ namespace Oqtane.Themes.Controls
|
||||
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
|
||||
return s;
|
||||
}
|
||||
|
||||
private async Task<string> MoveUp(string s, PageModule pagemodule)
|
||||
{
|
||||
pagemodule.Order -= 3;
|
||||
@ -135,6 +145,7 @@ namespace Oqtane.Themes.Controls
|
||||
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
|
||||
return s;
|
||||
}
|
||||
|
||||
private async Task<string> MoveDown(string s, PageModule pagemodule)
|
||||
{
|
||||
pagemodule.Order += 3;
|
||||
@ -148,7 +159,6 @@ namespace Oqtane.Themes.Controls
|
||||
public string Name { set; get; }
|
||||
|
||||
public Func<string, PageModule, Task<string>> Action { set; get; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user