1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

👌 Communicate why Fix My Valet is disabled (#135)

A quick 5-minute fix.

As raised in #135, it is not super obvious why Fix My Valet might be
disabled. From now on, Fix My Valet is now always enabled, but it might
throw up an alert if the required formula is missing.
This commit is contained in:
2022-02-11 14:19:29 +01:00
parent 0fa6d337f2
commit 6187eb3e4e
3 changed files with 13 additions and 13 deletions

View File

@ -260,6 +260,11 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
}
@objc func fixMyValet() {
if !PhpEnv.shared.availablePhpVersions.contains(PhpEnv.brewPhpVersion) {
Alert.notify(message: "alert.php_formula_missing.title".localized, info: "alert.php_formula_missing.info".localized, style: .warning)
return
}
if !Alert.present(
messageText: "alert.fix_my_valet.title".localized,
informativeText: "alert.fix_my_valet.info".localized(PhpEnv.brewPhpVersion),

View File

@ -97,19 +97,10 @@ class StatusMenu : NSMenu {
func addFirstAidAndServicesMenuItems() {
let services = NSMenuItem(title: "mi_other".localized, action: nil, keyEquivalent: "")
let servicesMenu = NSMenu()
servicesMenu.addItem(HeaderView.asMenuItem(text: "mi_first_aid".localized))
if !PhpEnv.shared.availablePhpVersions.contains(PhpEnv.brewPhpVersion) {
servicesMenu.addItem(NSMenuItem(
title: "mi_fix_my_valet_unavailable".localized(PhpEnv.brewPhpVersion),
action: nil, keyEquivalent: "f")
)
} else {
servicesMenu.addItem(NSMenuItem(
title: "mi_fix_my_valet".localized(PhpEnv.brewPhpVersion),
action: #selector(MainMenu.fixMyValet), keyEquivalent: "")
)
}
servicesMenu.addItem(NSMenuItem(
title: "mi_fix_my_valet".localized(PhpEnv.brewPhpVersion),
action: #selector(MainMenu.fixMyValet), keyEquivalent: "")
)
servicesMenu.addItem(NSMenuItem(
title: "mi_fix_brew_permissions".localized(),

View File

@ -208,6 +208,10 @@ problem manually, using your own Terminal app (this just shows you the output)."
"alert.php_switch_failed.confirm" = "Yes, run \"Fix My Valet\"";
"alert.php_switch_failed.cancel" = "Do Not Run";
// PHP Formula Missing
"alert.php_formula_missing.title" = "Oops! The `php` formula must be installed for Fix My Valet...";
"alert.php_formula_missing.info" = "It seems that you do not have the `php` formula installed, which prevents PHP Monitor from running Fix My Valet. Please install it using `brew install php`, restart PHP Monitor and try again.";
// Fix My Valet Started
"alert.fix_my_valet.title" = "Having issues? Fix My Valet is ready to commence!";
"alert.fix_my_valet.info" = "This can take a while. Please be patient.\n\nWhen this is done, all other services will be halted and PHP %@ will be linked. You will be able to switch to your desired version of PHP once this operation has completed.\n\n(You'll get another alert once Fix My Valet is done.)";