CA-180576: Provide a option to give case number when uploading a report from the Server Status Report wizard

- added Case Number edit box on the Destination page of the wizard
- valid case number needs to be 9 or less digits

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2015-11-03 15:45:59 +00:00
parent 2f1e5c38bb
commit af7852c7a0
9 changed files with 205 additions and 39 deletions

View File

@ -45,6 +45,9 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
this.BrowseButton = new System.Windows.Forms.Button();
this.m_ctrlError = new XenAdmin.Controls.Common.PasswordFailure();
this.uploadCheckBox = new System.Windows.Forms.CheckBox();
this.caseNumberLabel = new System.Windows.Forms.Label();
this.caseNumberTextBox = new System.Windows.Forms.TextBox();
this.optionalLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.authenticationGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
@ -59,15 +62,18 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
this.tableLayoutPanel1.Controls.Add(this.m_textBoxName, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.labelFileLocation, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.m_textBoxLocation, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.BrowseButton, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.m_ctrlError, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.BrowseButton, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.m_ctrlError, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.uploadCheckBox, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.caseNumberLabel, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.caseNumberTextBox, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.optionalLabel, 2, 5);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// authenticationGroupBox
//
resources.ApplyResources(this.authenticationGroupBox, "authenticationGroupBox");
this.tableLayoutPanel1.SetColumnSpan(this.authenticationGroupBox, 3);
this.tableLayoutPanel1.SetColumnSpan(this.authenticationGroupBox, 4);
this.authenticationGroupBox.Controls.Add(this.tableLayoutPanel2);
this.authenticationGroupBox.Name = "authenticationGroupBox";
this.authenticationGroupBox.TabStop = false;
@ -114,7 +120,7 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
// label2
//
resources.ApplyResources(this.label2, "label2");
this.tableLayoutPanel1.SetColumnSpan(this.label2, 3);
this.tableLayoutPanel1.SetColumnSpan(this.label2, 4);
this.label2.Name = "label2";
//
// labelName
@ -124,6 +130,7 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
//
// m_textBoxName
//
this.tableLayoutPanel1.SetColumnSpan(this.m_textBoxName, 2);
resources.ApplyResources(this.m_textBoxName, "m_textBoxName");
this.m_textBoxName.Name = "m_textBoxName";
this.m_textBoxName.TextChanged += new System.EventHandler(this.m_textBoxName_TextChanged);
@ -135,6 +142,7 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
//
// m_textBoxLocation
//
this.tableLayoutPanel1.SetColumnSpan(this.m_textBoxLocation, 2);
resources.ApplyResources(this.m_textBoxLocation, "m_textBoxLocation");
this.m_textBoxLocation.Name = "m_textBoxLocation";
this.m_textBoxLocation.TextChanged += new System.EventHandler(this.m_textBoxLocation_TextChanged);
@ -149,17 +157,33 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
// m_ctrlError
//
resources.ApplyResources(this.m_ctrlError, "m_ctrlError");
this.tableLayoutPanel1.SetColumnSpan(this.m_ctrlError, 3);
this.tableLayoutPanel1.SetColumnSpan(this.m_ctrlError, 4);
this.m_ctrlError.Name = "m_ctrlError";
//
// uploadCheckBox
//
resources.ApplyResources(this.uploadCheckBox, "uploadCheckBox");
this.tableLayoutPanel1.SetColumnSpan(this.uploadCheckBox, 3);
this.tableLayoutPanel1.SetColumnSpan(this.uploadCheckBox, 4);
this.uploadCheckBox.Name = "uploadCheckBox";
this.uploadCheckBox.UseVisualStyleBackColor = true;
this.uploadCheckBox.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// caseNumberLabel
//
resources.ApplyResources(this.caseNumberLabel, "caseNumberLabel");
this.caseNumberLabel.Name = "caseNumberLabel";
//
// caseNumberTextBox
//
resources.ApplyResources(this.caseNumberTextBox, "caseNumberTextBox");
this.caseNumberTextBox.Name = "caseNumberTextBox";
this.caseNumberTextBox.TextChanged += new System.EventHandler(this.caseNumberLabelTextBox_TextChanged);
//
// optionalLabel
//
resources.ApplyResources(this.optionalLabel, "optionalLabel");
this.optionalLabel.Name = "optionalLabel";
//
// BugToolPageDestination
//
this.Controls.Add(this.tableLayoutPanel1);
@ -194,5 +218,8 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
private System.Windows.Forms.Label labelFileLocation;
private System.Windows.Forms.TextBox m_textBoxLocation;
private System.Windows.Forms.Button BrowseButton;
private System.Windows.Forms.Label caseNumberLabel;
private System.Windows.Forms.TextBox caseNumberTextBox;
private System.Windows.Forms.Label optionalLabel;
}
}

View File

@ -51,8 +51,8 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
public partial class BugToolPageDestination : XenTabPage
{
private bool m_buttonNextEnabled;
private const int TokenExpiration = 86400; // 24 hours
private const int TokenExpiration = 86400; // 24 hours
public BugToolPageDestination()
{
@ -122,6 +122,14 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
public string UploadToken { get; private set; }
public string CaseNumber
{
get
{
return caseNumberTextBox.Text.Trim();
}
}
private bool PerformCheck(params CheckDelegate[] checks)
{
bool success = m_ctrlError.PerformCheck(checks);
@ -201,24 +209,41 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
return !string.IsNullOrEmpty(UploadToken);
}
private bool CheckCaseNumberValid(out string error)
{
error = string.Empty;
if (!uploadCheckBox.Checked || string.IsNullOrEmpty(caseNumberTextBox.Text.Trim()))
return true;
ulong val;
if (ulong.TryParse(caseNumberTextBox.Text.Trim(), out val) && val > 0 && val < 1000000000)
return true;
error = Messages.BUGTOOL_PAGE_DESTINATION_INVALID_CASE_NO;
return false;
}
private void EnableDisableAuthenticationControls()
{
if (!Visible)
return;
authenticationGroupBox.Enabled = uploadCheckBox.Checked;
authenticationGroupBox.Enabled =
caseNumberLabel.Enabled = caseNumberTextBox.Enabled = optionalLabel.Enabled =
uploadCheckBox.Checked;
}
#region Control event handlers
private void m_textBoxName_TextChanged(object sender, EventArgs e)
{
PerformCheck(CheckPathValid, CheckCredentialsEntered);
PerformCheck(CheckPathValid, CheckCaseNumberValid, CheckCredentialsEntered);
}
private void m_textBoxLocation_TextChanged(object sender, EventArgs e)
{
PerformCheck(CheckPathValid, CheckCredentialsEntered);
PerformCheck(CheckPathValid, CheckCaseNumberValid, CheckCredentialsEntered);
}
private void BrowseButton_Click(object sender, EventArgs e)
@ -233,12 +258,17 @@ namespace XenAdmin.Wizards.BugToolWizardFiles
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
EnableDisableAuthenticationControls();
PerformCheck(CheckPathValid, CheckCredentialsEntered);
PerformCheck(CheckPathValid, CheckCaseNumberValid, CheckCredentialsEntered);
}
private void credentials_TextChanged(object sender, EventArgs e)
{
PerformCheck(CheckPathValid, CheckCredentialsEntered);
PerformCheck(CheckPathValid, CheckCaseNumberValid, CheckCredentialsEntered);
}
private void caseNumberLabelTextBox_TextChanged(object sender, EventArgs e)
{
PerformCheck(CheckPathValid, CheckCaseNumberValid, CheckCredentialsEntered);
}
#endregion

View File

@ -119,7 +119,7 @@
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>3</value>
<value>4</value>
</data>
<data name="authenticationGroupBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -187,7 +187,7 @@
<value>0, 0, 0, 0</value>
</data>
<data name="usernameLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 29</value>
<value>91, 29</value>
</data>
<data name="usernameLabel.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
@ -229,7 +229,7 @@
<value>0, 0, 0, 0</value>
</data>
<data name="passwordLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 29</value>
<value>91, 29</value>
</data>
<data name="passwordLabel.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
@ -256,7 +256,7 @@
<value>Segoe UI, 9pt</value>
</data>
<data name="passwordTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>69, 67</value>
<value>94, 67</value>
</data>
<data name="passwordTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>246, 23</value>
@ -280,7 +280,7 @@
<value>Segoe UI, 9pt</value>
</data>
<data name="usernameTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>69, 38</value>
<value>94, 38</value>
</data>
<data name="usernameTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>246, 23</value>
@ -328,7 +328,7 @@
<value>0</value>
</data>
<data name="tableLayoutPanel2.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="autoHeightLabel2" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="usernameLabel" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="passwordLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="passwordTextBox" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="usernameTextBox" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,20,AutoSize,100,AutoSize,0,AutoSize,20,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="autoHeightLabel2" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="usernameLabel" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="passwordLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="passwordTextBox" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="usernameTextBox" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Absolute,91,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="authenticationGroupBox.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
@ -436,10 +436,10 @@
<value>Fill</value>
</data>
<data name="m_textBoxName.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 28</value>
<value>103, 28</value>
</data>
<data name="m_textBoxName.Size" type="System.Drawing.Size, System.Drawing">
<value>410, 20</value>
<value>382, 20</value>
</data>
<data name="m_textBoxName.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -499,13 +499,13 @@
<value>Fill</value>
</data>
<data name="m_textBoxLocation.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 61</value>
<value>103, 61</value>
</data>
<data name="m_textBoxLocation.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 10, 3, 3</value>
</data>
<data name="m_textBoxLocation.Size" type="System.Drawing.Size, System.Drawing">
<value>410, 20</value>
<value>382, 20</value>
</data>
<data name="m_textBoxLocation.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
@ -565,10 +565,10 @@
<value />
</data>
<data name="m_ctrlError.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 251</value>
<value>0, 287</value>
</data>
<data name="m_ctrlError.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
<value>0, 10, 0, 0</value>
</data>
<data name="m_ctrlError.Size" type="System.Drawing.Size, System.Drawing">
<value>569, 22</value>
@ -601,7 +601,7 @@
<value>3, 20, 3, 6</value>
</data>
<data name="uploadCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>272, 17</value>
<value>254, 17</value>
</data>
<data name="uploadCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -621,6 +621,99 @@
<data name="&gt;&gt;uploadCheckBox.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="caseNumberLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="caseNumberLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="caseNumberLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="caseNumberLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 257</value>
</data>
<data name="caseNumberLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="caseNumberLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 13</value>
</data>
<data name="caseNumberLabel.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="caseNumberLabel.Text" xml:space="preserve">
<value>&amp;Case number:</value>
</data>
<data name="&gt;&gt;caseNumberLabel.Name" xml:space="preserve">
<value>caseNumberLabel</value>
</data>
<data name="&gt;&gt;caseNumberLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;caseNumberLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;caseNumberLabel.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="caseNumberTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>103, 254</value>
</data>
<data name="caseNumberTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>246, 20</value>
</data>
<data name="caseNumberTextBox.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="&gt;&gt;caseNumberTextBox.Name" xml:space="preserve">
<value>caseNumberTextBox</value>
</data>
<data name="&gt;&gt;caseNumberTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;caseNumberTextBox.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;caseNumberTextBox.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="optionalLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="optionalLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="optionalLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="optionalLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>355, 257</value>
</data>
<data name="optionalLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="optionalLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 13</value>
</data>
<data name="optionalLabel.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="optionalLabel.Text" xml:space="preserve">
<value>(optional)</value>
</data>
<data name="&gt;&gt;optionalLabel.Name" xml:space="preserve">
<value>optionalLabel</value>
</data>
<data name="&gt;&gt;optionalLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;optionalLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;optionalLabel.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@ -631,7 +724,7 @@
<value>0, 0, 0, 0</value>
</data>
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>7</value>
<value>8</value>
</data>
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>569, 419</value>
@ -652,7 +745,7 @@
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="authenticationGroupBox" Row="4" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="label2" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="labelName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_textBoxName" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelFileLocation" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_textBoxLocation" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="BrowseButton" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="m_ctrlError" Row="5" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="uploadCheckBox" Row="3" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="authenticationGroupBox" Row="4" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="label2" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="labelName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_textBoxName" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="labelFileLocation" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="m_textBoxLocation" Row="2" RowSpan="1" Column="1" ColumnSpan="2" /&gt;&lt;Control Name="BrowseButton" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="m_ctrlError" Row="6" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="uploadCheckBox" Row="3" RowSpan="1" Column="0" ColumnSpan="4" /&gt;&lt;Control Name="caseNumberLabel" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="caseNumberTextBox" Row="5" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="optionalLabel" Row="5" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Absolute,100,AutoSize,100,Percent,50,AutoSize,0" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>

View File

@ -132,7 +132,7 @@ namespace XenAdmin.Wizards
if (bugToolPageDestination1.Upload)
{
var uploadAction = new Actions.UploadServerStatusReportAction(bugToolPageDestination1.OutputFile,
bugToolPageDestination1.UploadToken,
bugToolPageDestination1.UploadToken, bugToolPageDestination1.CaseNumber,
Registry.HealthCheckUploadDomainName, false);
dialog = new ActionProgressDialog(uploadAction, ProgressBarStyle.Blocks) {ShowCancel = true};
dialog.ShowDialog();

View File

@ -42,21 +42,23 @@ namespace XenAdmin.Actions
private readonly string uploadToken;
private readonly string bundleToUpload;
private readonly string caseNumber;
private const string UPLOAD_URL = "/feeds/api/";
private readonly string UPLOAD_DOMAIN_NAME = "https://rttf.citrix.com";
private CancellationTokenSource cts;
public UploadServerStatusReportAction(string bundleToUpload, string uploadToken, bool suppressHistory)
public UploadServerStatusReportAction(string bundleToUpload, string uploadToken, string caseNumber, bool suppressHistory)
: base(null, Messages.ACTION_UPLOAD_SERVER_STATUS_REPORT, Messages.ACTION_UPLOAD_SERVER_STATUS_REPORT_PROGRESS, suppressHistory)
{
this.bundleToUpload = bundleToUpload;
this.bundleToUpload = bundleToUpload;
this.uploadToken = uploadToken;
this.caseNumber = caseNumber;
}
public UploadServerStatusReportAction(string bundleToUpload, string uploadToken, string uploadDomainName, bool suppressHistory)
: this(bundleToUpload, uploadToken, suppressHistory)
public UploadServerStatusReportAction(string bundleToUpload, string uploadToken, string caseNumber, string uploadDomainName, bool suppressHistory)
: this(bundleToUpload, uploadToken, caseNumber, suppressHistory)
{
if (!string.IsNullOrEmpty(uploadDomainName))
UPLOAD_DOMAIN_NAME = uploadDomainName;
@ -102,7 +104,7 @@ namespace XenAdmin.Actions
// Upload the zip file to CIS uploading server.
var uploadUrl = string.Format("{0}{1}", UPLOAD_DOMAIN_NAME, UPLOAD_URL);
XenServerHealthCheckUpload upload = new XenServerHealthCheckUpload(uploadToken, 9, uploadUrl, null);
string uploadUuid = upload.UploadZip(bundleToUpload, cts.Token);
string uploadUuid = upload.UploadZip(bundleToUpload, caseNumber, cts.Token);
// Return the uuid of upload.
return uploadUuid;

View File

@ -66,10 +66,12 @@ namespace XenServerHealthCheck
}
// Request an upload and fetch the uploading id from CIS.
public string InitiateUpload(string fileName, long size)
public string InitiateUpload(string fileName, long size, string caseNumber)
{
// Request a new bundle upload to CIS server.
string FULL_URL = UPLOAD_URL + "bundle/?size=" + size.ToString() + "&name=" + fileName;
if (!string.IsNullOrEmpty(caseNumber))
FULL_URL += "&sr=" + caseNumber;
log.InfoFormat("InitiateUpload, UPLOAD_URL: {0}", FULL_URL);
Uri uri = new Uri(FULL_URL);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
@ -166,14 +168,14 @@ namespace XenServerHealthCheck
}
// Upload the zip file.
public string UploadZip(string fileName, System.Threading.CancellationToken cancel)
public string UploadZip(string fileName, string caseNumber, System.Threading.CancellationToken cancel)
{
log.InfoFormat("Start to upload bundle {0}", fileName);
FileInfo fileInfo = new FileInfo(fileName);
long size = fileInfo.Length;
// Fetch the upload UUID from CIS server.
string uploadUuid = InitiateUpload(Path.GetFileName(fileName), size);
string uploadUuid = InitiateUpload(Path.GetFileName(fileName), size, caseNumber);
if (string.IsNullOrEmpty(uploadUuid))
{
log.ErrorFormat("Cannot fetch the upload UUID from CIS server");

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -5770,6 +5770,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Case number is invalid..
/// </summary>
public static string BUGTOOL_PAGE_DESTINATION_INVALID_CASE_NO {
get {
return ResourceManager.GetString("BUGTOOL_PAGE_DESTINATION_INVALID_CASE_NO", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Destination directory is invalid..
/// </summary>

View File

@ -2101,6 +2101,9 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
<data name="BUGTOOL_PAGE_CAPABILITIES_TEXT" xml:space="preserve">
<value>Select Report Contents</value>
</data>
<data name="BUGTOOL_PAGE_DESTINATION_INVALID_CASE_NO" xml:space="preserve">
<value>Case number is invalid.</value>
</data>
<data name="BUGTOOL_PAGE_DESTINATION_INVALID_FOLDER" xml:space="preserve">
<value>Destination directory is invalid.</value>
</data>

View File

@ -252,7 +252,7 @@ namespace XenServerHealthCheck
string upload_uuid = "";
try
{
upload_uuid = upload.UploadZip(bundleToUpload, cancel);
upload_uuid = upload.UploadZip(bundleToUpload, null, cancel);
}
catch (Exception e)
{