mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
♻️ Use alternate cell identifier for favorite
This commit is contained in:
@ -930,6 +930,50 @@ Gw
|
||||
<outlet property="labelSiteName" destination="XJL-Uw-frD" id="f0t-vd-W68"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="domainListNameCellFavorited" wantsLayer="YES" id="Byb-te-u65" customClass="DomainListNameCell" customModule="PHP_Monitor" customModuleProvider="target">
|
||||
<rect key="frame" x="69" y="54" width="200" height="54"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="aot-FJ-HIk">
|
||||
<rect key="frame" x="33" y="26" width="145" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="my-domain-name.test" id="LHu-UF-QlC">
|
||||
<font key="font" metaFont="systemSemibold" size="13"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="GNH-l8-oki">
|
||||
<rect key="frame" x="33" y="12" width="75" height="14"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="~/path/to/site" id="LNw-Ju-0Ot">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3Wp-DX-An9">
|
||||
<rect key="frame" x="5" y="4.5" width="19" height="45"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="Q76-fI-lkW">
|
||||
<imageReference key="image" image="star.square.fill" catalog="system" symbolScale="large"/>
|
||||
</imageCell>
|
||||
<color key="contentTintColor" name="AccentColor"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3Wp-DX-An9" firstAttribute="leading" secondItem="Byb-te-u65" secondAttribute="leading" constant="5" id="CTd-ON-loK"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="aot-FJ-HIk" secondAttribute="trailing" constant="20" symbolic="YES" id="Csc-Dy-H4K"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="GNH-l8-oki" secondAttribute="trailing" constant="20" symbolic="YES" id="H10-MG-hCG"/>
|
||||
<constraint firstItem="GNH-l8-oki" firstAttribute="leading" secondItem="aot-FJ-HIk" secondAttribute="leading" id="Hk0-x3-RyN"/>
|
||||
<constraint firstItem="3Wp-DX-An9" firstAttribute="top" secondItem="Byb-te-u65" secondAttribute="top" constant="9" id="erH-dR-K7S"/>
|
||||
<constraint firstItem="aot-FJ-HIk" firstAttribute="top" secondItem="Byb-te-u65" secondAttribute="top" constant="12" id="ktI-fg-qaX"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3Wp-DX-An9" secondAttribute="bottom" constant="9" id="uyc-26-gZb"/>
|
||||
<constraint firstItem="aot-FJ-HIk" firstAttribute="leading" secondItem="Byb-te-u65" secondAttribute="leading" constant="35" id="vXE-jj-lLF"/>
|
||||
<constraint firstItem="GNH-l8-oki" firstAttribute="top" secondItem="aot-FJ-HIk" secondAttribute="bottom" id="wSX-fR-O7a"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="labelPathName" destination="GNH-l8-oki" id="GC1-TA-lIk"/>
|
||||
<outlet property="labelSiteName" destination="aot-FJ-HIk" id="HdZ-Rh-ua6"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="ENVIRONMENT" width="100" minWidth="100" maxWidth="150" id="hzb-XI-Out">
|
||||
@ -1126,7 +1170,7 @@ Gw
|
||||
</viewController>
|
||||
<customObject id="HgD-aB-bQb" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="323" y="723"/>
|
||||
<point key="canvasLocation" x="323" y="722.5"/>
|
||||
</scene>
|
||||
<!--Add ProxyVC-->
|
||||
<scene sceneID="g8z-pE-RL9">
|
||||
@ -1503,6 +1547,10 @@ Gw
|
||||
<image name="Lock" width="30" height="30"/>
|
||||
<image name="arrow.clockwise" catalog="system" width="14" height="16"/>
|
||||
<image name="plus" catalog="system" width="14" height="13"/>
|
||||
<image name="star.square.fill" catalog="system" width="19" height="18"/>
|
||||
<namedColor name="AccentColor">
|
||||
<color red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
<namedColor name="IconColorGreen">
|
||||
<color red="0.24699999392032623" green="0.69700002670288086" blue="0.50099998712539673" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
|
@ -10,6 +10,7 @@ import Cocoa
|
||||
import AppKit
|
||||
|
||||
protocol DomainListCellProtocol {
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String
|
||||
func populateCell(with site: ValetSite)
|
||||
func populateCell(with proxy: ValetProxy)
|
||||
}
|
||||
|
@ -10,10 +10,12 @@ import Cocoa
|
||||
import AppKit
|
||||
|
||||
class DomainListKindCell: NSTableCellView, DomainListCellProtocol {
|
||||
static let reusableName = "domainListKindCell"
|
||||
|
||||
@IBOutlet weak var imageViewType: NSImageView!
|
||||
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String {
|
||||
return "domainListKindCell"
|
||||
}
|
||||
|
||||
func populateCell(with site: ValetSite) {
|
||||
// If the `aliasPath` is nil, we're dealing with a parked site (otherwise: linked).
|
||||
imageViewType.image = site.aliasPath == nil
|
||||
|
@ -10,20 +10,20 @@ import Cocoa
|
||||
import AppKit
|
||||
|
||||
class DomainListNameCell: NSTableCellView, DomainListCellProtocol {
|
||||
static let reusableName = "domainListNameCell"
|
||||
|
||||
@IBOutlet weak var labelSiteName: NSTextField!
|
||||
@IBOutlet weak var labelPathName: NSTextField!
|
||||
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String {
|
||||
return domain.getListableFavorited() ? "domainListNameCellFavorited" : "domainListNameCell"
|
||||
}
|
||||
|
||||
func populateCell(with site: ValetSite) {
|
||||
let favoritePrefix = site.favorited ? "★ " : ""
|
||||
labelSiteName.stringValue = "\(favoritePrefix)\(site.name).\(site.tld)"
|
||||
labelSiteName.stringValue = "\(site.name).\(site.tld)"
|
||||
labelPathName.stringValue = site.absolutePathRelative
|
||||
}
|
||||
|
||||
func populateCell(with proxy: ValetProxy) {
|
||||
let favoritePrefix = proxy.favorited ? "★ " : ""
|
||||
labelSiteName.stringValue = "\(favoritePrefix)\(proxy.domain).\(proxy.tld)"
|
||||
labelSiteName.stringValue = "\(proxy.domain).\(proxy.tld)"
|
||||
labelPathName.stringValue = proxy.target
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,15 @@ import AppKit
|
||||
import SwiftUI
|
||||
|
||||
class DomainListPhpCell: NSTableCellView, DomainListCellProtocol {
|
||||
static let reusableName = "domainListPhpCell"
|
||||
|
||||
var site: ValetSite?
|
||||
|
||||
@IBOutlet weak var buttonPhpVersion: NSButton!
|
||||
@IBOutlet weak var imageViewPhpVersionOK: NSImageView!
|
||||
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String {
|
||||
return "domainListPhpCell"
|
||||
}
|
||||
|
||||
func populateCell(with site: ValetSite) {
|
||||
self.site = site
|
||||
|
||||
|
@ -10,10 +10,12 @@ import Cocoa
|
||||
import AppKit
|
||||
|
||||
class DomainListTLSCell: NSTableCellView, DomainListCellProtocol {
|
||||
static let reusableName = "domainListTLSCell"
|
||||
|
||||
@IBOutlet weak var imageViewLock: NSImageView!
|
||||
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String {
|
||||
return "domainListTLSCell"
|
||||
}
|
||||
|
||||
func populateCell(with site: ValetSite) {
|
||||
imageViewLock.contentTintColor = site.secured
|
||||
? NSColor(named: "IconColorGreen")
|
||||
|
@ -10,11 +10,13 @@ import Cocoa
|
||||
import AppKit
|
||||
|
||||
class DomainListTypeCell: NSTableCellView, DomainListCellProtocol {
|
||||
static let reusableName = "domainListTypeCell"
|
||||
|
||||
@IBOutlet weak var labelDriver: NSTextField!
|
||||
@IBOutlet weak var labelPhpVersion: NSTextField!
|
||||
|
||||
static func getCellIdentifier(for domain: ValetListable) -> String {
|
||||
return "domainListTypeCell"
|
||||
}
|
||||
|
||||
func populateCell(with site: ValetSite) {
|
||||
labelDriver.stringValue = site.driver ?? "driver.not_detected".localized
|
||||
|
||||
|
@ -263,16 +263,17 @@ class DomainListVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
let mapping: [String: String] = [
|
||||
"TLS": DomainListTLSCell.reusableName,
|
||||
"DOMAIN": DomainListNameCell.reusableName,
|
||||
"ENVIRONMENT": DomainListPhpCell.reusableName,
|
||||
"KIND": DomainListKindCell.reusableName,
|
||||
"TYPE": DomainListTypeCell.reusableName
|
||||
let mapping: [String: DomainListCellProtocol.Type] = [
|
||||
"TLS": DomainListTLSCell.self,
|
||||
"DOMAIN": DomainListNameCell.self,
|
||||
"ENVIRONMENT": DomainListPhpCell.self,
|
||||
"KIND": DomainListKindCell.self,
|
||||
"TYPE": DomainListTypeCell.self
|
||||
]
|
||||
|
||||
let columnName = tableColumn!.identifier.rawValue
|
||||
let identifier = NSUserInterfaceItemIdentifier(rawValue: mapping[columnName]!)
|
||||
guard let cellType = mapping[columnName] else { return nil }
|
||||
let identifier = NSUserInterfaceItemIdentifier(rawValue: cellType.getCellIdentifier(for: domains[row]))
|
||||
|
||||
guard let userCell = tableView.makeView(withIdentifier: identifier, owner: self)
|
||||
as? DomainListCellProtocol else { return nil }
|
||||
|
Reference in New Issue
Block a user