Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Fixes #99 Adds copy-paste dialog for pull-secret
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jul 13, 2021
1 parent 757f578 commit 0e72d48
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 188 deletions.
14 changes: 5 additions & 9 deletions CRCTray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, dynamic> pullSecretConfig = new Dictionary<String, dynamic>
{
["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);
Expand Down
96 changes: 96 additions & 0 deletions Forms/PullSecretForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 9 additions & 18 deletions Forms/PullSecretPickerForm.cs → Forms/PullSecretForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

namespace CRCTray
{
public partial class PullSecretPickerForm : Form
public partial class PullSecretForm : Form
{
string pullSecretPath = "";
public PullSecretPickerForm()

public PullSecretForm()
{
InitializeComponent();

PullSecret = String.Empty;
}

private void PullSecretPicker_Load(object sender, EventArgs e)
Expand All @@ -25,26 +27,15 @@ private void PullSecretPicker_Load(object sender, EventArgs e)
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()
public String PullSecret
{
base.ShowDialog();
return pullSecretPath;
get;
set;
}

private void okButton_Click(object sender, EventArgs e)
{
PullSecret = textBox1.Text;
Hide();
}

Expand Down
File renamed without changes.
156 changes: 0 additions & 156 deletions Forms/PullSecretPickerForm.Designer.cs

This file was deleted.

10 changes: 5 additions & 5 deletions crc-tray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@
<Compile Include="Forms\AboutForm.Designer.cs">
<DependentUpon>AboutForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\PullSecretPickerForm.cs">
<Compile Include="Forms\PullSecretForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\PullSecretPickerForm.Designer.cs">
<DependentUpon>PullSecretPickerForm.cs</DependentUpon>
<Compile Include="Forms\PullSecretForm.Designer.cs">
<DependentUpon>PullSecretForm.cs</DependentUpon>
</Compile>
<Compile Include="Helpers\DaemonLauncher.cs" />
<Compile Include="Helpers\Handlers.cs" />
Expand Down Expand Up @@ -287,8 +287,8 @@
<EmbeddedResource Include="Forms\CrcSettingsForm.resx">
<DependentUpon>CrcSettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\PullSecretPickerForm.resx">
<DependentUpon>PullSecretPickerForm.cs</DependentUpon>
<EmbeddedResource Include="Forms\PullSecretForm.resx">
<DependentUpon>PullSecretForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\StatusForm.resx">
<DependentUpon>StatusForm.cs</DependentUpon>
Expand Down

0 comments on commit 0e72d48

Please sign in to comment.