From a381f093992acda289067b5fcd3b8ebd9adb5622 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Thu, 14 Jul 2022 13:08:22 +0100 Subject: [PATCH] Added support for displaying a message when the PBI Embedded capacity has been paused or is not active of other reasons. --- src/DotNetNuke.PowerBI.sln | 6 +- .../Controllers/ContentViewController.cs | 3 +- .../SharedSettings/Models/SharedSettings.cs | 3 +- .../SharedSettingsRepository.cs | 1 + .../DotNetNuke.PowerBI.csproj | 3 +- src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn | 17 +- src/DotNetNuke.PowerBI/Models/EmbedConfig.cs | 1 + .../components/general/workspaces/index.jsx | 2 + .../workspaces/workspaceEditor/index.jsx | 29 ++- .../Properties/AssemblyInfo.cs | 6 +- .../SqlDataProvider/01.00.21.SqlDataProvider | 7 + .../Services/EmbedService.cs | 200 +++++++++++------- .../Views/ContentView/Index.cshtml | 10 +- .../App_LocalResources/PBIEmbedded.resx | 9 + src/DotNetNuke.PowerBI/css/module.css | 8 + 15 files changed, 212 insertions(+), 93 deletions(-) create mode 100644 src/DotNetNuke.PowerBI/Providers/DataProviders/SqlDataProvider/01.00.21.SqlDataProvider diff --git a/src/DotNetNuke.PowerBI.sln b/src/DotNetNuke.PowerBI.sln index 5fc93b8..987888c 100644 --- a/src/DotNetNuke.PowerBI.sln +++ b/src/DotNetNuke.PowerBI.sln @@ -12,15 +12,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "watcher", "watcher", "{D8E9 EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug PersonaBar|Any CPU = Debug PersonaBar|Any CPU Debug|Any CPU = Debug|Any CPU + DebugPersonaBar|Any CPU = DebugPersonaBar|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Debug PersonaBar|Any CPU.ActiveCfg = Debug PersonaBar|Any CPU - {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Debug PersonaBar|Any CPU.Build.0 = Debug PersonaBar|Any CPU {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.DebugPersonaBar|Any CPU.ActiveCfg = DebugPersonaBar|Any CPU + {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.DebugPersonaBar|Any CPU.Build.0 = DebugPersonaBar|Any CPU {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D61A32C-0F21-453F-A981-BD8E5A3A5304}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/src/DotNetNuke.PowerBI/Controllers/ContentViewController.cs b/src/DotNetNuke.PowerBI/Controllers/ContentViewController.cs index e777877..f07d7d8 100644 --- a/src/DotNetNuke.PowerBI/Controllers/ContentViewController.cs +++ b/src/DotNetNuke.PowerBI/Controllers/ContentViewController.cs @@ -111,7 +111,7 @@ public ActionResult Index() return new HttpStatusCodeResult(HttpStatusCode.Forbidden, "User doesn't have permissions for this resource"); } - ViewBag.Locale = System.Threading.Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2); + ViewBag.Locale = System.Threading.Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2); ViewBag.FilterPaneVisible = bool.Parse(GetSetting("PowerBIEmbedded_FilterPaneVisible", "true")); ViewBag.NavPaneVisible = bool.Parse(GetSetting("PowerBIEmbedded_NavPaneVisible", "true")); @@ -136,6 +136,7 @@ public ActionResult Index() reportsPage = Common.Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias) + reportsPage; } ViewBag.ReportsPage = reportsPage; + ViewBag.DisabledCapacityMessage = embedService.Settings.DisabledCapacityMessage; } var currentLocale = LocaleController.Instance.GetLocale(ModuleContext.PortalId, CultureInfo.CurrentCulture.Name); diff --git a/src/DotNetNuke.PowerBI/Data/SharedSettings/Models/SharedSettings.cs b/src/DotNetNuke.PowerBI/Data/SharedSettings/Models/SharedSettings.cs index c25f439..fe261d4 100644 --- a/src/DotNetNuke.PowerBI/Data/SharedSettings/Models/SharedSettings.cs +++ b/src/DotNetNuke.PowerBI/Data/SharedSettings/Models/SharedSettings.cs @@ -46,7 +46,7 @@ public class PowerBISettings public int ModifiedBy { get; set; } public DateTime ModifiedOn { get; set; } public bool InheritPermissions { get; set; } - + public string DisabledCapacityMessage { get; set; } public PowerBISettings() { @@ -88,6 +88,7 @@ public static PowerBISettings GetPortalPowerBISettings(int portalId, int tabModu settings.SettingsGroupId = sharedSettings.SettingsGroupId; settings.SettingsGroupName = sharedSettings.SettingsGroupName; settings.InheritPermissions = sharedSettings.InheritPermissions; + settings.DisabledCapacityMessage = sharedSettings.DisabledCapacityMessage; } return settings; } diff --git a/src/DotNetNuke.PowerBI/Data/SharedSettings/SharedSettingsRepository.cs b/src/DotNetNuke.PowerBI/Data/SharedSettings/SharedSettingsRepository.cs index ed60d1e..856568c 100644 --- a/src/DotNetNuke.PowerBI/Data/SharedSettings/SharedSettingsRepository.cs +++ b/src/DotNetNuke.PowerBI/Data/SharedSettings/SharedSettingsRepository.cs @@ -94,6 +94,7 @@ public bool UpdateSettings(PowerBISettings settings, int portalId) current.ApplicationId = settings.ApplicationId; current.WorkspaceId = settings.WorkspaceId; current.ContentPageUrl = settings.ContentPageUrl; + current.DisabledCapacityMessage = settings.DisabledCapacityMessage; current.ModifiedOn = DateTime.Now; current.ModifiedBy = Components.Common.CurrentUser.UserID; current.InheritPermissions = settings.InheritPermissions; diff --git a/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.csproj b/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.csproj index 439c979..ce09236 100644 --- a/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.csproj +++ b/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.csproj @@ -262,6 +262,7 @@ + web.config @@ -306,7 +307,7 @@ OnBuildSuccess - + true ..\..\bin\ TRACE;DEBUG;DEBUGPERSONABAR diff --git a/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn b/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn index 80256b7..f29e9dd 100644 --- a/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn +++ b/src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn @@ -1,6 +1,6 @@ - + PowerBI Embedded Content List A set of modules to embed PowerBI Embedded dashboards and reports into a DNN Platform installation. ~/DesktopModules/MVC/PowerBIEmbedded/images/powerbi.png @@ -45,9 +45,14 @@ - + +