2023-01-24 15:29:31 +01:00
|
|
|
|
/* Copyright (c) Cloud Software Group, Inc.
|
2013-06-24 13:41:48 +02:00
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms,
|
|
|
|
|
* with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer in the documentation and/or other
|
|
|
|
|
* materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-07-16 09:06:23 +02:00
|
|
|
|
using System.Collections.Specialized;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Xml;
|
2014-07-16 09:06:23 +02:00
|
|
|
|
using System.Web;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
using XenAPI;
|
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAdmin.Wlb;
|
|
|
|
|
using XenAdmin.Actions;
|
|
|
|
|
using XenAdmin.Actions.Wlb;
|
|
|
|
|
using XenAdmin.Controls.Wlb;
|
|
|
|
|
// Report viewer control dependencies
|
|
|
|
|
using Microsoft.Reporting.WinForms;
|
|
|
|
|
|
|
|
|
|
|
2021-05-26 18:54:53 +02:00
|
|
|
|
namespace XenAdmin.Dialogs.Wlb
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
public partial class WorkloadReports : XenDialogBase
|
|
|
|
|
{
|
|
|
|
|
#region Private Variables
|
|
|
|
|
|
|
|
|
|
private IEnumerable<Host> _hosts;
|
|
|
|
|
private Pool _pool;
|
|
|
|
|
private WlbReportSubscriptionCollection _subscriptionCollection;
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private readonly string _reportFile = string.Empty;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private bool _runReport;
|
2014-07-16 09:06:23 +02:00
|
|
|
|
private bool _isCreedenceOrLater;
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private XmlNodeList _currentNodes;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Object set to current pool
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Pool Pool
|
|
|
|
|
{
|
|
|
|
|
get { return _pool; }
|
|
|
|
|
set { _pool = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Collection of hosts for the current pool
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IEnumerable<Host> Hosts
|
|
|
|
|
{
|
|
|
|
|
get { return _hosts; }
|
|
|
|
|
set { _hosts = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
public WorkloadReports()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
splitContainerLeftPane.Panel2Collapsed = true;
|
|
|
|
|
lblSubscriptions.Visible = false;
|
|
|
|
|
treeViewSubscriptionList.Visible = false;
|
|
|
|
|
wlbReportView1.ButtonSubscribeVisible = false;
|
|
|
|
|
wlbReportView1.ButtonLaterReportVisible = false;
|
|
|
|
|
wlbReportView1.Visible = false;
|
|
|
|
|
subscriptionView1.Visible = false;
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Overloaded constructor provides access to a specific report upon load
|
|
|
|
|
/// </summary>
|
|
|
|
|
public WorkloadReports(string reportFile, bool run)
|
2021-05-27 00:07:56 +02:00
|
|
|
|
: this()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
_reportFile = reportFile;
|
|
|
|
|
_runReport = run;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
internal override string HelpName => "WLBReports";
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
#region Private Methods
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Populates the treeview with ReportInfo and SubscriptionInfo nodes
|
|
|
|
|
/// </summary>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private void PopulateTreeViewReportList()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
treeViewReportList.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
treeViewReportList.Nodes.Clear();
|
|
|
|
|
treeViewReportList.ImageList = CreateReportImageList();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
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];
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
treeViewReportList.EndUpdate();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Populates the subscription list with items of type WlbReportSubscription
|
|
|
|
|
/// </summary>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private void PopulateTreeViewSubscriptionList()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
treeViewSubscriptionList.BeginUpdate();
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
try
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
treeViewSubscriptionList.Nodes.Clear();
|
|
|
|
|
treeViewSubscriptionList.ImageList = CreateReportImageList();
|
|
|
|
|
|
|
|
|
|
if (_subscriptionCollection != null)
|
|
|
|
|
{
|
|
|
|
|
lblSubscriptions.Visible = true;
|
|
|
|
|
treeViewSubscriptionList.Visible = true;
|
|
|
|
|
|
|
|
|
|
foreach (string key in _subscriptionCollection.Keys)
|
|
|
|
|
treeViewSubscriptionList.Nodes.Add(GetReportSubscriptionTreeNode(_subscriptionCollection[key]));
|
|
|
|
|
}
|
|
|
|
|
else
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
lblSubscriptions.Visible = false;
|
|
|
|
|
treeViewSubscriptionList.Visible = false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-27 00:07:56 +02:00
|
|
|
|
finally
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
treeViewSubscriptionList.EndUpdate();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used by drilldown and back events from the reportviewer to maintain treeview state
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SynchTreeViewReportList(string reportName)
|
|
|
|
|
{
|
|
|
|
|
WlbReportInfo reportInfo;
|
|
|
|
|
wlbReportView1.ResetReportViewer = false;
|
|
|
|
|
|
|
|
|
|
string reportFile = String.Format("{0}.{1}", reportName, "rdlc");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < treeViewReportList.Nodes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((treeViewReportList.Nodes[i].Tag != null) &&
|
|
|
|
|
(treeViewReportList.Nodes[i].Tag.GetType() == typeof(WlbReportInfo)))
|
|
|
|
|
{
|
|
|
|
|
reportInfo = (WlbReportInfo)treeViewReportList.Nodes[i].Tag;
|
|
|
|
|
|
|
|
|
|
if (reportInfo.ReportFile == reportFile)
|
|
|
|
|
{
|
|
|
|
|
treeViewReportList.SelectedNode = treeViewReportList.Nodes[i];
|
|
|
|
|
treeViewReportList.Select();
|
|
|
|
|
wlbReportView1.ViewerReportInfo = reportInfo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update report treeView when edit/add/delete report subscriptions
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void UpdateReportTreeView()
|
|
|
|
|
{
|
|
|
|
|
// Begin update report treeView
|
|
|
|
|
treeViewReportList.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
// If there is a selected subscription node, need to save it before it got cleared
|
|
|
|
|
// There is no need to save selected report node since it never got cleared
|
|
|
|
|
WlbReportSubscription selectedSub = null;
|
|
|
|
|
String selectedSubReportFile = String.Empty;
|
|
|
|
|
if (this.treeViewReportList.SelectedNode != null && this.treeViewReportList.SelectedNode.Tag != null && this.treeViewReportList.SelectedNode.Tag.GetType() == typeof(WlbReportSubscription))
|
|
|
|
|
{
|
|
|
|
|
// Save selected subscription node for later
|
|
|
|
|
selectedSub = (WlbReportSubscription)this.treeViewReportList.SelectedNode.Tag;
|
|
|
|
|
|
|
|
|
|
// Save the report file of the selected subscription node for later
|
|
|
|
|
selectedSubReportFile = ((WlbReportInfo)this.treeViewReportList.SelectedNode.Parent.Parent.Tag).ReportFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update subscription nodes
|
|
|
|
|
foreach (TreeNode reportNode in this.treeViewReportList.Nodes)
|
|
|
|
|
{
|
|
|
|
|
// Get subscriptions under the report node
|
|
|
|
|
Dictionary<string, WlbReportSubscription> subscriptionList = _subscriptionCollection.GetReportSubscriptionByReportName(((WlbReportInfo)reportNode.Tag).ReportFile);
|
|
|
|
|
|
|
|
|
|
// If there's subscriptions for the current report, add them
|
|
|
|
|
if (subscriptionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
// Add a subscriptions folder if there isn't one
|
|
|
|
|
if (reportNode.GetNodeCount(true) == 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode subscriptionFolderNode = new TreeNode(Messages.WLB_SUBSCRIPTIONS, 2, 2);
|
|
|
|
|
reportNode.Nodes.Add(subscriptionFolderNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete all the nodes to build the updated list
|
|
|
|
|
reportNode.Nodes[0].Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
// Add in the latest nodes
|
|
|
|
|
if (selectedSub != null && String.Compare(selectedSubReportFile, ((WlbReportInfo)reportNode.Tag).ReportFile, true) == 0)
|
|
|
|
|
{
|
|
|
|
|
// Add new subscription node and retrieve selected node if there is one
|
|
|
|
|
AddNewSubscriptionNode(reportNode.Nodes[0], subscriptionList, ((WlbReportInfo)reportNode.Tag).ReportName, selectedSub);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Add new subscription node
|
|
|
|
|
AddNewSubscriptionNode(reportNode.Nodes[0], subscriptionList, ((WlbReportInfo)reportNode.Tag).ReportName, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Force to select reportNode before clear reportNode's children node
|
|
|
|
|
// only if the original selected subscription has been deleted
|
|
|
|
|
// and there are no more subscriptions under the report
|
|
|
|
|
if (selectedSub != null && String.Compare(selectedSubReportFile, ((WlbReportInfo)reportNode.Tag).ReportFile, true) == 0)
|
|
|
|
|
{
|
|
|
|
|
this.treeViewReportList.SelectedNode = reportNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clear reportNode's children node (subscription folder node)
|
|
|
|
|
// if there is no subscription under the reportNode
|
|
|
|
|
reportNode.Nodes.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End updating report treeView
|
|
|
|
|
treeViewReportList.EndUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update subscriptionTreeView when Add/Edit/Delete subscription
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void UpdateSubscriptionTreeView()
|
|
|
|
|
{
|
|
|
|
|
// Begin update subscription treeView
|
|
|
|
|
treeViewSubscriptionList.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
// Save selected node if there is one
|
|
|
|
|
WlbReportSubscription selectedSub = null;
|
|
|
|
|
if (treeViewSubscriptionList.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
selectedSub = (WlbReportSubscription)treeViewSubscriptionList.SelectedNode.Tag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete all nodes
|
|
|
|
|
treeViewSubscriptionList.Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
// Add subscription nodes if there is any
|
2017-06-15 17:11:05 +02:00
|
|
|
|
if (_subscriptionCollection.Count > 0)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
foreach (string key in _subscriptionCollection.Keys)
|
|
|
|
|
{
|
|
|
|
|
TreeNode subNode = GetReportSubscriptionTreeNode(_subscriptionCollection[key]);
|
|
|
|
|
treeViewSubscriptionList.Nodes.Add(subNode);
|
|
|
|
|
|
|
|
|
|
// Retrieve selected node if there is one
|
|
|
|
|
if (selectedSub != null && String.Compare(_subscriptionCollection[key].Id, selectedSub.Id, true) == 0)
|
|
|
|
|
{
|
|
|
|
|
treeViewSubscriptionList.SelectedNode = subNode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Force to set selected node to the first node
|
|
|
|
|
// only if treeViewSubscriptionList has selected subscription node before update
|
|
|
|
|
// but the selected subscription doesn't exist anymore
|
|
|
|
|
if (selectedSub != null && treeViewSubscriptionList.SelectedNode == null)
|
|
|
|
|
{
|
|
|
|
|
treeViewSubscriptionList.SelectedNode = treeViewSubscriptionList.Nodes[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-15 17:11:05 +02:00
|
|
|
|
else if (selectedSub != null)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
// No nodes left in the tree so select the current report in the reportviewer tree
|
|
|
|
|
foreach (TreeNode reportNode in this.treeViewReportList.Nodes)
|
|
|
|
|
{
|
|
|
|
|
if (((WlbReportInfo)reportNode.Tag).ReportName == selectedSub.ReportDisplayName)
|
|
|
|
|
{
|
|
|
|
|
treeViewReportList.SelectedNode = reportNode;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End update subscription treeView
|
|
|
|
|
treeViewSubscriptionList.EndUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds an image list to the current treeview for use by each of the nodes types
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ImageList CreateReportImageList()
|
|
|
|
|
{
|
|
|
|
|
ImageList reportImageList;
|
|
|
|
|
|
|
|
|
|
reportImageList = new ImageList();
|
|
|
|
|
|
2020-06-18 02:20:29 +02:00
|
|
|
|
reportImageList.Images.Add(Images.StaticImages._000_GetServerReport_h32bit_16);
|
|
|
|
|
reportImageList.Images.Add(Images.StaticImages.subscribe);
|
|
|
|
|
reportImageList.Images.Add(Images.StaticImages._000_Folder_open_h32bit_16);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
return reportImageList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieve subscriptions and set _subscriptionCollection
|
|
|
|
|
/// </summary>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private void RetrieveSubscriptionCollection()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
_subscriptionCollection = null;
|
|
|
|
|
|
|
|
|
|
RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
|
2021-05-27 00:07:56 +02:00
|
|
|
|
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks) {ShowCancel = true})
|
|
|
|
|
dialog.ShowDialog(this);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
if (action.Succeeded)
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var poolConfiguration = new WlbPoolConfiguration(action.WlbConfiguration);
|
2017-06-15 17:09:32 +02:00
|
|
|
|
_isCreedenceOrLater = poolConfiguration.IsCreedenceOrLater;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
Close();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
/// Attempts to get the latest set of reports from the WLB server version 2.0
|
2021-08-31 12:31:16 +02:00
|
|
|
|
/// and beyond (it invokes and runs a call to the Kirkwood database via Xapi
|
2013-06-24 13:41:48 +02:00
|
|
|
|
/// to obtain report configuration data including the actual
|
2021-05-27 00:07:56 +02:00
|
|
|
|
/// rdlc report definitions).
|
|
|
|
|
/// If there are no report definitions on WLB server, it obtains them
|
|
|
|
|
/// from local XML file (the old way).
|
2013-06-24 13:41:48 +02:00
|
|
|
|
/// </summary>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private XmlNodeList GetReportsConfig()
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
string reportName = "get_report_definitions";
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> parms = new Dictionary<string, string>();
|
|
|
|
|
parms.Add("LocaleCode", Program.CurrentLanguage);
|
2014-07-16 09:06:23 +02:00
|
|
|
|
if (_isCreedenceOrLater)
|
|
|
|
|
{
|
|
|
|
|
parms.Add("ReportVersion", "Creedence");
|
|
|
|
|
parms.Add("PoolId", _pool.uuid);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
AsyncAction action = new WlbReportAction(_pool.Connection,
|
2021-08-31 12:31:16 +02:00
|
|
|
|
Helpers.GetCoordinator(_pool.Connection),
|
2013-06-24 13:41:48 +02:00
|
|
|
|
reportName,
|
|
|
|
|
Messages.WLB_REPORT_DEFINITIONS,
|
|
|
|
|
true,
|
|
|
|
|
parms);
|
|
|
|
|
|
2016-06-20 14:17:42 +02:00
|
|
|
|
using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
|
|
|
|
|
dlg.ShowDialog();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
string returnValue = action.Result;
|
|
|
|
|
XmlDocument xmlReportsDoc = new XmlDocument();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (action.Succeeded && !string.IsNullOrEmpty(returnValue))
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xmlReportsDoc.LoadXml(returnValue);
|
2021-05-27 00:07:56 +02:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//ignore
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (!xmlReportsDoc.HasChildNodes || xmlReportsDoc.DocumentElement == null ||
|
|
|
|
|
!xmlReportsDoc.DocumentElement.HasChildNodes)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xmlReportsDoc.Load($@"{Application.StartupPath}\{"reports.xml"}");
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2021-05-27 00:07:56 +02:00
|
|
|
|
catch
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
//ignore
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
return xmlReportsDoc.SelectNodes(@"Reports/Report");
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-16 09:06:23 +02:00
|
|
|
|
// To enhance pool audit trail report, WLB server updates RDLC and would send user and object lists.
|
|
|
|
|
// These values are sent along with parameter keys "AuditUser", "AuditObject".
|
|
|
|
|
// The GetCustomXmlElement functions are used to retrieve the parameter values from WLB server.
|
|
|
|
|
private static XmlElement GetCustomXmlElement(XmlElement root)
|
|
|
|
|
{
|
|
|
|
|
XmlNodeList labelNodes = root.GetElementsByTagName("Custom");
|
|
|
|
|
if (labelNodes != null && labelNodes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string xmlCustom = labelNodes[0].InnerXml;
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
xmlDoc.LoadXml("<root>" + xmlCustom + "</root>");
|
|
|
|
|
return xmlDoc.DocumentElement;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
string searchStart = "Function Custom() As String";
|
|
|
|
|
string searchEnd = "\nEnd Function";
|
|
|
|
|
string xmlDocString = root.InnerXml;
|
|
|
|
|
int startPos = xmlDocString.IndexOf(searchStart, 0);
|
|
|
|
|
if (startPos > -1)
|
|
|
|
|
{
|
|
|
|
|
int endPos = xmlDocString.IndexOf(searchEnd, startPos);
|
|
|
|
|
string customString = xmlDocString.Substring(startPos + searchStart.Length, endPos - startPos - searchStart.Length);
|
|
|
|
|
customString = customString.Trim().Substring("Return".Length).Trim().Trim("\"".ToCharArray());
|
|
|
|
|
customString = HttpUtility.HtmlDecode(customString);
|
|
|
|
|
xmlDoc.LoadXml(customString);
|
|
|
|
|
return xmlDoc.DocumentElement;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static XmlElement GetCustomXmlElement(XmlElement root, string version)
|
|
|
|
|
{
|
|
|
|
|
XmlElement customXml = GetCustomXmlElement(root);
|
|
|
|
|
if (customXml != null)
|
|
|
|
|
{
|
|
|
|
|
XmlNodeList versionNodes = customXml.GetElementsByTagName("Version");
|
|
|
|
|
foreach (XmlNode thisNode in versionNodes)
|
|
|
|
|
{
|
|
|
|
|
if (thisNode.Attributes["value"].Value == version)
|
|
|
|
|
{
|
|
|
|
|
XmlDocument thisDoc = new XmlDocument();
|
|
|
|
|
thisDoc.LoadXml("<root>" + thisNode.InnerXml + "</root>");
|
|
|
|
|
return thisDoc.DocumentElement;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static XmlElement GetCustomXmlElement(XmlElement root, string version, string tagName)
|
|
|
|
|
{
|
|
|
|
|
XmlElement customXml = GetCustomXmlElement(root, version);
|
|
|
|
|
if (customXml != null)
|
|
|
|
|
{
|
|
|
|
|
XmlNodeList tagNodes = customXml.GetElementsByTagName(tagName);
|
|
|
|
|
if (tagNodes != null && tagNodes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
XmlDocument thisDoc = new XmlDocument();
|
|
|
|
|
thisDoc.LoadXml("<root>" + tagNodes[0].InnerXml + "</root>");
|
|
|
|
|
return thisDoc.DocumentElement;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static XmlElement GetCustomXmlElement(XmlNode root, string version, string tagName)
|
|
|
|
|
{
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
xmlDoc.LoadXml("<root>" + root.InnerXml + "</root>");
|
|
|
|
|
return GetCustomXmlElement(xmlDoc.DocumentElement, version, tagName);
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a node of type ReportTreeNode based on information specified from the XML report
|
|
|
|
|
/// configuration file.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="currentNode">Current report XML node from config file</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private TreeNode GetReportTreeNode(XmlNode currentNode)
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
// 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
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
string nodeReportDefinition;
|
|
|
|
|
var rdlc = currentNode.SelectSingleNode(@"Rdlc");
|
|
|
|
|
var nodeFileName = currentNode.Attributes?["File"].Value;
|
2014-07-16 09:06:23 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (rdlc == null)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
XmlDocument xmlReportDefinition = new XmlDocument();
|
2021-05-27 00:07:56 +02:00
|
|
|
|
xmlReportDefinition.Load($@"{Application.StartupPath}\{nodeFileName}");
|
|
|
|
|
nodeReportDefinition = xmlReportDefinition.OuterXml;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
nodeReportDefinition = rdlc.InnerText;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
string nodeNameLabel = string.Empty;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (currentNode.Attributes?["Name"] != null)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
nodeNameLabel = currentNode.Attributes["Name"].Value;
|
2021-05-27 00:07:56 +02:00
|
|
|
|
else if (currentNode.Attributes?["NameLabel"].Value != null)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var obj = Messages.ResourceManager.GetObject(currentNode.Attributes?["NameLabel"].Value);
|
|
|
|
|
if (obj != null)
|
|
|
|
|
nodeNameLabel = obj.ToString();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var nodeDisplayFilter = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='Filter']") != null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var nodeDisplayHosts = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='HostID']") != null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var nodeDisplayUsers = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditUser']") != null;
|
2014-07-16 09:06:23 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
var nodeDisplayAuditObjects = currentNode.SelectSingleNode(@"QueryParameters/QueryParameter[@Name='AuditObject']") != null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Tag = reportInfo,
|
|
|
|
|
Text = nodeNameLabel,
|
|
|
|
|
ImageIndex = 0,
|
|
|
|
|
SelectedImageIndex = 0
|
|
|
|
|
};
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a treeNode for give report name and subscription object
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="subscription">Instance of a subscription</param>
|
|
|
|
|
/// <returns>Return a instance of TreeNode</returns>
|
|
|
|
|
private TreeNode GetReportSubscriptionTreeNode(WlbReportSubscription subscription)
|
|
|
|
|
{
|
|
|
|
|
TreeNode subscriptionTreeNode = new TreeNode();
|
|
|
|
|
|
|
|
|
|
subscriptionTreeNode.Text = subscription.Name;
|
|
|
|
|
subscriptionTreeNode.Tag = subscription;
|
|
|
|
|
subscriptionTreeNode.ImageIndex = 1;
|
|
|
|
|
subscriptionTreeNode.SelectedImageIndex = 1;
|
|
|
|
|
|
|
|
|
|
return subscriptionTreeNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns a list of parameters names whose values will be required for reports' SQL query
|
2021-08-31 12:31:16 +02:00
|
|
|
|
/// to run. These names are specified in the Report XML configuration file.
|
2013-06-24 13:41:48 +02:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="currentNode">Current report XML node from config file</param>
|
2014-07-16 09:06:23 +02:00
|
|
|
|
/// <param name="queryParametersXmlElement">Current report XML node from config file</param>
|
|
|
|
|
/// <returns>OrderedDictionary of parameter names and contents whose values are required by the report SQL query</returns>
|
|
|
|
|
private OrderedDictionary GetSQLQueryParamNames(XmlNode currentNode, XmlElement queryParametersXmlElement)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2014-07-16 09:06:23 +02:00
|
|
|
|
OrderedDictionary paramNames = new OrderedDictionary();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
XmlNodeList paramNameNodes = currentNode.SelectNodes("QueryParameters/QueryParameter");
|
|
|
|
|
|
|
|
|
|
foreach (XmlNode paramNode in paramNameNodes)
|
|
|
|
|
{
|
|
|
|
|
if (paramNode.Attributes["Name"] != null)
|
|
|
|
|
{
|
2014-07-16 09:06:23 +02:00
|
|
|
|
string value = paramNode.Attributes["Name"].Value;
|
|
|
|
|
// To implement the AuditUser and AuditObject dropdowns, the values are set
|
|
|
|
|
// along with parameter "AuditUser' and "AuditObject" from WLB server.
|
|
|
|
|
// If the query parameters contain values, store them in dictionary.
|
|
|
|
|
// Else just store the parameter as key with "" value.
|
|
|
|
|
if(_isCreedenceOrLater && queryParametersXmlElement != null)
|
|
|
|
|
{
|
|
|
|
|
XmlNodeList valueTagNodes = queryParametersXmlElement.GetElementsByTagName(value);
|
|
|
|
|
if (valueTagNodes != null && valueTagNodes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
paramNames.Add(value, valueTagNodes[0].InnerText);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
paramNames.Add(value, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
paramNames.Add(value, "");
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return paramNames;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add subscription nodes if a report has subscriptions
|
|
|
|
|
/// </summary>
|
2018-03-22 18:05:07 +01:00
|
|
|
|
/// <param name="subscriptions"></param>
|
2013-06-24 13:41:48 +02:00
|
|
|
|
/// <param name="reportName">Report display name that can be added to WlbReportSubscription instance</param>
|
|
|
|
|
/// <param name="selectedSub">The original selected node before update</param>
|
2018-03-22 18:05:07 +01:00
|
|
|
|
/// <param name="subscriptionFolder"></param>
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private void AddNewSubscriptionNode(TreeNode subscriptionFolder, Dictionary<string, WlbReportSubscription> subscriptions, string reportName, WlbReportSubscription selectedSub)
|
|
|
|
|
{
|
|
|
|
|
foreach (WlbReportSubscription sub in subscriptions.Values)
|
|
|
|
|
{
|
|
|
|
|
sub.ReportDisplayName = reportName;
|
|
|
|
|
TreeNode subNode = GetReportSubscriptionTreeNode(sub);
|
|
|
|
|
subscriptionFolder.Nodes.Add(subNode);
|
|
|
|
|
|
|
|
|
|
// Retrieve selected subscription node if there is one
|
|
|
|
|
if (selectedSub != null && String.Compare(selectedSub.Id, sub.Id, true) == 0)
|
|
|
|
|
{
|
|
|
|
|
this.treeViewReportList.SelectedNode = subNode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Force to set selected node to the first subscription node of the report
|
|
|
|
|
// only if the original selected subscription node of the report has been deleted.
|
|
|
|
|
if (selectedSub != null && subscriptions.Count > 0 && (this.treeViewReportList.SelectedNode == null || this.treeViewReportList.SelectedNode.Tag == null))
|
|
|
|
|
{
|
|
|
|
|
this.treeViewReportList.SelectedNode = subscriptionFolder.Nodes[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Event Handlers
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Load report form
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private void WorkloadReports_Load(object sender, EventArgs e)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
subscriptionView1.OnChangeOK += OnChangeOK_Refresh;
|
|
|
|
|
wlbReportView1.OnChangeOK += OnChangeOK_Refresh;
|
|
|
|
|
|
|
|
|
|
RetrieveSubscriptionCollection();
|
|
|
|
|
_currentNodes = GetReportsConfig();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// When the report window is displayed, the current pool and a list of hosts that
|
|
|
|
|
/// correlate to the pool need to be set in the viewer control.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
2021-05-27 00:07:56 +02:00
|
|
|
|
private void WorkloadReports_Shown(object sender, EventArgs e)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
subscriptionView1.Pool = _pool;
|
2021-05-27 00:07:56 +02:00
|
|
|
|
wlbReportView1.Pool = _pool;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
wlbReportView1.Hosts = _hosts;
|
2021-05-27 00:07:56 +02:00
|
|
|
|
wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
// Populate report treeview with report and subscription on the top of left panel
|
2021-05-27 00:07:56 +02:00
|
|
|
|
PopulateTreeViewReportList();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
// Populate subscription treeview with subscription on the bottom of the left panel
|
2021-05-27 00:07:56 +02:00
|
|
|
|
PopulateTreeViewSubscriptionList();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update report treeView and subscription treeView
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void OnChangeOK_Refresh(object sender, EventArgs e)
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
RetrieveSubscriptionCollection();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (_subscriptionCollection != null)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
// Update subscription treeView must be before updating report treeView
|
|
|
|
|
UpdateSubscriptionTreeView();
|
|
|
|
|
UpdateReportTreeView();
|
|
|
|
|
|
|
|
|
|
if (sender is WlbReportSubscriptionView)
|
|
|
|
|
subscriptionView1.RefreshSubscriptionView();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void treeViewReportList_AfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (treeViewReportList.SelectedNode.Tag is WlbReportInfo report)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
subscriptionView1.Visible = false;
|
|
|
|
|
wlbReportView1.RefreshReportViewer(report);
|
|
|
|
|
wlbReportView1.Visible = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (_runReport)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-08-31 12:31:16 +02:00
|
|
|
|
wlbReportView1.RunReport();
|
2021-05-27 00:07:56 +02:00
|
|
|
|
_runReport = false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-27 00:07:56 +02:00
|
|
|
|
else if (treeViewReportList.SelectedNode.Tag is WlbReportSubscription subscription)
|
|
|
|
|
{
|
|
|
|
|
wlbReportView1.Visible = false;
|
|
|
|
|
subscriptionView1.RefreshSubscriptionView(subscription);
|
|
|
|
|
subscriptionView1.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
treeViewSubscriptionList.SelectedNode = null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void treeViewSubscriptionList_AfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
if (treeViewSubscriptionList.SelectedNode.Tag is WlbReportSubscription subscription)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2021-05-27 00:07:56 +02:00
|
|
|
|
wlbReportView1.Visible = false;
|
|
|
|
|
subscriptionView1.RefreshSubscriptionView(subscription);
|
|
|
|
|
subscriptionView1.Visible = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2021-05-27 00:07:56 +02:00
|
|
|
|
treeViewReportList.SelectedNode = null;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event handler for when a report is drilled in to from the MS Viewer inside the ReportView control.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void wlbReportView1_ReportDrilledThrough(object sender, DrillthroughEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SynchTreeViewReportList(e.ReportPath.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void wlbReportView1_Close(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
this.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event handler for a lost pool connection
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void wlbReportView1_PoolConnectionLost(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-04-22 15:47:03 +02:00
|
|
|
|
using (var dlg = new InformationDialog(String.Format(Messages.WLB_REPORT_POOL_CONNECTION_LOST, _pool.Name()))
|
|
|
|
|
{WindowTitle = Messages.WLBREPORT_POOL_CONNECTION_LOST_CAPTION})
|
2016-06-20 11:49:12 +02:00
|
|
|
|
{
|
|
|
|
|
dlg.ShowDialog(this);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
this.Close();
|
|
|
|
|
this.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|