|
@@ -37,6 +37,8 @@ namespace PRSDesktop
|
|
|
|
|
|
public class CustomDashboard : BaseObject
|
|
|
{
|
|
|
+ public Guid ID { get; set; }
|
|
|
+
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string Group { get; set; }
|
|
@@ -128,7 +130,7 @@ namespace PRSDesktop
|
|
|
|
|
|
public void CreateToolbarButtons(IPanelHost host)
|
|
|
{
|
|
|
- host.CreateSetupAction("Manage Custom Dashboards", null, ManageCustomDashboards_Click);
|
|
|
+ host.CreateSetupActionIf<CanManageCustomDashboards>("Manage Custom Dashboards", null, ManageCustomDashboards_Click);
|
|
|
}
|
|
|
|
|
|
private void ManageCustomDashboards_Click(PanelAction action)
|
|
@@ -138,6 +140,18 @@ namespace PRSDesktop
|
|
|
|
|
|
var grid = new CustomDashboardGrid();
|
|
|
grid.Items = settings.CustomDashboards;
|
|
|
+ grid.Refresh(true, true);
|
|
|
+
|
|
|
+ var dlg = new DynamicContentDialog(grid)
|
|
|
+ {
|
|
|
+ Title = "Manage Custom Dashboards"
|
|
|
+ };
|
|
|
+ dlg.CanSave = true;
|
|
|
+ if(dlg.ShowDialog() == true)
|
|
|
+ {
|
|
|
+ config.Save(settings);
|
|
|
+ UpdateCustomDashboardList();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void SaveSettings()
|
|
@@ -522,7 +536,9 @@ namespace PRSDesktop
|
|
|
string dashboardName;
|
|
|
if(element is CustomDashboardElement custom)
|
|
|
{
|
|
|
- dashboardName = custom.Properties.DashboardName;
|
|
|
+ var customDashboard = new GlobalConfiguration<GlobalUtilityDashboardSettings>().Load()
|
|
|
+ .CustomDashboards.FirstOrDefault(x => x.ID == custom.Properties.DashboardID);
|
|
|
+ dashboardName = customDashboard?.Name ?? "Unknown Dashboard";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -682,7 +698,7 @@ namespace PRSDesktop
|
|
|
var config = new GlobalConfiguration<GlobalUtilityDashboardSettings>();
|
|
|
var settings = config.Load();
|
|
|
|
|
|
- var customDashboard = settings.CustomDashboards.FirstOrDefault(x => x.Name == element.Properties.DashboardName);
|
|
|
+ var customDashboard = settings.CustomDashboards.FirstOrDefault(x => x.ID == element.Properties.DashboardID);
|
|
|
if(customDashboard is null)
|
|
|
{
|
|
|
return;
|
|
@@ -711,11 +727,6 @@ namespace PRSDesktop
|
|
|
customDashboard.Group = editor.DashboardGroup;
|
|
|
config.Save(settings);
|
|
|
|
|
|
- element.Properties = new CustomDashboardProperties
|
|
|
- {
|
|
|
- DashboardName = editor.DashboardName
|
|
|
- };
|
|
|
-
|
|
|
UpdateCustomDashboardList();
|
|
|
}
|
|
|
}
|
|
@@ -725,7 +736,7 @@ namespace PRSDesktop
|
|
|
var element = new CustomDashboardElement();
|
|
|
element.Properties = new CustomDashboardProperties
|
|
|
{
|
|
|
- DashboardName = dashboard.Name
|
|
|
+ DashboardID = dashboard.ID
|
|
|
};
|
|
|
return element;
|
|
|
}
|
|
@@ -749,18 +760,20 @@ namespace PRSDesktop
|
|
|
{
|
|
|
var config = new GlobalConfiguration<GlobalUtilityDashboardSettings>();
|
|
|
var settings = config.Load();
|
|
|
- settings.CustomDashboards.Add(new CustomDashboard
|
|
|
+ var newDashboard = new CustomDashboard
|
|
|
{
|
|
|
Layout = DynamicDashboardUtils.Serialize(editor.GetDashboard()),
|
|
|
Name = editor.DashboardName,
|
|
|
- Group = editor.DashboardGroup
|
|
|
- });
|
|
|
+ Group = editor.DashboardGroup,
|
|
|
+ ID = Guid.NewGuid()
|
|
|
+ };
|
|
|
+ settings.CustomDashboards.Add(newDashboard);
|
|
|
config.Save(settings);
|
|
|
|
|
|
var element = new CustomDashboardElement();
|
|
|
element.Properties = new CustomDashboardProperties
|
|
|
{
|
|
|
- DashboardName = editor.DashboardName
|
|
|
+ DashboardID = newDashboard.ID
|
|
|
};
|
|
|
|
|
|
UpdateCustomDashboardList();
|