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 16, 2021
1 parent b318171 commit 47a70e5
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 235 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.

42 changes: 42 additions & 0 deletions Forms/PullSecretForm.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
File renamed without changes.
156 changes: 0 additions & 156 deletions Forms/PullSecretPickerForm.Designer.cs

This file was deleted.

65 changes: 0 additions & 65 deletions Forms/PullSecretPickerForm.cs

This file was deleted.

Loading

0 comments on commit 47a70e5

Please sign in to comment.