mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
CORDA-1480: In Demobench, saving a profile, opening it, and adding a node skips next name (#4113)
* Fixes Github #3800 ,Jira Issue CORDA-1480 * did the requested changes * does the requested changes * Did requested changes * Does the required changes
This commit is contained in:
parent
51adf9b678
commit
e14421b7b4
@ -203,6 +203,7 @@ see changes to this list.
|
||||
* tomtau
|
||||
* Tudor Malene (R3)
|
||||
* Tushar Singh Bora (Accenture)
|
||||
* Vardan Nadkarni (Persistent Systems Limited)
|
||||
* varunkm
|
||||
* Venelin Stoykov (INDUSTRIA)
|
||||
* verymahler
|
||||
|
@ -165,6 +165,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
|
||||
nodeInfoFilesCopier.reset()
|
||||
notaryIdentity = null
|
||||
networkParametersCopier = null
|
||||
SuggestedDetails.reset()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,20 @@ object SuggestedDetails {
|
||||
|
||||
private var cursor = 0
|
||||
|
||||
val nextBank: Pair<String, String> get() = banks[cursor++ % banks.size]
|
||||
fun nextBank(exists: (String) -> Boolean): Pair<String, String> {
|
||||
for (i in 0 until banks.size) {
|
||||
val bank = banks[cursor]
|
||||
if (!exists(bank.first)) {
|
||||
return bank
|
||||
}
|
||||
cursor = (cursor + 1) % banks.size
|
||||
}
|
||||
return banks[cursor]
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
cursor = 0
|
||||
}
|
||||
}
|
||||
|
||||
class NodeData {
|
||||
|
@ -206,7 +206,8 @@ class NodeTabView : Fragment() {
|
||||
model.webPort.value = nodeController.nextPort
|
||||
model.h2Port.value = nodeController.nextPort
|
||||
|
||||
val defaults = SuggestedDetails.nextBank
|
||||
val defaults = SuggestedDetails.nextBank(nodeController::nameExists)
|
||||
|
||||
model.legalName.value = defaults.first
|
||||
model.nearestCity.value = CityDatabase[defaults.second]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user