From d62b9a6bdb3dfd6a06c5d593950b179db6653698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Airam=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 20 Jul 2023 08:29:14 +0100 Subject: [PATCH] feat: added new features like adding an id (portal Alias), database tier info and database size info. --- DNNPulse.dnn | 4 +- Data/Provider/SqlDataProvider.cs | 16 +++++++- Model/DNNPulse.cs | 2 + Model/JsonBase.cs | 3 ++ Properties/AssemblyInfo.cs | 4 +- .../SqlDataProvider/01.00.00.SqlDataProvider | 38 +++++++++++++++++-- ReleaseNotes.txt | 12 +++++- Tasks/PulseTask.cs | 4 ++ 8 files changed, 72 insertions(+), 11 deletions(-) diff --git a/DNNPulse.dnn b/DNNPulse.dnn index 16993cc..01202b2 100644 --- a/DNNPulse.dnn +++ b/DNNPulse.dnn @@ -1,6 +1,6 @@ - + DNNPulse intelequia.com DNNPulse module ~/Images/icon_extensions_32px.png @@ -51,7 +51,7 @@ Intelequia.Modules.DNNPulse.Components.FeatureController, DNNPulse [DESKTOPMODULEID] - 01.00.00 + 01.01.00 diff --git a/Data/Provider/SqlDataProvider.cs b/Data/Provider/SqlDataProvider.cs index 9168059..cb4a136 100644 --- a/Data/Provider/SqlDataProvider.cs +++ b/Data/Provider/SqlDataProvider.cs @@ -88,7 +88,21 @@ public override Model.DNNPulse GetDNNPulse() } else { - query.DNNVersion = name; + if (type == "DNNVersion") + { + query.DNNVersion = name; + } + else + { + if (type == "DatabaseSize") + { + query.DatabaseSize = name; + } + else + { + query.DatabaseTier = name; + } + } } } } diff --git a/Model/DNNPulse.cs b/Model/DNNPulse.cs index b0019f9..874cdbc 100644 --- a/Model/DNNPulse.cs +++ b/Model/DNNPulse.cs @@ -15,6 +15,8 @@ public DNNPulse() public List PortalAlias { get; set; } public List ModulesName { get; set; } public List ModulesVersion { get; set; } + public string DatabaseSize { get; set; } + public string DatabaseTier { get; set; } } } \ No newline at end of file diff --git a/Model/JsonBase.cs b/Model/JsonBase.cs index c6bc95a..868f304 100644 --- a/Model/JsonBase.cs +++ b/Model/JsonBase.cs @@ -26,6 +26,9 @@ public class Properties public string DNNVersion { get; set; } public string modules { get; set; } public string[] portalAliases { get; set; } + public string databaseSize { get; set; } + public string databaseType { get; set; } + public string id { get; set; } } public class Module diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index bdf1733..a872d68 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -30,5 +30,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("01.00.00.00")] -[assembly: AssemblyFileVersion("01.00.00.00")] +[assembly: AssemblyVersion("01.01.00.00")] +[assembly: AssemblyFileVersion("01.01.00.00")] diff --git a/Providers/DataProviders/SqlDataProvider/01.00.00.SqlDataProvider b/Providers/DataProviders/SqlDataProvider/01.00.00.SqlDataProvider index 47ccd47..210ac40 100644 --- a/Providers/DataProviders/SqlDataProvider/01.00.00.SqlDataProvider +++ b/Providers/DataProviders/SqlDataProvider/01.00.00.SqlDataProvider @@ -20,10 +20,19 @@ BEGIN DECLARE @ModulesVersions TABLE ( - ModuleName Varchar(100), + ModuleName VARCHAR(100), ModuleVersion VARCHAR(100) ); + DECLARE @DatabaseSize TABLE + ( + Size VARCHAR(100) + ); + + DECLARE @DatabaseTier TABLE + ( + Tier VARCHAR(100) + ); INSERT INTO @DNNVersion (DNNVersion) SELECT TOP 1 CONCAT(major, '.' , minor, '.' ,build) FROM Version @@ -39,20 +48,41 @@ BEGIN FROM DesktopModules ORDER BY ModuleName ASC, Version ASC; + INSERT INTO @DatabaseSize (Size) + SELECT SUM(size/128.0) AS DatabaseDataSpaceAllocatedInMB + FROM sys.database_files + GROUP BY type_desc + HAVING type_desc = 'ROWS' + + INSERT INTO @DatabaseTier (Tier) + SELECT service_objective + FROM sys.database_service_objectives + WHERE database_id = DB_ID(); + SELECT * FROM ( - SELECT 'DNNVersion' AS Type, DNNVersion as Name + SELECT 'DNNVersion' AS TYPE, DNNVersion AS NAME FROM @DNNVersion UNION ALL - SELECT 'PortalAlias' as Type, HTTPALIAS as Name + SELECT 'PortalAlias' AS TYPE, HTTPALIAS AS NAME FROM @PortalAliases UNION ALL - SELECT 'Modules' as Type, CONCAT(ModuleName, ' - ', ModuleVersion) as Name + SELECT 'Modules' AS TYPE, CONCAT(ModuleName, ' - ', ModuleVersion) AS NAME FROM @ModulesVersions + + UNION ALL + + SELECT 'DatabaseSize' AS TYPE, Size AS NAME + FROM @DatabaseSize + + UNION ALL + + SELECT 'DatabaseTier' AS TYPE, Tier AS NAME + FROM @DatabaseTier ) AS DNNPulse END diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 7e84318..8013e06 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -11,6 +11,14 @@

Version 1.0.0

-

Initial realease.

- +

Initial realease.

+

+ Version 1.1.0 +

+

Added new features: +

    +
  • Database Size information added.
  • +
  • Database Tier information added.
  • +
+

\ No newline at end of file diff --git a/Tasks/PulseTask.cs b/Tasks/PulseTask.cs index 197e548..b9f7097 100644 --- a/Tasks/PulseTask.cs +++ b/Tasks/PulseTask.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -81,7 +82,10 @@ public static JsonBase GetMappedJsonBase(Model.DNNPulse dnnPulse) Properties jsonProperties = new Properties { DNNVersion = dnnPulse.DNNVersion, + databaseSize = dnnPulse.DatabaseSize, + databaseType = dnnPulse.DatabaseTier, portalAliases = dnnPulse.PortalAlias.ToArray(), + id = dnnPulse.PortalAlias.FirstOrDefault() }; for (int cont = 0; cont < dnnPulse.ModulesName.Count; cont++) {