status-desktop/ui/app/AppLayouts/Profile/popups/AddWakuNodeModal.qml

72 lines
1.7 KiB
QML
Raw Normal View History

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
import AppLayouts.Profile.stores 1.0
StatusModal {
id: root
property MessagingStore messagingStore
property AdvancedStore advancedStore
height: 560
padding: 8
headerSettings.title: qsTr("Waku nodes")
onClosed: {
destroy()
}
onOpened: {
addrInput.text = "";
}
StatusScrollView {
id: scrollView
anchors.fill: parent
contentWidth: availableWidth
2022-07-28 22:59:58 +00:00
Column {
id: nodesColumn
width: scrollView.availableWidth
2022-07-28 22:59:58 +00:00
StatusInput {
id: addrInput
width: parent.width
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
errorMessage: qsTr("You need to enter a value")
2022-07-28 22:59:58 +00:00
},
StatusRegularExpressionValidator {
errorMessage: qsTr("Value should start with '/' or 'enr:'")
regularExpression: /(\/|enr:).+/
2022-07-28 22:59:58 +00:00
}]
validationMode: StatusInput.ValidationMode.Always
}
}
}
rightButtons: [
StatusButton {
text: qsTr("Save")
enabled: addrInput.valid
onClicked: {
root.messagingStore.saveNewWakuNode(addrInput.text)
root.close()
}
}
]
}