added uninstall support for modules
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Create [Module] table
|
||||
Create [Owner][Module] table
|
||||
*/
|
||||
|
||||
CREATE TABLE [dbo].[[Owner][Module]](
|
||||
|
6
Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Server/Scripts/Uninstall.sql
vendored
Normal file
6
Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Server/Scripts/Uninstall.sql
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
Remove [Owner][Module] table
|
||||
*/
|
||||
|
||||
DROP TABLE [dbo].[[Owner][Module]]
|
||||
GO
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Create [Module] table
|
||||
Create [Owner][Module] table
|
||||
*/
|
||||
|
||||
CREATE TABLE [dbo].[[Owner][Module]](
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
Create [Module] table
|
||||
*/
|
||||
|
||||
CREATE TABLE [dbo].[[Module]](
|
||||
[[Module]Id] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ModuleId] [int] NOT NULL,
|
||||
[Name] [nvarchar](256) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_[Module]] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[[Module]Id] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
/*
|
||||
Create foreign key relationships
|
||||
*/
|
||||
ALTER TABLE [dbo].[[Module]] WITH CHECK ADD CONSTRAINT [FK_[Module]_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].Module ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
@ -0,0 +1,6 @@
|
||||
/*
|
||||
Remove [Owner][Module] table
|
||||
*/
|
||||
|
||||
DROP TABLE [dbo].[[Owner][Module]]
|
||||
GO
|
@ -10,7 +10,7 @@
|
||||
@inject IPageModuleService PageModuleService
|
||||
@inject ILogService logger
|
||||
|
||||
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||
{
|
||||
<div class="app-controlpanel" style="@_display">
|
||||
|
||||
@ -231,17 +231,17 @@
|
||||
{
|
||||
ButtonClass = "btn-outline-primary";
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(CardClass))
|
||||
{
|
||||
CardClass = "card bg-secondary mb-3";
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(HeaderClass))
|
||||
{
|
||||
HeaderClass = "card-header text-white";
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(BodyClass))
|
||||
{
|
||||
BodyClass = "card-body";
|
||||
@ -251,8 +251,22 @@
|
||||
{
|
||||
_pages?.Clear();
|
||||
|
||||
foreach (Page p in PageState.Pages)
|
||||
{
|
||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions))
|
||||
{
|
||||
_pages.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
var panes = PageState.Page.Panes.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
_pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
||||
var themes = await ThemeService.GetThemesAsync();
|
||||
_containers = ThemeService.GetContainerTypes(themes);
|
||||
_containerType = PageState.Site.DefaultContainerType;
|
||||
|
||||
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||
|
||||
|
||||
foreach (ModuleDefinition moduledefinition in _allModuleDefinitions)
|
||||
{
|
||||
if (moduledefinition.Categories != "")
|
||||
@ -266,22 +280,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories == "").ToList();
|
||||
|
||||
foreach (Page p in PageState.Pages)
|
||||
{
|
||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions))
|
||||
{
|
||||
_pages.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
var panes = PageState.Page.Panes.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
_pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
||||
var themes = await ThemeService.GetThemesAsync();
|
||||
_containers = ThemeService.GetContainerTypes(themes);
|
||||
_containerType = PageState.Site.DefaultContainerType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@
|
||||
{
|
||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(category)).ToList();
|
||||
}
|
||||
|
||||
|
||||
_moduleDefinitionName = "-";
|
||||
StateHasChanged();
|
||||
}
|
||||
@ -305,7 +305,7 @@
|
||||
{
|
||||
_pageId = (string) e.Value;
|
||||
_modules?.Clear();
|
||||
|
||||
|
||||
if (_pageId != "-")
|
||||
{
|
||||
foreach (Module module in PageState.Modules.Where(item => item.PageId == int.Parse(_pageId) && !item.IsDeleted))
|
||||
@ -316,7 +316,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_moduleId = "-";
|
||||
StateHasChanged();
|
||||
}
|
||||
@ -355,7 +355,7 @@
|
||||
pageModule.Title = _modules.FirstOrDefault(item => item.ModuleId == int.Parse(_moduleId))?.Title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pageModule.Pane = _pane;
|
||||
pageModule.Order = int.MaxValue;
|
||||
pageModule.ContainerType = _containerType;
|
||||
@ -438,19 +438,19 @@
|
||||
case "Admin":
|
||||
// get admin dashboard moduleid
|
||||
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.AdminDashboardModule);
|
||||
|
||||
|
||||
if (module != null)
|
||||
{
|
||||
NavigationManager.NavigateTo(EditUrl(PageState.Page.Path, module.ModuleId, "Index", ""));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case "Add":
|
||||
case "Edit":
|
||||
string url = "";
|
||||
// get page management moduleid
|
||||
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.PageManagementModule);
|
||||
|
||||
|
||||
if (module != null)
|
||||
{
|
||||
switch (location)
|
||||
@ -463,12 +463,12 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (url != "")
|
||||
{
|
||||
NavigationManager.NavigateTo(url);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -482,7 +482,7 @@
|
||||
private async Task DeletePage()
|
||||
{
|
||||
ConfirmDelete();
|
||||
|
||||
|
||||
var page = PageState.Page;
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user