added page to display WireGuard client information

This commit is contained in:
vladimir.kuznetsov 2023-01-10 16:21:45 +03:00
parent a42beb86c0
commit 8c137ecc52
9 changed files with 216 additions and 76 deletions

View file

@ -9,7 +9,6 @@ import "../../Config"
PageClientInfoBase {
id: root
protocol: ProtocolEnum.OpenVpn
BackButton {
id: back
}
@ -71,7 +70,7 @@ PageClientInfoBase {
LabelType {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: ClientInfoLogic.labelCertId
text: ClientInfoLogic.labelOpenVpnCertId
}
LabelType {
@ -87,7 +86,7 @@ PageClientInfoBase {
textArea.readOnly: true
textArea.wrapMode: TextEdit.WrapAnywhere
textArea.verticalAlignment: Text.AlignTop
textArea.text: ClientInfoLogic.textAreaCertificate
textArea.text: ClientInfoLogic.textAreaOpenVpnCertData
}
BlueButtonType {
@ -95,7 +94,7 @@ PageClientInfoBase {
Layout.preferredHeight: 41
text: qsTr("Revoke Certificate")
onClicked: {
ClientInfoLogic.onRevokeCertificateClicked()
ClientInfoLogic.onRevokeOpenVpnCertificateClicked()
}
}
}

View file

@ -7,5 +7,84 @@ import "../../Controls"
import "../../Config"
PageClientInfoBase {
id: root
protocol: ProtocolEnum.WireGuard
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Client Info")
}
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
LabelType {
Layout.fillWidth: true
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: ClientInfoLogic.labelCurrentVpnProtocolText
}
LabelType {
height: 21
text: qsTr("Client name")
}
TextFieldType {
Layout.fillWidth: true
Layout.preferredHeight: 31
text: ClientInfoLogic.lineEditNameAliasText
onEditingFinished: {
ClientInfoLogic.lineEditNameAliasText = text
ClientInfoLogic.onLineEditNameAliasEditingFinished()
}
}
LabelType {
Layout.topMargin: 20
height: 21
text: qsTr("Public Key")
}
TextAreaType {
Layout.preferredHeight: 200
Layout.fillWidth: true
textArea.readOnly: true
textArea.wrapMode: TextEdit.WrapAnywhere
textArea.verticalAlignment: Text.AlignTop
textArea.text: ClientInfoLogic.textAreaWireGuardKeyData
}
BlueButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 41
text: qsTr("Revoke Key")
onClicked: {
ClientInfoLogic.onRevokeWireGuardKeyClicked()
}
}
}
}
}

View file

@ -2,6 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Shapes 1.4
import SortFilterProxyModel 0.2
import PageEnum 1.0
import "./"
import "../Controls"
@ -45,6 +46,12 @@ PageBase {
text: ServerSettingsLogic.labelCurrentVpnProtocolText
}
SortFilterProxyModel {
id: proxyClientManagementModel
sourceModel: UiLogic.clientManagementModel
sorters: RoleSorter { roleName: "clientName" }
}
ListView {
id: lv_clients
width: parent.width
@ -56,7 +63,7 @@ PageBase {
topMargin: 10
spacing: 10
clip: true
model: UiLogic.clientManagementModel
model: proxyClientManagementModel
highlightRangeMode: ListView.ApplyRange
highlightMoveVelocity: -1
delegate: Item {
@ -69,7 +76,7 @@ PageBase {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
ClientManagementLogic.onClientItemClicked(index)
ClientManagementLogic.onClientItemClicked(proxyClientManagementModel.mapToSource(index))
}
}
@ -96,23 +103,11 @@ PageBase {
}
}
Text {
x: 10
y: 10
font.family: "Lato"
font.styleName: "normal"
color: "#181922"
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: clientName
}
LabelType {
x: 20
y: 40
// width: 141
height: 16
text: certId
y: 20
font.pixelSize: 20
text: clientName
}
}
}