beepdog
08/08/2018, 8:16 PMfun loadExistingConfiguration(events: Observable<ActionEvent>) {
events.subscribeOnFx()
.doOnNext {
logger.debug("Event received from button!")
//TODO: indicate loading!
//Event received
configSections.clear()
}
.subscribeOn(<http://Schedulers.io|Schedulers.io>())
.flatMap {
//load teh file and emit all the sections
val home = System.getProperty("user.home")
val config = SSHConfigFile(Paths.get(home, ".ssh", "config")) //TODO: turn this into a proper configurable value
config.sections.toObservable()
}
.subscribeOnFx()
.doOnNext {
configSections.add(ViewConfigSection(it))
}
.subscribe()
}