1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-08 05:30:05 +01:00

👌 Cleanup, ensure dynamic form works correctly

This commit is contained in:
2022-04-17 14:33:59 +02:00
parent 1a75838a3b
commit 836b076da9
5 changed files with 190 additions and 70 deletions

View File

@@ -651,8 +651,8 @@ Gw
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
</box> </box>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PVw-cM-qAB"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PVw-cM-qAB">
<rect key="frame" x="363" y="13" width="104" height="32"/> <rect key="frame" x="325" y="13" width="142" height="32"/>
<buttonCell key="cell" type="push" title="Create Link" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WwW-Wv-I8s"> <buttonCell key="cell" type="push" title="[i18n] Create Link" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WwW-Wv-I8s">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES"> <string key="keyEquivalent" base64-UTF8="YES">
@@ -664,11 +664,11 @@ DQ
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SwS-o8-pbl"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SwS-o8-pbl">
<rect key="frame" x="13" y="13" width="94" height="32"/> <rect key="frame" x="13" y="13" width="114" height="32"/>
<constraints> <constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="qCP-Sp-gxm"/> <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="qCP-Sp-gxm"/>
</constraints> </constraints>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WHE-HW-jwp"> <buttonCell key="cell" type="push" title="[i18n] Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WHE-HW-jwp">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES"> <string key="keyEquivalent" base64-UTF8="YES">
@@ -692,15 +692,15 @@ Gw
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VzR-5a-cmT"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VzR-5a-cmT">
<rect key="frame" x="18" y="128" width="444" height="14"/> <rect key="frame" x="18" y="128" width="444" height="14"/>
<textFieldCell key="cell" title="Preview text here" id="bJr-s6-tdP"> <textFieldCell key="cell" title="[i18n] Preview text here" id="bJr-s6-tdP">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KZf-b0-9cm"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KZf-b0-9cm">
<rect key="frame" x="18" y="95" width="227" height="18"/> <rect key="frame" x="18" y="95" width="266" height="18"/>
<buttonCell key="cell" type="check" title="Secure this domain after creation" bezelStyle="regularSquare" imagePosition="left" inset="2" id="vFv-Of-2yZ"> <buttonCell key="cell" type="check" title="[i18n] Secure this domain after creation" bezelStyle="regularSquare" imagePosition="left" inset="2" id="vFv-Of-2yZ">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
@@ -710,7 +710,7 @@ Gw
</button> </button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mmQ-7e-dlb"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mmQ-7e-dlb">
<rect key="frame" x="18" y="60" width="444" height="28"/> <rect key="frame" x="18" y="60" width="444" height="28"/>
<textFieldCell key="cell" title="Securing a domain requires administrative privileges. You may be prompted for your password or Touch ID." id="4gd-KM-5Fu"> <textFieldCell key="cell" title="[i18n] Securing a domain requires administrative privileges. You may be prompted for your password or Touch ID." id="4gd-KM-5Fu">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -724,15 +724,15 @@ Gw
</pathCell> </pathCell>
</pathControl> </pathControl>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P0B-Ht-R8n"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P0B-Ht-R8n">
<rect key="frame" x="18" y="209" width="87" height="16"/> <rect key="frame" x="18" y="209" width="128" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Link a Folder" id="S4j-ZC-ddT"> <textFieldCell key="cell" lineBreakMode="clipping" title="[i18n] Link a Folder" id="S4j-ZC-ddT">
<font key="font" textStyle="headline" name=".SFNS-Bold"/> <font key="font" textStyle="headline" name=".SFNS-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="900-Z2-tID"> <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="900-Z2-tID">
<rect key="frame" x="177" y="23" width="180" height="14"/> <rect key="frame" x="139" y="23" width="180" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="That domain name already exists." id="jOt-n6-TQf"> <textFieldCell key="cell" lineBreakMode="clipping" title="That domain name already exists." id="jOt-n6-TQf">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
@@ -779,7 +779,7 @@ Gw
<outlet property="buttonCancel" destination="SwS-o8-pbl" id="N1v-uy-2Mi"/> <outlet property="buttonCancel" destination="SwS-o8-pbl" id="N1v-uy-2Mi"/>
<outlet property="buttonCreateLink" destination="PVw-cM-qAB" id="0Oo-xW-He7"/> <outlet property="buttonCreateLink" destination="PVw-cM-qAB" id="0Oo-xW-He7"/>
<outlet property="buttonSecure" destination="KZf-b0-9cm" id="5A7-Bn-NB7"/> <outlet property="buttonSecure" destination="KZf-b0-9cm" id="5A7-Bn-NB7"/>
<outlet property="linkName" destination="ZX9-s1-23i" id="yT6-80-Zr1"/> <outlet property="inputDomainName" destination="ZX9-s1-23i" id="yT6-80-Zr1"/>
<outlet property="pathControl" destination="6JT-Vt-3q0" id="f5K-8h-VOd"/> <outlet property="pathControl" destination="6JT-Vt-3q0" id="f5K-8h-VOd"/>
<outlet property="previewText" destination="VzR-5a-cmT" id="qwd-wX-645"/> <outlet property="previewText" destination="VzR-5a-cmT" id="qwd-wX-645"/>
<outlet property="textFieldError" destination="900-Z2-tID" id="qUk-FE-IKW"/> <outlet property="textFieldError" destination="900-Z2-tID" id="qUk-FE-IKW"/>
@@ -1117,16 +1117,16 @@ Gw
</connections> </connections>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uib-vA-HRc"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uib-vA-HRc">
<rect key="frame" x="18" y="221" width="290" height="14"/> <rect key="frame" x="18" y="221" width="325" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Proxy subject (usually: protocol, IP address and port)" id="G1Z-3f-BhL"> <textFieldCell key="cell" lineBreakMode="clipping" title="[i18n] Proxy subject (usually: protocol, IP address and port)" id="G1Z-3f-BhL">
<font key="font" metaFont="systemMedium" size="11"/> <font key="font" metaFont="systemMedium" size="11"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mlA-Zt-Hu8"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mlA-Zt-Hu8">
<rect key="frame" x="18" y="172" width="77" height="14"/> <rect key="frame" x="18" y="172" width="112" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Domain name" id="dQs-oZ-80e"> <textFieldCell key="cell" lineBreakMode="clipping" title="[i18n] Domain name" id="dQs-oZ-80e">
<font key="font" metaFont="systemMedium" size="11"/> <font key="font" metaFont="systemMedium" size="11"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -1160,21 +1160,24 @@ Gw
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
</box> </box>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Vi-cN-ude"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Vi-cN-ude">
<rect key="frame" x="355" y="13" width="112" height="32"/> <rect key="frame" x="317" y="13" width="150" height="32"/>
<buttonCell key="cell" type="push" title="Create Proxy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="H2Z-c5-5Vk"> <buttonCell key="cell" type="push" title="[i18n] Create Proxy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="H2Z-c5-5Vk">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES"> <string key="keyEquivalent" base64-UTF8="YES">
DQ DQ
</string> </string>
</buttonCell> </buttonCell>
<connections>
<action selector="pressedCreateProxy:" target="dwh-CF-6iv" id="wFW-Aw-FOR"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nC0-dk-QaF"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nC0-dk-QaF">
<rect key="frame" x="13" y="13" width="94" height="32"/> <rect key="frame" x="13" y="13" width="114" height="32"/>
<constraints> <constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="uCc-fF-wS2"/> <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="uCc-fF-wS2"/>
</constraints> </constraints>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="D8g-GE-7TU"> <buttonCell key="cell" type="push" title="[i18n] Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="D8g-GE-7TU">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES"> <string key="keyEquivalent" base64-UTF8="YES">
@@ -1187,40 +1190,40 @@ Gw
</button> </button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JSZ-x8-Pqi"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JSZ-x8-Pqi">
<rect key="frame" x="18" y="128" width="444" height="14"/> <rect key="frame" x="18" y="128" width="444" height="14"/>
<textFieldCell key="cell" title="Please enter a domain name first." id="ISE-9R-ncQ"> <textFieldCell key="cell" title="[i18n] Preview text here" id="ISE-9R-ncQ">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rJa-yg-nCn"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rJa-yg-nCn">
<rect key="frame" x="18" y="95" width="132" height="18"/> <rect key="frame" x="18" y="95" width="170" height="18"/>
<buttonCell key="cell" type="check" title="Secure this proxy" bezelStyle="regularSquare" imagePosition="left" inset="2" id="5LI-lt-Asl"> <buttonCell key="cell" type="check" title="[i18n] Secure this proxy" bezelStyle="regularSquare" imagePosition="left" inset="2" id="5LI-lt-Asl">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
<connections> <connections>
<action selector="pressedSecure:" target="dwh-CF-6iv" id="IEg-LB-0RE"/> <action selector="pressedSecure:" target="dwh-CF-6iv" id="b74-8T-AzO"/>
</connections> </connections>
</button> </button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5x7-ll-2f7"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5x7-ll-2f7">
<rect key="frame" x="18" y="60" width="444" height="28"/> <rect key="frame" x="18" y="60" width="444" height="28"/>
<textFieldCell key="cell" title="Securing a domain requires administrative privileges. You may be prompted for your password or Touch ID." id="IMB-O5-ZOy"> <textFieldCell key="cell" title="[i18n] Securing a domain requires administrative privileges. You may be prompted for your password or Touch ID." id="IMB-O5-ZOy">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DAh-br-Dfx"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DAh-br-Dfx">
<rect key="frame" x="18" y="250" width="97" height="16"/> <rect key="frame" x="18" y="250" width="123" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Set up a Proxy" id="AZ1-04-kUl"> <textFieldCell key="cell" lineBreakMode="clipping" title="[i18n] Add a Proxy" id="AZ1-04-kUl">
<font key="font" textStyle="headline" name=".SFNS-Bold"/> <font key="font" textStyle="headline" name=".SFNS-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w0k-CK-0u4"> <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w0k-CK-0u4">
<rect key="frame" x="169" y="23" width="180" height="14"/> <rect key="frame" x="131" y="23" width="180" height="14"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="That domain name already exists." id="4sH-94-UJl"> <textFieldCell key="cell" lineBreakMode="clipping" title="That domain name already exists." id="4sH-94-UJl">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
@@ -1260,8 +1263,16 @@ Gw
</view> </view>
<connections> <connections>
<outlet property="buttonCancel" destination="nC0-dk-QaF" id="n5Q-jg-UCe"/> <outlet property="buttonCancel" destination="nC0-dk-QaF" id="n5Q-jg-UCe"/>
<outlet property="buttonCreateProxy" destination="4Vi-cN-ude" id="rdK-xc-N7F"/>
<outlet property="buttonSecure" destination="rJa-yg-nCn" id="WIs-zt-f3a"/>
<outlet property="inputDomainName" destination="SNw-oQ-bnb" id="ELH-63-cAe"/>
<outlet property="inputProxySubject" destination="QCK-Z9-w7g" id="76U-te-Jzt"/>
<outlet property="previewText" destination="JSZ-x8-Pqi" id="Mve-6W-Owd"/>
<outlet property="textFieldDomainName" destination="mlA-Zt-Hu8" id="cHL-Yu-Yvx"/>
<outlet property="textFieldError" destination="w0k-CK-0u4" id="28h-bn-igB"/> <outlet property="textFieldError" destination="w0k-CK-0u4" id="28h-bn-igB"/>
<outlet property="textFieldProxySubject" destination="Uib-vA-HRc" id="5tV-3l-Wbw"/>
<outlet property="textFieldSecure" destination="5x7-ll-2f7" id="NlV-g8-rYP"/> <outlet property="textFieldSecure" destination="5x7-ll-2f7" id="NlV-g8-rYP"/>
<outlet property="textFieldTitle" destination="DAh-br-Dfx" id="8SA-EW-wcq"/>
</connections> </connections>
</viewController> </viewController>
<customObject id="VaP-ZM-OcY" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> <customObject id="VaP-ZM-OcY" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@@ -1305,11 +1316,11 @@ Gw
<rect key="frame" x="0.0" y="0.0" width="540" height="177"/> <rect key="frame" x="0.0" y="0.0" width="540" height="177"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FhN-AM-SkI"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FhN-AM-SkI">
<rect key="frame" x="13" y="13" width="94" height="32"/> <rect key="frame" x="13" y="13" width="114" height="32"/>
<constraints> <constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="Zhu-D8-cLK"/> <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="Zhu-D8-cLK"/>
</constraints> </constraints>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="LxP-t4-H2W"> <buttonCell key="cell" type="push" title="[i18n] Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="LxP-t4-H2W">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES"> <string key="keyEquivalent" base64-UTF8="YES">
@@ -1321,11 +1332,11 @@ Gw
</connections> </connections>
</button> </button>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pYe-Qu-qnK"> <stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pYe-Qu-qnK">
<rect key="frame" x="263" y="20" width="257" height="20"/> <rect key="frame" x="187" y="20" width="333" height="20"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="L5n-Gw-J27"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="L5n-Gw-J27">
<rect key="frame" x="-7" y="-7" width="134" height="32"/> <rect key="frame" x="-7" y="-7" width="172" height="32"/>
<buttonCell key="cell" type="push" title="Create a Link" bezelStyle="rounded" image="IconLinked" imagePosition="left" alignment="center" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="8UP-Sw-TP6"> <buttonCell key="cell" type="push" title="[i18n] Create a Link" bezelStyle="rounded" image="IconLinked" imagePosition="left" alignment="center" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="8UP-Sw-TP6">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent">l</string> <string key="keyEquivalent">l</string>
@@ -1335,8 +1346,8 @@ Gw
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="01Z-IV-hv1"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="01Z-IV-hv1">
<rect key="frame" x="121" y="-7" width="143" height="32"/> <rect key="frame" x="159" y="-7" width="181" height="32"/>
<buttonCell key="cell" type="push" title="Create a Proxy" bezelStyle="rounded" image="IconProxy" imagePosition="left" alignment="center" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="bJ4-q8-1Ej"> <buttonCell key="cell" type="push" title="[i18n] Create a Proxy" bezelStyle="rounded" image="IconProxy" imagePosition="left" alignment="center" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="bJ4-q8-1Ej">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<string key="keyEquivalent">p</string> <string key="keyEquivalent">p</string>
@@ -1357,7 +1368,7 @@ Gw
</stackView> </stackView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fJK-Ke-IK3"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fJK-Ke-IK3">
<rect key="frame" x="18" y="138" width="504" height="19"/> <rect key="frame" x="18" y="138" width="504" height="19"/>
<textFieldCell key="cell" selectable="YES" alignment="left" title="What kind of domain would you like to set up?" id="agk-Nj-FLd"> <textFieldCell key="cell" selectable="YES" alignment="left" title="[i18n] What kind of domain would you like to set up?" id="agk-Nj-FLd">
<font key="font" metaFont="systemBold" size="15"/> <font key="font" metaFont="systemBold" size="15"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -1370,7 +1381,7 @@ Gw
</constraints> </constraints>
<textFieldCell key="cell" selectable="YES" alignment="left" id="3i9-RG-Ift"> <textFieldCell key="cell" selectable="YES" alignment="left" id="3i9-RG-Ift">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
<mutableString key="title">Links are used to directly serve projects. If you have a Laravel, Symfony, WordPress, etc. folder with code, you'll want to create a link and choose the folder where your code lives.If you are in need of a proxy, you can proxy e.g. a container to a particular domain name. This can be useful in combination with Docker, for example.</mutableString> <mutableString key="title">[i18n] Links are used to directly serve projects. If you have a Laravel, Symfony, WordPress, etc. folder with code, you'll want to create a link and choose the folder where your code lives.If you are in need of a proxy, you can proxy e.g. a container to a particular domain name. This can be useful in combination with Docker, for example.</mutableString>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>

View File

@@ -13,32 +13,132 @@ class AddProxyVC: NSViewController, NSTextFieldDelegate {
// MARK: - Outlets // MARK: - Outlets
@IBOutlet weak var textFieldTitle: NSTextField!
@IBOutlet weak var textFieldProxySubject: NSTextField!
@IBOutlet weak var textFieldDomainName: NSTextField!
@IBOutlet weak var inputProxySubject: NSTextField!
@IBOutlet weak var inputDomainName: NSTextField!
@IBOutlet weak var previewText: NSTextField!
@IBOutlet weak var buttonSecure: NSButton!
@IBOutlet weak var buttonCreateProxy: NSButton!
@IBOutlet weak var buttonCancel: NSButton!
@IBOutlet weak var textFieldSecure: NSTextField!
@IBOutlet weak var textFieldError: NSTextField!
// MARK: - View Lifecycle // MARK: - View Lifecycle
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
loadStaticLocalisedStrings() loadStaticLocalisedStrings()
buttonCreateProxy.isEnabled = false
updatePreview()
validate()
} }
private func dismissView(outcome: NSApplication.ModalResponse) { private func dismissView(outcome: NSApplication.ModalResponse) {
guard let window = self.view.window, let parent = window.sheetParent else { return } guard let window = view.window, let parent = window.sheetParent else { return }
parent.endSheet(window, returnCode: outcome) parent.endSheet(window, returnCode: outcome)
} }
// MARK: - Localisation // MARK: - Localisation
func loadStaticLocalisedStrings() { func loadStaticLocalisedStrings() {
textFieldTitle.stringValue = "domain_list.add.set_up_proxy".localized
textFieldProxySubject.stringValue = "domain_list.add.proxy_subject".localized
textFieldDomainName.stringValue = "domain_list.add.domain_name".localized
textFieldSecure.stringValue = "domain_list.add.secure_description".localized
buttonCancel.title = "domain_list.add.cancel".localized
buttonCreateProxy.title = "domain_list.add.create_proxy".localized
} }
// MARK: - Outlet Interactions // MARK: - Outlet Interactions
@IBAction func pressedSecure(_ sender: Any) {
updatePreview()
}
@IBAction func pressedCreateProxy(_ sender: Any) { @IBAction func pressedCreateProxy(_ sender: Any) {
// valet proxy (domain) http://127.0.0.1:90 (--secure) // valet proxy (domain) http://127.0.0.1:90 (--secure)
} }
@IBAction func pressedCancel(_ sender: Any) { @IBAction func pressedCancel(_ sender: Any) {
self.dismissView(outcome: .cancel) dismissView(outcome: .cancel)
}
// MARK: - Text Field Delegate
func controlTextDidChange(_ obj: Notification) {
updateTextField()
}
// MARK: - Helper Methods
private func validate() {
_ = validate(
domain: inputDomainName.stringValue,
proxy: inputProxySubject.stringValue
)
}
private func validate(domain: String, proxy: String) -> Bool {
if domain.isEmpty {
textFieldError.isHidden = false
textFieldError.stringValue = "domain_list.add.errors.empty".localized
return false
}
if proxy.isEmpty {
textFieldError.isHidden = false
textFieldError.stringValue = "domain_list.add.errors.empty_proxy".localized
return false
}
if Valet.shared.sites.contains(where: { $0.name == domain }) {
textFieldError.isHidden = false
textFieldError.stringValue = "domain_list.add.errors.already_exists".localized
return false
}
textFieldError.isHidden = true
return true
}
func updateTextField() {
inputDomainName.stringValue = inputDomainName.stringValue
.replacingOccurrences(of: " ", with: "-")
buttonCreateProxy.isEnabled = validate(
domain: inputDomainName.stringValue,
proxy: inputProxySubject.stringValue
)
updatePreview()
}
func updatePreview() {
buttonSecure.title = "domain_list.add.secure_after_creation"
.localized(
inputDomainName.stringValue,
Valet.shared.config.tld
)
if (inputProxySubject.stringValue.isEmpty || inputDomainName.stringValue.isEmpty) {
previewText.stringValue = "domain_list.add.empty_fields".localized
return
}
previewText.stringValue = "domain_list.add.proxy_available"
.localized(
inputProxySubject.stringValue,
buttonSecure.state == .on ? "https" : "http",
inputDomainName.stringValue,
Valet.shared.config.tld
)
} }
} }

View File

@@ -12,15 +12,18 @@ import Cocoa
class AddSiteVC: NSViewController, NSTextFieldDelegate { class AddSiteVC: NSViewController, NSTextFieldDelegate {
// MARK: - Outlets // MARK: - Outlets
@IBOutlet weak var textFieldTitle: NSTextField!
@IBOutlet weak var pathControl: NSPathControl! @IBOutlet weak var pathControl: NSPathControl!
@IBOutlet weak var linkName: NSTextField! @IBOutlet weak var inputDomainName: NSTextField!
@IBOutlet weak var previewText: NSTextField! @IBOutlet weak var previewText: NSTextField!
@IBOutlet weak var buttonSecure: NSButton! @IBOutlet weak var buttonSecure: NSButton!
@IBOutlet weak var buttonCreateLink: NSButton! @IBOutlet weak var buttonCreateLink: NSButton!
@IBOutlet weak var buttonCancel: NSButton! @IBOutlet weak var buttonCancel: NSButton!
@IBOutlet weak var textFieldTitle: NSTextField!
@IBOutlet weak var textFieldSecure: NSTextField! @IBOutlet weak var textFieldSecure: NSTextField!
@IBOutlet weak var textFieldError: NSTextField! @IBOutlet weak var textFieldError: NSTextField!
@@ -40,30 +43,27 @@ class AddSiteVC: NSViewController, NSTextFieldDelegate {
func loadStaticLocalisedStrings() { func loadStaticLocalisedStrings() {
textFieldTitle.stringValue = "domain_list.add.link_folder".localized textFieldTitle.stringValue = "domain_list.add.link_folder".localized
linkName.placeholderString = "domain_list.add.domain_name_placeholder".localized inputDomainName.placeholderString = "domain_list.add.domain_name_placeholder".localized
textFieldSecure.stringValue = "domain_list.add.secure_description".localized textFieldSecure.stringValue = "domain_list.add.secure_description".localized
buttonCancel.stringValue = "domain_list.add.cancel".localized buttonCancel.title = "domain_list.add.cancel".localized
buttonCreateLink.title = "domain_list.add.create_link".localized
} }
// MARK: - Outlet Interactions // MARK: - Outlet Interactions
@IBAction func pressedCreateProxy(_ sender: Any) {
// valet proxy (domain) http://127.0.0.1:90 (--secure)
}
@IBAction func pressedCreateLink(_ sender: Any) { @IBAction func pressedCreateLink(_ sender: Any) {
let path = self.pathControl.url!.path let path = pathControl.url!.path
let name = self.linkName.stringValue let name = inputDomainName.stringValue
if !FileManager.default.fileExists(atPath: path) { if !FileManager.default.fileExists(atPath: path) {
Alert.confirm( Alert.confirm(
onWindow: self.view.window!, onWindow: view.window!,
messageText: "domain_list.alert.folder_missing.title".localized, messageText: "domain_list.alert.folder_missing.title".localized,
informativeText: "domain_list.alert.folder_missing.desc".localized, informativeText: "domain_list.alert.folder_missing.desc".localized,
buttonTitle: "domain_list.alert.folder_missing.cancel".localized, buttonTitle: "domain_list.alert.folder_missing.cancel".localized,
secondButtonTitle: "domain_list.alert.folder_missing.return".localized, secondButtonTitle: "domain_list.alert.folder_missing.return".localized,
onFirstButtonPressed: { onFirstButtonPressed: { [self] in
self.dismissView(outcome: .cancel) dismissView(outcome: .cancel)
} }
) )
return return
@@ -73,7 +73,7 @@ class AddSiteVC: NSViewController, NSTextFieldDelegate {
// TODO: I will have to investigate and report this behaviour if possible // TODO: I will have to investigate and report this behaviour if possible
Shell.run("cd '\(path)' && \(Paths.valet) link '\(name)' && valet links", requiresPath: true) Shell.run("cd '\(path)' && \(Paths.valet) link '\(name)' && valet links", requiresPath: true)
self.dismissView(outcome: .OK) dismissView(outcome: .OK)
// Reset search // Reset search
App.shared.domainListWindowController? App.shared.domainListWindowController?
@@ -90,7 +90,7 @@ class AddSiteVC: NSViewController, NSTextFieldDelegate {
} }
@IBAction func pressedCancel(_ sender: Any) { @IBAction func pressedCancel(_ sender: Any) {
self.dismissView(outcome: .cancel) dismissView(outcome: .cancel)
} }
@IBAction func pressedSecure(_ sender: Any) { @IBAction func pressedSecure(_ sender: Any) {
@@ -106,41 +106,46 @@ class AddSiteVC: NSViewController, NSTextFieldDelegate {
// MARK: - Helper Methods // MARK: - Helper Methods
private func isValidLinkName(_ name: String) -> Bool { private func isValidLinkName(_ name: String) -> Bool {
if self.linkName.stringValue.isEmpty { if name.isEmpty {
self.textFieldError.isHidden = false textFieldError.isHidden = false
self.textFieldError.stringValue = "domain_list.add.errors.empty".localized textFieldError.stringValue = "domain_list.add.errors.empty".localized
return false return false
} }
if Valet.shared.sites.contains(where: { $0.name == name }) { if Valet.shared.sites.contains(where: { $0.name == name }) {
self.textFieldError.isHidden = false textFieldError.isHidden = false
self.textFieldError.stringValue = "domain_list.add.errors.already_exists".localized textFieldError.stringValue = "domain_list.add.errors.already_exists".localized
return false return false
} }
self.textFieldError.isHidden = true textFieldError.isHidden = true
return true return true
} }
func updateTextField() { func updateTextField() {
self.linkName.stringValue = self.linkName.stringValue inputDomainName.stringValue = inputDomainName.stringValue
.replacingOccurrences(of: " ", with: "-") .replacingOccurrences(of: " ", with: "-")
buttonCreateLink.isEnabled = isValidLinkName(self.linkName.stringValue) buttonCreateLink.isEnabled = isValidLinkName(inputDomainName.stringValue)
self.updatePreview() updatePreview()
} }
func updatePreview() { func updatePreview() {
buttonSecure.title = "domain_list.add.secure_after_creation" buttonSecure.title = "domain_list.add.secure_after_creation"
.localized( .localized(
self.linkName.stringValue, inputDomainName.stringValue,
Valet.shared.config.tld Valet.shared.config.tld
) )
if (inputDomainName.stringValue.isEmpty) {
previewText.stringValue = "domain_list.add.empty_fields".localized
return
}
previewText.stringValue = "domain_list.add.folder_available" previewText.stringValue = "domain_list.add.folder_available"
.localized( .localized(
self.buttonSecure.state == .on ? "https" : "http", buttonSecure.state == .on ? "https" : "http",
self.linkName.stringValue, inputDomainName.stringValue,
Valet.shared.config.tld Valet.shared.config.tld
) )
} }

View File

@@ -111,7 +111,7 @@ class DomainListWC: PMWindowController, NSSearchFieldDelegate, NSToolbarDelegate
let viewController = windowController.window!.contentViewController as! AddSiteVC let viewController = windowController.window!.contentViewController as! AddSiteVC
viewController.pathControl.url = URL(fileURLWithPath: folder) viewController.pathControl.url = URL(fileURLWithPath: folder)
viewController.linkName.stringValue = String(folder.split(separator: "/").last!) viewController.inputDomainName.stringValue = String(folder.split(separator: "/").last!)
viewController.updateTextField() viewController.updateTextField()
self.window?.beginSheet(windowController.window!) self.window?.beginSheet(windowController.window!)

View File

@@ -104,6 +104,8 @@
"domain_list.add.set_up_proxy" = "Set up a Proxy"; "domain_list.add.set_up_proxy" = "Set up a Proxy";
"domain_list.add.proxy_subject" = "Proxy subject (usually: protocol, IP address and port)"; "domain_list.add.proxy_subject" = "Proxy subject (usually: protocol, IP address and port)";
"domain_list.add.domain_name" = "Domain name"; "domain_list.add.domain_name" = "Domain name";
"domain_list.add.create_proxy" = "Create Proxy";
"domain_list.add.proxy_available" = "%@ will be proxied and will be available via: %@://%@.%@";
// ADD SITE TO DOMAINS LIST // ADD SITE TO DOMAINS LIST
@@ -115,7 +117,9 @@
"domain_list.add.cancel" = "Cancel"; "domain_list.add.cancel" = "Cancel";
"domain_list.add.folder_available" = "This site will be available via the following URL: %@://%@.%@"; "domain_list.add.folder_available" = "This site will be available via the following URL: %@://%@.%@";
"domain_list.add.errors.empty" = "You must enter a name."; "domain_list.add.empty_fields" = "One or more fields are empty. Please fill all required fields.";
"domain_list.add.errors.empty" = "You must enter a domain name.";
"domain_list.add.errors.empty_proxy" = "You must enter what will be proxied.";
"domain_list.add.errors.already_exists" = "A link with that name already exists."; "domain_list.add.errors.already_exists" = "A link with that name already exists.";
// ADD SITE ERROR: FOLDER MISSING SINCE SELECTION // ADD SITE ERROR: FOLDER MISSING SINCE SELECTION