Skip to content

Commit

Permalink
Version 1.0.19. Merge operation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjrh committed Mar 30, 2021
2 parents 088e4e0 + 38c2853 commit b0c333f
Show file tree
Hide file tree
Showing 25 changed files with 877 additions and 128 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/src/DotNetNuke.PowerBI/PBIEmbedded.Web/package-lock.json
/src/DotNetNuke.PowerBI/.vs/DotNetNuke.PowerBI/v16
/src/DotNetNuke.PowerBI/.vs
/src/DotNetNuke.PowerBI.sln.DotSettings.user
4 changes: 2 additions & 2 deletions docs/images/ReleaseBadge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/DotNetNuke.PowerBI/Components/RouteMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ public class RouteMapper : IServiceRouteMapper
{
public void RegisterRoutes(IMapRoute routeManager)
{
//routeManager.MapHttpRoute("PowerBI", "default", "{controller}/{action}", new[] { "DotNetNuke.PowerBI.Controllers.Api" });
//routeManager.MapHttpRoute("PowerBI", "default", "{controller}/{action}", new[] { "DotNetNuke.PowerBI.Controllers" });
routeManager.MapHttpRoute("PowerBI/UI", "default", "{controller}/{action}", new[] { "DotNetNuke.PowerBI.Controllers.Api.Admin" });
routeManager.MapHttpRoute("Bookmarks", "default", "{controller}/{action}", new[] { "DotNetNuke.PowerBI.Services" });
}

}
Expand Down
9 changes: 6 additions & 3 deletions src/DotNetNuke.PowerBI/Controllers/ContentViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using DotNetNuke.Entities.Profile;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security.Roles;
using DotNetNuke.PowerBI.Data.Bookmarks.Models;

namespace DotNetNuke.PowerBI.Controllers
{
Expand Down Expand Up @@ -52,15 +53,15 @@ public ActionResult Index()
if (userPropertySetting == "PowerBiGroup")
{
var userProperty = PortalSettings.UserInfo.Profile.GetProperty("PowerBiGroup");
if (userProperty != null && userProperty.PropertyValue != null)
if (userProperty?.PropertyValue != null)
{
user = userProperty.PropertyValue;
}
}
else if (userPropertySetting == "Custom")
{
var customProperties = (string) ModuleContext.Settings["PowerBIEmbedded_CustomUserProperty"];
var matches = System.Text.RegularExpressions.Regex.Matches(customProperties, @"\[PROFILE:(?<PROPERTY>[A-z]*)]");
var matches = Regex.Matches(customProperties, @"\[PROFILE:(?<PROPERTY>[A-z]*)]");

foreach (Match match in matches)
{
Expand Down Expand Up @@ -110,9 +111,12 @@ public ActionResult Index()
ViewBag.FilterPaneVisible = bool.Parse(GetSetting("PowerBIEmbedded_FilterPaneVisible", "true"));
ViewBag.NavPaneVisible = bool.Parse(GetSetting("PowerBIEmbedded_NavPaneVisible", "true"));
ViewBag.OverrideVisualHeaderVisibility = bool.Parse(GetSetting("PowerBIEmbedded_OverrideVisualHeaderVisibility", "false"));
ViewBag.OverrideFilterPaneVisibility = bool.Parse(GetSetting("PowerBIEmbedded_OverrideFilterPaneVisibility", "false"));
ViewBag.VisualHeaderVisible = bool.Parse(GetSetting("PowerBIEmbedded_VisualHeaderVisible", "false"));
ViewBag.PrintVisible = bool.Parse(GetSetting("PowerBIEmbedded_PrintVisible", "false"));
ViewBag.ToolbarVisible = bool.Parse(GetSetting("PowerBIEmbedded_ToolbarVisible", "false"));
ViewBag.FullScreenVisible = bool.Parse(GetSetting("PowerBIEmbedded_FullScreenVisible", "false"));
ViewBag.BookmarksVisible = bool.Parse(GetSetting("PowerBIEmbedded_BookmarksVisible", "false"));
ViewBag.Height = GetSetting("PowerBIEmbedded_Height");

// Sets the reports page on the viewbag
Expand All @@ -125,7 +129,6 @@ public ActionResult Index()
}
ViewBag.ReportsPage = reportsPage;
}

return View(model);
}
catch (Exception ex)
Expand Down
12 changes: 12 additions & 0 deletions src/DotNetNuke.PowerBI/Controllers/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ public SettingsModel()
FilterPaneVisible = true;
NavPaneVisible = true;
OverrideVisualHeaderVisibility = false;
OverrideFilterPaneVisibility = false;
VisualHeaderVisible = false;
IsContentView = false;
ToolbarVisible = false;
PrintVisible = false;
BookmarksVisible = false;
FullScreenVisible = false;
Height = "";
}
public string SettingsGroupId { get; set; }
Expand All @@ -37,9 +40,12 @@ public SettingsModel()
public bool FilterPaneVisible { get; set; }
public bool NavPaneVisible { get; set; }
public bool OverrideVisualHeaderVisibility { get; set; }
public bool OverrideFilterPaneVisibility { get; set; }
public bool VisualHeaderVisible { get; set; }
public bool ToolbarVisible { get; set; }
public bool PrintVisible { get; set; }
public bool FullScreenVisible { get; set; }
public bool BookmarksVisible { get; set; }
public string Height { get; set; }
public string UserProperty { get; set; }
public string CustomUserProperty { get; set; }
Expand All @@ -65,8 +71,11 @@ public ActionResult Index()
Height = GetSetting("PowerBIEmbedded_Height"),
OverrideVisualHeaderVisibility = bool.Parse(GetSetting("PowerBIEmbedded_OverrideVisualHeaderVisibility", "False")),
VisualHeaderVisible = bool.Parse(GetSetting("PowerBIEmbedded_VisualHeaderVisible", "False")),
OverrideFilterPaneVisibility = bool.Parse(GetSetting("PowerBIEmbedded_OverrideFilterPaneVisibility", "False")),
ToolbarVisible = bool.Parse(GetSetting("PowerBIEmbedded_ToolbarVisible", "False")),
PrintVisible = bool.Parse(GetSetting("PowerBIEmbedded_PrintVisible", "False")),
BookmarksVisible = bool.Parse(GetSetting("PowerBIEmbedded_BookmarksVisible", "False")),
FullScreenVisible = bool.Parse(GetSetting("PowerBIEmbedded_FullScreenVisible", "False")),
UserProperty = GetSetting("PowerBIEmbedded_UserProperty","Username"),
CustomUserProperty = GetSetting("PowerBIEmbedded_CustomUserProperty","")
};
Expand Down Expand Up @@ -135,9 +144,12 @@ public ActionResult Index(SettingsModel settings)
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_NavPaneVisible", settings.NavPaneVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_Height", settings.Height);
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_OverrideVisualHeaderVisibility", settings.OverrideVisualHeaderVisibility.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_OverrideFilterPaneVisibility", settings.OverrideFilterPaneVisibility.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_VisualHeaderVisible", settings.VisualHeaderVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_ToolbarVisible", settings.ToolbarVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_PrintVisible", settings.PrintVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_FullScreenVisible", settings.FullScreenVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_BookmarksVisible", settings.BookmarksVisible.ToString());
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_UserProperty", settings.UserProperty);
ModuleController.Instance.UpdateTabModuleSetting(this.ModuleContext.TabModuleId, "PowerBIEmbedded_CustomUserProperty", settings.CustomUserProperty);
return RedirectToDefaultRoute();
Expand Down
75 changes: 75 additions & 0 deletions src/DotNetNuke.PowerBI/Data/Bookmarks/BookmarksRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using DotNetNuke.Framework;
using DotNetNuke.PowerBI.Data.Bookmarks.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetNuke.Common;
using DotNetNuke.Data;
using DotNetNuke.PowerBI.Services;

namespace DotNetNuke.PowerBI.Data.Bookmarks
{
public class BookmarksRepository : ServiceLocator<IBookmarksRepository, BookmarksRepository>, IBookmarksRepository
{
public bool DeleteBookmark(int bookmarkId)
{
Requires.NotNegative("portalId", bookmarkId);
using (var ctx = DataContext.Instance())
{
var repo = ctx.GetRepository<Bookmark>();
var bookmark = repo.GetById(bookmarkId);
repo.Delete(bookmark);
return true;
}
}

public List<Bookmark> GetBookmarks(string reportId, int currentPortalId)
{
Requires.NotNull(reportId);
using (var ctx = DataContext.Instance())
{
var repo = ctx.GetRepository<Bookmark>();
var bookmarks = repo.Get(currentPortalId).Where(bookmark => bookmark.ReportId == reportId).ToList();
return bookmarks;
}
}

public List<Bookmark> GetBookmarksByUser(int portalId, string reportId, int userId)
{
Requires.NotNegative("portalId", portalId);
Requires.NotNull(reportId);
Requires.NotNull(userId);

using (var ctx = DataContext.Instance())
{
var repo = ctx.GetRepository<Bookmark>();
var bookmarks = repo.Get(portalId).Where(bookmark => bookmark.CreatedBy == userId && bookmark.ReportId == reportId).ToList();
return bookmarks;
}
}

public int SaveBookmark(Bookmark bookmark)
{
Requires.NotNull(bookmark);

bookmark.CreatedOn = DateTime.Now;
bookmark.CreatedBy = Components.Common.CurrentUser.UserID;

using (var ctx = DataContext.Instance())
{
var repo = ctx.GetRepository<Bookmark>();
repo.Insert(bookmark);

return bookmark.Id;
}

return -1;
}

protected override Func<IBookmarksRepository> GetFactory()
{
return () => new BookmarksRepository();
}
}
}
17 changes: 17 additions & 0 deletions src/DotNetNuke.PowerBI/Data/Bookmarks/IBookmarksRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using DotNetNuke.PowerBI.Data.Bookmarks.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace DotNetNuke.PowerBI.Data.Bookmarks
{
public interface IBookmarksRepository
{
List<Bookmark> GetBookmarks(string reportId, int currentPortalId);
List<Bookmark> GetBookmarksByUser(int portalId, string reportId,int userId);
int SaveBookmark(Bookmark bookmark);
bool DeleteBookmark(int bookmarkId);
}
}
35 changes: 35 additions & 0 deletions src/DotNetNuke.PowerBI/Data/Bookmarks/Models/Bookmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using DotNetNuke.ComponentModel.DataAnnotations;
using System.Web.Caching;
using DotNetNuke.PowerBI.Services;

namespace DotNetNuke.PowerBI.Data.Bookmarks.Models
{
[TableName("PBI_Bookmarks")]
//setup the primary key for table
[PrimaryKey("Id", AutoIncrement = true)]
//scope the objects to the ModuleId of a module on a page (or copy of a module on a page)
[Scope("PortalId")]
public class Bookmark
{
public Bookmark()
{
}
public Bookmark(BookmarksController.BookmarkViewModel bookmarkViewModel, int userId, int portalId)
{
Name = bookmarkViewModel.name;
DisplayName = bookmarkViewModel.displayName;
State = bookmarkViewModel.state;
ReportId = bookmarkViewModel.reportId;
PortalId = portalId;
}
public int Id { get; set; }
public int PortalId{get; set; }
public string ReportId { get; set; }
public string DisplayName { get; set; }
public string Name { get; set; }
public string State { get; set; }
public DateTime CreatedOn { get; set; }
public int CreatedBy { get; set; }
}
}
8 changes: 8 additions & 0 deletions src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@
<Compile Include="Controllers\ContentViewController.cs" />
<Compile Include="Controllers\ListViewController.cs" />
<Compile Include="Controllers\SettingsController.cs" />
<Compile Include="Data\Bookmarks\BookmarksRepository.cs" />
<Compile Include="Data\Bookmarks\IBookmarksRepository.cs" />
<Compile Include="Data\Bookmarks\Models\Bookmark.cs" />
<Compile Include="Data\IObjectPermissionsRepository.cs" />
<Compile Include="Data\Models\ObjectPermission.cs" />
<Compile Include="Data\SharedSettings\ISharedSettingsRepository.cs" />
Expand All @@ -195,6 +198,7 @@
<Compile Include="Models\TileEmbedConfig.cs" />
<Compile Include="Models\Workspace.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\BookmarksController.cs" />
<Compile Include="Services\EmbedService.cs" />
<Compile Include="Services\IEmbedService.cs" />
<Compile Include="Services\Models\GetPowerBiObjectListResponse.cs" />
Expand All @@ -208,6 +212,9 @@
<Content Include="admin\personaBar\scripts\bundles\bundle-en.js" />
<Content Include="admin\personaBar\scripts\PBIEmbedded.js" />
<Content Include="css\vendors\select2.min.css" />
<Content Include="images\addbookmark.png" />
<Content Include="images\bookmark.png" />
<Content Include="images\delete.png" />
<Content Include="images\fullscreen.png" />
<Content Include="images\powerbi.png" />
<Content Include="images\powerbi.svg" />
Expand Down Expand Up @@ -251,6 +258,7 @@
<Content Include="Providers\DataProviders\SqlDataProvider\01.00.06.SqlDataProvider" />
<Content Include="Views\CalendarView\Index.cshtml" />
<Content Include="scripts\powerbi.js.map" />
<Content Include="Providers\DataProviders\SqlDataProvider\01.00.07.SqlDataProvider" />
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
Expand Down
13 changes: 9 additions & 4 deletions src/DotNetNuke.PowerBI/DotNetNuke.PowerBI.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="PowerBIEmbeddedList" type="Module" version="01.00.17">
<package name="PowerBIEmbeddedList" type="Module" version="01.00.19">
<friendlyName>PowerBI Embedded Content List</friendlyName>
<description>A set of modules to embed PowerBI Embedded dashboards and reports into a DNN Platform installation.</description>
<iconFile>~/DesktopModules/MVC/PowerBIEmbedded/images/powerbi.png</iconFile>
Expand Down Expand Up @@ -41,7 +41,12 @@
<path>Providers\DataProviders\SqlDataProvider</path>
<name>01.00.06.SqlDataProvider</name>
<version>01.00.06</version>
</script>
</script>
<script type="Install">
<path>Providers\DataProviders\SqlDataProvider</path>
<name>01.00.07.SqlDataProvider</name>
<version>01.00.18</version>
</script>
<script type="UnInstall">
<path>Providers\DataProviders\SqlDataProvider</path>
<name>Uninstall.SqlDataProvider</name>
Expand Down Expand Up @@ -157,7 +162,7 @@
</component>
</components>
</package>
<package name="PowerBIEmbeddedContent" type="Module" version="01.00.17">
<package name="PowerBIEmbeddedContent" type="Module" version="01.00.19">
<friendlyName>PowerBI Embedded Content View</friendlyName>
<description>A set of modules to embed PowerBI Embedded dashboards and reports into a DNN Platform installation.</description>
<iconFile>~/DesktopModules/MVC/PowerBIEmbedded/images/powerbi.png</iconFile>
Expand Down Expand Up @@ -212,7 +217,7 @@
</component>
</components>
</package>
<package name="PowerBIEmbeddedCalendar" type="Module" version="01.00.17">
<package name="PowerBIEmbeddedCalendar" type="Module" version="01.00.19">
<friendlyName>PowerBI Embedded Calendar View</friendlyName>
<description>A set of modules to embed PowerBI Embedded dashboards and reports into a DNN Platform installation.</description>
<iconFile>~/DesktopModules/MVC/PowerBIEmbedded/images/powerbi.png</iconFile>
Expand Down
4 changes: 2 additions & 2 deletions src/DotNetNuke.PowerBI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.17.*")]
[assembly: AssemblyFileVersion("01.00.17.*")]
[assembly: AssemblyVersion("01.00.19.*")]
[assembly: AssemblyFileVersion("01.00.19.*")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
IF (NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'PBI_Bookmarks'))
BEGIN
CREATE TABLE {databaseOwner}[{objectQualifier}PBI_Bookmarks](
[Id] [int] IDENTITY(1,1) NOT NULL,
[PortalId] [int] NOT NULL,
[ReportId] [nvarchar](100) NOT NULL,
[DisplayName] [nvarchar](100) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[State] [nvarchar](max) NOT NULL,
[CreatedOn] [date] NOT NULL,
[CreatedBy] [int] NOT NULL
CONSTRAINT [PK_PBI_Bookmarks] PRIMARY KEY CLUSTERED
(
[Id] ASC
)
)
END


5 changes: 5 additions & 0 deletions src/DotNetNuke.PowerBI/ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@
</p>
<p>Fix for Service Principal workspace registration</p>

<b>Version 1.0.18</b>
<p>Added the feature to create and delete personal bookmarks.</p>

<b>Version 1.0.19</b>
<p>Merge fix</p>
</div>
Loading

0 comments on commit b0c333f

Please sign in to comment.