2023-05-25 15:40:17 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
import ProtocolEnum 1.0
|
|
|
|
|
import ContainerProps 1.0
|
2024-08-20 16:54:05 +07:00
|
|
|
import Style 1.0
|
2023-05-25 15:40:17 +08:00
|
|
|
|
|
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
import "../Config"
|
|
|
|
|
import "../Components"
|
|
|
|
|
|
|
|
|
|
PageType {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
ColumnLayout {
|
2023-05-25 15:40:17 +08:00
|
|
|
id: header
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
anchors.topMargin: 20
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
BackButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: backButton
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HeaderType {
|
|
|
|
|
Layout.fillWidth: true
|
2023-06-30 10:40:43 +09:00
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2023-07-24 16:33:58 +09:00
|
|
|
headerText: qsTr("Servers")
|
2023-05-25 15:40:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
ListView {
|
|
|
|
|
id: servers
|
|
|
|
|
objectName: "servers"
|
|
|
|
|
|
|
|
|
|
width: parent.width
|
2023-05-25 15:40:17 +08:00
|
|
|
anchors.top: header.bottom
|
|
|
|
|
anchors.topMargin: 16
|
2024-12-31 04:16:52 +01:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
height: 500
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
property bool isFocusable: true
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
model: ServersModel
|
2023-05-25 15:40:17 +08:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
clip: true
|
|
|
|
|
reuseItems: true
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
implicitWidth: servers.width
|
|
|
|
|
implicitHeight: delegateContent.implicitHeight
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: delegateContent
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
LabelWithButtonType {
|
|
|
|
|
id: server
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
text: name
|
|
|
|
|
|
|
|
|
|
descriptionText: {
|
|
|
|
|
var servicesNameString = ""
|
|
|
|
|
var servicesName = ServersModel.getAllInstalledServicesName(index)
|
|
|
|
|
for (var i = 0; i < servicesName.length; i++) {
|
|
|
|
|
servicesNameString += servicesName[i] + " · "
|
2024-04-18 17:54:55 +04:00
|
|
|
}
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
if (ServersModel.isServerFromApi(index)) {
|
|
|
|
|
return servicesNameString + serverDescription
|
|
|
|
|
} else {
|
|
|
|
|
return servicesNameString + hostName
|
2023-05-25 15:40:17 +08:00
|
|
|
}
|
2024-12-31 04:16:52 +01:00
|
|
|
}
|
|
|
|
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
2023-05-25 15:40:17 +08:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
clickedFunction: function() {
|
|
|
|
|
ServersModel.processedIndex = index
|
2025-01-31 10:06:35 +07:00
|
|
|
|
|
|
|
|
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
|
2025-02-07 22:22:14 +07:00
|
|
|
PageController.showBusyIndicator(true)
|
2025-02-10 15:10:59 +07:00
|
|
|
let result = ApiSettingsController.getAccountInfo()
|
2025-02-07 22:22:14 +07:00
|
|
|
PageController.showBusyIndicator(false)
|
2025-02-10 15:10:59 +07:00
|
|
|
if (!result) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-01-31 10:06:35 +07:00
|
|
|
|
2025-02-06 15:26:47 +07:00
|
|
|
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
|
2025-01-31 10:06:35 +07:00
|
|
|
} else {
|
|
|
|
|
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
|
|
|
|
}
|
2023-05-25 15:40:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-12-31 04:16:52 +01:00
|
|
|
|
|
|
|
|
DividerType {}
|
2023-05-25 15:40:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|