|
@@ -5,6 +5,7 @@ using System.Reflection;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
+using Comal.Classes;
|
|
|
using InABox.Configuration;
|
|
|
using InABox.Core;
|
|
|
using InABox.DynamicGrid;
|
|
@@ -230,15 +231,27 @@ namespace PRSDesktop
|
|
|
var favourites = GetFavourites().ToList();
|
|
|
var grid = new DynamicItemsListGrid<DashboardFavourite>(favourites);
|
|
|
grid.Options.AddRange(DynamicGridOption.DeleteRows, DynamicGridOption.EditRows, DynamicGridOption.MultiSelect);
|
|
|
+ grid.OnCustomiseEditor += FavouritesGrid_OnCustomiseEditor;
|
|
|
DynamicGridUtils.CreateGridWindow("Manage Favourites", grid).ShowDialog();
|
|
|
|
|
|
_settings.Favourites = favourites.Where(x => !x.IsGlobal).ToList();
|
|
|
SaveSettings();
|
|
|
|
|
|
- var config = new GlobalConfiguration<GlobalUtilityDashboardSettings>();
|
|
|
- var global = config.Load();
|
|
|
- global.Favourites = favourites.Where(x => x.IsGlobal).ToList();
|
|
|
- config.Save(global);
|
|
|
+ if (Security.IsAllowed<CanSetGlobalDashboardFavourites>())
|
|
|
+ {
|
|
|
+ var config = new GlobalConfiguration<GlobalUtilityDashboardSettings>();
|
|
|
+ var global = config.Load();
|
|
|
+ global.Favourites = favourites.Where(x => x.IsGlobal).ToList();
|
|
|
+ config.Save(global);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void FavouritesGrid_OnCustomiseEditor(IDynamicEditorForm sender, DashboardFavourite[]? items, DynamicGridColumn column, BaseEditor editor)
|
|
|
+ {
|
|
|
+ if(column.ColumnName == "IsGlobal")
|
|
|
+ {
|
|
|
+ editor.Editable = Security.IsAllowed<CanSetGlobalDashboardFavourites>() ? Editable.Enabled : Editable.Disabled;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void SaveAsFavourite_Click(string dashboardName)
|