fix: pinned mailserver value
This commit is contained in:
parent
934dacd632
commit
9fe2236a23
|
@ -41,9 +41,9 @@ proc getPinnedMailserver*(self: Controller): string =
|
|||
let fleet = self.settingsService.getFleet()
|
||||
self.settingsService.getPinnedMailserver(fleet)
|
||||
|
||||
proc pinMailserver*(self: Controller, nodeAddress: string) =
|
||||
proc pinMailserver*(self: Controller, mailserverID: string) =
|
||||
let fleet = self.settingsService.getFleet()
|
||||
discard self.settingsService.pinMailserver(nodeAddress, fleet)
|
||||
discard self.settingsService.pinMailserver(mailserverID, fleet)
|
||||
|
||||
proc saveNewMailserver*(self: Controller, name: string, nodeAddress: string) =
|
||||
discard self.mailserversService.saveMailserver(name, nodeAddress)
|
||||
|
|
|
@ -27,7 +27,7 @@ method isAutomaticSelection*(self: AccessInterface): bool {.base.} =
|
|||
method getMailserverNameForNodeAddress*(self: AccessInterface, nodeAddress: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setActiveMailserver*(self: AccessInterface, nodeAddress: string) {.base.} =
|
||||
method setActiveMailserver*(self: AccessInterface, mailserverID: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method saveNewMailserver*(self: AccessInterface, name: string, nodeAddress: string) {.base.} =
|
||||
|
|
|
@ -72,8 +72,8 @@ method getMailserverNameForNodeAddress*(self: Module, nodeAddress: string): stri
|
|||
return name
|
||||
return "---"
|
||||
|
||||
method setActiveMailserver*(self: Module, nodeAddress: string) =
|
||||
self.controller.pinMailserver(nodeAddress)
|
||||
method setActiveMailserver*(self: Module, mailserverID: string) =
|
||||
self.controller.pinMailserver(mailserverID)
|
||||
|
||||
method saveNewMailserver*(self: Module, name: string, nodeAddress: string) =
|
||||
self.controller.saveNewMailserver(name, nodeAddress)
|
||||
|
|
|
@ -47,8 +47,8 @@ QtObject:
|
|||
read = getActiveMailserver
|
||||
notify = activeMailserverChanged
|
||||
|
||||
proc setActiveMailserver(self: View, nodeAddress: string) {.slot.} =
|
||||
self.delegate.setActiveMailserver(nodeAddress)
|
||||
proc setActiveMailserver(self: View, mailserverID: string) {.slot.} =
|
||||
self.delegate.setActiveMailserver(mailserverID)
|
||||
|
||||
proc onActiveMailserverSet*(self: View, nodeAddress: string) =
|
||||
if(self.activeMailserver == nodeAddress):
|
||||
|
|
|
@ -10,8 +10,8 @@ import ../node_configuration/service as node_configuration_service
|
|||
import ../../../backend/mailservers as status_mailservers
|
||||
|
||||
# allow runtime override via environment variable; core contributors can set a
|
||||
# mailserver address in this way for local development or test
|
||||
let MAILSERVER_ADDRESS = $getEnv("MAILSERVER")
|
||||
# mailserver id in this way for local development or test
|
||||
let MAILSERVER_ID = $getEnv("MAILSERVER")
|
||||
|
||||
# allow runtime override via environment variable. core contributors can set a
|
||||
# specific peer to set for testing messaging and mailserver functionality with squish.
|
||||
|
@ -121,8 +121,8 @@ QtObject:
|
|||
let mailserverID = self.saveMailserver(mailserverName, TEST_PEER_ENR)
|
||||
discard self.settingsService.pinMailserver(mailserverId, fleet)
|
||||
|
||||
if MAILSERVER_ADDRESS != "":
|
||||
discard self.settingsService.pinMailserver(MAILSERVER_ADDRESS, fleet)
|
||||
if MAILSERVER_ID != "":
|
||||
discard self.settingsService.pinMailserver(MAILSERVER_ID, fleet)
|
||||
|
||||
proc mailserverSynced*(self: Service, syncInfo: string) {.slot.} =
|
||||
let syncInfoParsed = parseJson(syncInfo)
|
||||
|
|
|
@ -359,26 +359,26 @@ QtObject:
|
|||
return self.settings.pinnedMailserver.statusProd
|
||||
return ""
|
||||
|
||||
proc pinMailserver*(self: Service, address: string, fleet: Fleet): bool =
|
||||
proc pinMailserver*(self: Service, mailserverID: string, fleet: Fleet): bool =
|
||||
var newMailserverJsonObj = self.settings.pinnedMailserver.pinnedMailserverToJsonNode()
|
||||
newMailserverJsonObj[$fleet] = %* address
|
||||
newMailserverJsonObj[$fleet] = %* mailserverID
|
||||
if(self.saveSetting(KEY_PINNED_MAILSERVERS, newMailserverJsonObj)):
|
||||
if (fleet == Fleet.Prod):
|
||||
self.settings.pinnedMailserver.ethProd = address
|
||||
self.settings.pinnedMailserver.ethProd = mailserverID
|
||||
elif (fleet == Fleet.Staging):
|
||||
self.settings.pinnedMailserver.ethStaging = address
|
||||
self.settings.pinnedMailserver.ethStaging = mailserverID
|
||||
elif (fleet == Fleet.Test):
|
||||
self.settings.pinnedMailserver.ethTest = address
|
||||
self.settings.pinnedMailserver.ethTest = mailserverID
|
||||
elif (fleet == Fleet.WakuV2Prod):
|
||||
self.settings.pinnedMailserver.wakuv2Prod = address
|
||||
self.settings.pinnedMailserver.wakuv2Prod = mailserverID
|
||||
elif (fleet == Fleet.WakuV2Test):
|
||||
self.settings.pinnedMailserver.wakuv2Test = address
|
||||
self.settings.pinnedMailserver.wakuv2Test = mailserverID
|
||||
elif (fleet == Fleet.GoWakuTest):
|
||||
self.settings.pinnedMailserver.goWakuTest = address
|
||||
self.settings.pinnedMailserver.goWakuTest = mailserverID
|
||||
elif (fleet == Fleet.StatusTest):
|
||||
self.settings.pinnedMailserver.statusTest = address
|
||||
self.settings.pinnedMailserver.statusTest = mailserverID
|
||||
elif (fleet == Fleet.StatusProd):
|
||||
self.settings.pinnedMailserver.statusProd = address
|
||||
self.settings.pinnedMailserver.statusProd = mailserverID
|
||||
return true
|
||||
return false
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ StatusModal {
|
|||
model: root.messagingStore.mailservers
|
||||
delegate: Component {
|
||||
StatusListItem {
|
||||
title: qsTr("Node %1").arg(index)
|
||||
title: qsTr("Node %1").arg(index + 1)
|
||||
subTitle: model.name
|
||||
visible: !automaticSelectionSwitch.checked
|
||||
height: visible ? implicitHeight : 0
|
||||
|
@ -101,7 +101,7 @@ StatusModal {
|
|||
checked: model.nodeAddress === root.messagingStore.activeMailserver
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
root.messagingStore.setActiveMailserver(model.nodeAddress)
|
||||
root.messagingStore.setActiveMailserver(model.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ QtObject {
|
|||
return root.syncModule.getMailserverNameForNodeAddress(nodeAddress)
|
||||
}
|
||||
|
||||
function setActiveMailserver(nodeAddress) {
|
||||
root.syncModule.setActiveMailserver(nodeAddress)
|
||||
function setActiveMailserver(mailserverID) {
|
||||
root.syncModule.setActiveMailserver(mailserverID)
|
||||
}
|
||||
|
||||
function saveNewMailserver(name, nodeAddress) {
|
||||
|
|
Loading…
Reference in New Issue