From 3ce8711af3aef95387d2e4261ff45bba346964fc Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Tue, 13 Jul 2021 15:09:02 +0800 Subject: [PATCH 1/4] Fixes #100 Use pull-secret API --- CRCTray.cs | 16 ++++------- Communication/DaemonCommander.cs | 46 +++++++++++++++++++++++++++++--- Communication/Enums.cs | 2 ++ Communication/Exceptions.cs | 6 +++++ Helpers/Handlers.cs | 10 +++++++ 5 files changed, 65 insertions(+), 15 deletions(-) diff --git a/CRCTray.cs b/CRCTray.cs index c870e25..2e925a6 100755 --- a/CRCTray.cs +++ b/CRCTray.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; using System.Collections.Generic; +using System.IO; using CRCTray.Communication; using CRCTray.Helpers; @@ -228,19 +229,12 @@ await TaskHelpers.TryTaskAndNotify(TaskHandlers.Stop, async private void StartMenu_Click(object sender, EventArgs e) { // Check using get-config if pullSecret is configured - var configs = await TaskHelpers.TryTaskAndNotify(TaskHandlers.ConfigView, + var pullsecret = await TaskHelpers.TryTaskAndNotify(TaskHandlers.GetPullSecret, String.Empty, String.Empty, String.Empty); - if(configs == null) - { - // no config was returned, does this mean a communication error? - TrayIcon.NotifyError("Unable to read configuration. Is the CRC daemon running?"); - return; - } - - if (configs != null && configs.Configs.PullSecretFile == String.Empty) + if (!pullsecret) { var pullSecretForm = new PullSecretPickerForm(); var pullSecretPath = pullSecretForm.ShowFilePicker(); @@ -254,13 +248,13 @@ async private void StartMenu_Click(object sender, EventArgs e) ["pull-secret-file"] = pullSecretPath }; - await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetConfig, pullSecretConfig, + string data = File.ReadAllText(pullSecretPath); + await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, data, "Pull Secret stored", "Pull Secret not stored", String.Empty); } - TrayIcon.NotifyInfo(@"Starting Cluster"); var startResult = await TaskHelpers.TryTaskAndNotify(TaskHandlers.Start, diff --git a/Communication/DaemonCommander.cs b/Communication/DaemonCommander.cs index 86d4ef4..5deca9d 100755 --- a/Communication/DaemonCommander.cs +++ b/Communication/DaemonCommander.cs @@ -81,6 +81,38 @@ public static LogsResult GetLogs() return getResultsForBasicCommand(BasicCommands.Logs); } + public static bool GetPullSecret() + { + try + { + // On success the API returns 200 but no value. + getResultsForBasicCommand(BasicCommands.PullSecret); + return true; + } + + catch (AggregateException ae) + { + ae.Handle((x) => + { + if (x is NotFoundException) // This we know how to handle. + { + // Marking as handled + return true; + } + + return false; + }); + + return false; + } + } + + public static bool SetPullSecret(string data) + { + var result = postResponse(BasicCommands.PullSecret, data, 30); + return true; + } + private static string SendBasicCommand(string command, int timeout) { return getResponse(command, timeout).Result; @@ -103,9 +135,12 @@ private static async Task postResponse(string cmd, string content, int t body = await response.Content.ReadAsStringAsync(); - if (response.StatusCode == HttpStatusCode.InternalServerError) + switch (response.StatusCode) { - throw new APIException(body); + case HttpStatusCode.InternalServerError: + throw new APIException(body); + case HttpStatusCode.NotFound: + throw new NotFoundException(body); } } catch (TimeoutException e) @@ -134,9 +169,12 @@ private static async Task getResponse(string cmd, int timeout) HttpResponseMessage response = await httpClient.GetAsync(command); body = await response.Content.ReadAsStringAsync(); - if (response.StatusCode == HttpStatusCode.InternalServerError) + switch (response.StatusCode) { - throw new APIException(body); + case HttpStatusCode.InternalServerError: + throw new APIException(body); + case HttpStatusCode.NotFound: + throw new NotFoundException(body); } } catch (TimeoutException e) diff --git a/Communication/Enums.cs b/Communication/Enums.cs index 2e9f967..2c6e163 100755 --- a/Communication/Enums.cs +++ b/Communication/Enums.cs @@ -14,5 +14,7 @@ static class BasicCommands internal const string ConfigSet = "config/set"; internal const string ConfigUnset = "config/unset"; internal const string Logs = "logs"; + + internal const string PullSecret = "pull-secret"; } } \ No newline at end of file diff --git a/Communication/Exceptions.cs b/Communication/Exceptions.cs index 67736b4..e383000 100755 --- a/Communication/Exceptions.cs +++ b/Communication/Exceptions.cs @@ -2,6 +2,12 @@ namespace CRCTray.Communication { + internal class NotFoundException : Exception + { + public NotFoundException(string message) : base(message) { } + + } + internal class APIException : Exception { public APIException(string message) : base(message) { } diff --git a/Helpers/Handlers.cs b/Helpers/Handlers.cs index 9980512..30f70fa 100755 --- a/Helpers/Handlers.cs +++ b/Helpers/Handlers.cs @@ -126,6 +126,16 @@ public static SetUnsetConfig UnsetConfig(List cfg) return getTypedResults(DaemonCommander.UnsetConfig, config); } + public static bool GetPullSecret() + { + return getTypedResults(DaemonCommander.GetPullSecret); + } + + public static bool SetPullSecret(string data) + { + return getTypedResults(DaemonCommander.SetPullSecret, data); + } + public static ConsoleResult LoginForDeveloper() { return WebConsole(); From 987cbc538adeb2ea57c77aa49610fda8a3812b0a Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Tue, 13 Jul 2021 17:05:05 +0800 Subject: [PATCH 2/4] Fixes #99 Adds copy-paste dialog for pull-secret --- CRCTray.cs | 14 +- Forms/PullSecretForm.Designer.cs | 96 +++++++++++ Forms/PullSecretForm.cs | 42 +++++ ...retPickerForm.resx => PullSecretForm.resx} | 0 Forms/PullSecretPickerForm.Designer.cs | 156 ------------------ Forms/PullSecretPickerForm.cs | 65 -------- crc-tray.csproj | 10 +- 7 files changed, 148 insertions(+), 235 deletions(-) create mode 100755 Forms/PullSecretForm.Designer.cs create mode 100755 Forms/PullSecretForm.cs rename Forms/{PullSecretPickerForm.resx => PullSecretForm.resx} (100%) delete mode 100755 Forms/PullSecretPickerForm.Designer.cs delete mode 100755 Forms/PullSecretPickerForm.cs diff --git a/CRCTray.cs b/CRCTray.cs index 2e925a6..4bea374 100755 --- a/CRCTray.cs +++ b/CRCTray.cs @@ -236,20 +236,16 @@ async private void StartMenu_Click(object sender, EventArgs e) if (!pullsecret) { - var pullSecretForm = new PullSecretPickerForm(); - var pullSecretPath = pullSecretForm.ShowFilePicker(); - if (pullSecretPath == String.Empty) + var pullSecretForm = new PullSecretForm(); + pullSecretForm.ShowDialog(); + var pullSecretContent = pullSecretForm.PullSecret; + if (pullSecretContent == String.Empty) { TrayIcon.NotifyWarn(@"No Pull Secret was provided, Cannot start cluster without pull secret."); return; } - Dictionary pullSecretConfig = new Dictionary - { - ["pull-secret-file"] = pullSecretPath - }; - string data = File.ReadAllText(pullSecretPath); - await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, data, + await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, pullSecretContent, "Pull Secret stored", "Pull Secret not stored", String.Empty); diff --git a/Forms/PullSecretForm.Designer.cs b/Forms/PullSecretForm.Designer.cs new file mode 100755 index 0000000..226e7dc --- /dev/null +++ b/Forms/PullSecretForm.Designer.cs @@ -0,0 +1,96 @@ + +namespace CRCTray +{ + partial class PullSecretForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.okButton = new System.Windows.Forms.Button(); + this.browseFile = new System.Windows.Forms.OpenFileDialog(); + this.label1 = new System.Windows.Forms.Label(); + this.pullSecreTextbox = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // okButton + // + this.okButton.Location = new System.Drawing.Point(370, 305); + this.okButton.Margin = new System.Windows.Forms.Padding(2); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(58, 20); + this.okButton.TabIndex = 5; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 10); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(286, 30); + this.label1.TabIndex = 6; + this.label1.Text = "Please paste here the pull secret to start the cluster.\r\n It will be saved in the" + + " secure store."; + // + // pullSecreTextbox + // + this.pullSecreTextbox.Location = new System.Drawing.Point(15, 43); + this.pullSecreTextbox.Multiline = true; + this.pullSecreTextbox.Name = "pullSecreTextbox"; + this.pullSecreTextbox.Size = new System.Drawing.Size(413, 257); + this.pullSecreTextbox.TabIndex = 7; + // + // PullSecretForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(440, 336); + this.Controls.Add(this.pullSecreTextbox); + this.Controls.Add(this.label1); + this.Controls.Add(this.okButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(2); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PullSecretForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Pull Secret Picker"; + this.Load += new System.EventHandler(this.PullSecretPicker_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.OpenFileDialog browseFile; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox pullSecreTextbox; + } +} \ No newline at end of file diff --git a/Forms/PullSecretForm.cs b/Forms/PullSecretForm.cs new file mode 100755 index 0000000..74b5b2d --- /dev/null +++ b/Forms/PullSecretForm.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using CRCTray.Helpers; + +namespace CRCTray +{ + public partial class PullSecretForm : Form + { + + public PullSecretForm() + { + InitializeComponent(); + + PullSecret = String.Empty; + } + + private void PullSecretPicker_Load(object sender, EventArgs e) + { + Bitmap bm = new Bitmap(Resource.ocp_logo); + Icon = Icon.FromHandle(bm.GetHicon()); + } + + public String PullSecret + { + get; + set; + } + + private void okButton_Click(object sender, EventArgs e) + { + PullSecret = pullSecreTextbox.Text; + Hide(); + } + } +} diff --git a/Forms/PullSecretPickerForm.resx b/Forms/PullSecretForm.resx similarity index 100% rename from Forms/PullSecretPickerForm.resx rename to Forms/PullSecretForm.resx diff --git a/Forms/PullSecretPickerForm.Designer.cs b/Forms/PullSecretPickerForm.Designer.cs deleted file mode 100755 index 4ab5c10..0000000 --- a/Forms/PullSecretPickerForm.Designer.cs +++ /dev/null @@ -1,156 +0,0 @@ - -namespace CRCTray -{ - partial class PullSecretPickerForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.pullSecretPathTextField = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.BrowseButton = new System.Windows.Forms.Button(); - this.okButton = new System.Windows.Forms.Button(); - this.browseFile = new System.Windows.Forms.OpenFileDialog(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(3, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(236, 18); - this.label1.TabIndex = 0; - this.label1.Text = "Please select the pull secret to use"; - // - // pullSecretPathTextField - // - this.pullSecretPathTextField.Location = new System.Drawing.Point(3, 35); - this.pullSecretPathTextField.Name = "pullSecretPathTextField"; - this.pullSecretPathTextField.ReadOnly = true; - this.pullSecretPathTextField.Size = new System.Drawing.Size(440, 22); - this.pullSecretPathTextField.TabIndex = 1; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(15, 103); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(150, 17); - this.label2.TabIndex = 2; - this.label2.Text = "Pull secret available at"; - // - // linkLabel1 - // - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(160, 103); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(256, 17); - this.linkLabel1.TabIndex = 3; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "cloud.redhat.com/openshift/create/local"; - this.linkLabel1.LinkClicked += - new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); - // - // BrowseButton - // - this.BrowseButton.Location = new System.Drawing.Point(450, 35); - this.BrowseButton.Name = "BrowseButton"; - this.BrowseButton.Size = new System.Drawing.Size(73, 26); - this.BrowseButton.TabIndex = 4; - this.BrowseButton.Text = "Browse"; - this.BrowseButton.UseVisualStyleBackColor = true; - this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click); - // - // okButton - // - this.okButton.Location = new System.Drawing.Point(462, 103); - this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(73, 25); - this.okButton.TabIndex = 5; - this.okButton.Text = "OK"; - this.okButton.UseVisualStyleBackColor = true; - this.okButton.Click += new System.EventHandler(this.okButton_Click); - // - // browseFile - // - this.browseFile.InitialDirectory = "$env:USERPROFILE"; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 85F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F)); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.pullSecretPathTextField, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.BrowseButton, 1, 1); - this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(526, 64); - this.tableLayoutPanel1.TabIndex = 6; - // - // PullSecretPickerForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(550, 143); - this.Controls.Add(this.okButton); - this.Controls.Add(this.tableLayoutPanel1); - this.Controls.Add(this.linkLabel1); - this.Controls.Add(this.label2); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PullSecretPickerForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Pull Secret Picker"; - this.Load += new System.EventHandler(this.PullSecretPicker_Load); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox pullSecretPathTextField; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.Button BrowseButton; - private System.Windows.Forms.Button okButton; - private System.Windows.Forms.OpenFileDialog browseFile; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - } -} \ No newline at end of file diff --git a/Forms/PullSecretPickerForm.cs b/Forms/PullSecretPickerForm.cs deleted file mode 100755 index 8ab15d0..0000000 --- a/Forms/PullSecretPickerForm.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using CRCTray.Helpers; - -namespace CRCTray -{ - public partial class PullSecretPickerForm : Form - { - string pullSecretPath = ""; - public PullSecretPickerForm() - { - InitializeComponent(); - } - - private void PullSecretPicker_Load(object sender, EventArgs e) - { - Bitmap bm = new Bitmap(Resource.ocp_logo); - Icon = Icon.FromHandle(bm.GetHicon()); - } - - private void BrowseButton_Click(object sender, EventArgs e) - { - browseFile.ShowDialog(); - if (browseFile.FileName != "") - { - pullSecretPath = browseFile.FileName; - pullSecretPathTextField.Text = pullSecretPath; - } - - Console.WriteLine("Selected file: {0}", pullSecretPath); - } - - public String ShowFilePicker() - { - base.ShowDialog(); - return pullSecretPath; - } - - private void okButton_Click(object sender, EventArgs e) - { - Hide(); - } - - private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - const String url = "https://cloud.redhat.com/openshift/create/local"; - try - { - linkLabel1.LinkVisited = true; - System.Diagnostics.Process.Start(url); - } - catch (Exception ex) - { - TrayIcon.NotifyWarn(string.Format("Cannot open URL in default browser {0}", ex.ToString())); - } - } - } -} diff --git a/crc-tray.csproj b/crc-tray.csproj index 95b791e..e752017 100755 --- a/crc-tray.csproj +++ b/crc-tray.csproj @@ -249,11 +249,11 @@ AboutForm.cs - + Form - - PullSecretPickerForm.cs + + PullSecretForm.cs @@ -287,8 +287,8 @@ CrcSettingsForm.cs - - PullSecretPickerForm.cs + + PullSecretForm.cs StatusForm.cs From fe84c7259255a330f979cf3818ce125f0ea8ab08 Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Tue, 20 Jul 2021 13:57:05 +0800 Subject: [PATCH 3/4] Refactor; rename exceptions --- Communication/DaemonCommander.cs | 10 +++++----- Communication/Exceptions.cs | 12 ++++++------ Helpers/TaskHelpers.cs | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Communication/DaemonCommander.cs b/Communication/DaemonCommander.cs index 5deca9d..5228230 100755 --- a/Communication/DaemonCommander.cs +++ b/Communication/DaemonCommander.cs @@ -94,7 +94,7 @@ public static bool GetPullSecret() { ae.Handle((x) => { - if (x is NotFoundException) // This we know how to handle. + if (x is APINotFoundException) // This we know how to handle. { // Marking as handled return true; @@ -140,12 +140,12 @@ private static async Task postResponse(string cmd, string content, int t case HttpStatusCode.InternalServerError: throw new APIException(body); case HttpStatusCode.NotFound: - throw new NotFoundException(body); + throw new APINotFoundException(body); } } catch (TimeoutException e) { - throw new CommunicationException(e.Message); + throw new APICommunicationException(e.Message); } catch (Exception e) { @@ -174,12 +174,12 @@ private static async Task getResponse(string cmd, int timeout) case HttpStatusCode.InternalServerError: throw new APIException(body); case HttpStatusCode.NotFound: - throw new NotFoundException(body); + throw new APINotFoundException(body); } } catch (TimeoutException e) { - throw new CommunicationException(e.Message); + throw new APICommunicationException(e.Message); } catch (Exception e) { diff --git a/Communication/Exceptions.cs b/Communication/Exceptions.cs index e383000..e9c5f13 100755 --- a/Communication/Exceptions.cs +++ b/Communication/Exceptions.cs @@ -2,21 +2,21 @@ namespace CRCTray.Communication { - internal class NotFoundException : Exception + internal class APIException : Exception { - public NotFoundException(string message) : base(message) { } + public APIException(string message) : base(message) { } } - internal class APIException : Exception + internal class APINotFoundException : Exception { - public APIException(string message) : base(message) { } + public APINotFoundException(string message) : base(message) { } } - internal class CommunicationException : Exception + internal class APICommunicationException : Exception { - public CommunicationException(string message) : base(message) { } + public APICommunicationException(string message) : base(message) { } } diff --git a/Helpers/TaskHelpers.cs b/Helpers/TaskHelpers.cs index 919d387..4c92570 100755 --- a/Helpers/TaskHelpers.cs +++ b/Helpers/TaskHelpers.cs @@ -25,7 +25,7 @@ public static async Task TryTaskAndNotify(Func function, string success { ae.Handle((x) => { - if (x is CommunicationException) // This we know how to handle. + if (x is APICommunicationException) // This we know how to handle. { // TODO: start counting and eventually notify @@ -73,7 +73,7 @@ public static async Task TryTaskAndNotify(Func function, { ae.Handle((x) => { - if (x is CommunicationException) // This we know how to handle. + if (x is APICommunicationException) // This we know how to handle. { // TODO: start counting and eventually notify From dfb9bc4e6ff4fbc2e8b4a7817316d7f902c1afb1 Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Tue, 20 Jul 2021 14:20:17 +0800 Subject: [PATCH 4/4] Allow stored pull-secret to be changed --- CRCTray.cs | 2 +- Forms/CrcSettingsForm.Designer.cs | 340 +++++++++++++++--------------- Forms/CrcSettingsForm.cs | 38 +++- 3 files changed, 198 insertions(+), 182 deletions(-) diff --git a/CRCTray.cs b/CRCTray.cs index 4bea374..422febb 100755 --- a/CRCTray.cs +++ b/CRCTray.cs @@ -241,7 +241,7 @@ async private void StartMenu_Click(object sender, EventArgs e) var pullSecretContent = pullSecretForm.PullSecret; if (pullSecretContent == String.Empty) { - TrayIcon.NotifyWarn(@"No Pull Secret was provided, Cannot start cluster without pull secret."); + TrayIcon.NotifyWarn(@"No Pull Secret was provided. Cannot start cluster without pull secret."); return; } diff --git a/Forms/CrcSettingsForm.Designer.cs b/Forms/CrcSettingsForm.Designer.cs index c20ee47..2829eb7 100755 --- a/Forms/CrcSettingsForm.Designer.cs +++ b/Forms/CrcSettingsForm.Designer.cs @@ -53,9 +53,6 @@ private void InitializeComponent() this.cpusNumBox = new System.Windows.Forms.NumericUpDown(); this.label3 = new System.Windows.Forms.Label(); this.label22 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.pullSecretTxtBox = new System.Windows.Forms.TextBox(); - this.PullSecretSelectButton = new System.Windows.Forms.Button(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.memoryNumBox = new System.Windows.Forms.NumericUpDown(); this.label11 = new System.Windows.Forms.Label(); @@ -79,6 +76,8 @@ private void InitializeComponent() this.SkipCheckUserInHypervAdminsGroup = new System.Windows.Forms.CheckBox(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.fileRequester = new System.Windows.Forms.OpenFileDialog(); + this.label4 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); this.tabs.SuspendLayout(); this.properties_tab.SuspendLayout(); this.tableLayoutPanel6.SuspendLayout(); @@ -104,11 +103,11 @@ private void InitializeComponent() this.tabs.AccessibleName = "Settings tab"; this.tabs.Controls.Add(this.properties_tab); this.tabs.Controls.Add(this.advance_tab); - this.tabs.Location = new System.Drawing.Point(9, 9); - this.tabs.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tabs.Location = new System.Drawing.Point(7, 7); + this.tabs.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tabs.Name = "tabs"; this.tabs.SelectedIndex = 0; - this.tabs.Size = new System.Drawing.Size(628, 460); + this.tabs.Size = new System.Drawing.Size(502, 368); this.tabs.TabIndex = 0; // // properties_tab @@ -116,11 +115,11 @@ private void InitializeComponent() this.properties_tab.Controls.Add(this.tableLayoutPanel6); this.properties_tab.Controls.Add(this.groupBox2); this.properties_tab.Controls.Add(this.groupBox1); - this.properties_tab.Location = new System.Drawing.Point(4, 25); - this.properties_tab.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.properties_tab.Location = new System.Drawing.Point(4, 22); + this.properties_tab.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.properties_tab.Name = "properties_tab"; - this.properties_tab.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.properties_tab.Size = new System.Drawing.Size(620, 431); + this.properties_tab.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.properties_tab.Size = new System.Drawing.Size(494, 342); this.properties_tab.TabIndex = 0; this.properties_tab.Text = "Properties"; this.properties_tab.UseVisualStyleBackColor = true; @@ -132,21 +131,21 @@ private void InitializeComponent() this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel6.Controls.Add(this.refreshButton, 0, 0); this.tableLayoutPanel6.Controls.Add(this.applyButton, 1, 0); - this.tableLayoutPanel6.Location = new System.Drawing.Point(423, 387); + this.tableLayoutPanel6.Location = new System.Drawing.Point(338, 310); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel6.Size = new System.Drawing.Size(182, 35); + this.tableLayoutPanel6.Size = new System.Drawing.Size(146, 28); this.tableLayoutPanel6.TabIndex = 16; // // refreshButton // this.refreshButton.AccessibleName = "Refresh button"; - this.refreshButton.Location = new System.Drawing.Point(3, 2); - this.refreshButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.refreshButton.Location = new System.Drawing.Point(2, 2); + this.refreshButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.refreshButton.Name = "refreshButton"; - this.refreshButton.Size = new System.Drawing.Size(85, 28); + this.refreshButton.Size = new System.Drawing.Size(68, 22); this.refreshButton.TabIndex = 14; this.refreshButton.Text = "Refresh"; this.refreshButton.UseVisualStyleBackColor = true; @@ -155,10 +154,10 @@ private void InitializeComponent() // applyButton // this.applyButton.AccessibleName = "Apply button"; - this.applyButton.Location = new System.Drawing.Point(94, 2); - this.applyButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.applyButton.Location = new System.Drawing.Point(75, 2); + this.applyButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.applyButton.Name = "applyButton"; - this.applyButton.Size = new System.Drawing.Size(85, 28); + this.applyButton.Size = new System.Drawing.Size(68, 22); this.applyButton.TabIndex = 15; this.applyButton.Text = "Apply"; this.applyButton.UseVisualStyleBackColor = true; @@ -167,11 +166,11 @@ private void InitializeComponent() // groupBox2 // this.groupBox2.Controls.Add(this.tableLayoutPanel5); - this.groupBox2.Location = new System.Drawing.Point(4, 188); - this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox2.Location = new System.Drawing.Point(3, 150); + this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupBox2.Size = new System.Drawing.Size(607, 180); + this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox2.Size = new System.Drawing.Size(486, 144); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Proxy"; @@ -193,7 +192,8 @@ private void InitializeComponent() this.tableLayoutPanel5.Controls.Add(this.label7, 0, 3); this.tableLayoutPanel5.Controls.Add(this.useProxyTick, 1, 0); this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 17); + this.tableLayoutPanel5.Location = new System.Drawing.Point(2, 15); + this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel5.Name = "tableLayoutPanel5"; this.tableLayoutPanel5.RowCount = 5; this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); @@ -201,16 +201,16 @@ private void InitializeComponent() this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel5.Size = new System.Drawing.Size(601, 161); + this.tableLayoutPanel5.Size = new System.Drawing.Size(482, 127); this.tableLayoutPanel5.TabIndex = 0; // // proxyCABrowseButton // this.proxyCABrowseButton.AccessibleName = "Proxy CA filerequester"; - this.proxyCABrowseButton.Location = new System.Drawing.Point(513, 130); - this.proxyCABrowseButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.proxyCABrowseButton.Location = new System.Drawing.Point(411, 102); + this.proxyCABrowseButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.proxyCABrowseButton.Name = "proxyCABrowseButton"; - this.proxyCABrowseButton.Size = new System.Drawing.Size(85, 28); + this.proxyCABrowseButton.Size = new System.Drawing.Size(68, 22); this.proxyCABrowseButton.TabIndex = 13; this.proxyCABrowseButton.Text = "Select file"; this.proxyCABrowseButton.UseVisualStyleBackColor = true; @@ -221,10 +221,10 @@ private void InitializeComponent() this.proxyCAFileTxtBox.AccessibleName = "Proxy CA file"; this.proxyCAFileTxtBox.Dock = System.Windows.Forms.DockStyle.Fill; this.proxyCAFileTxtBox.Enabled = false; - this.proxyCAFileTxtBox.Location = new System.Drawing.Point(123, 130); - this.proxyCAFileTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.proxyCAFileTxtBox.Location = new System.Drawing.Point(98, 102); + this.proxyCAFileTxtBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.proxyCAFileTxtBox.Name = "proxyCAFileTxtBox"; - this.proxyCAFileTxtBox.Size = new System.Drawing.Size(384, 22); + this.proxyCAFileTxtBox.Size = new System.Drawing.Size(309, 20); this.proxyCAFileTxtBox.TabIndex = 12; this.proxyCAFileTxtBox.TextChanged += new System.EventHandler(this.proxyCAFileTxtBox_TextChanged); // @@ -232,9 +232,10 @@ private void InitializeComponent() // this.label5.AutoSize = true; this.label5.Dock = System.Windows.Forms.DockStyle.Fill; - this.label5.Location = new System.Drawing.Point(3, 32); + this.label5.Location = new System.Drawing.Point(2, 25); + this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(114, 32); + this.label5.Size = new System.Drawing.Size(92, 25); this.label5.TabIndex = 1; this.label5.Text = "HTTP Proxy"; // @@ -243,10 +244,10 @@ private void InitializeComponent() this.httpProxyTxtBox.AccessibleName = "HTTP proxy"; this.httpProxyTxtBox.Dock = System.Windows.Forms.DockStyle.Fill; this.httpProxyTxtBox.Enabled = false; - this.httpProxyTxtBox.Location = new System.Drawing.Point(123, 34); - this.httpProxyTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.httpProxyTxtBox.Location = new System.Drawing.Point(98, 27); + this.httpProxyTxtBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.httpProxyTxtBox.Name = "httpProxyTxtBox"; - this.httpProxyTxtBox.Size = new System.Drawing.Size(384, 22); + this.httpProxyTxtBox.Size = new System.Drawing.Size(309, 20); this.httpProxyTxtBox.TabIndex = 9; this.httpProxyTxtBox.TextChanged += new System.EventHandler(this.httpProxyTxtBox_TextChanged); // @@ -254,9 +255,10 @@ private void InitializeComponent() // this.label6.AutoSize = true; this.label6.Dock = System.Windows.Forms.DockStyle.Fill; - this.label6.Location = new System.Drawing.Point(3, 64); + this.label6.Location = new System.Drawing.Point(2, 50); + this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(114, 32); + this.label6.Size = new System.Drawing.Size(92, 25); this.label6.TabIndex = 3; this.label6.Text = "HTTPS Proxy"; // @@ -264,9 +266,10 @@ private void InitializeComponent() // this.label8.AutoSize = true; this.label8.Dock = System.Windows.Forms.DockStyle.Fill; - this.label8.Location = new System.Drawing.Point(3, 128); + this.label8.Location = new System.Drawing.Point(2, 100); + this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(114, 33); + this.label8.Size = new System.Drawing.Size(92, 27); this.label8.TabIndex = 7; this.label8.Text = "Proxy CA file"; // @@ -275,10 +278,10 @@ private void InitializeComponent() this.httpsProxyTxtBox.AccessibleName = "HTTPS proxy"; this.httpsProxyTxtBox.Dock = System.Windows.Forms.DockStyle.Fill; this.httpsProxyTxtBox.Enabled = false; - this.httpsProxyTxtBox.Location = new System.Drawing.Point(123, 66); - this.httpsProxyTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.httpsProxyTxtBox.Location = new System.Drawing.Point(98, 52); + this.httpsProxyTxtBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.httpsProxyTxtBox.Name = "httpsProxyTxtBox"; - this.httpsProxyTxtBox.Size = new System.Drawing.Size(384, 22); + this.httpsProxyTxtBox.Size = new System.Drawing.Size(309, 20); this.httpsProxyTxtBox.TabIndex = 10; this.httpsProxyTxtBox.TextChanged += new System.EventHandler(this.httpsProxyTxtBox_TextChanged); // @@ -287,10 +290,10 @@ private void InitializeComponent() this.noProxyTxtBox.AccessibleName = "No proxy"; this.noProxyTxtBox.Dock = System.Windows.Forms.DockStyle.Fill; this.noProxyTxtBox.Enabled = false; - this.noProxyTxtBox.Location = new System.Drawing.Point(123, 98); - this.noProxyTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.noProxyTxtBox.Location = new System.Drawing.Point(98, 77); + this.noProxyTxtBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.noProxyTxtBox.Name = "noProxyTxtBox"; - this.noProxyTxtBox.Size = new System.Drawing.Size(384, 22); + this.noProxyTxtBox.Size = new System.Drawing.Size(309, 20); this.noProxyTxtBox.TabIndex = 11; this.noProxyTxtBox.TextChanged += new System.EventHandler(this.noProxyTxtBox_TextChanged); // @@ -298,9 +301,10 @@ private void InitializeComponent() // this.label7.AutoSize = true; this.label7.Dock = System.Windows.Forms.DockStyle.Fill; - this.label7.Location = new System.Drawing.Point(3, 96); + this.label7.Location = new System.Drawing.Point(2, 75); + this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(114, 32); + this.label7.Size = new System.Drawing.Size(92, 25); this.label7.TabIndex = 6; this.label7.Text = "No Proxy(s)"; // @@ -309,10 +313,10 @@ private void InitializeComponent() this.useProxyTick.AccessibleName = "Use proxy"; this.useProxyTick.AutoSize = true; this.useProxyTick.Dock = System.Windows.Forms.DockStyle.Fill; - this.useProxyTick.Location = new System.Drawing.Point(123, 2); - this.useProxyTick.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.useProxyTick.Location = new System.Drawing.Point(98, 2); + this.useProxyTick.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.useProxyTick.Name = "useProxyTick"; - this.useProxyTick.Size = new System.Drawing.Size(384, 28); + this.useProxyTick.Size = new System.Drawing.Size(309, 21); this.useProxyTick.TabIndex = 8; this.useProxyTick.Text = "Use Proxy"; this.useProxyTick.UseVisualStyleBackColor = true; @@ -321,11 +325,11 @@ private void InitializeComponent() // groupBox1 // this.groupBox1.Controls.Add(this.tableLayoutPanel2); - this.groupBox1.Location = new System.Drawing.Point(4, 4); - this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox1.Location = new System.Drawing.Point(3, 3); + this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupBox1.Size = new System.Drawing.Size(607, 180); + this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox1.Size = new System.Drawing.Size(486, 144); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "General"; @@ -333,22 +337,21 @@ private void InitializeComponent() // tableLayoutPanel2 // this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.ColumnCount = 3; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 65F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F)); + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.91701F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80.08298F)); this.tableLayoutPanel2.Controls.Add(this.label2, 0, 0); this.tableLayoutPanel2.Controls.Add(this.consentTelemetryCheckBox, 1, 4); this.tableLayoutPanel2.Controls.Add(this.cpusNumBox, 1, 0); this.tableLayoutPanel2.Controls.Add(this.label3, 0, 1); this.tableLayoutPanel2.Controls.Add(this.label22, 0, 3); this.tableLayoutPanel2.Controls.Add(this.label4, 0, 2); - this.tableLayoutPanel2.Controls.Add(this.pullSecretTxtBox, 1, 2); - this.tableLayoutPanel2.Controls.Add(this.PullSecretSelectButton, 2, 2); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 1, 1); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 1, 3); + this.tableLayoutPanel2.Controls.Add(this.button1, 1, 2); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 17); + this.tableLayoutPanel2.Location = new System.Drawing.Point(2, 15); + this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 5; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); @@ -356,16 +359,17 @@ private void InitializeComponent() this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(601, 161); + this.tableLayoutPanel2.Size = new System.Drawing.Size(482, 127); this.tableLayoutPanel2.TabIndex = 0; // // label2 // this.label2.AutoSize = true; this.label2.Dock = System.Windows.Forms.DockStyle.Fill; - this.label2.Location = new System.Drawing.Point(3, 0); + this.label2.Location = new System.Drawing.Point(2, 0); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(114, 32); + this.label2.Size = new System.Drawing.Size(92, 25); this.label2.TabIndex = 2; this.label2.Text = "CPUs"; // @@ -373,9 +377,10 @@ private void InitializeComponent() // this.consentTelemetryCheckBox.AutoSize = true; this.consentTelemetryCheckBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.consentTelemetryCheckBox.Location = new System.Drawing.Point(123, 131); + this.consentTelemetryCheckBox.Location = new System.Drawing.Point(98, 102); + this.consentTelemetryCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.consentTelemetryCheckBox.Name = "consentTelemetryCheckBox"; - this.consentTelemetryCheckBox.Size = new System.Drawing.Size(384, 27); + this.consentTelemetryCheckBox.Size = new System.Drawing.Size(382, 23); this.consentTelemetryCheckBox.TabIndex = 17; this.consentTelemetryCheckBox.Text = "Report telemetry to Red Hat"; this.consentTelemetryCheckBox.UseVisualStyleBackColor = true; @@ -385,10 +390,10 @@ private void InitializeComponent() // this.cpusNumBox.AccessibleName = "vCPUs"; this.cpusNumBox.Dock = System.Windows.Forms.DockStyle.Left; - this.cpusNumBox.Location = new System.Drawing.Point(123, 2); - this.cpusNumBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.cpusNumBox.Location = new System.Drawing.Point(98, 2); + this.cpusNumBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.cpusNumBox.Name = "cpusNumBox"; - this.cpusNumBox.Size = new System.Drawing.Size(87, 22); + this.cpusNumBox.Size = new System.Drawing.Size(70, 20); this.cpusNumBox.TabIndex = 3; this.cpusNumBox.Value = new decimal(new int[] { 4, @@ -401,9 +406,10 @@ private void InitializeComponent() // this.label3.AutoSize = true; this.label3.Dock = System.Windows.Forms.DockStyle.Fill; - this.label3.Location = new System.Drawing.Point(3, 32); + this.label3.Location = new System.Drawing.Point(2, 25); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(114, 32); + this.label3.Size = new System.Drawing.Size(92, 25); this.label3.TabIndex = 4; this.label3.Text = "Memory"; // @@ -411,46 +417,13 @@ private void InitializeComponent() // this.label22.AutoSize = true; this.label22.Dock = System.Windows.Forms.DockStyle.Fill; - this.label22.Location = new System.Drawing.Point(3, 96); + this.label22.Location = new System.Drawing.Point(2, 75); + this.label22.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label22.Name = "label22"; - this.label22.Size = new System.Drawing.Size(114, 32); + this.label22.Size = new System.Drawing.Size(92, 25); this.label22.TabIndex = 15; this.label22.Text = "Disk Size"; // - // label4 - // - this.label4.AutoSize = true; - this.label4.Dock = System.Windows.Forms.DockStyle.Fill; - this.label4.Location = new System.Drawing.Point(3, 64); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(114, 32); - this.label4.TabIndex = 7; - this.label4.Text = "Pull secret file"; - // - // pullSecretTxtBox - // - this.pullSecretTxtBox.AccessibleName = "PullSecret location"; - this.pullSecretTxtBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pullSecretTxtBox.Location = new System.Drawing.Point(123, 66); - this.pullSecretTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.pullSecretTxtBox.Name = "pullSecretTxtBox"; - this.pullSecretTxtBox.Size = new System.Drawing.Size(384, 22); - this.pullSecretTxtBox.TabIndex = 5; - this.pullSecretTxtBox.TextChanged += new System.EventHandler(this.pullSecretTxtBox_TextChanged); - // - // PullSecretSelectButton - // - this.PullSecretSelectButton.AccessibleName = "PullSecret filerequester"; - this.PullSecretSelectButton.Dock = System.Windows.Forms.DockStyle.Fill; - this.PullSecretSelectButton.Location = new System.Drawing.Point(513, 66); - this.PullSecretSelectButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.PullSecretSelectButton.Name = "PullSecretSelectButton"; - this.PullSecretSelectButton.Size = new System.Drawing.Size(85, 28); - this.PullSecretSelectButton.TabIndex = 6; - this.PullSecretSelectButton.Text = "Select file"; - this.PullSecretSelectButton.UseVisualStyleBackColor = true; - this.PullSecretSelectButton.Click += new System.EventHandler(this.PullSecretSelectButton_Click); - // // tableLayoutPanel3 // this.tableLayoutPanel3.ColumnCount = 2; @@ -459,11 +432,12 @@ private void InitializeComponent() this.tableLayoutPanel3.Controls.Add(this.memoryNumBox, 0, 0); this.tableLayoutPanel3.Controls.Add(this.label11, 1, 0); this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Left; - this.tableLayoutPanel3.Location = new System.Drawing.Point(123, 35); + this.tableLayoutPanel3.Location = new System.Drawing.Point(98, 27); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(134, 26); + this.tableLayoutPanel3.Size = new System.Drawing.Size(107, 21); this.tableLayoutPanel3.TabIndex = 18; // // memoryNumBox @@ -478,7 +452,7 @@ private void InitializeComponent() 0, 0}); this.memoryNumBox.Name = "memoryNumBox"; - this.memoryNumBox.Size = new System.Drawing.Size(87, 22); + this.memoryNumBox.Size = new System.Drawing.Size(70, 20); this.memoryNumBox.TabIndex = 4; this.memoryNumBox.Value = new decimal(new int[] { 9126, @@ -490,11 +464,11 @@ private void InitializeComponent() // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(93, 0); + this.label11.Location = new System.Drawing.Point(74, 0); this.label11.Margin = new System.Windows.Forms.Padding(0); this.label11.Name = "label11"; - this.label11.Padding = new System.Windows.Forms.Padding(3); - this.label11.Size = new System.Drawing.Size(34, 23); + this.label11.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.label11.Size = new System.Drawing.Size(27, 17); this.label11.TabIndex = 11; this.label11.Text = "MB"; // @@ -506,33 +480,33 @@ private void InitializeComponent() this.tableLayoutPanel4.Controls.Add(this.diskSizeNumBox, 0, 0); this.tableLayoutPanel4.Controls.Add(this.label23, 1, 0); this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Left; - this.tableLayoutPanel4.Location = new System.Drawing.Point(120, 96); + this.tableLayoutPanel4.Location = new System.Drawing.Point(96, 75); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 1; this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel4.Size = new System.Drawing.Size(137, 32); + this.tableLayoutPanel4.Size = new System.Drawing.Size(110, 25); this.tableLayoutPanel4.TabIndex = 19; // // diskSizeNumBox // this.diskSizeNumBox.AccessibleName = "Disk size"; this.diskSizeNumBox.Dock = System.Windows.Forms.DockStyle.Left; - this.diskSizeNumBox.Location = new System.Drawing.Point(3, 2); - this.diskSizeNumBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.diskSizeNumBox.Location = new System.Drawing.Point(2, 2); + this.diskSizeNumBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.diskSizeNumBox.Name = "diskSizeNumBox"; - this.diskSizeNumBox.Size = new System.Drawing.Size(89, 22); + this.diskSizeNumBox.Size = new System.Drawing.Size(71, 20); this.diskSizeNumBox.TabIndex = 7; this.diskSizeNumBox.ValueChanged += new System.EventHandler(this.diskSizeNumBox_ValueChanged); // // label23 // this.label23.AutoSize = true; - this.label23.Location = new System.Drawing.Point(95, 0); + this.label23.Location = new System.Drawing.Point(77, 0); this.label23.Margin = new System.Windows.Forms.Padding(0); this.label23.Name = "label23"; - this.label23.Padding = new System.Windows.Forms.Padding(3); - this.label23.Size = new System.Drawing.Size(34, 23); + this.label23.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.label23.Size = new System.Drawing.Size(26, 17); this.label23.TabIndex = 16; this.label23.Text = "GB"; // @@ -541,11 +515,11 @@ private void InitializeComponent() this.advance_tab.Controls.Add(this.tableLayoutPanel8); this.advance_tab.Controls.Add(this.groupBox4); this.advance_tab.Controls.Add(this.groupBox3); - this.advance_tab.Location = new System.Drawing.Point(4, 25); - this.advance_tab.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.advance_tab.Location = new System.Drawing.Point(4, 22); + this.advance_tab.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.advance_tab.Name = "advance_tab"; - this.advance_tab.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.advance_tab.Size = new System.Drawing.Size(620, 431); + this.advance_tab.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.advance_tab.Size = new System.Drawing.Size(494, 342); this.advance_tab.TabIndex = 1; this.advance_tab.Text = "Advanced"; this.advance_tab.UseVisualStyleBackColor = true; @@ -557,20 +531,21 @@ private void InitializeComponent() this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel8.Controls.Add(this.refreshButton2, 0, 0); this.tableLayoutPanel8.Controls.Add(this.applyButton2, 1, 0); - this.tableLayoutPanel8.Location = new System.Drawing.Point(430, 283); + this.tableLayoutPanel8.Location = new System.Drawing.Point(344, 226); + this.tableLayoutPanel8.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel8.Name = "tableLayoutPanel8"; this.tableLayoutPanel8.RowCount = 1; this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel8.Size = new System.Drawing.Size(182, 35); + this.tableLayoutPanel8.Size = new System.Drawing.Size(146, 28); this.tableLayoutPanel8.TabIndex = 24; // // refreshButton2 // this.refreshButton2.AccessibleName = "Refresh button"; - this.refreshButton2.Location = new System.Drawing.Point(3, 2); - this.refreshButton2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.refreshButton2.Location = new System.Drawing.Point(2, 2); + this.refreshButton2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.refreshButton2.Name = "refreshButton2"; - this.refreshButton2.Size = new System.Drawing.Size(85, 28); + this.refreshButton2.Size = new System.Drawing.Size(68, 22); this.refreshButton2.TabIndex = 22; this.refreshButton2.Text = "Refresh"; this.refreshButton2.UseVisualStyleBackColor = true; @@ -579,10 +554,10 @@ private void InitializeComponent() // applyButton2 // this.applyButton2.AccessibleName = "Apply button"; - this.applyButton2.Location = new System.Drawing.Point(94, 2); - this.applyButton2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.applyButton2.Location = new System.Drawing.Point(75, 2); + this.applyButton2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.applyButton2.Name = "applyButton2"; - this.applyButton2.Size = new System.Drawing.Size(85, 28); + this.applyButton2.Size = new System.Drawing.Size(68, 22); this.applyButton2.TabIndex = 23; this.applyButton2.Text = "Apply"; this.applyButton2.UseVisualStyleBackColor = true; @@ -591,11 +566,11 @@ private void InitializeComponent() // groupBox4 // this.groupBox4.Controls.Add(this.tableLayoutPanel7); - this.groupBox4.Location = new System.Drawing.Point(5, 144); - this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox4.Location = new System.Drawing.Point(4, 115); + this.groupBox4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupBox4.Size = new System.Drawing.Size(607, 118); + this.groupBox4.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox4.Size = new System.Drawing.Size(486, 94); this.groupBox4.TabIndex = 1; this.groupBox4.TabStop = false; this.groupBox4.Text = "Misc"; @@ -610,13 +585,14 @@ private void InitializeComponent() this.tableLayoutPanel7.Controls.Add(this.autostartTrayCheckBox, 1, 1); this.tableLayoutPanel7.Controls.Add(this.label9, 0, 2); this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 17); + this.tableLayoutPanel7.Location = new System.Drawing.Point(2, 15); + this.tableLayoutPanel7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel7.Name = "tableLayoutPanel7"; this.tableLayoutPanel7.RowCount = 3; this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 31F)); - this.tableLayoutPanel7.Size = new System.Drawing.Size(601, 99); + this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel7.Size = new System.Drawing.Size(482, 77); this.tableLayoutPanel7.TabIndex = 0; // // disableUpdateCheckBox @@ -624,10 +600,10 @@ private void InitializeComponent() this.disableUpdateCheckBox.AccessibleName = "Disable update check"; this.disableUpdateCheckBox.AutoSize = true; this.disableUpdateCheckBox.Dock = System.Windows.Forms.DockStyle.Left; - this.disableUpdateCheckBox.Location = new System.Drawing.Point(123, 2); - this.disableUpdateCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.disableUpdateCheckBox.Location = new System.Drawing.Point(98, 2); + this.disableUpdateCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.disableUpdateCheckBox.Name = "disableUpdateCheckBox"; - this.disableUpdateCheckBox.Size = new System.Drawing.Size(166, 30); + this.disableUpdateCheckBox.Size = new System.Drawing.Size(130, 22); this.disableUpdateCheckBox.TabIndex = 19; this.disableUpdateCheckBox.Text = "Disable update check"; this.disableUpdateCheckBox.UseVisualStyleBackColor = true; @@ -643,10 +619,10 @@ private void InitializeComponent() this.nameServerTxtBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.nameServerTxtBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; this.nameServerTxtBox.Dock = System.Windows.Forms.DockStyle.Left; - this.nameServerTxtBox.Location = new System.Drawing.Point(123, 70); - this.nameServerTxtBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.nameServerTxtBox.Location = new System.Drawing.Point(98, 54); + this.nameServerTxtBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.nameServerTxtBox.Name = "nameServerTxtBox"; - this.nameServerTxtBox.Size = new System.Drawing.Size(153, 22); + this.nameServerTxtBox.Size = new System.Drawing.Size(123, 20); this.nameServerTxtBox.TabIndex = 20; this.nameServerTxtBox.TextChanged += new System.EventHandler(this.nameServerTxtBox_TextChanged); // @@ -654,9 +630,10 @@ private void InitializeComponent() // this.autostartTrayCheckBox.AutoSize = true; this.autostartTrayCheckBox.Dock = System.Windows.Forms.DockStyle.Left; - this.autostartTrayCheckBox.Location = new System.Drawing.Point(123, 37); + this.autostartTrayCheckBox.Location = new System.Drawing.Point(98, 28); + this.autostartTrayCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.autostartTrayCheckBox.Name = "autostartTrayCheckBox"; - this.autostartTrayCheckBox.Size = new System.Drawing.Size(199, 28); + this.autostartTrayCheckBox.Size = new System.Drawing.Size(151, 22); this.autostartTrayCheckBox.TabIndex = 21; this.autostartTrayCheckBox.Text = "Automatically start on login"; this.autostartTrayCheckBox.UseVisualStyleBackColor = true; @@ -666,20 +643,21 @@ private void InitializeComponent() // this.label9.AutoSize = true; this.label9.Dock = System.Windows.Forms.DockStyle.Fill; - this.label9.Location = new System.Drawing.Point(3, 68); + this.label9.Location = new System.Drawing.Point(2, 52); + this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(114, 31); + this.label9.Size = new System.Drawing.Size(92, 25); this.label9.TabIndex = 1; this.label9.Text = "Nameserver"; // // groupBox3 // this.groupBox3.Controls.Add(this.tableLayoutPanel1); - this.groupBox3.Location = new System.Drawing.Point(5, 5); - this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox3.Location = new System.Drawing.Point(4, 4); + this.groupBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupBox3.Size = new System.Drawing.Size(607, 134); + this.groupBox3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox3.Size = new System.Drawing.Size(486, 107); this.groupBox3.TabIndex = 0; this.groupBox3.TabStop = false; this.groupBox3.Text = "Preflight Checks"; @@ -691,24 +669,23 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.SkipCheckWindowsVersion, 0, 2); this.tableLayoutPanel1.Controls.Add(this.SkipCheckRunningAsAdmin, 0, 1); this.tableLayoutPanel1.Controls.Add(this.SkipCheckUserInHypervAdminsGroup, 0, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(5, 21); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 17); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(597, 97); + this.tableLayoutPanel1.Size = new System.Drawing.Size(478, 78); this.tableLayoutPanel1.TabIndex = 32; // // SkipCheckWindowsVersion // this.SkipCheckWindowsVersion.AccessibleName = "Skip Windows version check"; this.SkipCheckWindowsVersion.AutoSize = true; - this.SkipCheckWindowsVersion.Location = new System.Drawing.Point(4, 68); - this.SkipCheckWindowsVersion.Margin = new System.Windows.Forms.Padding(4); + this.SkipCheckWindowsVersion.Location = new System.Drawing.Point(3, 55); this.SkipCheckWindowsVersion.Name = "SkipCheckWindowsVersion"; - this.SkipCheckWindowsVersion.Size = new System.Drawing.Size(204, 21); + this.SkipCheckWindowsVersion.Size = new System.Drawing.Size(161, 17); this.SkipCheckWindowsVersion.TabIndex = 18; this.SkipCheckWindowsVersion.Text = "Skip windows version check"; this.SkipCheckWindowsVersion.UseVisualStyleBackColor = true; @@ -719,10 +696,9 @@ private void InitializeComponent() this.SkipCheckRunningAsAdmin.AccessibleDescription = "Skip check if user is administrator"; this.SkipCheckRunningAsAdmin.AccessibleName = "Skip administrator check"; this.SkipCheckRunningAsAdmin.AutoSize = true; - this.SkipCheckRunningAsAdmin.Location = new System.Drawing.Point(4, 36); - this.SkipCheckRunningAsAdmin.Margin = new System.Windows.Forms.Padding(4); + this.SkipCheckRunningAsAdmin.Location = new System.Drawing.Point(3, 29); this.SkipCheckRunningAsAdmin.Name = "SkipCheckRunningAsAdmin"; - this.SkipCheckRunningAsAdmin.Size = new System.Drawing.Size(264, 21); + this.SkipCheckRunningAsAdmin.Size = new System.Drawing.Size(201, 17); this.SkipCheckRunningAsAdmin.TabIndex = 17; this.SkipCheckRunningAsAdmin.Text = "Skip check for running as admin user"; this.SkipCheckRunningAsAdmin.UseVisualStyleBackColor = true; @@ -733,10 +709,9 @@ private void InitializeComponent() this.SkipCheckUserInHypervAdminsGroup.AccessibleDescription = "Skip check if user in Hyper-V administrators group"; this.SkipCheckUserInHypervAdminsGroup.AccessibleName = "Skip Hyper-V admin check"; this.SkipCheckUserInHypervAdminsGroup.AutoSize = true; - this.SkipCheckUserInHypervAdminsGroup.Location = new System.Drawing.Point(4, 4); - this.SkipCheckUserInHypervAdminsGroup.Margin = new System.Windows.Forms.Padding(4); + this.SkipCheckUserInHypervAdminsGroup.Location = new System.Drawing.Point(3, 3); this.SkipCheckUserInHypervAdminsGroup.Name = "SkipCheckUserInHypervAdminsGroup"; - this.SkipCheckUserInHypervAdminsGroup.Size = new System.Drawing.Size(282, 21); + this.SkipCheckUserInHypervAdminsGroup.Size = new System.Drawing.Size(215, 17); this.SkipCheckUserInHypervAdminsGroup.TabIndex = 16; this.SkipCheckUserInHypervAdminsGroup.Text = "Skip user in hyperv admins group check"; this.SkipCheckUserInHypervAdminsGroup.UseVisualStyleBackColor = true; @@ -753,14 +728,36 @@ private void InitializeComponent() this.fileRequester.FileName = "openFileDialog1"; this.fileRequester.InitialDirectory = "$env:USERPROFILE"; // + // label4 + // + this.label4.AutoSize = true; + this.label4.Dock = System.Windows.Forms.DockStyle.Fill; + this.label4.Location = new System.Drawing.Point(2, 50); + this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(92, 25); + this.label4.TabIndex = 7; + this.label4.Text = "Pull secret"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(96, 50); + this.button1.Margin = new System.Windows.Forms.Padding(0); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(68, 22); + this.button1.TabIndex = 20; + this.button1.Text = "Change"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.PullSecretChangeButton_Click); + // // CrcSettingsForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(645, 476); + this.ClientSize = new System.Drawing.Size(516, 381); this.Controls.Add(this.tabs); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "CrcSettingsForm"; @@ -803,9 +800,6 @@ private void InitializeComponent() private System.Windows.Forms.TabPage advance_tab; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Button PullSecretSelectButton; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox pullSecretTxtBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; @@ -848,5 +842,7 @@ private void InitializeComponent() private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button button1; } } \ No newline at end of file diff --git a/Forms/CrcSettingsForm.cs b/Forms/CrcSettingsForm.cs index d70a946..cc5d0b0 100755 --- a/Forms/CrcSettingsForm.cs +++ b/Forms/CrcSettingsForm.cs @@ -16,7 +16,8 @@ public partial class CrcSettingsForm : Form List configsNeedingUnset; ConfigResult currentConfig; Dictionary changedConfigs; - + String pullSecretContent = String.Empty; + public CrcSettingsForm() { InitializeComponent(); @@ -64,7 +65,6 @@ private void loadConfigurationValues(ConfigResult cr) this.memoryNumBox.Value = cr.Configs.memory; this.cpusNumBox.Value = cr.Configs.cpus; this.diskSizeNumBox.Value = cr.Configs.DiskSize; - this.pullSecretTxtBox.Text = cr.Configs.PullSecretFile; this.consentTelemetryCheckBox.Checked = cr.Configs.ConsentTelemetry == "no" ? false : true; this.autostartTrayCheckBox.Checked = cr.Configs.AutostartTray; // proxy configs @@ -123,9 +123,20 @@ private string showAndGetNameFromFileRequester(string filter) return fileRequester.FileName; } - private void PullSecretSelectButton_Click(object sender, EventArgs e) + private void PullSecretChangeButton_Click(object sender, EventArgs e) { - this.pullSecretTxtBox.Text = showAndGetNameFromFileRequester(null); + pullSecretContent = String.Empty; + + var pullSecretForm = new PullSecretForm(); + pullSecretForm.ShowDialog(); + + pullSecretContent = pullSecretForm.PullSecret; + + if (pullSecretContent == String.Empty) + { + TrayIcon.NotifyWarn(@"No Pull Secret was provided. Cannot start cluster without pull secret."); + return; + } } private void proxyCABrowseButton_Click(object sender, EventArgs e) @@ -136,6 +147,9 @@ private void proxyCABrowseButton_Click(object sender, EventArgs e) // refresh button on properties tab private void RefreshButton_Click(object sender, EventArgs e) { + // Clear value + pullSecretContent = String.Empty; + getConfigurationAndResetChanged(); } @@ -160,6 +174,17 @@ await TaskHelpers.TryTaskAndNotify(TaskHandlers.UnsetConfig, configsNeedingUnset String.Empty); } + if(pullSecretContent != String.Empty) + { + await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, pullSecretContent, + "Pull Secret stored", + "Pull Secret not stored", + String.Empty); + + // Clear out value to prevent resending + pullSecretContent = String.Empty; + } + // Load the configs again and reset the change trackers getConfigurationAndResetChanged(); } @@ -215,11 +240,6 @@ private void memoryNumBox_ValueChanged(object sender, EventArgs e) handleConfigChangesForNumBoxes("memory", currentConfig.Configs.memory, this.memoryNumBox); } - private void pullSecretTxtBox_TextChanged(object sender, EventArgs e) - { - handleConfigChangesForTextBoxes("pull-secret-file", currentConfig.Configs.PullSecretFile, this.pullSecretTxtBox); - } - private void diskSizeNumBox_ValueChanged(object sender, EventArgs e) { handleConfigChangesForNumBoxes("disk-size", currentConfig.Configs.DiskSize, this.diskSizeNumBox);