mirror of
https://github.com/corda/corda.git
synced 2025-05-31 14:40:52 +00:00
Improve NodeTabView in DemoBench (#1639)
* Improve NodeTabView in DemoBench Reflect recent changes with advertised services removal. * Force selection of only one notary * Update screenshots
This commit is contained in:
parent
f8a43a8331
commit
eb0e5ad417
@ -260,8 +260,8 @@ open class NodeStartup(val args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun printPluginsAndServices(node: Node) {
|
private fun printPluginsAndServices(node: Node) {
|
||||||
node.configuration.extraAdvertisedServiceIds.let {
|
node.configuration.extraAdvertisedServiceIds.filter { it.startsWith("corda.notary.") || it.startsWith("corda.network_map") }.let {
|
||||||
if (it.isNotEmpty()) Node.printBasicNodeInfo("Providing network services", it.joinToString())
|
if (it.isNotEmpty()) Node.printBasicNodeInfo("Providing additional services", it.joinToString())
|
||||||
}
|
}
|
||||||
Node.printBasicNodeInfo("Loaded CorDapps", node.cordappProvider.cordapps.map { it.name }.joinToString())
|
Node.printBasicNodeInfo("Loaded CorDapps", node.cordappProvider.cordapps.map { it.name }.joinToString())
|
||||||
val plugins = node.pluginRegistries
|
val plugins = node.pluginRegistries
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 57 KiB |
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 52 KiB |
@ -54,7 +54,7 @@ class InstallFactory : Controller() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Config.parseExtraServices(path: String): MutableList<String> {
|
private fun Config.parseExtraServices(path: String): MutableList<String> {
|
||||||
val services = serviceController.services.toSortedSet() + ServiceInfo(ServiceType.networkMap).toString()
|
val services = serviceController.services.values.toSortedSet() + ServiceInfo(ServiceType.networkMap).toString()
|
||||||
return this.getStringList(path)
|
return this.getStringList(path)
|
||||||
.filter { !it.isNullOrEmpty() }
|
.filter { !it.isNullOrEmpty() }
|
||||||
.map { svc ->
|
.map { svc ->
|
||||||
|
@ -24,6 +24,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
|
|||||||
|
|
||||||
private val jvm by inject<JVMConfig>()
|
private val jvm by inject<JVMConfig>()
|
||||||
private val pluginController by inject<PluginController>()
|
private val pluginController by inject<PluginController>()
|
||||||
|
private val serviceController by inject<ServiceController>()
|
||||||
|
|
||||||
private var baseDir: Path = baseDirFor(ManagementFactory.getRuntimeMXBean().startTime)
|
private var baseDir: Path = baseDirFor(ManagementFactory.getRuntimeMXBean().startTime)
|
||||||
private val cordaPath: Path = jvm.applicationDir.resolve("corda").resolve("corda.jar")
|
private val cordaPath: Path = jvm.applicationDir.resolve("corda").resolve("corda.jar")
|
||||||
@ -63,7 +64,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
|
|||||||
nodeData.rpcPort.value,
|
nodeData.rpcPort.value,
|
||||||
nodeData.webPort.value,
|
nodeData.webPort.value,
|
||||||
nodeData.h2Port.value,
|
nodeData.h2Port.value,
|
||||||
nodeData.extraServices.toMutableList()
|
nodeData.extraServices.map { serviceController.services[it]!! }.toMutableList()
|
||||||
)
|
)
|
||||||
|
|
||||||
if (nodes.putIfAbsent(config.key, config) != null) {
|
if (nodes.putIfAbsent(config.key, config) != null) {
|
||||||
|
@ -8,31 +8,37 @@ import java.util.logging.Level
|
|||||||
|
|
||||||
class ServiceController(resourceName: String = "/services.conf") : Controller() {
|
class ServiceController(resourceName: String = "/services.conf") : Controller() {
|
||||||
|
|
||||||
val services: List<String> = loadConf(resources.url(resourceName))
|
val services: Map<String, String> = loadConf(resources.url(resourceName))
|
||||||
|
|
||||||
val notaries: List<String> = services.filter { it.startsWith("corda.notary.") }.toList()
|
val notaries: Map<String, String> = services.filter { it.value.startsWith("corda.notary.") }
|
||||||
|
|
||||||
|
val issuers: Map<String, String> = services.filter { it.value.startsWith("corda.issuer.") }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load our list of known extra Corda services.
|
* Load our list of known extra Corda services.
|
||||||
*/
|
*/
|
||||||
private fun loadConf(url: URL?): List<String> {
|
private fun loadConf(url: URL?): Map<String, String> {
|
||||||
return if (url == null) {
|
return if (url == null) {
|
||||||
emptyList()
|
emptyMap()
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
val set = sortedSetOf<String>()
|
val map = linkedMapOf<String, String>()
|
||||||
InputStreamReader(url.openStream()).useLines { sq ->
|
InputStreamReader(url.openStream()).useLines { sq ->
|
||||||
sq.forEach { line ->
|
sq.forEach { line ->
|
||||||
val service = line.trim()
|
val service = line.split(":").map { it.trim() }
|
||||||
set.add(service)
|
if (service.size != 2) {
|
||||||
|
log.warning("Encountered corrupted line '$line' while reading services from config: $url")
|
||||||
log.info("Supports: $service")
|
}
|
||||||
|
else {
|
||||||
|
map[service[1]] = service[0]
|
||||||
|
log.info("Supports: $service")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
map
|
||||||
}
|
}
|
||||||
set.toList()
|
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
log.log(Level.SEVERE, "Failed to load $url: ${e.message}", e)
|
log.log(Level.SEVERE, "Failed to load $url: ${e.message}", e)
|
||||||
emptyList<String>()
|
emptyMap<String, String>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView
|
|||||||
import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory
|
import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory
|
||||||
import javafx.application.Platform
|
import javafx.application.Platform
|
||||||
import javafx.beans.InvalidationListener
|
import javafx.beans.InvalidationListener
|
||||||
|
import javafx.collections.ListChangeListener
|
||||||
import javafx.geometry.Pos
|
import javafx.geometry.Pos
|
||||||
import javafx.scene.control.ComboBox
|
import javafx.scene.control.ComboBox
|
||||||
import javafx.scene.image.Image
|
import javafx.scene.image.Image
|
||||||
@ -61,7 +62,7 @@ class NodeTabView : Fragment() {
|
|||||||
private val chooser = FileChooser()
|
private val chooser = FileChooser()
|
||||||
|
|
||||||
private val model = NodeDataModel()
|
private val model = NodeDataModel()
|
||||||
private val availableServices: List<String> = if (nodeController.hasNetworkMap()) serviceController.services else serviceController.notaries
|
private val availableServices: List<String> = if (nodeController.hasNetworkMap()) serviceController.issuers.keys.toList() else serviceController.notaries.keys.toList()
|
||||||
|
|
||||||
private val nodeTerminalView = find<NodeTerminalView>()
|
private val nodeTerminalView = find<NodeTerminalView>()
|
||||||
private val nodeConfigView = stackpane {
|
private val nodeConfigView = stackpane {
|
||||||
@ -109,7 +110,7 @@ class NodeTabView : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset("Services") {
|
fieldset("Additional configuration") {
|
||||||
styleClass.addAll("services-panel")
|
styleClass.addAll("services-panel")
|
||||||
|
|
||||||
val servicesList = CheckListView(availableServices.observable()).apply {
|
val servicesList = CheckListView(availableServices.observable()).apply {
|
||||||
@ -117,6 +118,17 @@ class NodeTabView : Fragment() {
|
|||||||
model.item.extraServices.set(checkModel.checkedItems)
|
model.item.extraServices.set(checkModel.checkedItems)
|
||||||
if (!nodeController.hasNetworkMap()) {
|
if (!nodeController.hasNetworkMap()) {
|
||||||
checkModel.check(0)
|
checkModel.check(0)
|
||||||
|
checkModel.checkedItems.addListener(ListChangeListener { change ->
|
||||||
|
while (change.next()) {
|
||||||
|
if (change.wasAdded()) {
|
||||||
|
val item = change.addedSubList.last()
|
||||||
|
val idx = checkModel.getItemIndex(item)
|
||||||
|
checkModel.checkedIndices.forEach {
|
||||||
|
if (it != idx) checkModel.clearCheck(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add(servicesList)
|
add(servicesList)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
corda.notary.validating
|
corda.notary.validating : Validating Notary
|
||||||
corda.notary.simple
|
corda.notary.simple : Non-validating Notary
|
||||||
corda.interest_rates
|
corda.issuer.USD : Issuer USD
|
||||||
corda.issuer.USD
|
corda.issuer.GBP : Issuer GBP
|
||||||
corda.issuer.GBP
|
corda.issuer.CHF : Issuer CHF
|
||||||
corda.issuer.CHF
|
corda.issuer.EUR : Issuer EUR
|
||||||
corda.issuer.EUR
|
|
||||||
corda.cash
|
|
@ -21,14 +21,14 @@ class ServiceControllerTest {
|
|||||||
fun `test duplicates`() {
|
fun `test duplicates`() {
|
||||||
val controller = ServiceController("/duplicate-services.conf")
|
val controller = ServiceController("/duplicate-services.conf")
|
||||||
assertNotNull(controller.services)
|
assertNotNull(controller.services)
|
||||||
assertEquals(listOf("corda.example"), controller.services)
|
assertEquals(listOf("corda.example"), controller.services.map { it.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test notaries`() {
|
fun `test notaries`() {
|
||||||
val controller = ServiceController("/notary-services.conf")
|
val controller = ServiceController("/notary-services.conf")
|
||||||
assertNotNull(controller.notaries)
|
assertNotNull(controller.notaries)
|
||||||
assertEquals(listOf("corda.notary.simple"), controller.notaries)
|
assertEquals(listOf("corda.notary.simple"), controller.notaries.map { it.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
corda.example
|
corda.example : Example
|
||||||
corda.example
|
corda.example : Example
|
||||||
corda.example
|
corda.example : Example
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
corda.notary.simple
|
corda.notary.simple : Notary Simple
|
||||||
corda.example
|
corda.example : Example
|
||||||
|
Loading…
x
Reference in New Issue
Block a user