mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 12:00:09 +02:00
👌 Show alert with what will be rolled back
This commit is contained in:
@ -145,7 +145,7 @@ extension MainMenu {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func rollbackPreset() {
|
||||
private func performRollback() {
|
||||
asyncExecution {
|
||||
PresetHelper.rollbackPreset?.apply()
|
||||
PresetHelper.rollbackPreset = nil
|
||||
@ -153,6 +153,24 @@ extension MainMenu {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func rollbackPreset() {
|
||||
guard let preset = PresetHelper.rollbackPreset else {
|
||||
return
|
||||
}
|
||||
|
||||
BetterAlert().withInformation(
|
||||
title: "alert.revert_description.title".localized,
|
||||
subtitle: "alert.revert_description.subtitle".localized(
|
||||
preset.textDescription
|
||||
)
|
||||
)
|
||||
.withPrimary(text: "alert.revert_description.ok".localized, action: { _ in
|
||||
self.performRollback()
|
||||
})
|
||||
.withSecondary(text: "alert.revert_description.cancel".localized)
|
||||
.show()
|
||||
}
|
||||
|
||||
@objc func togglePreset(sender: PresetMenuItem) {
|
||||
asyncExecution {
|
||||
sender.preset?.apply()
|
||||
|
@ -21,6 +21,32 @@ struct Preset: Codable {
|
||||
configuration = "configuration"
|
||||
}
|
||||
|
||||
var textDescription: String {
|
||||
var text = ""
|
||||
|
||||
if self.version != nil {
|
||||
text += "Switches to PHP \(self.version!).\n"
|
||||
}
|
||||
|
||||
if !self.extensions.isEmpty {
|
||||
text += "\nApplies the following extensions:\n"
|
||||
}
|
||||
|
||||
for (ext, extValue) in self.extensions {
|
||||
text += "• \(ext): \(extValue ? "enabled" : "disabled") \n"
|
||||
}
|
||||
|
||||
if !self.configuration.isEmpty {
|
||||
text += "\nApplies the following configuration values:\n"
|
||||
}
|
||||
|
||||
for (key, value) in self.configuration {
|
||||
text += "• \(key)=\(value ?? "(empty)") \n"
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
// MARK: Applying
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user