From aaacb0f11fa5b9f5d417faf695f560a8cca2d8e1 Mon Sep 17 00:00:00 2001 From: Bogdan Pintea Date: Wed, 10 Jul 2019 16:40:39 +0200 Subject: [PATCH] add new "Misc" pannel for rest of config options This commit adds a new Panel to the configuration GUI that allows controlling of the "rest" of the connection string paramters (the ones not yet covered in the existing panels). --- .../EsOdbcDsnEditor/DSNEditorForm.Designer.cs | 243 +++++++++++++++++- dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs | 35 +++ dsneditor/EsOdbcDsnEditor/DSNEditorForm.resx | 27 ++ 3 files changed, 304 insertions(+), 1 deletion(-) diff --git a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.Designer.cs b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.Designer.cs index 3939d31e..2186f3c1 100644 --- a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.Designer.cs +++ b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.Designer.cs @@ -74,6 +74,20 @@ private void InitializeComponent() this.logDirectoryPathButton = new System.Windows.Forms.Button(); this.textLogDirectoryPath = new System.Windows.Forms.TextBox(); this.labelLogDirectory = new System.Windows.Forms.Label(); + this.pageMisc = new System.Windows.Forms.TabPage(); + this.checkBoxAutoEscapePVA = new System.Windows.Forms.CheckBox(); + this.comboBoxFloatsFormat = new System.Windows.Forms.ComboBox(); + this.labelFloatsFormat = new System.Windows.Forms.Label(); + this.checkBoxIndexIncludeFrozen = new System.Windows.Forms.CheckBox(); + this.checkBoxMultiFieldLenient = new System.Windows.Forms.CheckBox(); + this.checkBoxApplyTZ = new System.Windows.Forms.CheckBox(); + this.checkBoxFollowRedirects = new System.Windows.Forms.CheckBox(); + this.labelBodySize = new System.Windows.Forms.Label(); + this.numericUpDownBodySize = new System.Windows.Forms.NumericUpDown(); + this.labelFetchSize = new System.Windows.Forms.Label(); + this.numericUpDownFetchSize = new System.Windows.Forms.NumericUpDown(); + this.labelTimeout = new System.Windows.Forms.Label(); + this.numericUpDownTimeout = new System.Windows.Forms.NumericUpDown(); this.folderLogDirectoryDialog = new System.Windows.Forms.FolderBrowserDialog(); this.toolTipName = new System.Windows.Forms.ToolTip(this.components); this.toolTipDescription = new System.Windows.Forms.ToolTip(this.components); @@ -91,6 +105,15 @@ private void InitializeComponent() this.toolTipLogDirectoryPath = new System.Windows.Forms.ToolTip(this.components); this.toolTipLoggingEnabled = new System.Windows.Forms.ToolTip(this.components); this.toolTipLogLevel = new System.Windows.Forms.ToolTip(this.components); + this.toolTipTimeout = new System.Windows.Forms.ToolTip(this.components); + this.toolTipFetchSize = new System.Windows.Forms.ToolTip(this.components); + this.toolTipBodySize = new System.Windows.Forms.ToolTip(this.components); + this.toolTipFloatsFormat = new System.Windows.Forms.ToolTip(this.components); + this.toolTipFollowRedirects = new System.Windows.Forms.ToolTip(this.components); + this.toolTipApplyTZ = new System.Windows.Forms.ToolTip(this.components); + this.toolTipAutoEscapePVA = new System.Windows.Forms.ToolTip(this.components); + this.toolTipMultiFieldLenient = new System.Windows.Forms.ToolTip(this.components); + this.toolTipIndexIncludeFrozen = new System.Windows.Forms.ToolTip(this.components); ((System.ComponentModel.ISupportInitialize)(this.header)).BeginInit(); this.groupSSL.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPort)).BeginInit(); @@ -98,6 +121,10 @@ private void InitializeComponent() this.pageBasic.SuspendLayout(); this.pageSecurity.SuspendLayout(); this.pageLogging.SuspendLayout(); + this.pageMisc.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownBodySize)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFetchSize)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).BeginInit(); this.SuspendLayout(); // // saveButton @@ -335,7 +362,8 @@ private void InitializeComponent() this.tabConfiguration.Controls.Add(this.pageBasic); this.tabConfiguration.Controls.Add(this.pageSecurity); this.tabConfiguration.Controls.Add(this.pageLogging); - this.tabConfiguration.Location = new System.Drawing.Point(16, 74); + this.tabConfiguration.Controls.Add(this.pageMisc); + this.tabConfiguration.Location = new System.Drawing.Point(17, 74); this.tabConfiguration.Name = "tabConfiguration"; this.tabConfiguration.SelectedIndex = 0; this.tabConfiguration.Size = new System.Drawing.Size(648, 460); @@ -520,6 +548,191 @@ private void InitializeComponent() this.labelLogDirectory.TabIndex = 16; this.labelLogDirectory.Text = "Log Directory:"; // + // pageMisc + // + this.pageMisc.Controls.Add(this.checkBoxAutoEscapePVA); + this.pageMisc.Controls.Add(this.comboBoxFloatsFormat); + this.pageMisc.Controls.Add(this.labelFloatsFormat); + this.pageMisc.Controls.Add(this.checkBoxIndexIncludeFrozen); + this.pageMisc.Controls.Add(this.checkBoxMultiFieldLenient); + this.pageMisc.Controls.Add(this.checkBoxApplyTZ); + this.pageMisc.Controls.Add(this.checkBoxFollowRedirects); + this.pageMisc.Controls.Add(this.labelBodySize); + this.pageMisc.Controls.Add(this.numericUpDownBodySize); + this.pageMisc.Controls.Add(this.labelFetchSize); + this.pageMisc.Controls.Add(this.numericUpDownFetchSize); + this.pageMisc.Controls.Add(this.labelTimeout); + this.pageMisc.Controls.Add(this.numericUpDownTimeout); + this.pageMisc.Location = new System.Drawing.Point(4, 25); + this.pageMisc.Name = "pageMisc"; + this.pageMisc.Padding = new System.Windows.Forms.Padding(3); + this.pageMisc.Size = new System.Drawing.Size(640, 431); + this.pageMisc.TabIndex = 3; + this.pageMisc.Text = "Misc"; + this.pageMisc.UseVisualStyleBackColor = true; + // + // checkBoxAutoEscapePVA + // + this.checkBoxAutoEscapePVA.AutoSize = true; + this.checkBoxAutoEscapePVA.Checked = true; + this.checkBoxAutoEscapePVA.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxAutoEscapePVA.Location = new System.Drawing.Point(339, 86); + this.checkBoxAutoEscapePVA.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.checkBoxAutoEscapePVA.Name = "checkBoxAutoEscapePVA"; + this.checkBoxAutoEscapePVA.Size = new System.Drawing.Size(156, 21); + this.checkBoxAutoEscapePVA.TabIndex = 29; + this.checkBoxAutoEscapePVA.Text = "Auto-escape PVAs?"; + this.checkBoxAutoEscapePVA.UseVisualStyleBackColor = true; + // + // comboBoxFloatsFormat + // + this.comboBoxFloatsFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxFloatsFormat.FormattingEnabled = true; + this.comboBoxFloatsFormat.Items.AddRange(new object[] { + "default", + "scientific", + "auto"}); + this.comboBoxFloatsFormat.Location = new System.Drawing.Point(182, 119); + this.comboBoxFloatsFormat.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxFloatsFormat.Name = "comboBoxFloatsFormat"; + this.comboBoxFloatsFormat.Size = new System.Drawing.Size(108, 24); + this.comboBoxFloatsFormat.TabIndex = 28; + // + // labelFloatsFormat + // + this.labelFloatsFormat.AutoSize = true; + this.labelFloatsFormat.Location = new System.Drawing.Point(66, 122); + this.labelFloatsFormat.Name = "labelFloatsFormat"; + this.labelFloatsFormat.Size = new System.Drawing.Size(94, 17); + this.labelFloatsFormat.TabIndex = 27; + this.labelFloatsFormat.Text = "Floats format:"; + // + // checkBoxIndexIncludeFrozen + // + this.checkBoxIndexIncludeFrozen.AutoSize = true; + this.checkBoxIndexIncludeFrozen.Location = new System.Drawing.Point(339, 154); + this.checkBoxIndexIncludeFrozen.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.checkBoxIndexIncludeFrozen.Name = "checkBoxIndexIncludeFrozen"; + this.checkBoxIndexIncludeFrozen.Size = new System.Drawing.Size(175, 21); + this.checkBoxIndexIncludeFrozen.TabIndex = 26; + this.checkBoxIndexIncludeFrozen.Text = "Include frozen indices?"; + this.checkBoxIndexIncludeFrozen.UseVisualStyleBackColor = true; + // + // checkBoxMultiFieldLenient + // + this.checkBoxMultiFieldLenient.AutoSize = true; + this.checkBoxMultiFieldLenient.Checked = true; + this.checkBoxMultiFieldLenient.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxMultiFieldLenient.Location = new System.Drawing.Point(339, 119); + this.checkBoxMultiFieldLenient.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.checkBoxMultiFieldLenient.Name = "checkBoxMultiFieldLenient"; + this.checkBoxMultiFieldLenient.Size = new System.Drawing.Size(181, 21); + this.checkBoxMultiFieldLenient.TabIndex = 25; + this.checkBoxMultiFieldLenient.Text = "Multi value field lenient?"; + this.checkBoxMultiFieldLenient.UseVisualStyleBackColor = true; + // + // checkBoxApplyTZ + // + this.checkBoxApplyTZ.AutoSize = true; + this.checkBoxApplyTZ.Location = new System.Drawing.Point(339, 53); + this.checkBoxApplyTZ.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.checkBoxApplyTZ.Name = "checkBoxApplyTZ"; + this.checkBoxApplyTZ.Size = new System.Drawing.Size(157, 21); + this.checkBoxApplyTZ.TabIndex = 24; + this.checkBoxApplyTZ.Text = "Use local timezone?"; + this.checkBoxApplyTZ.UseVisualStyleBackColor = true; + // + // checkBoxFollowRedirects + // + this.checkBoxFollowRedirects.AutoSize = true; + this.checkBoxFollowRedirects.Checked = true; + this.checkBoxFollowRedirects.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxFollowRedirects.Location = new System.Drawing.Point(339, 20); + this.checkBoxFollowRedirects.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.checkBoxFollowRedirects.Name = "checkBoxFollowRedirects"; + this.checkBoxFollowRedirects.Size = new System.Drawing.Size(177, 21); + this.checkBoxFollowRedirects.TabIndex = 23; + this.checkBoxFollowRedirects.Text = "Follow HTTP redirects?"; + this.checkBoxFollowRedirects.UseVisualStyleBackColor = true; + // + // labelBodySize + // + this.labelBodySize.AutoSize = true; + this.labelBodySize.Location = new System.Drawing.Point(24, 88); + this.labelBodySize.Name = "labelBodySize"; + this.labelBodySize.Size = new System.Drawing.Size(150, 17); + this.labelBodySize.TabIndex = 10; + this.labelBodySize.Text = "Max page lenght (MB):"; + // + // numericUpDownBodySize + // + this.numericUpDownBodySize.Location = new System.Drawing.Point(182, 86); + this.numericUpDownBodySize.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.numericUpDownBodySize.Name = "numericUpDownBodySize"; + this.numericUpDownBodySize.Size = new System.Drawing.Size(104, 22); + this.numericUpDownBodySize.TabIndex = 11; + this.numericUpDownBodySize.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // labelFetchSize + // + this.labelFetchSize.AutoSize = true; + this.labelFetchSize.Location = new System.Drawing.Point(24, 53); + this.labelFetchSize.Name = "labelFetchSize"; + this.labelFetchSize.Size = new System.Drawing.Size(145, 17); + this.labelFetchSize.TabIndex = 8; + this.labelFetchSize.Text = "Max page size (rows):"; + // + // numericUpDownFetchSize + // + this.numericUpDownFetchSize.Increment = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownFetchSize.Location = new System.Drawing.Point(182, 51); + this.numericUpDownFetchSize.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.numericUpDownFetchSize.Name = "numericUpDownFetchSize"; + this.numericUpDownFetchSize.Size = new System.Drawing.Size(104, 22); + this.numericUpDownFetchSize.TabIndex = 9; + this.numericUpDownFetchSize.Value = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + // + // labelTimeout + // + this.labelTimeout.AutoSize = true; + this.labelTimeout.Location = new System.Drawing.Point(24, 20); + this.labelTimeout.Name = "labelTimeout"; + this.labelTimeout.Size = new System.Drawing.Size(136, 17); + this.labelTimeout.TabIndex = 6; + this.labelTimeout.Text = "Request timeout (s):"; + // + // numericUpDownTimeout + // + this.numericUpDownTimeout.Location = new System.Drawing.Point(182, 18); + this.numericUpDownTimeout.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.numericUpDownTimeout.Name = "numericUpDownTimeout"; + this.numericUpDownTimeout.Size = new System.Drawing.Size(104, 22); + this.numericUpDownTimeout.TabIndex = 7; + // // DsnEditorForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -549,6 +762,11 @@ private void InitializeComponent() this.pageSecurity.PerformLayout(); this.pageLogging.ResumeLayout(false); this.pageLogging.PerformLayout(); + this.pageMisc.ResumeLayout(false); + this.pageMisc.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownBodySize)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFetchSize)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeout)).EndInit(); this.ResumeLayout(false); } @@ -609,6 +827,29 @@ private void InitializeComponent() private System.Windows.Forms.ToolTip toolTipLoggingEnabled; private System.Windows.Forms.ToolTip toolTipLogLevel; private System.Windows.Forms.TextBox textDescription; + private System.Windows.Forms.TabPage pageMisc; + private System.Windows.Forms.Label labelTimeout; + private System.Windows.Forms.NumericUpDown numericUpDownTimeout; + private System.Windows.Forms.Label labelFetchSize; + private System.Windows.Forms.NumericUpDown numericUpDownFetchSize; + private System.Windows.Forms.Label labelBodySize; + private System.Windows.Forms.NumericUpDown numericUpDownBodySize; + private System.Windows.Forms.CheckBox checkBoxIndexIncludeFrozen; + private System.Windows.Forms.CheckBox checkBoxMultiFieldLenient; + private System.Windows.Forms.CheckBox checkBoxApplyTZ; + private System.Windows.Forms.CheckBox checkBoxFollowRedirects; + private System.Windows.Forms.ComboBox comboBoxFloatsFormat; + private System.Windows.Forms.Label labelFloatsFormat; + private System.Windows.Forms.CheckBox checkBoxAutoEscapePVA; + private System.Windows.Forms.ToolTip toolTipTimeout; + private System.Windows.Forms.ToolTip toolTipFetchSize; + private System.Windows.Forms.ToolTip toolTipBodySize; + private System.Windows.Forms.ToolTip toolTipFloatsFormat; + private System.Windows.Forms.ToolTip toolTipFollowRedirects; + private System.Windows.Forms.ToolTip toolTipApplyTZ; + private System.Windows.Forms.ToolTip toolTipAutoEscapePVA; + private System.Windows.Forms.ToolTip toolTipMultiFieldLenient; + private System.Windows.Forms.ToolTip toolTipIndexIncludeFrozen; } } diff --git a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs index 58c3f796..b61d869f 100644 --- a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs +++ b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs @@ -8,6 +8,7 @@ using System.Data.Odbc; using System.Windows.Forms; using System.IO; +using System.Linq; // uncomment to have the assembly loading to ask for (various) resources; various solutions: // https://stackoverflow.com/questions/4368201/appdomain-currentdomain-assemblyresolve-asking-for-a-appname-resources-assembl @@ -151,6 +152,29 @@ public DsnEditorForm( toolTipLogDirectoryPath.SetToolTip(textLogDirectoryPath, "Specify which directory to write the log files in."); toolTipLogLevel.SetToolTip(comboLogLevel, "Configure the verbosity of the logs."); + // Logging Panel + numericUpDownTimeout.Text = Builder.ContainsKey("Timeout") ? Builder["Timeout"].ToString().StripBraces() : "0"; + numericUpDownFetchSize.Text = Builder.ContainsKey("MaxFetchSize") ? Builder["MaxFetchSize"].ToString().StripBraces() : "1000"; + numericUpDownBodySize.Text = Builder.ContainsKey("MaxBodySizeMB") ? Builder["MaxBodySizeMB"].ToString().StripBraces() : "100"; + comboBoxFloatsFormat.Text = Builder.ContainsKey("ScientificFloats") ? Builder["ScientificFloats"].ToString().StripBraces() : "default"; + + string[] noes = {"no", "false", "0"}; + checkBoxFollowRedirects.Checked = !noes.Contains(Builder.ContainsKey("Follow") ? Builder["Follow"].ToString().StripBraces() : "yes"); + checkBoxApplyTZ.Checked = !noes.Contains(Builder.ContainsKey("ApplyTZ") ? Builder["ApplyTZ"].ToString().StripBraces() : "no"); + checkBoxAutoEscapePVA.Checked = !noes.Contains(Builder.ContainsKey("AutoEscapePVA") ? Builder["AutoEscapePVA"].ToString().StripBraces() : "yes"); + checkBoxMultiFieldLenient.Checked = !noes.Contains(Builder.ContainsKey("MultiFieldLenient") ? Builder["MultiFieldLenient"].ToString().StripBraces() : "yes"); + checkBoxIndexIncludeFrozen.Checked = !noes.Contains(Builder.ContainsKey("IndexIncludeFrozen") ? Builder["IndexIncludeFrozen"].ToString().StripBraces() : "no"); + + toolTipTimeout.SetToolTip(numericUpDownTimeout, "The maximum number of seconds a request to the server can take. The value 0 disables disables the timeout."); + toolTipFetchSize.SetToolTip(numericUpDownFetchSize, "The maximum number of rows that Elasticsearch SQL server should send the driver for one page."); + toolTipBodySize.SetToolTip(numericUpDownBodySize, "The maximum number of megabytes that the driver will accept for one page."); + toolTipFloatsFormat.SetToolTip(comboBoxFloatsFormat, "How should the floating point numbers be printed, when these are converted to string by the driver."); + toolTipFollowRedirects.SetToolTip(checkBoxFollowRedirects, "Should the driver follow HTTP redirects of the requests to the server?"); + toolTipApplyTZ.SetToolTip(checkBoxApplyTZ, "Should the driver use machine's local timezone? The default is UTC."); + toolTipAutoEscapePVA.SetToolTip(checkBoxAutoEscapePVA, "Should the driver auto-escape the pattern-value arguments?"); + toolTipMultiFieldLenient.SetToolTip(checkBoxMultiFieldLenient, "Should the server return one value out of a multi-value field (instead of rejecting the request)?"); + toolTipIndexIncludeFrozen.SetToolTip(checkBoxIndexIncludeFrozen, "Should the server consider the frozen indices when servicing a request?"); + // Set initial state of action buttons. EnableDisableActionButtons(); } @@ -251,6 +275,17 @@ private bool RebuildAndValidateDsn() Builder["tracelevel"] = comboLogLevel.Text; Builder["traceenabled"] = checkLoggingEnabled.Checked ? "1" : "0"; + // Misc Panel + Builder["Timeout"] = numericUpDownTimeout.Text; + Builder["MaxFetchSize"] = numericUpDownFetchSize.Text; + Builder["MaxBodySizeMB"] = numericUpDownBodySize.Text; + Builder["ScientificFloats"] = comboBoxFloatsFormat.Text; + Builder["Follow"] = checkBoxFollowRedirects.Checked ? "true" : "false"; + Builder["ApplyTZ"] = checkBoxApplyTZ.Checked ? "true" : "false"; + Builder["AutoEscapePVA"] = checkBoxAutoEscapePVA.Checked ? "true" : "false"; + Builder["MultiFieldLenient"] = checkBoxMultiFieldLenient.Checked ? "true" : "false"; + Builder["IndexIncludeFrozen"] = checkBoxIndexIncludeFrozen.Checked ? "true" : "false"; + // Validations var keynameOK = true; var certificateFileOK = true; diff --git a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.resx b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.resx index 667cc5d2..d817fb82 100644 --- a/dsneditor/EsOdbcDsnEditor/DSNEditorForm.resx +++ b/dsneditor/EsOdbcDsnEditor/DSNEditorForm.resx @@ -2807,6 +2807,33 @@ 17, 161 + + 341, 161 + + + 454, 161 + + + 619, 163 + + + 774, 165 + + + 960, 162 + + + 31, 212 + + + 187, 214 + + + 399, 213 + + + 617, 213 + 314