notify user when GUI starts if minikube not found on path

pull/13784/head
Steven Powell 2022-03-14 22:36:30 +00:00
parent 45f5e4c2d3
commit 6bf038b75b
2 changed files with 35 additions and 2 deletions

View File

@ -89,6 +89,8 @@
//! [0]
Window::Window()
{
trayIconIcon = new QIcon(":/images/minikube.png");
checkForMinikube();
createClusterGroupBox();
createActions();
@ -185,8 +187,6 @@ void Window::createTrayIcon()
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
trayIconIcon = new QIcon(":/images/minikube.png");
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setIcon(*trayIconIcon);
@ -443,6 +443,7 @@ void Window::askName()
{
QDialog dialog;
dialog.setWindowTitle(tr("Create minikube Cluster"));
dialog.setWindowIcon(*trayIconIcon);
dialog.setModal(true);
QFormLayout form(&dialog);
@ -469,6 +470,7 @@ void Window::askCustom()
{
QDialog dialog;
dialog.setWindowTitle(tr("Set Cluster Values"));
dialog.setWindowIcon(*trayIconIcon);
dialog.setModal(true);
QFormLayout form(&dialog);
@ -593,4 +595,34 @@ void Window::dashboardClose()
}
}
void Window::checkForMinikube()
{
QString program = minikubePath();
if (!program.isEmpty()) {
return;
}
QDialog dialog;
dialog.setWindowTitle(tr("minikube"));
dialog.setWindowIcon(*trayIconIcon);
dialog.setModal(true);
QFormLayout form(&dialog);
QLabel *message = new QLabel(this);
message->setText("minikube was not found on the path.\nPlease follow the install instructions "
"below to install minikube first.\n");
form.addWidget(message);
QLabel *link = new QLabel(this);
link->setOpenExternalLinks(true);
link->setText("<a "
"href='https://minikube.sigs.k8s.io/docs/start/'>https://minikube.sigs.k8s.io/"
"docs/start/</a>");
form.addWidget(link);
QDialogButtonBox buttonBox(Qt::Horizontal, &dialog);
buttonBox.addButton(QString(tr("OK")), QDialogButtonBox::AcceptRole);
connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
form.addRow(&buttonBox);
dialog.exec();
exit(EXIT_FAILURE);
}
#endif

View File

@ -121,6 +121,7 @@ private:
void initMachine();
void sshConsole();
void dashboardBrowser();
void checkForMinikube();
QPushButton *sshButton;
QPushButton *dashboardButton;
QProcess *dashboardProcess;