mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
✨ Show external extensions
This commit is contained in:
@ -25,6 +25,14 @@ struct BrewPhpExtension: Hashable, Comparable {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasAlternativeInstall: Bool {
|
||||||
|
// Extension must be active
|
||||||
|
let isActive = PhpEnvironments.shared.currentInstall?.extensions
|
||||||
|
.contains(where: { $0.name == self.name }) ?? false
|
||||||
|
|
||||||
|
return isActive && !isInstalled
|
||||||
|
}
|
||||||
|
|
||||||
static func hasInstallationReceipt(for formulaName: String) -> Bool {
|
static func hasInstallationReceipt(for formulaName: String) -> Bool {
|
||||||
return FileSystem.fileExists("\(Paths.optPath)/\(formulaName)/INSTALL_RECEIPT.json")
|
return FileSystem.fileExists("\(Paths.optPath)/\(formulaName)/INSTALL_RECEIPT.json")
|
||||||
}
|
}
|
||||||
|
@ -81,17 +81,40 @@ struct PhpExtensionManagerView: View {
|
|||||||
HStack(alignment: .center, spacing: 7.0) {
|
HStack(alignment: .center, spacing: 7.0) {
|
||||||
VStack(alignment: .center, spacing: 0) {
|
VStack(alignment: .center, spacing: 0) {
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: bExtension.isInstalled
|
HStack {
|
||||||
? "puzzlepiece.extension.fill"
|
Image(systemName: bExtension.isInstalled || bExtension.hasAlternativeInstall
|
||||||
: "puzzlepiece.extension")
|
? "puzzlepiece.extension.fill"
|
||||||
.resizable()
|
: "puzzlepiece.extension")
|
||||||
.frame(width: 16, height: 16)
|
.resizable()
|
||||||
.foregroundColor(Color.blue)
|
.frame(width: 24, height: 20)
|
||||||
Text(bExtension.name).bold()
|
.foregroundColor(bExtension.hasAlternativeInstall ? Color.gray : Color.blue)
|
||||||
Text("for PHP \(bExtension.phpVersion)")
|
}.frame(width: 48, height: 24)
|
||||||
.font(.system(size: 9))
|
|
||||||
.foregroundStyle(.secondary)
|
VStack(alignment: .leading, spacing: 3) {
|
||||||
.padding(.top, 2)
|
HStack {
|
||||||
|
Text(bExtension.name).bold()
|
||||||
|
Text("for PHP \(bExtension.phpVersion)")
|
||||||
|
.font(.system(size: 9))
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.padding(.top, 2)
|
||||||
|
}
|
||||||
|
if bExtension.isInstalled {
|
||||||
|
Text("This extension is installed and can be managed by PHP Monitor.")
|
||||||
|
.font(.system(size: 11))
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
} else {
|
||||||
|
if bExtension.hasAlternativeInstall {
|
||||||
|
Text("This external extension cannot be managed by PHP Monitor.")
|
||||||
|
.font(.system(size: 11))
|
||||||
|
.foregroundStyle(.orange)
|
||||||
|
} else {
|
||||||
|
Text("This extension can be installed.")
|
||||||
|
.font(.system(size: 11))
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
@ -109,7 +132,7 @@ struct PhpExtensionManagerView: View {
|
|||||||
Task { await self.runCommand(
|
Task { await self.runCommand(
|
||||||
InstallPhpExtensionCommand(install: [bExtension])
|
InstallPhpExtensionCommand(install: [bExtension])
|
||||||
) }
|
) }
|
||||||
}
|
}.disabled(bExtension.hasAlternativeInstall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user