rolled back change creating an Infrastructure.Interfaces namespace, modified IModule interface to be strongly typed (#343)

* upgrade to .NET Core 3.2 Preview 3 and fixes for issues created by #314

* Components based on Bootstrap4 for Sections and  TabStrip to increase productivity and promote uniformity in Module UIs

* rolled back change creating an Infrastructure.Interfaces namespace, modified IModule interface to be strongly typed
This commit is contained in:
Shaun Walker 2020-04-05 14:39:08 -04:00 committed by GitHub
parent 05de65d3a0
commit 02fde9cec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 91 additions and 141 deletions

View File

@ -1,22 +1,15 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Modules.Admin.ModuleCreator
{
public class Module : IModule
{
public Dictionary<string, string> Properties
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Module Creator" },
{ "Description", "Enables software developers to quickly create modules by automating many of the initial module creation tasks" },
{ "Version", "1.0.0" },
{ "Categories", "Developer" }
};
return properties;
}
}
Name = "Module Creator",
Description = "Enables software developers to quickly create modules by automating many of the initial module creation tasks",
Version = "1.0.0",
Categories = "Developer"
};
}
}

View File

@ -1,22 +1,16 @@
using System.Collections.Generic;
using Oqtane.Models;
using Oqtane.Modules;
namespace Oqtane.Modules.[Module]s
{
public class Module : IModule
{
public Dictionary<string, string> Properties
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "[Module]" },
{ "Description", "[Module]" },
{ "Version", "1.0.0" },
{ "ServerAssemblyName", "Oqtane.Server" }
};
return properties;
}
}
Name = "[Module]",
Description = "[Module]",
Version = "1.0.0",
ServerAssemblyName = "Oqtane.Server"
};
}
}

View File

@ -5,7 +5,7 @@ using Oqtane.Repository.[Module]s;
using Oqtane.Shared;
using System.Collections.Generic;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
namespace Oqtane.Controllers.[Module]s
{

View File

@ -1,21 +1,14 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Modules.Counter
{
public class Module : IModule
{
public Dictionary<string, string> Properties
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Counter" },
{ "Description", "Increments a counter" },
{ "Version", "1.0.0" }
};
return properties;
}
}
Name = "Counter",
Description = "Increments a counter",
Version = "1.0.0"
};
}
}

View File

@ -1,22 +1,15 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Modules.HtmlText
{
public class ModuleInfo : IModule
{
public Dictionary<string, string> Properties
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "HtmlText" },
{ "Description", "Renders HTML or Text" },
{ "Version", "1.0.0" },
{ "ServerAssemblyName", "Oqtane.Server" }
};
return properties;
}
}
Name = "HtmlText",
Description = "Renders HTML or Text",
Version = "1.0.0",
ServerAssemblyName = "Oqtane.Server"
};
}
}

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Modules
{
public interface IModule
{
Dictionary<string, string> Properties { get; }
ModuleDefinition ModuleDefinition { get; }
}
}

View File

@ -1,21 +1,14 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Modules.Weather
{
public class Module : IModule
{
public Dictionary<string, string> Properties
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Weather" },
{ "Description", "Displays random weather using a service" },
{ "Version", "1.0.0" }
};
return properties;
}
}
Name = "Weather",
Description = "Displays random weather using a service",
Version = "1.0.0"
};
}
}

View File

@ -8,7 +8,7 @@ using System;
using System.Net;
using System.Globalization;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -14,7 +14,7 @@ using System.Linq;
using System.Drawing;
using System.Net;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
// ReSharper disable StringIndexOfIsCultureSpecific.1

View File

@ -6,7 +6,7 @@ using Oqtane.Shared;
using System.Linq;
using System.Net;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Security;

View File

@ -4,7 +4,6 @@ using Microsoft.Extensions.Configuration;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure;
using Oqtane.Infrastructure.Interfaces;
// ReSharper disable StringIndexOfIsCultureSpecific.1

View File

@ -7,7 +7,7 @@ using System;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -2,7 +2,7 @@
using Oqtane.Models;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Shared;

View File

@ -5,7 +5,7 @@ using Oqtane.Models;
using Oqtane.Shared;
using System.Linq;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Security;

View File

@ -8,7 +8,7 @@ using System.Reflection;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Security;
using System;

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Security;

View File

@ -7,7 +7,7 @@ using System.Linq;
using Oqtane.Security;
using System.Net;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -5,7 +5,7 @@ using Oqtane.Models;
using Oqtane.Shared;
using System.Linq;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Security;

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -5,7 +5,7 @@ using Oqtane.Shared;
using Oqtane.Security;
using System.Linq;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -5,7 +5,7 @@ using Oqtane.Models;
using Oqtane.Shared;
using System.Linq;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Models;
using System.Collections.Generic;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Enums;
using System.Data.SqlClient;

View File

@ -4,7 +4,7 @@ using Oqtane.Models;
using System.Collections.Generic;
using Oqtane.Enums;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -8,7 +8,7 @@ using System.Reflection;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
// ReSharper disable StringIndexOfIsCultureSpecific.1

View File

@ -11,7 +11,7 @@ using Oqtane.Shared;
using System;
using System.Net;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Controllers

View File

@ -7,7 +7,6 @@ using System.Xml;
using Oqtane.Shared;
using System;
using System.Diagnostics;
using Oqtane.Infrastructure.Interfaces;
using Microsoft.Extensions.Caching.Memory;
namespace Oqtane.Infrastructure

View File

@ -1,4 +1,4 @@
namespace Oqtane.Infrastructure.Interfaces
namespace Oqtane.Infrastructure
{
public interface IInstallationManager
{

View File

@ -3,7 +3,7 @@ using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Shared;
namespace Oqtane.Infrastructure.Interfaces
namespace Oqtane.Infrastructure
{
public interface ILogManager
{

View File

@ -1,7 +1,7 @@
using Oqtane.Models;
using System.Collections.Generic;
namespace Oqtane.Infrastructure.Interfaces
namespace Oqtane.Infrastructure
{
public interface ISiteTemplate
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Infrastructure.Interfaces
namespace Oqtane.Infrastructure
{
public interface ISyncManager
{

View File

@ -6,7 +6,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Repository;
using Oqtane.Security;
// ReSharper disable StringIndexOfIsCultureSpecific.2

View File

@ -1,5 +1,5 @@
using Oqtane.Models;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using System.Collections.Generic;
using Oqtane.Repository;
using Microsoft.AspNetCore.Hosting;

View File

@ -3,7 +3,7 @@ using Oqtane.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Repository;
namespace Oqtane.Infrastructure

View File

@ -7,7 +7,7 @@ using Oqtane.Shared;
using System;
using System.Collections.Generic;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
namespace Oqtane.Modules.HtmlText.Controllers
{

View File

@ -148,50 +148,22 @@ namespace Oqtane.Repository
if (moduletype != null)
{
var moduleobject = Activator.CreateInstance(moduletype);
Dictionary<string, string> properties = (Dictionary<string, string>)moduletype.GetProperty("Properties").GetValue(moduleobject);
moduledefinition = new ModuleDefinition
{
ModuleDefinitionName = qualifiedModuleType,
Name = GetProperty(properties, "Name"),
Description = GetProperty(properties, "Description"),
Categories = GetProperty(properties, "Categories"),
Version = GetProperty(properties, "Version"),
Owner = GetProperty(properties, "Owner"),
Url = GetProperty(properties, "Url"),
Contact = GetProperty(properties, "Contact"),
License = GetProperty(properties, "License"),
Dependencies = GetProperty(properties, "Dependencies"),
PermissionNames = GetProperty(properties, "PermissionNames"),
ServerAssemblyName = GetProperty(properties, "ServerAssemblyName"),
ControlTypeTemplate = moduleType + "." + Constants.ActionToken + ", " + typename[1],
ControlTypeRoutes = "",
AssemblyName = assembly.FullName.Split(",")[0],
Permissions = ""
};
moduledefinition = (ModuleDefinition)moduletype.GetProperty("ModuleDefinition").GetValue(moduleobject);
}
else
{
moduledefinition = new ModuleDefinition
{
ModuleDefinitionName = qualifiedModuleType,
Name = moduleType.Substring(moduleType.LastIndexOf(".") + 1),
Description = moduleType.Substring(moduleType.LastIndexOf(".") + 1),
Categories = ((qualifiedModuleType.StartsWith("Oqtane.Modules.Admin.")) ? "Admin" : ""),
Version = new Version(1, 0, 0).ToString(),
Owner = "",
Url = "",
Contact = "",
License = "",
Dependencies = "",
PermissionNames = "",
ServerAssemblyName = "",
ControlTypeTemplate = moduleType + "." + Constants.ActionToken + ", " + typename[1],
ControlTypeRoutes = "",
AssemblyName = assembly.FullName.Split(",")[0],
Permissions = ""
Version = new Version(1, 0, 0).ToString()
};
}
// permissions
// set internal properties
moduledefinition.ModuleDefinitionName = qualifiedModuleType;
moduledefinition.ControlTypeTemplate = moduleType + "." + Constants.ActionToken + ", " + typename[1];
moduledefinition.AssemblyName = assembly.FullName.Split(",")[0];
if (moduledefinition.Categories == "Admin")
{
moduledefinition.Permissions = "[{\"PermissionName\":\"Utilize\",\"Permissions\":\"" + Constants.AdminRole + "\"}]";

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Oqtane.Extensions;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Models;
using Oqtane.Modules;
using Oqtane.Shared;

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Models;
namespace Oqtane.Repository

View File

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Oqtane.Enums;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Infrastructure;
using Oqtane.Shared;
namespace Oqtane.Security

View File

@ -15,7 +15,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Oqtane.Infrastructure;
using Oqtane.Infrastructure.Interfaces;
using Oqtane.Repository;
using Oqtane.Security;
using Oqtane.Services;

View File

@ -5,6 +5,22 @@ namespace Oqtane.Models
{
public class ModuleDefinition : IAuditable
{
public ModuleDefinition()
{
Name = "";
Description = "";
Categories = "";
Version = "";
Owner = "";
Url = "";
Contact = "";
License = "";
Dependencies = "";
PermissionNames = "";
ServerAssemblyName = "";
ControlTypeRoutes = "";
}
public int ModuleDefinitionId { get; set; }
public string ModuleDefinitionName { get; set; }
@ -13,6 +29,8 @@ namespace Oqtane.Models
public string ModifiedBy { get; set; }
public DateTime ModifiedOn { get; set; }
[NotMapped]
public int SiteId { get; set; }
[NotMapped]
public string Name { get; set; }
[NotMapped]
@ -42,8 +60,6 @@ namespace Oqtane.Models
[NotMapped]
public string AssemblyName { get; set; }
[NotMapped]
public int SiteId { get; set; }
[NotMapped]
public string Permissions { get; set; }
}
}