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

Commit fcd7fff

Browse files
committed
Fixes #99 Adds copy-paste dialog for pull-secret
1 parent 010eded commit fcd7fff

6 files changed

+115
-188
lines changed

Diff for: CRCTray.cs

+5-9
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,16 @@ async private void StartMenu_Click(object sender, EventArgs e)
236236

237237
if (!pullsecret)
238238
{
239-
var pullSecretForm = new PullSecretPickerForm();
240-
var pullSecretPath = pullSecretForm.ShowFilePicker();
241-
if (pullSecretPath == String.Empty)
239+
var pullSecretForm = new PullSecretForm();
240+
pullSecretForm.ShowDialog();
241+
var pullSecretContent = pullSecretForm.PullSecret;
242+
if (pullSecretContent == String.Empty)
242243
{
243244
TrayIcon.NotifyWarn(@"No Pull Secret was provided, Cannot start cluster without pull secret.");
244245
return;
245246
}
246-
Dictionary<String, dynamic> pullSecretConfig = new Dictionary<String, dynamic>
247-
{
248-
["pull-secret-file"] = pullSecretPath
249-
};
250247

251-
string data = File.ReadAllText(pullSecretPath);
252-
await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, data,
248+
await TaskHelpers.TryTaskAndNotify(TaskHandlers.SetPullSecret, pullSecretContent,
253249
"Pull Secret stored",
254250
"Pull Secret not stored",
255251
String.Empty);

Diff for: Forms/PullSecretForm.Designer.cs

+96
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Forms/PullSecretPickerForm.cs renamed to Forms/PullSecretForm.cs

+9-18
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
namespace CRCTray
1313
{
14-
public partial class PullSecretPickerForm : Form
14+
public partial class PullSecretForm : Form
1515
{
16-
string pullSecretPath = "";
17-
public PullSecretPickerForm()
16+
17+
public PullSecretForm()
1818
{
1919
InitializeComponent();
20+
21+
PullSecret = String.Empty;
2022
}
2123

2224
private void PullSecretPicker_Load(object sender, EventArgs e)
@@ -25,26 +27,15 @@ private void PullSecretPicker_Load(object sender, EventArgs e)
2527
Icon = Icon.FromHandle(bm.GetHicon());
2628
}
2729

28-
private void BrowseButton_Click(object sender, EventArgs e)
29-
{
30-
browseFile.ShowDialog();
31-
if (browseFile.FileName != "")
32-
{
33-
pullSecretPath = browseFile.FileName;
34-
pullSecretPathTextField.Text = pullSecretPath;
35-
}
36-
37-
Console.WriteLine("Selected file: {0}", pullSecretPath);
38-
}
39-
40-
public String ShowFilePicker()
30+
public String PullSecret
4131
{
42-
base.ShowDialog();
43-
return pullSecretPath;
32+
get;
33+
set;
4434
}
4535

4636
private void okButton_Click(object sender, EventArgs e)
4737
{
38+
PullSecret = textBox1.Text;
4839
Hide();
4940
}
5041

File renamed without changes.

Diff for: Forms/PullSecretPickerForm.Designer.cs

-156
This file was deleted.

Diff for: crc-tray.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@
249249
<Compile Include="Forms\AboutForm.Designer.cs">
250250
<DependentUpon>AboutForm.cs</DependentUpon>
251251
</Compile>
252-
<Compile Include="Forms\PullSecretPickerForm.cs">
252+
<Compile Include="Forms\PullSecretForm.cs">
253253
<SubType>Form</SubType>
254254
</Compile>
255-
<Compile Include="Forms\PullSecretPickerForm.Designer.cs">
256-
<DependentUpon>PullSecretPickerForm.cs</DependentUpon>
255+
<Compile Include="Forms\PullSecretForm.Designer.cs">
256+
<DependentUpon>PullSecretForm.cs</DependentUpon>
257257
</Compile>
258258
<Compile Include="Helpers\DaemonLauncher.cs" />
259259
<Compile Include="Helpers\Handlers.cs" />
@@ -287,8 +287,8 @@
287287
<EmbeddedResource Include="Forms\CrcSettingsForm.resx">
288288
<DependentUpon>CrcSettingsForm.cs</DependentUpon>
289289
</EmbeddedResource>
290-
<EmbeddedResource Include="Forms\PullSecretPickerForm.resx">
291-
<DependentUpon>PullSecretPickerForm.cs</DependentUpon>
290+
<EmbeddedResource Include="Forms\PullSecretForm.resx">
291+
<DependentUpon>PullSecretForm.cs</DependentUpon>
292292
</EmbeddedResource>
293293
<EmbeddedResource Include="Forms\StatusForm.resx">
294294
<DependentUpon>StatusForm.cs</DependentUpon>

0 commit comments

Comments
 (0)