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

👌 Show repair button in version manager

This commit is contained in:
2023-05-14 12:04:25 +02:00
parent c7ee4b8838
commit 2b7bb3f352
2 changed files with 20 additions and 6 deletions

View File

@@ -134,15 +134,19 @@ struct PhpFormulaeView: View {
.frame(width: 16, height: 16) .frame(width: 16, height: 16)
.foregroundColor(formula.iconColor) .foregroundColor(formula.iconColor)
.padding(.horizontal, 5) .padding(.horizontal, 5)
VStack(alignment: .leading) { VStack(alignment: .leading, spacing: 2) {
Text(formula.displayName).bold() Text(formula.displayName).bold()
if formula.isInstalled && formula.hasUpgrade { if formula.isInstalled && formula.hasUpgrade {
Text("\(formula.installedVersion!) installed, \(formula.upgradeVersion!) available.") Text("phpman.version.has_update".localized(
formula.installedVersion!,
formula.upgradeVersion!
))
.font(.system(size: 11)) .font(.system(size: 11))
.foregroundColor(.gray) .foregroundColor(.gray)
} else if formula.isInstalled && formula.installedVersion != nil { } else if formula.isInstalled && formula.installedVersion != nil {
Text("\(formula.installedVersion!) is currently installed.").font(.system(size: 11)) Text("phpman.version.installed".localized(formula.installedVersion!))
.font(.system(size: 11))
.foregroundColor(.gray) .foregroundColor(.gray)
} else { } else {
Text("phpman.version.available_for_installation".localizedForSwiftUI) Text("phpman.version.available_for_installation".localizedForSwiftUI)
@@ -151,13 +155,19 @@ struct PhpFormulaeView: View {
} }
if !formula.healthy { if !formula.healthy {
Text("This PHP installation is broken.") Text("phpman.version.broken".localizedForSwiftUI)
.font(.system(size: 11)) .font(.system(size: 11))
.foregroundColor(.red) .foregroundColor(.red)
} }
} }
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
if !formula.healthy {
Button("phpman.buttons.repair".localizedForSwiftUI, role: .destructive) {
Task { await self.repairAll() }
}
}
if formula.isInstalled { if formula.isInstalled {
Button("phpman.buttons.uninstall".localizedForSwiftUI, role: .destructive) { Button("phpman.buttons.uninstall".localizedForSwiftUI, role: .destructive) {
Task { await self.confirmUninstall(formula) } Task { await self.confirmUninstall(formula) }

View File

@@ -94,10 +94,14 @@
"phpman.busy.title" = "Checking for updates!"; "phpman.busy.title" = "Checking for updates!";
"phpman.busy.description.outdated" = "Checking if any PHP version is outdated..."; "phpman.busy.description.outdated" = "Checking if any PHP version is outdated...";
"phpman.version.broken" = "This version appears to be broken, you can attempt repair.";
"phpman.version.has_update" = "Version %@ installed, %@ available.";
"phpman.version.installed" = "Version %@ is currently installed.";
"phpman.version.available_for_installation" = "This version can be installed."; "phpman.version.available_for_installation" = "This version can be installed.";
"phpman.buttons.uninstall" = "Uninstall"; "phpman.buttons.uninstall" = "Uninstall";
"phpman.buttons.install" = "Install"; "phpman.buttons.install" = "Install";
"phpman.buttons.update" = "Update"; "phpman.buttons.update" = "Update";
"phpman.buttons.repair" = "Repair";
"phpman.title" = "PHP Version Manager"; "phpman.title" = "PHP Version Manager";
"phpman.description" = "**PHP Version Manager** lets you install, upgrade and delete different PHP versions via Homebrew without needing to run the commands in the terminal yourself."; "phpman.description" = "**PHP Version Manager** lets you install, upgrade and delete different PHP versions via Homebrew without needing to run the commands in the terminal yourself.";