2022-03-07 20:34:59 +00:00
import QtQuick 2.12
import QtQuick . Controls 2.3
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Components 0.1
import StatusQ . Controls 0.1
import StatusQ . Controls . Validators 0.1
import StatusQ . Popups 0.1
import utils 1.0
StatusModal {
id: popup
anchors.centerIn: parent
height: 560
header.title: qsTr ( "Waku nodes" )
property var messagingStore
2022-07-28 22:59:58 +00:00
property var advancedStore
2022-03-07 20:34:59 +00:00
onClosed: {
destroy ( )
}
onOpened: {
nameInput . text = "" ;
enodeInput . text = "" ;
}
2022-07-28 22:59:58 +00:00
contentItem: StatusScrollView {
2022-03-07 20:34:59 +00:00
height: parent . height
2022-07-28 22:59:58 +00:00
width: parent . width
2022-03-07 20:34:59 +00:00
2022-07-28 22:59:58 +00:00
Column {
id: nodesColumn
width: parent . width
StatusInput {
id: nameInput
label: qsTr ( "Name" )
placeholderText: qsTr ( "Specify a name" )
validators: [ StatusMinLengthValidator {
minLength: 1
errorMessage: qsTr ( "You need to enter a name" )
} ]
validationMode: StatusInput . ValidationMode . Always
}
2022-03-07 20:34:59 +00:00
2022-07-28 22:59:58 +00:00
StatusInput {
id: enodeInput
label: popup . advancedStore . isWakuV2 ? qsTr ( "Storenode multiaddress" ) : qsTr ( "History node address" )
placeholderText: popup . advancedStore . isWakuV2 ? "/ip4/0.0.0.0/tcp/123/..." : "enode://{enode-id}:{password}@{ip-address}:{port-number}"
validators: [
StatusMinLengthValidator {
minLength: 1
errorMessage: popup . advancedStore . isWakuV2 ? qsTr ( "You need to enter the storenode multiaddress" ) : qsTr ( "You need to enter the enode address" )
} ,
StatusRegularExpressionValidator {
errorMessage: popup . advancedStore . isWakuV2 ? qsTr ( 'Multiaddress must start with a "/"' ) : qsTr ( "The format must be: enode://{enode-id}:{password}@{ip-address}:{port}" )
regularExpression: popup . advancedStore . isWakuV2 ? /\/.+/ : /enode:\/\/[a-z0-9]+:[a-z0-9]+@(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}:[0-9]+/
} ]
validationMode: StatusInput . ValidationMode . Always
}
2022-03-07 20:34:59 +00:00
}
}
rightButtons: [
StatusButton {
2022-04-04 11:26:30 +00:00
text: qsTr ( "Save" )
2022-03-07 20:34:59 +00:00
enabled: nameInput . valid && enodeInput . valid
// enabled: nameInput.text !== "" && enodeInput.text !== ""
onClicked: {
root . messagingStore . saveNewMailserver ( nameInput . text , enodeInput . text )
popup . close ( )
}
}
]
}