1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 21:20:07 +01:00

Add proxy view

This commit is contained in:
2022-04-16 23:19:13 +02:00
parent 419ebe61f7
commit 84548634ec
5 changed files with 97 additions and 7 deletions

View File

@@ -6,7 +6,6 @@
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Search Toolbar Item" minToolsVersion="12.0" minSystemVersion="11.0"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -1120,7 +1119,7 @@ Gw
<rect key="frame" x="18" y="245" width="290" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Proxy subject (usually: protocol, IP address and port)" id="G1Z-3f-BhL">
<font key="font" metaFont="systemMedium" size="11"/>
<color key="textColor" name="controlAccentColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
@@ -1128,7 +1127,7 @@ Gw
<rect key="frame" x="18" y="196" width="77" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Domain name" id="dQs-oZ-80e">
<font key="font" metaFont="systemMedium" size="11"/>
<color key="textColor" name="controlAccentColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
@@ -1337,6 +1336,9 @@ Gw
<font key="font" metaFont="system"/>
<string key="keyEquivalent">l</string>
</buttonCell>
<connections>
<action selector="pressedCreateLink:" target="gOD-Gu-zDG" id="77M-Ip-GMi"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="01Z-IV-hv1">
<rect key="frame" x="121" y="-7" width="143" height="32"/>
@@ -1345,6 +1347,9 @@ Gw
<font key="font" metaFont="system"/>
<string key="keyEquivalent">p</string>
</buttonCell>
<connections>
<action selector="pressedCreateProxy:" target="gOD-Gu-zDG" id="UDf-lD-KCS"/>
</connections>
</button>
</subviews>
<visibilityPriorities>

View File

@@ -0,0 +1,42 @@
//
// AddSiteVC.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 24/01/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
import Cocoa
class AddProxyVC: NSViewController, NSTextFieldDelegate {
// MARK: - View Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
loadStaticLocalisedStrings()
}
private func dismissView(outcome: NSApplication.ModalResponse) {
guard let window = self.view.window, let parent = window.sheetParent else { return }
parent.endSheet(window, returnCode: outcome)
}
// MARK: - Localisation
func loadStaticLocalisedStrings() {
}
// MARK: - Outlet Interactions
@IBAction func pressedCreateProxy(_ sender: Any) {
// valet proxy (domain) http://127.0.0.1:90 (--secure)
}
@IBAction func pressedCancel(_ sender: Any) {
self.dismissView(outcome: .cancel)
}
}

View File

@@ -67,12 +67,25 @@ class DomainListWC: PMWindowController, NSSearchFieldDelegate, NSToolbarDelegate
withIdentifier: "showSelectionWindow"
) as! NSWindowController
// let viewController = windowController.window!.contentViewController!
let viewController = windowController.window!
.contentViewController as! SelectionVC
viewController.domainListWC = self
self.window?.beginSheet(windowController.window!)
}
func selectFolder() {
func startCreateLinkFlow() {
self.showFolderSelectionForLink()
}
func startCreateProxyFlow() {
self.showProxyPopup()
}
// MARK: - Popups
private func showFolderSelectionForLink() {
let dialog = NSOpenPanel()
dialog.message = "domain_list.add.modal_description".localized
dialog.showsResizeIndicator = true
@@ -84,12 +97,12 @@ class DomainListWC: PMWindowController, NSSearchFieldDelegate, NSToolbarDelegate
let result = dialog.url
if (result != nil && response == .OK) {
let path: String = result!.path
self.showSitePopup(path)
self.showLinkPopup(path)
}
}
}
func showSitePopup(_ folder: String) {
private func showLinkPopup(_ folder: String) {
let storyboard = NSStoryboard(name: "Main", bundle : nil)
let windowController = storyboard.instantiateController(
@@ -103,4 +116,16 @@ class DomainListWC: PMWindowController, NSSearchFieldDelegate, NSToolbarDelegate
self.window?.beginSheet(windowController.window!)
}
private func showProxyPopup() {
let storyboard = NSStoryboard(name: "Main", bundle : nil)
let windowController = storyboard.instantiateController(
withIdentifier: "addProxyWindow"
) as! NSWindowController
// let viewController = windowController.window!.contentViewController as! AddSiteVC
self.window?.beginSheet(windowController.window!)
}
}

View File

@@ -11,6 +11,8 @@ import Cocoa
class SelectionVC: NSViewController {
weak var domainListWC: DomainListWC?
@IBOutlet weak var buttonCreateLink: NSButton!
@IBOutlet weak var buttonCreateProxy: NSButton!
@IBOutlet weak var buttonCancel: NSButton!
@@ -37,6 +39,16 @@ class SelectionVC: NSViewController {
// MARK: - Outlet Interactions
@IBAction func pressedCreateLink(_ sender: Any) {
self.dismissView(outcome: .continue)
domainListWC?.startCreateLinkFlow()
}
@IBAction func pressedCreateProxy(_ sender: Any) {
self.dismissView(outcome: .continue)
domainListWC?.startCreateProxyFlow()
}
@IBAction func pressedCancel(_ sender: Any) {
self.dismissView(outcome: .cancel)
}