2023-09-27 18:11:46 +00:00
import QtQuick 2.15
import QtQuick . Layouts 1.15
import QtQuick . Controls 2.15
import QtQml . Models 2.15
import QtQml 2.15
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Controls 0.1
import StatusQ . Components 0.1
import StatusQ . Popups . Dialog 0.1
import shared . controls 1.0
import shared . popups 1.0
import utils 1.0
StatusDialog {
id: root
required property string communityName
required property int shardIndex
2023-10-31 20:40:00 +00:00
required property string pubsubTopic
2023-09-27 18:11:46 +00:00
signal disableShardingRequested ( )
signal editShardIndexRequested ( )
title: qsTr ( "Manage community sharding for %1" ) . arg ( communityName )
width: 640
footer: StatusDialogFooter {
rightButtons: ObjectModel {
StatusFlatButton {
type: StatusBaseButton . Type . Danger
text: qsTr ( "Disable community sharding" )
onClicked: confirmationPopup . open ( )
}
StatusButton {
text: qsTr ( "Edit shard number" )
onClicked: {
root . editShardIndexRequested ( )
root . close ( )
}
}
}
}
contentItem: ColumnLayout {
spacing: Style . current . halfPadding
2023-10-02 12:20:15 +00:00
StatusBaseText {
text: qsTr ( "Shard number" )
}
StatusTextArea {
2023-09-27 18:11:46 +00:00
Layout.fillWidth: true
2023-10-02 12:20:15 +00:00
readOnly: true
2023-09-27 18:11:46 +00:00
text: root . shardIndex
}
2023-10-02 12:20:15 +00:00
StatusBaseText {
Layout.topMargin: Style . current . halfPadding
text: qsTr ( "Pub/Sub topic" )
}
StatusTextArea {
2023-09-27 18:11:46 +00:00
Layout.fillWidth: true
2023-10-02 12:20:15 +00:00
Layout.preferredHeight: 138
readOnly: true
2023-10-31 20:40:00 +00:00
text: root . pubsubTopic
2023-10-02 12:20:15 +00:00
rightPadding: 48
wrapMode: TextEdit . Wrap
2023-09-27 18:11:46 +00:00
CopyButton {
anchors.right: parent . right
anchors.top: parent . top
anchors.rightMargin: 12
2023-10-02 12:20:15 +00:00
anchors.topMargin: 10
2023-09-27 18:11:46 +00:00
textToCopy: parent . text
}
}
}
ConfirmationDialog {
id: confirmationPopup
anchors.centerIn: parent
headerSettings.title: qsTr ( "Are you sure you want to disable sharding?" )
showCancelButton: true
cancelBtnType: ""
confirmationText: qsTr ( "Are you sure you want to disable community sharding? Your community will automatically revert to using the general shared Waku network." )
confirmButtonLabel: qsTr ( "Disable community sharding" )
onCancelButtonClicked: close ( )
onConfirmButtonClicked: {
close ( )
root . disableShardingRequested ( )
root . close ( )
}
}
}