Disable Node Explorer and Database Viewer buttons until the node has launched and is responding to RPC.

This commit is contained in:
Chris Rankin 2017-02-08 12:16:35 +00:00
parent 37aa486bd7
commit c734fbf8bb
3 changed files with 10 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import net.corda.demobench.model.NodeConfig
import net.corda.node.services.messaging.CordaRPCClient
import org.slf4j.LoggerFactory
class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable {
class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit): AutoCloseable {
private val log = LoggerFactory.getLogger(NodeRPC::class.java)
companion object Data {
@ -30,6 +30,7 @@ class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable
this.cancel()
log.info("Node '{}' is now ready.", config.legalName)
start()
// Schedule a new task that will refresh the display once per second.
timer.schedule(object: TimerTask() {

View File

@ -86,7 +86,12 @@ class NodeTerminalView : Fragment() {
})
}
fun launchRPC(config: NodeConfig) = NodeRPC(config, { ops ->
fun enable() {
launchExplorerButton.isDisable = false
viewDatabaseButton.isDisable = false
}
fun launchRPC(config: NodeConfig) = NodeRPC(config, start = { enable() }, invoke = { ops ->
try {
val verifiedTx = ops.verifiedTransactions()
val statesInVault = ops.vaultAndUpdates()

View File

@ -25,8 +25,8 @@
</children>
</VBox>
<Pane prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
<Button fx:id="viewDatabaseButton" mnemonicParsing="false" prefHeight="92.0" prefWidth="115.0" styleClass="big-button" text="View&#10;Database" textAlignment="CENTER" />
<Button fx:id="launchExplorerButton" mnemonicParsing="false" prefHeight="92.0" prefWidth="115.0" styleClass="big-button" text="Launch&#10;Explorer" textAlignment="CENTER" />
<Button fx:id="viewDatabaseButton" disable="true" mnemonicParsing="false" prefHeight="92.0" prefWidth="115.0" styleClass="big-button" text="View&#10;Database" textAlignment="CENTER" />
<Button fx:id="launchExplorerButton" disable="true" mnemonicParsing="false" prefHeight="92.0" prefWidth="115.0" styleClass="big-button" text="Launch&#10;Explorer" textAlignment="CENTER" />
</children>
</HBox>
</children>