mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-21 07:49:32 +01:00
DataSet field Uuid is not really a uuid. Renamed to Id to avoid misunderstandings.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
5e7f18dcab
commit
c2ea499057
@ -68,7 +68,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
set.Points.Sort();
|
set.Points.Sort();
|
||||||
|
|
||||||
var other = Sets.FirstOrDefault(s => s.Uuid == set.Uuid);
|
var other = Sets.FirstOrDefault(s => s.Id == set.Id);
|
||||||
|
|
||||||
if (other == null)
|
if (other == null)
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
foreach (DataSet set in SetsAdded)
|
foreach (DataSet set in SetsAdded)
|
||||||
{
|
{
|
||||||
Palette.LoadSetColor(set);
|
Palette.LoadSetColor(set);
|
||||||
DataSet copy = DataSet.Create(set.Uuid, set.XenObject, set.Show, set.TypeString);
|
DataSet copy = DataSet.Create(set.Id, set.XenObject, set.Show, set.TypeString);
|
||||||
foreach (DataPoint p in set.Points)
|
foreach (DataPoint p in set.Points)
|
||||||
copy.AddPoint(new DataPoint(p.X,p.Y));
|
copy.AddPoint(new DataPoint(p.X,p.Y));
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
lock (Palette.PaletteLock)
|
lock (Palette.PaletteLock)
|
||||||
{
|
{
|
||||||
using (var thickPen = Palette.CreatePen(item.Sets[ArchiveInterval.FiveSecond].Uuid, Palette.PEN_THICKNESS_THICK))
|
using (var thickPen = Palette.CreatePen(item.Sets[ArchiveInterval.FiveSecond].Id, Palette.PEN_THICKNESS_THICK))
|
||||||
{
|
{
|
||||||
e.Graphics.DrawLine(thickPen,
|
e.Graphics.DrawLine(thickPen,
|
||||||
new Point(e.Bounds.Left + 2, e.Bounds.Top + e.Bounds.Height / 2),
|
new Point(e.Bounds.Left + 2, e.Bounds.Top + e.Bounds.Height / 2),
|
||||||
@ -116,7 +116,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
{
|
{
|
||||||
var wrapper = new DataSetCollectionWrapper();
|
var wrapper = new DataSetCollectionWrapper();
|
||||||
|
|
||||||
if (!DataSourceUUIDsToShow.Contains(fivesecond.Uuid))
|
if (!DataSourceUUIDsToShow.Contains(fivesecond.Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wrapper.Sets.Add(ArchiveInterval.FiveSecond, fivesecond);
|
wrapper.Sets.Add(ArchiveInterval.FiveSecond, fivesecond);
|
||||||
@ -124,7 +124,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
foreach (var interval in intervals)
|
foreach (var interval in intervals)
|
||||||
{
|
{
|
||||||
var found = archives[interval].Sets.FirstOrDefault(s => s.Uuid == fivesecond.Uuid);
|
var found = archives[interval].Sets.FirstOrDefault(s => s.Id == fivesecond.Id);
|
||||||
if (found != null)
|
if (found != null)
|
||||||
wrapper.Sets.Add(interval, found);
|
wrapper.Sets.Add(interval, found);
|
||||||
}
|
}
|
||||||
@ -263,15 +263,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
public void SelectDataSet(DataSet set)
|
public void SelectDataSet(DataSet set)
|
||||||
{
|
{
|
||||||
SelectedItem = SelectWrapperFromUuid(set.Uuid);
|
SelectedItem = CurrentKeys.Find(item => item.Id == set.Id);
|
||||||
}
|
|
||||||
|
|
||||||
public DataSetCollectionWrapper SelectWrapperFromUuid(string uuid)
|
|
||||||
{
|
|
||||||
return CurrentKeys.Find(new Predicate<DataSetCollectionWrapper>(delegate(DataSetCollectionWrapper item)
|
|
||||||
{
|
|
||||||
return item.Uuid == uuid;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
@ -346,14 +338,14 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Uuid
|
public string Id
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!Sets.ContainsKey(ArchiveInterval.FiveSecond))
|
if (!Sets.ContainsKey(ArchiveInterval.FiveSecond))
|
||||||
return base.ToString();
|
return base.ToString();
|
||||||
|
|
||||||
return Sets[ArchiveInterval.FiveSecond].Uuid;
|
return Sets[ArchiveInterval.FiveSecond].Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +359,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
public bool Equals(DataSetCollectionWrapper other)
|
public bool Equals(DataSetCollectionWrapper other)
|
||||||
{
|
{
|
||||||
return Uuid.Equals(other.Uuid);
|
return Id.Equals(other?.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(DataSetCollectionWrapper other)
|
public int CompareTo(DataSetCollectionWrapper other)
|
||||||
|
@ -280,7 +280,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
// Refresh all sets
|
// Refresh all sets
|
||||||
foreach (DataSet set in DataPlotNav.CurrentArchive.Sets.ToArray())
|
foreach (DataSet set in DataPlotNav.CurrentArchive.Sets.ToArray())
|
||||||
{
|
{
|
||||||
if (!set.Draw || !DataKey.DataSourceUUIDsToShow.Contains(set.Uuid))
|
if (!set.Draw || !DataKey.DataSourceUUIDsToShow.Contains(set.Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
List<DataPoint> todraw;
|
List<DataPoint> todraw;
|
||||||
@ -363,16 +363,16 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
Array.Reverse(sets_to_show);
|
Array.Reverse(sets_to_show);
|
||||||
foreach (DataSet set in sets_to_show)
|
foreach (DataSet set in sets_to_show)
|
||||||
{
|
{
|
||||||
if (!set.Draw || DataKey == null || !DataKey.DataSourceUUIDsToShow.Contains(set.Uuid))
|
if (!set.Draw || DataKey == null || !DataKey.DataSourceUUIDsToShow.Contains(set.Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lock (Palette.PaletteLock)
|
lock (Palette.PaletteLock)
|
||||||
{
|
{
|
||||||
using (var thickPen = Palette.CreatePen(set.Uuid, Palette.PEN_THICKNESS_THICK))
|
using (var thickPen = Palette.CreatePen(set.Id, Palette.PEN_THICKNESS_THICK))
|
||||||
{
|
{
|
||||||
using (var normalPen = Palette.CreatePen(set.Uuid, Palette.PEN_THICKNESS_NORMAL))
|
using (var normalPen = Palette.CreatePen(set.Id, Palette.PEN_THICKNESS_NORMAL))
|
||||||
{
|
{
|
||||||
using (var shadowBrush = Palette.CreateBrush(set.Uuid))
|
using (var shadowBrush = Palette.CreateBrush(set.Id))
|
||||||
{
|
{
|
||||||
LineRenderer.Render(paintEventArgs.Graphics, SlightlySmaller, DataPlotNav.XRange, set.CustomYRange ?? SelectedYRange, set.Selected ? thickPen : normalPen, shadowBrush, set.CurrentlyDisplayed, true);
|
LineRenderer.Render(paintEventArgs.Graphics, SlightlySmaller, DataPlotNav.XRange, set.CustomYRange ?? SelectedYRange, set.Selected ? thickPen : normalPen, shadowBrush, set.CurrentlyDisplayed, true);
|
||||||
}
|
}
|
||||||
@ -533,7 +533,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
{
|
{
|
||||||
foreach (DataSet set in DataPlotNav.CurrentArchive.Sets.ToArray())
|
foreach (DataSet set in DataPlotNav.CurrentArchive.Sets.ToArray())
|
||||||
{
|
{
|
||||||
if (!set.Draw || DataKey == null || !DataKey.DataSourceUUIDsToShow.Contains(set.Uuid))
|
if (!set.Draw || DataKey == null || !DataKey.DataSourceUUIDsToShow.Contains(set.Id))
|
||||||
continue;
|
continue;
|
||||||
if (set.OnMouseClick(new MouseActionArgs(e.Location, GraphRectangle(), DataPlotNav.XRange, SelectedYRange)))
|
if (set.OnMouseClick(new MouseActionArgs(e.Location, GraphRectangle(), DataPlotNav.XRange, SelectedYRange)))
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
foreach (DataSet set in ScrollWideArchive.Sets.ToArray())
|
foreach (DataSet set in ScrollWideArchive.Sets.ToArray())
|
||||||
{
|
{
|
||||||
if (!set.Draw || !DisplayedUuids.Contains(set.Uuid))
|
if (!set.Draw || !DisplayedUuids.Contains(set.Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
List<DataPoint> todraw;
|
List<DataPoint> todraw;
|
||||||
@ -520,12 +520,12 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
foreach (DataSet set in ScrollWideArchive.Sets.ToArray())
|
foreach (DataSet set in ScrollWideArchive.Sets.ToArray())
|
||||||
{
|
{
|
||||||
if (!set.Draw || !DisplayedUuids.Contains(set.Uuid))
|
if (!set.Draw || !DisplayedUuids.Contains(set.Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lock (Palette.PaletteLock)
|
lock (Palette.PaletteLock)
|
||||||
{
|
{
|
||||||
using (var normalPen = Palette.CreatePen(set.Uuid, Palette.PEN_THICKNESS_NORMAL))
|
using (var normalPen = Palette.CreatePen(set.Id, Palette.PEN_THICKNESS_NORMAL))
|
||||||
{
|
{
|
||||||
LineRenderer.Render(paintEventArgs.Graphics, ScrollViewRectangle, everything, set.CustomYRange, normalPen, null, set.CurrentlyDisplayed, false);
|
LineRenderer.Render(paintEventArgs.Graphics, ScrollViewRectangle, everything, set.CustomYRange, normalPen, null, set.CurrentlyDisplayed, false);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
public bool Selected;
|
public bool Selected;
|
||||||
public List<DataPoint> CurrentlyDisplayed = new List<DataPoint>();
|
public List<DataPoint> CurrentlyDisplayed = new List<DataPoint>();
|
||||||
public IXenObject XenObject;
|
public IXenObject XenObject;
|
||||||
public string Uuid;
|
public readonly string Id;
|
||||||
private bool _hide;
|
private bool _hide;
|
||||||
private bool _deselected;
|
private bool _deselected;
|
||||||
|
|
||||||
@ -110,20 +110,20 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
public DataRange CustomYRange;
|
public DataRange CustomYRange;
|
||||||
|
|
||||||
private DataSet(string uuid, IXenObject xo, bool show, string settype)
|
private DataSet(string id, IXenObject xo, bool show, string settype)
|
||||||
{
|
{
|
||||||
XenObject = xo;
|
XenObject = xo;
|
||||||
_hide = !show;
|
_hide = !show;
|
||||||
Uuid = uuid;
|
Id = id;
|
||||||
TypeString = settype;
|
TypeString = settype;
|
||||||
Name = Helpers.GetFriendlyDataSourceName(settype, XenObject);
|
Name = Helpers.GetFriendlyDataSourceName(settype, XenObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Static methods
|
#region Static methods
|
||||||
|
|
||||||
public static DataSet Create(string uuid, IXenObject xo, bool show, string settype)
|
public static DataSet Create(string id, IXenObject xo, bool show, string settype)
|
||||||
{
|
{
|
||||||
var dataSet = new DataSet(uuid, xo, show, settype);
|
var dataSet = new DataSet(id, xo, show, settype);
|
||||||
if(settype == "xapi_open_fds" || settype == "pool_task_count" || settype == "pool_session_count")
|
if(settype == "xapi_open_fds" || settype == "pool_task_count" || settype == "pool_session_count")
|
||||||
{
|
{
|
||||||
dataSet.NeverShow = true;
|
dataSet.NeverShow = true;
|
||||||
@ -684,14 +684,14 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
DataSet other = (DataSet)obj;
|
DataSet other = (DataSet)obj;
|
||||||
|
|
||||||
return Uuid == other.Uuid;
|
return Id == other.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Uuid))
|
if (string.IsNullOrEmpty(Id))
|
||||||
return base.GetHashCode();
|
return base.GetHashCode();
|
||||||
return Uuid.GetHashCode();
|
return Id.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InsertPointCollection(List<DataPoint> list)
|
internal void InsertPointCollection(List<DataPoint> list)
|
||||||
@ -791,7 +791,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
|
|
||||||
public int CompareTo(DataSet other)
|
public int CompareTo(DataSet other)
|
||||||
{
|
{
|
||||||
if (Uuid == other.Uuid)
|
if (Id == other.Id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int comp = DisplayArea.CompareTo(other.DisplayArea);
|
int comp = DisplayArea.CompareTo(other.DisplayArea);
|
||||||
|
@ -151,7 +151,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
|||||||
if (!int.TryParse(gui_config[key], out argb))
|
if (!int.TryParse(gui_config[key], out argb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetCustomColor(set.Uuid, Color.FromArgb(argb));
|
SetCustomColor(set.Id, Color.FromArgb(argb));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetColorKey(string ds_name, IXenObject xo)
|
public static string GetColorKey(string ds_name, IXenObject xo)
|
||||||
|
Loading…
Reference in New Issue
Block a user