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 {
|
2023-06-06 16:45:05 +00:00
|
|
|
id: root
|
2022-03-07 20:34:59 +00:00
|
|
|
|
2023-05-31 20:58:23 +00:00
|
|
|
property var messagingStore
|
|
|
|
property var advancedStore
|
|
|
|
|
2022-03-07 20:34:59 +00:00
|
|
|
height: 560
|
2023-05-31 20:58:23 +00:00
|
|
|
padding: 8
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("Waku nodes")
|
2022-03-07 20:34:59 +00:00
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpened: {
|
2022-08-02 18:37:27 +00:00
|
|
|
addrInput.text = "";
|
2022-03-07 20:34:59 +00:00
|
|
|
}
|
2023-05-31 20:58:23 +00:00
|
|
|
|
|
|
|
StatusScrollView {
|
|
|
|
id: scrollView
|
|
|
|
anchors.fill: parent
|
|
|
|
contentWidth: availableWidth
|
2022-03-07 20:34:59 +00:00
|
|
|
|
2022-07-28 22:59:58 +00:00
|
|
|
Column {
|
|
|
|
id: nodesColumn
|
2023-05-31 20:58:23 +00:00
|
|
|
width: scrollView.availableWidth
|
2022-03-07 20:34:59 +00:00
|
|
|
|
2022-07-28 22:59:58 +00:00
|
|
|
StatusInput {
|
2022-08-02 18:37:27 +00:00
|
|
|
id: addrInput
|
2023-05-31 20:58:23 +00:00
|
|
|
width: parent.width
|
2022-08-02 18:37:27 +00:00
|
|
|
label: qsTr("Node multiaddress or DNS Discovery address")
|
|
|
|
placeholderText: "/ipv4/0.0.0.0/tcp/123/..."
|
2022-07-28 22:59:58 +00:00
|
|
|
validators: [
|
|
|
|
StatusMinLengthValidator {
|
|
|
|
minLength: 1
|
2022-08-02 18:37:27 +00:00
|
|
|
errorMessage: qsTr("You need to enter a value")
|
2022-07-28 22:59:58 +00:00
|
|
|
},
|
|
|
|
StatusRegularExpressionValidator {
|
2022-08-02 18:37:27 +00:00
|
|
|
errorMessage: qsTr("Value should start with '/' or 'enr:'")
|
|
|
|
regularExpression: /(\/|enr:).+/
|
2022-07-28 22:59:58 +00:00
|
|
|
}]
|
|
|
|
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-08-02 18:37:27 +00:00
|
|
|
enabled: addrInput.valid
|
2022-03-07 20:34:59 +00:00
|
|
|
onClicked: {
|
2022-08-02 18:37:27 +00:00
|
|
|
root.messagingStore.saveNewWakuNode(addrInput.text)
|
2023-06-06 16:45:05 +00:00
|
|
|
root.close()
|
2022-03-07 20:34:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|