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

Commit 47a70e5

Browse files
committed
Fixes #99 Adds copy-paste dialog for pull-secret
1 parent b318171 commit 47a70e5

7 files changed

+148
-235
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/PullSecretForm.cs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
using CRCTray.Helpers;
11+
12+
namespace CRCTray
13+
{
14+
public partial class PullSecretForm : Form
15+
{
16+
17+
public PullSecretForm()
18+
{
19+
InitializeComponent();
20+
21+
PullSecret = String.Empty;
22+
}
23+
24+
private void PullSecretPicker_Load(object sender, EventArgs e)
25+
{
26+
Bitmap bm = new Bitmap(Resource.ocp_logo);
27+
Icon = Icon.FromHandle(bm.GetHicon());
28+
}
29+
30+
public String PullSecret
31+
{
32+
get;
33+
set;
34+
}
35+
36+
private void okButton_Click(object sender, EventArgs e)
37+
{
38+
PullSecret = pullSecreTextbox.Text;
39+
Hide();
40+
}
41+
}
42+
}
File renamed without changes.

Diff for: Forms/PullSecretPickerForm.Designer.cs

-156
This file was deleted.

Diff for: Forms/PullSecretPickerForm.cs

-65
This file was deleted.

0 commit comments

Comments
 (0)