mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-08 05:30:05 +01:00
✨ Run the valet proxy command (#105)
This commit is contained in:
@@ -63,7 +63,23 @@ class AddProxyVC: NSViewController, NSTextFieldDelegate {
|
||||
}
|
||||
|
||||
@IBAction func pressedCreateProxy(_ sender: Any) {
|
||||
// valet proxy (domain) http://127.0.0.1:90 (--secure)
|
||||
let domain = self.inputDomainName.stringValue
|
||||
let proxyName = self.inputProxySubject.stringValue
|
||||
let secure = self.buttonSecure.state == .on ? " --secure" : ""
|
||||
|
||||
dismissView(outcome: .OK)
|
||||
|
||||
App.shared.domainListWindowController?.contentVC.setUIBusy()
|
||||
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
Shell.run("\(Paths.valet) proxy \(domain) \(proxyName)\(secure)", requiresPath: true)
|
||||
Actions.restartNginx()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
App.shared.domainListWindowController?.contentVC.setUINotBusy()
|
||||
App.shared.domainListWindowController?.pressedReload(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func pressedCancel(_ sender: Any) {
|
||||
|
||||
@@ -101,7 +101,7 @@ class DomainListVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource
|
||||
Disables the UI so the user cannot interact with it.
|
||||
Also shows a spinner to indicate that we're busy.
|
||||
*/
|
||||
private func setUIBusy() {
|
||||
public func setUIBusy() {
|
||||
// If it takes more than 0.5s to set the UI to not busy, show a spinner
|
||||
timer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false, block: { _ in
|
||||
self.progressIndicator.startAnimation(true)
|
||||
@@ -115,7 +115,7 @@ class DomainListVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource
|
||||
/**
|
||||
Re-enables the UI so the user can interact with it.
|
||||
*/
|
||||
private func setUINotBusy() {
|
||||
public func setUINotBusy() {
|
||||
timer?.invalidate()
|
||||
progressIndicator.stopAnimation(nil)
|
||||
tableView.alphaValue = 1.0
|
||||
|
||||
Reference in New Issue
Block a user