mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
Fixed workflow when loading the WorkloadReports dialog (includes CA-339666).
- Fixed exception handling in RetrieveWlbConfiguration action (exceptions of type other than Failure were silenced). - CA-339666: Fixed control flickering when showing the WorkloadReports dialog. - Retrieve the WlbConfiguration before attempting populating the controls. - If the dialog was launched requesting a certian report to be run, the report was not selected on the list. - Some refactoring to simplify the code. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
393e041c4f
commit
2defc1dbff
@ -45,7 +45,7 @@ namespace XenAdmin.Controls.Wlb
|
||||
{
|
||||
#region Variables
|
||||
|
||||
public event CustomRefreshEventHandler OnChangeOK;
|
||||
public event EventHandler OnChangeOK;
|
||||
public event EventHandler Close;
|
||||
public event EventHandler PoolConnectionLost;
|
||||
|
||||
@ -76,7 +76,7 @@ namespace XenAdmin.Controls.Wlb
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void BuildPanel()
|
||||
private void BuildPanel()
|
||||
{
|
||||
// Subscription section
|
||||
if (_subscription != null)
|
||||
@ -158,11 +158,11 @@ namespace XenAdmin.Controls.Wlb
|
||||
return range;
|
||||
}
|
||||
|
||||
public void ResetSubscriptionView(WlbReportSubscription subscription)
|
||||
public void RefreshSubscriptionView(WlbReportSubscription subscription = null)
|
||||
{
|
||||
this.ReportSubscription = subscription;
|
||||
this.BuildPanel();
|
||||
this.Visible = true;
|
||||
if (subscription != null)
|
||||
ReportSubscription = subscription;
|
||||
BuildPanel();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -58,7 +58,7 @@ namespace XenAdmin.Controls.Wlb
|
||||
|
||||
#region Variables
|
||||
|
||||
public event CustomRefreshEventHandler OnChangeOK;
|
||||
public event EventHandler OnChangeOK;
|
||||
public event DrillthroughEventHandler ReportDrilledThrough;
|
||||
public event EventHandler Close;
|
||||
public event EventHandler PoolConnectionLost;
|
||||
@ -497,7 +497,7 @@ namespace XenAdmin.Controls.Wlb
|
||||
/// Reset reportViewer after reportInfo is changed
|
||||
/// </summary>
|
||||
/// <param name="reportInfo">ReportInfo instance</param>
|
||||
public void SynchReportViewer(WlbReportInfo reportInfo)
|
||||
public void RefreshReportViewer(WlbReportInfo reportInfo)
|
||||
{
|
||||
if(reportInfo.ReportFile.StartsWith("pool_audit_history"))
|
||||
{
|
||||
@ -620,9 +620,6 @@ namespace XenAdmin.Controls.Wlb
|
||||
// Objects dropdown does not need to be displayed
|
||||
this.panelObjects.Visible = false;
|
||||
}
|
||||
|
||||
|
||||
this.Visible = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -1200,10 +1197,6 @@ namespace XenAdmin.Controls.Wlb
|
||||
/// <param name="e"></param>
|
||||
private void ReportView_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.btnRunReport.Enabled = false;
|
||||
this.btnLaterReport.Enabled = false;
|
||||
this.btnSubscribe.Enabled = false;
|
||||
|
||||
this.hostComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
|
||||
// Hide the toolbar until a report is executed
|
||||
|
7
XenAdmin/Dialogs/Wlb/WorkloadReports.Designer.cs
generated
7
XenAdmin/Dialogs/Wlb/WorkloadReports.Designer.cs
generated
@ -113,7 +113,6 @@
|
||||
//
|
||||
resources.ApplyResources(this.wlbReportView1, "wlbReportView1");
|
||||
this.wlbReportView1.Hosts = null;
|
||||
this.wlbReportView1.MinimumSize = new System.Drawing.Size(350, 350);
|
||||
this.wlbReportView1.IsCreedenceOrLater = false;
|
||||
this.wlbReportView1.Name = "wlbReportView1";
|
||||
this.wlbReportView1.Pool = null;
|
||||
@ -128,7 +127,6 @@
|
||||
//
|
||||
resources.ApplyResources(this.subscriptionView1, "subscriptionView1");
|
||||
this.subscriptionView1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.subscriptionView1.MinimumSize = new System.Drawing.Size(671, 278);
|
||||
this.subscriptionView1.Name = "subscriptionView1";
|
||||
this.subscriptionView1.Pool = null;
|
||||
this.subscriptionView1.Close += new System.EventHandler(this.wlbReportView1_Close);
|
||||
@ -152,10 +150,9 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
|
||||
this.HelpButton = true;
|
||||
this.Name = "WorkloadReports";
|
||||
this.Load += new System.EventHandler(this.ReportForm_Load);
|
||||
this.Shown += new System.EventHandler(this.WlbReportWindow_Shown);
|
||||
this.Load += new System.EventHandler(this.WorkloadReports_Load);
|
||||
this.Shown += new System.EventHandler(this.WorkloadReports_Shown);
|
||||
this.splitContainerLeftPane.Panel1.ResumeLayout(false);
|
||||
this.splitContainerLeftPane.Panel1.PerformLayout();
|
||||
this.splitContainerLeftPane.Panel2.ResumeLayout(false);
|
||||
|
@ -47,20 +47,17 @@ using Microsoft.Reporting.WinForms;
|
||||
|
||||
namespace XenAdmin.Dialogs.Wlb
|
||||
{
|
||||
public delegate void CustomRefreshEventHandler(object sender, System.EventArgs e);
|
||||
|
||||
public partial class WorkloadReports : XenDialogBase
|
||||
{
|
||||
#region Private Variables
|
||||
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IEnumerable<Host> _hosts;
|
||||
private Pool _pool;
|
||||
private WlbReportSubscriptionCollection _subscriptionCollection;
|
||||
private string _reportFile;
|
||||
private readonly string _reportFile = string.Empty;
|
||||
private bool _runReport;
|
||||
private bool _isCreedenceOrLater;
|
||||
private XmlNodeList _currentNodes;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -91,75 +88,72 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public WorkloadReports() : this(string.Empty, false) {}
|
||||
public WorkloadReports()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
splitContainerLeftPane.Panel2Collapsed = true;
|
||||
lblSubscriptions.Visible = false;
|
||||
treeViewSubscriptionList.Visible = false;
|
||||
wlbReportView1.ButtonSubscribeVisible = false;
|
||||
wlbReportView1.ButtonLaterReportVisible = false;
|
||||
wlbReportView1.Visible = false;
|
||||
subscriptionView1.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded constructor provides access to a specific report upon load
|
||||
/// </summary>
|
||||
public WorkloadReports(string reportFile, bool run)
|
||||
: this()
|
||||
{
|
||||
InitializeComponent();
|
||||
_reportFile = reportFile;
|
||||
_runReport = run;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal override string HelpName
|
||||
{
|
||||
get { return "WLBReports"; }
|
||||
}
|
||||
internal override string HelpName => "WLBReports";
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Populates the treeview with ReportInfo and SubscriptionInfo nodes
|
||||
/// </summary>
|
||||
private void SetTreeViewReportList()
|
||||
private void PopulateTreeViewReportList()
|
||||
{
|
||||
bool errorLoading = false;
|
||||
|
||||
// Prep treeview for population
|
||||
treeViewReportList.BeginUpdate();
|
||||
treeViewReportList.Nodes.Clear();
|
||||
|
||||
// Set up the image list for the tree
|
||||
this.treeViewReportList.ImageList = CreateReportImageList();
|
||||
|
||||
//_subscriptionCollection = null;
|
||||
|
||||
try
|
||||
{
|
||||
// retrieve subscription
|
||||
SetSubscriptionCollection();
|
||||
treeViewReportList.Nodes.Clear();
|
||||
treeViewReportList.ImageList = CreateReportImageList();
|
||||
|
||||
wlbReportView1.ButtonSubscribeVisible = false;
|
||||
wlbReportView1.ButtonLaterReportVisible = false;
|
||||
wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
|
||||
PopulateTreeView();
|
||||
}
|
||||
catch (XenAdmin.CancelledException xc)
|
||||
{
|
||||
// User cancelled entering credentials when prompted by action
|
||||
log.Debug(xc);
|
||||
errorLoading = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Debug(ex, ex);
|
||||
using (var dlg = new ErrorDialog(Messages.WLBREPORT_REPORT_CONFIG_ERROR))
|
||||
dlg.ShowDialog(this);
|
||||
errorLoading = true;
|
||||
if (_currentNodes == null || _currentNodes.Count == 0)
|
||||
return;
|
||||
|
||||
TreeNode nodeToSelect = null;
|
||||
|
||||
for (int i = 0; i < _currentNodes.Count; i++)
|
||||
{
|
||||
TreeNode currentReportTreeNode = GetReportTreeNode(_currentNodes[i]);
|
||||
treeViewReportList.Nodes.Add(currentReportTreeNode);
|
||||
|
||||
if (nodeToSelect != null)
|
||||
continue;
|
||||
|
||||
string currentReportFile = ((WlbReportInfo)currentReportTreeNode.Tag).ReportFile.Split('.')[0];
|
||||
|
||||
if (string.Compare(currentReportFile, _reportFile, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
|
||||
nodeToSelect = currentReportTreeNode;
|
||||
}
|
||||
|
||||
treeViewReportList.Sort();
|
||||
treeViewReportList.SelectedNode = nodeToSelect ?? treeViewReportList.Nodes[0];
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ((treeViewReportList != null) && (!errorLoading))
|
||||
treeViewReportList.EndUpdate();
|
||||
else
|
||||
this.Close();
|
||||
treeViewReportList.EndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,29 +161,33 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// <summary>
|
||||
/// Populates the subscription list with items of type WlbReportSubscription
|
||||
/// </summary>
|
||||
private void SetTreeViewSubscriptionList()
|
||||
private void PopulateTreeViewSubscriptionList()
|
||||
{
|
||||
// Prep treeview for population
|
||||
treeViewSubscriptionList.BeginUpdate();
|
||||
treeViewSubscriptionList.Nodes.Clear();
|
||||
|
||||
treeViewSubscriptionList.ImageList = CreateReportImageList();
|
||||
|
||||
if (_subscriptionCollection != null)
|
||||
try
|
||||
{
|
||||
this.lblSubscriptions.Visible = true;
|
||||
this.treeViewSubscriptionList.Visible = true;
|
||||
foreach (string key in _subscriptionCollection.Keys)
|
||||
treeViewSubscriptionList.Nodes.Clear();
|
||||
treeViewSubscriptionList.ImageList = CreateReportImageList();
|
||||
|
||||
if (_subscriptionCollection != null)
|
||||
{
|
||||
treeViewSubscriptionList.Nodes.Add(GetReportSubscriptionTreeNode(_subscriptionCollection[key]));
|
||||
lblSubscriptions.Visible = true;
|
||||
treeViewSubscriptionList.Visible = true;
|
||||
|
||||
foreach (string key in _subscriptionCollection.Keys)
|
||||
treeViewSubscriptionList.Nodes.Add(GetReportSubscriptionTreeNode(_subscriptionCollection[key]));
|
||||
}
|
||||
else
|
||||
{
|
||||
lblSubscriptions.Visible = false;
|
||||
treeViewSubscriptionList.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
this.lblSubscriptions.Visible = false;
|
||||
this.treeViewSubscriptionList.Visible = false;
|
||||
treeViewSubscriptionList.EndUpdate();
|
||||
}
|
||||
treeViewSubscriptionList.EndUpdate();
|
||||
}
|
||||
|
||||
|
||||
@ -374,110 +372,38 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// <summary>
|
||||
/// Retrieve subscriptions and set _subscriptionCollection
|
||||
/// </summary>
|
||||
private void SetSubscriptionCollection()
|
||||
private void RetrieveSubscriptionCollection()
|
||||
{
|
||||
_subscriptionCollection = null;
|
||||
|
||||
WlbPoolConfiguration poolConfiguration;
|
||||
RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
|
||||
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
|
||||
{
|
||||
dialog.ShowCancel = true;
|
||||
dialog.ShowDialog(this);
|
||||
}
|
||||
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks) {ShowCancel = true})
|
||||
dialog.ShowDialog(this);
|
||||
|
||||
if (action.Succeeded)
|
||||
{
|
||||
poolConfiguration = new WlbPoolConfiguration(action.WlbConfiguration);
|
||||
|
||||
var poolConfiguration = new WlbPoolConfiguration(action.WlbConfiguration);
|
||||
_isCreedenceOrLater = poolConfiguration.IsCreedenceOrLater;
|
||||
|
||||
this.splitContainerLeftPane.Panel2Collapsed = true;
|
||||
this.wlbReportView1.ButtonSubscribeVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw (action.Exception);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Populate report treeView on initial load report window
|
||||
/// </summary>
|
||||
private void PopulateTreeView()
|
||||
{
|
||||
|
||||
XmlNodeList currentNodes;
|
||||
XmlDocument xmlReportDoc = new XmlDocument();
|
||||
|
||||
// Attempt to get the latest set of reports from the WLB server. WLB version 2.0
|
||||
// and beyond will respond to this.
|
||||
xmlReportDoc = GetServerReportsConfig();
|
||||
|
||||
// No report definitons on WLB server, obtain them locally (the old way)
|
||||
if ((!xmlReportDoc.HasChildNodes) || (!xmlReportDoc.DocumentElement.HasChildNodes))
|
||||
xmlReportDoc = GetLocalReportsConfig();
|
||||
|
||||
// Get each of the reports from the config and load them into combo box
|
||||
currentNodes = xmlReportDoc.SelectNodes(@"Reports/Report");
|
||||
|
||||
// pupulate treeNode
|
||||
for (int i = 0; i < currentNodes.Count; i++)
|
||||
{
|
||||
// Adds the report node
|
||||
TreeNode currentReportTreeNode = GetReportTreeNode(currentNodes[i]);
|
||||
treeViewReportList.Nodes.Add(currentReportTreeNode);
|
||||
|
||||
// Force to highlight the proper report treeNode if WLBReportWindow is called from WLB tab
|
||||
if (!String.IsNullOrEmpty(_reportFile))
|
||||
{
|
||||
string currentReportFile = ((WlbReportInfo)currentReportTreeNode.Tag).ReportFile.Split('.')[0];
|
||||
if (String.Compare(currentReportFile, _reportFile, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
|
||||
{
|
||||
treeViewReportList.SelectedNode = currentReportTreeNode;
|
||||
_reportFile = String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
treeViewReportList.Sort();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Obtains report configuration from local report.xml definition
|
||||
/// This method is only utilized when WLB server is version 1.0 and 1.1.
|
||||
/// Subsequent versions utilize GetReportConfig(XmlDocument)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private XmlDocument GetLocalReportsConfig()
|
||||
{
|
||||
XmlDocument xmlReportsDoc = new XmlDocument();
|
||||
|
||||
// Load up report info from XML file
|
||||
xmlReportsDoc.Load(String.Format(@"{0}\{1}", Application.StartupPath.ToString(), "reports.xml"));
|
||||
|
||||
return xmlReportsDoc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invokes and executes a call to the Kirkwood database via Xapi
|
||||
/// Attempts to get the latest set of reports from the WLB server version 2.0
|
||||
/// and beyond (it invokes and executes a call to the Kirkwood database via Xapi
|
||||
/// to obtain report configuration data including the actual
|
||||
/// rdlc report definitions
|
||||
/// rdlc report definitions).
|
||||
/// If there are no report definitions on WLB server, it obtains them
|
||||
/// from local XML file (the old way).
|
||||
/// </summary>
|
||||
/// <returns>Report definition list XML document</returns>
|
||||
private XmlDocument GetServerReportsConfig()
|
||||
private XmlNodeList GetReportsConfig()
|
||||
{
|
||||
|
||||
string returnValue;
|
||||
XmlDocument xmlReportsDoc = new XmlDocument();
|
||||
string reportName = "get_report_definitions";
|
||||
|
||||
// Parameters
|
||||
Dictionary<string, string> parms = new Dictionary<string, string>();
|
||||
parms.Add("LocaleCode", Program.CurrentLanguage);
|
||||
if (_isCreedenceOrLater)
|
||||
@ -496,30 +422,35 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
|
||||
dlg.ShowDialog();
|
||||
|
||||
returnValue = action.Result;
|
||||
string returnValue = action.Result;
|
||||
XmlDocument xmlReportsDoc = new XmlDocument();
|
||||
|
||||
if ((action.Succeeded) && (!String.IsNullOrEmpty(returnValue)))
|
||||
if (action.Succeeded && !string.IsNullOrEmpty(returnValue))
|
||||
{
|
||||
try
|
||||
{
|
||||
xmlReportsDoc.LoadXml(returnValue);
|
||||
|
||||
string rdlcText;
|
||||
|
||||
foreach (XmlNode currentRdlc in xmlReportsDoc.SelectNodes(@"Reports/Report/Rdlc"))
|
||||
{
|
||||
rdlcText = currentRdlc.InnerText;
|
||||
currentRdlc.InnerText = String.Empty;
|
||||
currentRdlc.InnerText = rdlcText;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch
|
||||
{
|
||||
xmlReportsDoc = null;
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
return xmlReportsDoc;
|
||||
if (!xmlReportsDoc.HasChildNodes || xmlReportsDoc.DocumentElement == null ||
|
||||
!xmlReportsDoc.DocumentElement.HasChildNodes)
|
||||
{
|
||||
try
|
||||
{
|
||||
xmlReportsDoc.Load($@"{Application.StartupPath}\{"reports.xml"}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
return xmlReportsDoc.SelectNodes(@"Reports/Report");
|
||||
}
|
||||
|
||||
// To enhance pool audit trail report, WLB server updates RDLC and would send user and object lists.
|
||||
@ -609,113 +540,62 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// <returns></returns>
|
||||
private TreeNode GetReportTreeNode(XmlNode currentNode)
|
||||
{
|
||||
string nodeFileName;
|
||||
string nodeNameLabel;
|
||||
string nodeReportDefinition;
|
||||
bool nodeDisplayHosts;
|
||||
bool nodeDisplayFilter;
|
||||
bool nodeDisplayUsers;
|
||||
bool nodeDisplayAuditObjects;
|
||||
OrderedDictionary nodeParamDict;
|
||||
WlbReportInfo reportInfo;
|
||||
TreeNode reportTreeNode;
|
||||
|
||||
nodeFileName = currentNode.Attributes["File"].Value;
|
||||
|
||||
XmlElement queryParametersXmlElement = GetCustomXmlElement(currentNode, "Creedence", "QueryParameters");
|
||||
|
||||
// If the report definition node doesn't exist (old WLB version), load the definition from the
|
||||
// local file system. Otherwise, the definition is present in the config from the WLB server
|
||||
if (currentNode.SelectSingleNode(@"Rdlc") == null)
|
||||
// local file system. Otherwise, the definition is present in the config from the WLB server
|
||||
|
||||
string nodeReportDefinition;
|
||||
var rdlc = currentNode.SelectSingleNode(@"Rdlc");
|
||||
var nodeFileName = currentNode.Attributes?["File"].Value;
|
||||
|
||||
if (rdlc == null)
|
||||
{
|
||||
XmlDocument xmlReportDefinition = new XmlDocument();
|
||||
xmlReportDefinition.Load(String.Format(@"{0}\{1}", Application.StartupPath.ToString(), nodeFileName));
|
||||
nodeReportDefinition = xmlReportDefinition.OuterXml.ToString();
|
||||
xmlReportDefinition.Load($@"{Application.StartupPath}\{nodeFileName}");
|
||||
nodeReportDefinition = xmlReportDefinition.OuterXml;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeReportDefinition = currentNode.SelectSingleNode(@"Rdlc").InnerText;
|
||||
nodeReportDefinition = rdlc.InnerText;
|
||||
}
|
||||
|
||||
string nodeNameLabel = string.Empty;
|
||||
|
||||
// If the report definition was obtained from the WLB server, use the localized name provided.
|
||||
// Otherwise, get the label locally. If all else fails, just use NameLabel attribute from
|
||||
// xml config
|
||||
if (currentNode.Attributes["Name"] != null)
|
||||
{
|
||||
if (currentNode.Attributes?["Name"] != null)
|
||||
nodeNameLabel = currentNode.Attributes["Name"].Value;
|
||||
}
|
||||
else if (Messages.ResourceManager.GetObject(currentNode.Attributes["NameLabel"].Value) != null)
|
||||
else if (currentNode.Attributes?["NameLabel"].Value != null)
|
||||
{
|
||||
nodeNameLabel = Messages.ResourceManager.GetObject(currentNode.Attributes["NameLabel"].Value).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeNameLabel = currentNode.Attributes["NameLabel"].Value;
|
||||
var obj = Messages.ResourceManager.GetObject(currentNode.Attributes?["NameLabel"].Value);
|
||||
if (obj != null)
|
||||
nodeNameLabel = obj.ToString();
|
||||
}
|
||||
|
||||
var nodeDisplayFilter = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='Filter']") != null;
|
||||
|
||||
// Boolean variuable to determine the display the Filter drop down menu?
|
||||
if (currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='Filter']") == null)
|
||||
var nodeDisplayHosts = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='HostID']") != null;
|
||||
|
||||
var nodeDisplayUsers = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditUser']") != null;
|
||||
|
||||
var nodeDisplayAuditObjects = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditObject']") != null;
|
||||
|
||||
XmlElement queryParametersXmlElement = GetCustomXmlElement(currentNode, "Creedence", "QueryParameters");
|
||||
var nodeParamDict = GetSQLQueryParamNames(currentNode, queryParametersXmlElement);
|
||||
|
||||
var reportInfo = new WlbReportInfo(nodeNameLabel,
|
||||
nodeFileName,
|
||||
nodeReportDefinition,
|
||||
nodeDisplayHosts,
|
||||
nodeDisplayFilter,
|
||||
nodeDisplayUsers,
|
||||
nodeDisplayAuditObjects,
|
||||
nodeParamDict);
|
||||
|
||||
return new TreeNode
|
||||
{
|
||||
nodeDisplayFilter = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeDisplayFilter = true;
|
||||
}
|
||||
|
||||
|
||||
// Boolean variuable to determine the display the Host drop down menu?
|
||||
if (currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='HostID']") == null)
|
||||
{
|
||||
nodeDisplayHosts = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeDisplayHosts = true;
|
||||
}
|
||||
|
||||
// Boolean variable to determine the display of the User drop down menu
|
||||
if (currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditUser']") == null)
|
||||
{
|
||||
nodeDisplayUsers = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeDisplayUsers = true;
|
||||
}
|
||||
|
||||
// Boolean variable to determine the display of the Object drop down menu
|
||||
if (currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditObject']") == null)
|
||||
{
|
||||
nodeDisplayAuditObjects = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeDisplayAuditObjects = true;
|
||||
}
|
||||
|
||||
// Get a list of query params
|
||||
nodeParamDict = GetSQLQueryParamNames(currentNode, queryParametersXmlElement);
|
||||
|
||||
// Create a report node and add it to the treeview for the current report
|
||||
reportInfo = new WlbReportInfo(nodeNameLabel,
|
||||
nodeFileName,
|
||||
nodeReportDefinition,
|
||||
nodeDisplayHosts,
|
||||
nodeDisplayFilter,
|
||||
nodeDisplayUsers,
|
||||
nodeDisplayAuditObjects,
|
||||
nodeParamDict);
|
||||
|
||||
reportTreeNode = new TreeNode();
|
||||
reportTreeNode.Tag = reportInfo;
|
||||
reportTreeNode.Text = nodeNameLabel;
|
||||
reportTreeNode.ImageIndex = 0;
|
||||
reportTreeNode.SelectedImageIndex = 0;
|
||||
|
||||
return reportTreeNode;
|
||||
Tag = reportInfo,
|
||||
Text = nodeNameLabel,
|
||||
ImageIndex = 0,
|
||||
SelectedImageIndex = 0
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -821,11 +701,13 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ReportForm_Load(object sender, EventArgs e)
|
||||
private void WorkloadReports_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Add event handlers for creating/editing/deleting subscription
|
||||
this.subscriptionView1.OnChangeOK += new CustomRefreshEventHandler(OnChangeOK_Refresh);
|
||||
this.wlbReportView1.OnChangeOK += new CustomRefreshEventHandler(OnChangeOK_Refresh);
|
||||
subscriptionView1.OnChangeOK += OnChangeOK_Refresh;
|
||||
wlbReportView1.OnChangeOK += OnChangeOK_Refresh;
|
||||
|
||||
RetrieveSubscriptionCollection();
|
||||
_currentNodes = GetReportsConfig();
|
||||
}
|
||||
|
||||
|
||||
@ -835,17 +717,18 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void WlbReportWindow_Shown(object sender, EventArgs e)
|
||||
private void WorkloadReports_Shown(object sender, EventArgs e)
|
||||
{
|
||||
wlbReportView1.Pool = _pool;
|
||||
subscriptionView1.Pool = _pool;
|
||||
wlbReportView1.Pool = _pool;
|
||||
wlbReportView1.Hosts = _hosts;
|
||||
wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
|
||||
|
||||
// Populate report treeview with report and subscription on the top of left panel
|
||||
SetTreeViewReportList();
|
||||
PopulateTreeViewReportList();
|
||||
|
||||
// Populate subscription treeview with subscription on the bottom of the left panel
|
||||
SetTreeViewSubscriptionList();
|
||||
PopulateTreeViewSubscriptionList();
|
||||
}
|
||||
|
||||
|
||||
@ -856,99 +739,56 @@ namespace XenAdmin.Dialogs.Wlb
|
||||
/// <param name="e"></param>
|
||||
private void OnChangeOK_Refresh(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
RetrieveSubscriptionCollection();
|
||||
|
||||
if (_subscriptionCollection != null)
|
||||
{
|
||||
// set _subscriptionCollection
|
||||
SetSubscriptionCollection();
|
||||
// Update subscription treeView must be before updating report treeView
|
||||
UpdateSubscriptionTreeView();
|
||||
UpdateReportTreeView();
|
||||
|
||||
// Start update treeViews
|
||||
if (_subscriptionCollection != null)
|
||||
{
|
||||
// Update subscription treeView must be before updating report treeView
|
||||
this.UpdateSubscriptionTreeView();
|
||||
|
||||
// Update report treeView
|
||||
this.UpdateReportTreeView();
|
||||
|
||||
// Rebuild panel if ReportSubscriptionView is visible
|
||||
if (sender is WlbReportSubscriptionView)
|
||||
{
|
||||
this.subscriptionView1.BuildPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Debug(ex, ex);
|
||||
using (var dlg = new ErrorDialog(Messages.WLBREPORT_REPORT_CONFIG_ERROR))
|
||||
dlg.ShowDialog(this);
|
||||
this.Close();
|
||||
if (sender is WlbReportSubscriptionView)
|
||||
subscriptionView1.RefreshSubscriptionView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Event handler addresses various UI nuances depending on the type the node selected in the tree:
|
||||
/// - Hides/displays the ReportView control
|
||||
/// - Hides/displays host dropdown menu in ReportView control (and it's label)
|
||||
/// - Disables/enables Run Report button in ReportView control
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void treeViewReportList_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (this.treeViewReportList.SelectedNode.Tag != null)
|
||||
if (treeViewReportList.SelectedNode.Tag is WlbReportInfo report)
|
||||
{
|
||||
// Display report view if a report node gets selected
|
||||
if (this.treeViewReportList.SelectedNode.Tag.GetType() == typeof(WlbReportInfo))
|
||||
subscriptionView1.Visible = false;
|
||||
wlbReportView1.RefreshReportViewer(report);
|
||||
wlbReportView1.Visible = true;
|
||||
|
||||
if (_runReport)
|
||||
{
|
||||
// Reset reportView and disable subscriptionView
|
||||
this.subscriptionView1.Visible = false;
|
||||
this.wlbReportView1.SynchReportViewer((WlbReportInfo)treeViewReportList.SelectedNode.Tag);
|
||||
|
||||
// Run report if necessary
|
||||
if (_runReport)
|
||||
{
|
||||
this.wlbReportView1.ExecuteReport();
|
||||
|
||||
// Reset _runReport flag back to false
|
||||
_runReport = false;
|
||||
}
|
||||
wlbReportView1.ExecuteReport();
|
||||
_runReport = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display the subscription view if it's that type of node
|
||||
if (this.treeViewReportList.SelectedNode.Tag.GetType() == typeof(WlbReportSubscription))
|
||||
{
|
||||
// Reset subscriptionView and disable reportView
|
||||
this.wlbReportView1.Visible = false;
|
||||
this.subscriptionView1.ResetSubscriptionView((WlbReportSubscription)treeViewReportList.SelectedNode.Tag);
|
||||
}
|
||||
}
|
||||
|
||||
// Deselect treeViewsubscriptionList
|
||||
this.treeViewSubscriptionList.SelectedNode = null;
|
||||
}
|
||||
else if (treeViewReportList.SelectedNode.Tag is WlbReportSubscription subscription)
|
||||
{
|
||||
wlbReportView1.Visible = false;
|
||||
subscriptionView1.RefreshSubscriptionView(subscription);
|
||||
subscriptionView1.Visible = true;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
treeViewSubscriptionList.SelectedNode = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the the Subscriptions list box. Displays/Hides the Report View control
|
||||
/// and the Subscription View control
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void treeViewSubscriptionList_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
// Display the subscription view if it's that type of node
|
||||
if (treeViewSubscriptionList.SelectedNode.Tag != null)
|
||||
if (treeViewSubscriptionList.SelectedNode.Tag is WlbReportSubscription subscription)
|
||||
{
|
||||
// Reset the reportview control and hide it (if it isn't already)
|
||||
this.wlbReportView1.Visible = false;
|
||||
this.subscriptionView1.ResetSubscriptionView((WlbReportSubscription)treeViewSubscriptionList.SelectedNode.Tag);
|
||||
wlbReportView1.Visible = false;
|
||||
subscriptionView1.RefreshSubscriptionView(subscription);
|
||||
subscriptionView1.Visible = true;
|
||||
|
||||
// Deselect treeViewReportList
|
||||
this.treeViewReportList.SelectedNode = null;
|
||||
treeViewReportList.SelectedNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,16 +112,16 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="splitContainerLeftPane.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="splitContainerLeftPane.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 9pt</value>
|
||||
</data>
|
||||
@ -137,18 +137,18 @@
|
||||
<data name="treeViewReportList.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 9pt</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="treeViewReportList.Indent" type="System.Int32, mscorlib">
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="treeViewReportList.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>5, 55</value>
|
||||
<value>5, 53</value>
|
||||
</data>
|
||||
<data name="treeViewReportList.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="treeViewReportList.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 114</value>
|
||||
<value>171, 140</value>
|
||||
</data>
|
||||
<data name="treeViewReportList.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>20</value>
|
||||
@ -157,7 +157,7 @@
|
||||
<value>treeViewReportList</value>
|
||||
</data>
|
||||
<data name=">>treeViewReportList.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TreeView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>treeViewReportList.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane.Panel1</value>
|
||||
@ -184,10 +184,10 @@
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="lblReports.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 37, 0, 3</value>
|
||||
<value>0, 35, 0, 3</value>
|
||||
</data>
|
||||
<data name="lblReports.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>55, 55</value>
|
||||
<value>51, 53</value>
|
||||
</data>
|
||||
<data name="lblReports.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>21</value>
|
||||
@ -199,7 +199,7 @@
|
||||
<value>lblReports</value>
|
||||
</data>
|
||||
<data name=">>lblReports.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>lblReports.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane.Panel1</value>
|
||||
@ -217,7 +217,7 @@
|
||||
<value>splitContainerLeftPane.Panel1</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Panel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Panel1.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane</value>
|
||||
@ -238,7 +238,7 @@
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="treeViewSubscriptionList.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>171, 198</value>
|
||||
<value>171, 231</value>
|
||||
</data>
|
||||
<data name="treeViewSubscriptionList.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>21</value>
|
||||
@ -247,7 +247,7 @@
|
||||
<value>treeViewSubscriptionList</value>
|
||||
</data>
|
||||
<data name=">>treeViewSubscriptionList.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TreeView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>treeViewSubscriptionList.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane.Panel2</value>
|
||||
@ -289,7 +289,7 @@
|
||||
<value>lblSubscriptions</value>
|
||||
</data>
|
||||
<data name=">>lblSubscriptions.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>lblSubscriptions.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane.Panel2</value>
|
||||
@ -307,7 +307,7 @@
|
||||
<value>splitContainerLeftPane.Panel2</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Panel2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Panel2.Parent" xml:space="preserve">
|
||||
<value>splitContainerLeftPane</value>
|
||||
@ -316,10 +316,10 @@
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="splitContainerLeftPane.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>176, 401</value>
|
||||
<value>176, 458</value>
|
||||
</data>
|
||||
<data name="splitContainerLeftPane.SplitterDistance" type="System.Int32, mscorlib">
|
||||
<value>169</value>
|
||||
<value>193</value>
|
||||
</data>
|
||||
<data name="splitContainerLeftPane.SplitterWidth" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
@ -331,7 +331,7 @@
|
||||
<value>splitContainerLeftPane</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainerLeftPane.Parent" xml:space="preserve">
|
||||
<value>splitContainer1.Panel1</value>
|
||||
@ -346,7 +346,7 @@
|
||||
<value>Segoe UI, 9pt</value>
|
||||
</data>
|
||||
<data name="splitContainer1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 66</value>
|
||||
<value>9, 9</value>
|
||||
</data>
|
||||
<data name="splitContainer1.Panel1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 9pt</value>
|
||||
@ -358,7 +358,7 @@
|
||||
<value>splitContainer1.Panel1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel1.Parent" xml:space="preserve">
|
||||
<value>splitContainer1</value>
|
||||
@ -378,8 +378,11 @@
|
||||
<data name="wlbReportView1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="wlbReportView1.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>350, 350</value>
|
||||
</data>
|
||||
<data name="wlbReportView1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>721, 449</value>
|
||||
<value>721, 506</value>
|
||||
</data>
|
||||
<data name="wlbReportView1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
@ -414,8 +417,11 @@
|
||||
<data name="subscriptionView1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="subscriptionView1.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>671, 278</value>
|
||||
</data>
|
||||
<data name="subscriptionView1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>721, 449</value>
|
||||
<value>721, 506</value>
|
||||
</data>
|
||||
<data name="subscriptionView1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@ -439,7 +445,7 @@
|
||||
<value>splitContainer1.Panel2</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Panel2.Parent" xml:space="preserve">
|
||||
<value>splitContainer1</value>
|
||||
@ -448,7 +454,7 @@
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="splitContainer1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>902, 449</value>
|
||||
<value>902, 506</value>
|
||||
</data>
|
||||
<data name="splitContainer1.SplitterDistance" type="System.Int32, mscorlib">
|
||||
<value>176</value>
|
||||
@ -463,7 +469,7 @@
|
||||
<value>splitContainer1</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>splitContainer1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
@ -471,15 +477,9 @@
|
||||
<data name=">>splitContainer1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="contextMenuReports.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="contextMenuReports.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="runReportToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>133, 22</value>
|
||||
</data>
|
||||
<data name="runReportToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Run Report</value>
|
||||
</data>
|
||||
<data name="contextMenuReports.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>134, 26</value>
|
||||
</data>
|
||||
@ -487,98 +487,20 @@
|
||||
<value>contextMenuReports</value>
|
||||
</data>
|
||||
<data name=">>contextMenuReports.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.AutoScroll" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 9pt</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>97, 10</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>5, 5, 5, 5</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>707, 37</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="deprecationBanner.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>deprecationBanner.Name" xml:space="preserve">
|
||||
<value>deprecationBanner</value>
|
||||
</data>
|
||||
<data name=">>deprecationBanner.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.DeprecationBanner, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>deprecationBanner.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>deprecationBanner.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Top</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 9pt</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 9</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>5, 7, 5, 7</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>902, 57</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Name" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="deprecationBanner" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,10,Percent,80,Percent,10" /><Rows Styles="Percent,100" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<data name="runReportToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>133, 22</value>
|
||||
</data>
|
||||
<data name="runReportToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Run Report</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>41</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
@ -604,7 +526,7 @@
|
||||
<value>runReportToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>runReportToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>WorkloadReports</value>
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -42184,15 +42184,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to An error occurred when attempting to open the Workload Balancing report window. Please check the report configuration file..
|
||||
/// </summary>
|
||||
public static string WLBREPORT_REPORT_CONFIG_ERROR {
|
||||
get {
|
||||
return ResourceManager.GetString("WLBREPORT_REPORT_CONFIG_ERROR", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Machine Motion History.
|
||||
/// </summary>
|
||||
|
@ -13904,9 +13904,6 @@ Schedule:
|
||||
<data name="WLBREPORT_POOL_HEALTH_HISTORY" xml:space="preserve">
|
||||
<value>Pool Health History</value>
|
||||
</data>
|
||||
<data name="WLBREPORT_REPORT_CONFIG_ERROR" xml:space="preserve">
|
||||
<value>An error occurred when attempting to open the Workload Balancing report window. Please check the report configuration file.</value>
|
||||
</data>
|
||||
<data name="WLBREPORT_VM_MOTION_HISTORY" xml:space="preserve">
|
||||
<value>Virtual Machine Motion History</value>
|
||||
</data>
|
||||
|
@ -29,7 +29,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Wlb;
|
||||
@ -55,57 +54,34 @@ namespace XenAdmin.Actions.Wlb
|
||||
try
|
||||
{
|
||||
log.Debug("Retrieving Workload Balancing configuration for pool " + Pool.Name());
|
||||
this.WlbConfiguration = XenAPI.Pool.retrieve_wlb_configuration(this.Session);
|
||||
WlbConfiguration = Pool.retrieve_wlb_configuration(this.Session);
|
||||
|
||||
if (this.WlbConfiguration.Count == 0)
|
||||
if (WlbConfiguration.Count == 0)
|
||||
{
|
||||
//We didn;t get a configuration, so there is somethign wrong
|
||||
log.Debug("Failure retrieving Workload Balancing configuration on pool " + Pool.Name());
|
||||
this.Description = Messages.FAILED;
|
||||
Failure f = new Failure(FriendlyErrorNames.WLB_NOT_INITIALIZED);
|
||||
throw f;
|
||||
|
||||
Description = Messages.FAILED;
|
||||
throw new Failure(FriendlyErrorNames.WLB_NOT_INITIALIZED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
log.Debug("Success retrieving Workload Balancing configuration on pool " + Pool.Name());
|
||||
Description = Messages.COMPLETED;
|
||||
|
||||
log.Debug("Success retrieving Workload Balancing configuration on pool " + Pool.Name());
|
||||
this.Description = Messages.COMPLETED;
|
||||
|
||||
//Retrieving the configuration was successful, so update the WlbServerState to report the current state
|
||||
// This is here in case there was a previous communication error which has been fixed.
|
||||
if (Helpers.WlbEnabled(Pool.Connection))
|
||||
{
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.Enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.Disabled);
|
||||
}
|
||||
}
|
||||
//Retrieving the configuration was successful, so update the WlbServerState to report the current state
|
||||
//This is here in case there was a previous communication error which has been fixed.
|
||||
var state = Helpers.WlbEnabled(Pool.Connection) ? WlbServerState.ServerState.Enabled : WlbServerState.ServerState.Disabled;
|
||||
WlbServerState.SetState(Pool, state);
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Failure ex)
|
||||
{
|
||||
if (ex is Failure)
|
||||
{
|
||||
// Retrieving the configuration error could also because WLB is not initialized
|
||||
if (((Failure)ex).Message == FriendlyErrorNames.WLB_NOT_INITIALIZED)
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.NotConfigured);
|
||||
if (ex.Message == FriendlyErrorNames.WLB_NOT_INITIALIZED)
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.NotConfigured);
|
||||
else
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.ConnectionError, ex);
|
||||
|
||||
else
|
||||
WlbServerState.SetState(Pool, WlbServerState.ServerState.ConnectionError, (Failure)ex);
|
||||
|
||||
if (((Failure)ex).Message == FriendlyErrorNames.WLB_INTERNAL_ERROR)
|
||||
{
|
||||
Failure f = new Failure(new string[] { Messages.ResourceManager.GetString("WLB_ERROR_" + ((Failure)ex).ErrorDescription[1]) });
|
||||
throw (f);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw (ex);
|
||||
}
|
||||
}
|
||||
if (ex.Message == FriendlyErrorNames.WLB_INTERNAL_ERROR)
|
||||
throw new Failure(Messages.ResourceManager.GetString("WLB_ERROR_" + ex.ErrorDescription[1]));
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
string reportName,
|
||||
bool hideException,
|
||||
Dictionary<string, string> parms)
|
||||
: base(connection, string.Format(Messages.ACTION_WLB_REPORT, report, host.Name(), Helpers.GetName(connection)),
|
||||
Messages.ACTION_EXPORT_DESCRIPTION_PREPARING, true)
|
||||
: base(connection, string.Format(Messages.ACTION_WLB_REPORT, report, host.Name(), Helpers.GetName(connection)), "", true)
|
||||
{
|
||||
this.report = report;
|
||||
this.reportName = reportName;
|
||||
|
Loading…
Reference in New Issue
Block a user