mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
🏗️ Mapping more PHP configuration values
This commit is contained in:
@ -27,7 +27,7 @@ struct PreferenceContainer<ControlView: View>: View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
HStack(alignment: .top, spacing: 50) {
|
||||
VStack(alignment: .leading) {
|
||||
Text(self.name)
|
||||
Text(self.name.localizedForSwiftUI)
|
||||
.bold()
|
||||
.multilineTextAlignment(.leading)
|
||||
.frame(minWidth: 150, maxWidth: 150, alignment: .leading)
|
||||
@ -35,7 +35,7 @@ struct PreferenceContainer<ControlView: View>: View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
controlView
|
||||
Text(self.description).font(.subheadline)
|
||||
Text(self.description.localizedForSwiftUI).font(.subheadline)
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,24 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct PhpPreference {
|
||||
class PhpPreference {
|
||||
let key: String
|
||||
let type: PhpPreferenceType
|
||||
|
||||
init(key: String) {
|
||||
self.key = key
|
||||
}
|
||||
}
|
||||
|
||||
class BoolPhpPreference: PhpPreference {
|
||||
@State var value: Bool = false
|
||||
}
|
||||
|
||||
class StringPhpPreference: PhpPreference {
|
||||
@State var value: String = ""
|
||||
}
|
||||
|
||||
class BytePhpPreference: PhpPreference {
|
||||
@State var value: String = ""
|
||||
}
|
||||
|
||||
enum PhpPreferenceType {
|
||||
@ -22,10 +37,10 @@ enum PhpPreferenceType {
|
||||
|
||||
struct ConfigManagerView: View {
|
||||
var preferences: [PhpPreference] = [
|
||||
PhpPreference(key: "memory_limit", type: .byteLimit),
|
||||
PhpPreference(key: "post_max_size", type: .byteLimit),
|
||||
PhpPreference(key: "file_uploads", type: .boolean),
|
||||
PhpPreference(key: "upload_max_filesize", type: .byteLimit)
|
||||
BytePhpPreference(key: "memory_limit"),
|
||||
BytePhpPreference(key: "post_max_size"),
|
||||
BoolPhpPreference(key: "file_uploads"),
|
||||
BytePhpPreference(key: "upload_max_filesize")
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
@ -55,26 +70,28 @@ struct ConfigManagerView: View {
|
||||
VStack(spacing: 5) {
|
||||
ForEach(preferences, id: \.key) { preference in
|
||||
PreferenceContainer(
|
||||
name: "php_ini." + preference.key + ".title",
|
||||
description: "php_ini." + preference.key + ".description"
|
||||
name: "php_ini.\(preference.key).title",
|
||||
description: "php_ini.\(preference.key).description"
|
||||
) {
|
||||
if preference.type == .byteLimit {
|
||||
if let preference = preference as? BytePhpPreference {
|
||||
ByteLimitView()
|
||||
}
|
||||
if preference.type == .boolean {
|
||||
Text("Boolean value here")
|
||||
// Toggle(isOn: preference.)
|
||||
if let preference = preference as? BoolPhpPreference {
|
||||
Toggle("", isOn: preference.$value)
|
||||
}
|
||||
if let preference = preference as? StringPhpPreference {
|
||||
TextField("Placeholder", text: preference.$value)
|
||||
}
|
||||
}.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
Divider()
|
||||
HStack {
|
||||
Button("Close", action: {
|
||||
Button("Cancel", action: {
|
||||
|
||||
})
|
||||
Spacer()
|
||||
Button("Restart PHP-FPM", action: {
|
||||
Button("Apply", action: {
|
||||
|
||||
})
|
||||
}
|
||||
|
@ -786,3 +786,13 @@ Please note that some features (greyed out below) are currently unavailable beca
|
||||
"onboarding.tour.feature_unavailable" = "This feature is currently unavailable and requires Laravel Valet to be installed.";
|
||||
"onboarding.tour.once" = "You will only see the Welcome Tour once. You can re-open the Welcome Tour later via the menu bar icon (available in the menu, under First Aid & Services).";
|
||||
"onboarding.tour.close" = "Close Tour";
|
||||
|
||||
// CONFIGURATION MANAGER
|
||||
|
||||
"confman.title" = "Configuration Manager";
|
||||
"confman.description" = "You can update configuration values for the currently active PHP version.";
|
||||
|
||||
"php_ini.memory_limit.title" = "Memory Limit";
|
||||
"php_ini.post_max_size.title" = "POST Max Size";
|
||||
"php_ini.file_uploads.title" = "File Uploads";
|
||||
"php_ini.upload_max_filesize.title" = "Upload Max Size";
|
||||
|
Reference in New Issue
Block a user