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

️ Performance fixes

- Avoid preloading list of sites twice
- Avoid loading Valet info twice
- Preload list of sites if <= 10 sites linked + parked
- Added fallback for missing instructions
- Improved description
This commit is contained in:
2021-12-09 19:49:16 +01:00
parent 7feb13856d
commit eaf1423fb1
5 changed files with 36 additions and 20 deletions

View File

@@ -71,7 +71,13 @@ class SiteListVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
override func viewDidLoad() {
tableView.doubleAction = #selector(self.doubleClicked(sender:))
reloadSites()
if !Valet.shared.sites.isEmpty {
// Preloaded list
sites = Valet.shared.sites
searchedFor(text: lastSearchedFor)
} else {
reloadSites()
}
}
// MARK: - Async Operations
@@ -308,21 +314,24 @@ class SiteListVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
if editor.hasBinary() {
editor.openDirectory(file: selectedSite!.absolutePath!)
} else {
Alert.confirm(
onWindow: self.view.window!,
messageText: "editors.binary_missing.title"
.localized(
editor.pathToBinary
),
informativeText: editor.missingBinaryInstruction ?? "",
buttonTitle: "editors.alert.try_again".localized,
secondButtonTitle: "editors.alert.cancel".localized,
onFirstButtonPressed: {
self.openWithEditor(sender: sender)
}
)
presentAlertForMissingEditorBinary(editor, sender)
}
}
private func presentAlertForMissingEditorBinary(_ editor: Editor, _ sender: EditorMenuItem) {
Alert.confirm(
onWindow: self.view.window!,
messageText: "editors.binary_missing.title".localized(editor.pathToBinary),
informativeText:
editor.missingBinaryInstruction
?? "editors.binary_missing.desc".localized(editor.pathToBinary),
buttonTitle: "editors.alert.try_again".localized,
secondButtonTitle: "editors.alert.cancel".localized,
onFirstButtonPressed: {
self.openWithEditor(sender: sender)
}
)
}
// MARK: - Deinitialization