mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Address PR comments.
This commit is contained in:
parent
608550c920
commit
775c26c573
@ -2,7 +2,7 @@
|
|||||||
<configuration default="false" name="Explorer - demo nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
<configuration default="false" name="Explorer - demo nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
||||||
<option name="VM_PARAMETERS" value="-DAMQ_DELIVERY_DELAY_MS=15000" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<configuration default="false" name="Explorer - demo nodes (simulation)" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
<configuration default="false" name="Explorer - demo nodes (simulation)" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
||||||
<option name="VM_PARAMETERS" value="-DAMQ_DELIVERY_DELAY_MS=15000" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="-S" />
|
<option name="PROGRAM_PARAMETERS" value="-S" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||||
|
@ -18,8 +18,7 @@ import rx.Observable
|
|||||||
data class ProgressTrackingEvent(val stateMachineId: StateMachineRunId, val message: String) {
|
data class ProgressTrackingEvent(val stateMachineId: StateMachineRunId, val message: String) {
|
||||||
companion object {
|
companion object {
|
||||||
fun createStreamFromStateMachineInfo(stateMachine: StateMachineInfo): Observable<ProgressTrackingEvent>? {
|
fun createStreamFromStateMachineInfo(stateMachine: StateMachineInfo): Observable<ProgressTrackingEvent>? {
|
||||||
return stateMachine.progressTrackerStepAndUpdates?.let { pair ->
|
return stateMachine.progressTrackerStepAndUpdates?.let { (current, future) ->
|
||||||
val (current, future) = pair
|
|
||||||
future.map { ProgressTrackingEvent(stateMachine.id, it) }.startWith(ProgressTrackingEvent(stateMachine.id, current))
|
future.map { ProgressTrackingEvent(stateMachine.id, it) }.startWith(ProgressTrackingEvent(stateMachine.id, current))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,13 +64,7 @@ class StateMachineDataModel {
|
|||||||
private val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress ->
|
private val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress ->
|
||||||
val smStatus = status.value as StateMachineStatus.Added
|
val smStatus = status.value as StateMachineStatus.Added
|
||||||
StateMachineData(id, smStatus.stateMachineName, smStatus.flowInitiator, status,
|
StateMachineData(id, smStatus.stateMachineName, smStatus.flowInitiator, status,
|
||||||
EasyBind.map(progress) {
|
EasyBind.map(progress) { ProgressStatus(it?.message) })
|
||||||
if (it == null) {
|
|
||||||
ProgressStatus(null)
|
|
||||||
} else {
|
|
||||||
ProgressStatus(it.message)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}.getObservableValues()
|
}.getObservableValues()
|
||||||
|
|
||||||
val stateMachinesAll = stateMachineDataList
|
val stateMachinesAll = stateMachineDataList
|
||||||
|
@ -21,9 +21,7 @@ open class EventGenerator(val parties: List<Party>, val currencies: List<Currenc
|
|||||||
protected val currencyMap: MutableMap<Currency, Long> = mutableMapOf(USD to 0L, GBP to 0L) // Used for estimation of how much money we have in general.
|
protected val currencyMap: MutableMap<Currency, Long> = mutableMapOf(USD to 0L, GBP to 0L) // Used for estimation of how much money we have in general.
|
||||||
|
|
||||||
protected fun addToMap(ccy: Currency, amount: Long) {
|
protected fun addToMap(ccy: Currency, amount: Long) {
|
||||||
val value = currencyMap[ccy]
|
currencyMap.computeIfPresent(ccy) { _, value -> Math.max(0L, value + amount) }
|
||||||
if (value != null)
|
|
||||||
currencyMap[ccy] = Math.max(0L, value + amount)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected val issueCashGenerator = amountGenerator.combine(partyGenerator, issueRefGenerator, currencyGenerator) { amount, to, issueRef, ccy ->
|
protected val issueCashGenerator = amountGenerator.combine(partyGenerator, issueRefGenerator, currencyGenerator) { amount, to, issueRef, ccy ->
|
||||||
|
@ -23,7 +23,7 @@ import tornadofx.*
|
|||||||
* TODO : Predictive text?
|
* TODO : Predictive text?
|
||||||
* TODO : Regex?
|
* TODO : Regex?
|
||||||
*/
|
*/
|
||||||
class SearchField<T>(private val data: ObservableList<T>, val filterCriteria: List<Pair<String, (T, String) -> Boolean>>,
|
class SearchField<T>(private val data: ObservableList<T>, vararg filterCriteria: Pair<String, (T, String) -> Boolean>,
|
||||||
val disabledFields: List<String> = emptyList()) : UIComponent() {
|
val disabledFields: List<String> = emptyList()) : UIComponent() {
|
||||||
override val root: Parent by fxml()
|
override val root: Parent by fxml()
|
||||||
private val textField by fxid<TextField>()
|
private val textField by fxid<TextField>()
|
||||||
|
@ -102,10 +102,10 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
label("In progress") {
|
label("In progress") {
|
||||||
graphic = FontAwesomeIconView(FontAwesomeIcon.ROCKET).apply { // Blazing fast! Try not to blink.
|
graphic = FontAwesomeIconView(FontAwesomeIcon.ROCKET).apply {
|
||||||
|
// Blazing fast! Try not to blink.
|
||||||
glyphSize = 15.0
|
glyphSize = 15.0
|
||||||
textAlignment = TextAlignment.CENTER
|
textAlignment = TextAlignment.CENTER
|
||||||
style = "-fx-fill: lightslategrey"
|
style = "-fx-fill: lightslategrey"
|
||||||
@ -117,21 +117,27 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val searchField = SearchField(stateMachinesAll, listOf(
|
val searchField = SearchField(stateMachinesAll,
|
||||||
"Flow name" to { sm, s -> sm.stateMachineName.contains(s, true) },
|
"Flow name" to { sm, s -> sm.stateMachineName.contains(s, true) },
|
||||||
"Initiator" to { sm, s -> FlowInitiatorFormatter.format(sm.flowInitiator).contains(s, true) },
|
"Initiator" to { sm, s -> FlowInitiatorFormatter.format(sm.flowInitiator).contains(s, true) },
|
||||||
"Flow Status" to { sm, s -> val stat = sm.stateMachineStatus.value.status ?: "No progress data"
|
"Flow Status" to { sm, s ->
|
||||||
stat.contains(s, true) },
|
val stat = sm.stateMachineStatus.value.status ?: "No progress data"
|
||||||
"Error" to { sm, _ -> val smAddRm = sm.addRmStatus.value
|
stat.contains(s, true)
|
||||||
|
},
|
||||||
|
"Error" to { sm, _ ->
|
||||||
|
val smAddRm = sm.addRmStatus.value
|
||||||
if (smAddRm is StateMachineStatus.Removed)
|
if (smAddRm is StateMachineStatus.Removed)
|
||||||
smAddRm.result.error != null
|
smAddRm.result.error != null
|
||||||
else false },
|
else false
|
||||||
"Done" to { sm, _ -> val smAddRm = sm.addRmStatus.value
|
},
|
||||||
|
"Done" to { sm, _ ->
|
||||||
|
val smAddRm = sm.addRmStatus.value
|
||||||
if (smAddRm is StateMachineStatus.Removed)
|
if (smAddRm is StateMachineStatus.Removed)
|
||||||
smAddRm.result.error == null
|
smAddRm.result.error == null
|
||||||
else false },
|
else false
|
||||||
"In progress" to { sm, _ -> sm.addRmStatus.value !is StateMachineStatus.Removed }),
|
},
|
||||||
listOf("Error", "Done", "In progress")
|
"In progress" to { sm, _ -> sm.addRmStatus.value !is StateMachineStatus.Removed },
|
||||||
|
disabledFields = listOf("Error", "Done", "In progress")
|
||||||
)
|
)
|
||||||
root.top = searchField.root
|
root.top = searchField.root
|
||||||
makeColumns(allViewTable, searchField.filteredData)
|
makeColumns(allViewTable, searchField.filteredData)
|
||||||
@ -145,6 +151,7 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
private val flowNameLabel by fxid<Label>()
|
private val flowNameLabel by fxid<Label>()
|
||||||
private val flowProgressVBox by fxid<VBox>()
|
private val flowProgressVBox by fxid<VBox>()
|
||||||
private val flowInitiatorGrid by fxid<GridPane>()
|
private val flowInitiatorGrid by fxid<GridPane>()
|
||||||
|
private val flowInitiatorTitle by fxid<Label>()
|
||||||
private val flowResultVBox by fxid<VBox>()
|
private val flowResultVBox by fxid<VBox>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -158,19 +165,19 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (smmData.flowInitiator) {
|
when (smmData.flowInitiator) {
|
||||||
is FlowInitiator.Shell -> makeShellGrid(flowInitiatorGrid) // TODO Extend this when we will have more information on shell user.
|
is FlowInitiator.Shell -> makeShellGrid(flowInitiatorGrid, flowInitiatorTitle) // TODO Extend this when we will have more information on shell user.
|
||||||
is FlowInitiator.Peer -> makePeerGrid(flowInitiatorGrid, smmData.flowInitiator as FlowInitiator.Peer)
|
is FlowInitiator.Peer -> makePeerGrid(flowInitiatorGrid, flowInitiatorTitle, smmData.flowInitiator as FlowInitiator.Peer)
|
||||||
is FlowInitiator.RPC -> makeRPCGrid(flowInitiatorGrid, smmData.flowInitiator as FlowInitiator.RPC)
|
is FlowInitiator.RPC -> makeRPCGrid(flowInitiatorGrid, flowInitiatorTitle, smmData.flowInitiator as FlowInitiator.RPC)
|
||||||
is FlowInitiator.Scheduled -> makeScheduledGrid(flowInitiatorGrid, smmData.flowInitiator as FlowInitiator.Scheduled)
|
is FlowInitiator.Scheduled -> makeScheduledGrid(flowInitiatorGrid, flowInitiatorTitle, smmData.flowInitiator as FlowInitiator.Scheduled)
|
||||||
}
|
}
|
||||||
val status = smmData.addRmStatus.value
|
val status = smmData.addRmStatus.value
|
||||||
if (status is StateMachineStatus.Removed) {
|
if (status is StateMachineStatus.Removed) {
|
||||||
status.result.match(onValue = { makeResultVBox(flowResultVBox, it) }, onError = { makeErrorVBox(flowResultVBox, it) })
|
status.result.match(onValue = { makeResultVBox(flowResultVBox, it) }, onError = { makeErrorVBox(flowResultVBox, it) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T>makeResultVBox(vbox: VBox, result: T) {
|
private fun <T> makeResultVBox(vbox: VBox, result: T) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
vbox.apply { label("No return value from flow.").apply { style { fontWeight = FontWeight.BOLD } } }
|
vbox.apply { label("No return value from flow.").apply { style { fontWeight = FontWeight.BOLD } } }
|
||||||
} else if (result is SignedTransaction) {
|
} else if (result is SignedTransaction) {
|
||||||
@ -186,8 +193,7 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
} else if (result is Unit) {
|
} else if (result is Unit) {
|
||||||
vbox.apply { label("Flow completed with success.").apply { style { fontWeight = FontWeight.BOLD } } }
|
vbox.apply { label("Flow completed with success.").apply { style { fontWeight = FontWeight.BOLD } } }
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// TODO Here we could have sth different than SignedTransaction/Unit
|
// TODO Here we could have sth different than SignedTransaction/Unit
|
||||||
vbox.apply {
|
vbox.apply {
|
||||||
label("Flow completed with success. Result: ").apply { style { fontWeight = FontWeight.BOLD } }
|
label("Flow completed with success. Result: ").apply { style { fontWeight = FontWeight.BOLD } }
|
||||||
@ -215,19 +221,17 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeShellGrid(gridPane: GridPane) {
|
private fun makeShellGrid(gridPane: GridPane, title: Label) {
|
||||||
val title = gridPane.lookup("#flowInitiatorTitle") as Label
|
|
||||||
title.apply {
|
title.apply {
|
||||||
text = "Flow started by shell user"
|
text = "Flow started by shell user"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makePeerGrid(gridPane: GridPane, initiator: FlowInitiator.Peer) {
|
private fun makePeerGrid(gridPane: GridPane, title: Label, initiator: FlowInitiator.Peer) {
|
||||||
val title = gridPane.lookup("#flowInitiatorTitle") as Label
|
|
||||||
title.apply {
|
title.apply {
|
||||||
text = "Flow started by a peer node"
|
text = "Flow started by a peer node"
|
||||||
}
|
}
|
||||||
gridPane.apply{
|
gridPane.apply {
|
||||||
row {
|
row {
|
||||||
label("Legal name: ") {
|
label("Legal name: ") {
|
||||||
gridpaneConstraints { hAlignment = HPos.LEFT }
|
gridpaneConstraints { hAlignment = HPos.LEFT }
|
||||||
@ -249,8 +253,7 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeRPCGrid(gridPane: GridPane, initiator: FlowInitiator.RPC) {
|
private fun makeRPCGrid(gridPane: GridPane, title: Label, initiator: FlowInitiator.RPC) {
|
||||||
val title = gridPane.lookup("#flowInitiatorTitle") as Label
|
|
||||||
title.apply {
|
title.apply {
|
||||||
text = "Flow started by a RPC user"
|
text = "Flow started by a RPC user"
|
||||||
}
|
}
|
||||||
@ -267,8 +270,7 @@ class StateMachineViewer : CordaView("Flow Triage") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO test
|
// TODO test
|
||||||
private fun makeScheduledGrid(gridPane: GridPane, initiator: FlowInitiator.Scheduled) {
|
private fun makeScheduledGrid(gridPane: GridPane, title: Label, initiator: FlowInitiator.Scheduled) {
|
||||||
val title = gridPane.lookup("#flowInitiatorTitle") as Label
|
|
||||||
title.apply {
|
title.apply {
|
||||||
text = "Flow started as scheduled activity"
|
text = "Flow started as scheduled activity"
|
||||||
}
|
}
|
||||||
|
@ -105,13 +105,13 @@ class TransactionViewer : CordaView("Transactions") {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val searchField = SearchField(transactions, listOf(
|
val searchField = SearchField(transactions,
|
||||||
"Transaction ID" to { tx, s -> "${tx.id}".contains(s, true) },
|
"Transaction ID" to { tx, s -> "${tx.id}".contains(s, true) },
|
||||||
"Input" to { tx, s -> tx.inputs.resolved.any { it.state.data.contract.javaClass.simpleName.contains(s, true) } },
|
"Input" to { tx, s -> tx.inputs.resolved.any { it.state.data.contract.javaClass.simpleName.contains(s, true) } },
|
||||||
"Output" to { tx, s -> tx.outputs.any { it.state.data.contract.javaClass.simpleName.contains(s, true) } },
|
"Output" to { tx, s -> tx.outputs.any { it.state.data.contract.javaClass.simpleName.contains(s, true) } },
|
||||||
"Input Party" to { tx, s -> tx.inputParties.any { it.any { it.value?.legalIdentity?.name?.commonName?.contains(s, true) ?: false } } },
|
"Input Party" to { tx, s -> tx.inputParties.any { it.any { it.value?.legalIdentity?.name?.commonName?.contains(s, true) ?: false } } },
|
||||||
"Output Party" to { tx, s -> tx.outputParties.any { it.any { it.value?.legalIdentity?.name?.commonName?.contains(s, true) ?: false } } },
|
"Output Party" to { tx, s -> tx.outputParties.any { it.any { it.value?.legalIdentity?.name?.commonName?.contains(s, true) ?: false } } },
|
||||||
"Command Type" to { tx, s -> tx.commandTypes.any { it.simpleName.contains(s, true) } })
|
"Command Type" to { tx, s -> tx.commandTypes.any { it.simpleName.contains(s, true) } }
|
||||||
)
|
)
|
||||||
root.top = searchField.root
|
root.top = searchField.root
|
||||||
// Transaction table
|
// Transaction table
|
||||||
|
@ -146,9 +146,9 @@ class CashViewer : CordaView("Cash") {
|
|||||||
* one which produces more results, which seems to work, as the set of currency strings don't really overlap with
|
* one which produces more results, which seems to work, as the set of currency strings don't really overlap with
|
||||||
* issuer strings.
|
* issuer strings.
|
||||||
*/
|
*/
|
||||||
val searchField = SearchField(cashStates, listOf(
|
val searchField = SearchField(cashStates,
|
||||||
"Currency" to { state, text -> state.state.data.amount.token.product.toString().contains(text, true) },
|
"Currency" to { state, text -> state.state.data.amount.token.product.toString().contains(text, true) },
|
||||||
"Issuer" to { state, text -> state.resolveIssuer().value?.name?.commonName?.contains(text, true) ?: false })
|
"Issuer" to { state, text -> state.resolveIssuer().value?.name?.commonName?.contains(text, true) ?: false }
|
||||||
)
|
)
|
||||||
root.top = hbox(5.0) {
|
root.top = hbox(5.0) {
|
||||||
button("New Transaction", FontAwesomeIconView(FontAwesomeIcon.PLUS)) {
|
button("New Transaction", FontAwesomeIconView(FontAwesomeIcon.PLUS)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user