2023-06-01 11:25:33 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
import ContainerProps 1.0
|
2024-07-07 13:42:38 +03:00
|
|
|
import Style 1.0
|
2023-06-01 11:25:33 +08:00
|
|
|
|
|
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
import "../Config"
|
|
|
|
|
import "../Components"
|
|
|
|
|
|
|
|
|
|
PageType {
|
|
|
|
|
id: root
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
readonly property int pageSettingsServerProtocols: 0
|
|
|
|
|
readonly property int pageSettingsServerServices: 1
|
|
|
|
|
readonly property int pageSettingsServerData: 2
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
property var processedServer
|
|
|
|
|
|
2023-08-16 12:11:34 +05:00
|
|
|
Connections {
|
|
|
|
|
target: PageController
|
|
|
|
|
|
|
|
|
|
function onGoToPageSettingsServerServices() {
|
2024-12-31 04:16:52 +01:00
|
|
|
tabBar.setCurrentIndex(root.pageSettingsServerServices)
|
2023-08-16 12:11:34 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-28 10:57:08 +08:00
|
|
|
Connections {
|
|
|
|
|
target: ServersUiController
|
|
|
|
|
|
|
|
|
|
function onProcessedServerIdChanged() {
|
|
|
|
|
root.processedServer = proxyServersModel.get(0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
Connections {
|
|
|
|
|
target: ServersModel
|
|
|
|
|
|
2026-05-28 10:57:08 +08:00
|
|
|
function onModelReset() {
|
2024-12-09 09:32:49 +03:00
|
|
|
root.processedServer = proxyServersModel.get(0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
SortFilterProxyModel {
|
|
|
|
|
id: proxyServersModel
|
2024-12-09 09:32:49 +03:00
|
|
|
objectName: "proxyServersModel"
|
|
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
sourceModel: ServersModel
|
|
|
|
|
filters: [
|
|
|
|
|
ValueFilter {
|
2026-05-28 10:57:08 +08:00
|
|
|
roleName: "serverId"
|
|
|
|
|
value: ServersUiController.processedServerId
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
]
|
2024-12-09 09:32:49 +03:00
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
root.processedServer = proxyServersModel.get(0)
|
|
|
|
|
}
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "mainLayout"
|
|
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
anchors.fill: parent
|
2026-04-30 14:53:03 +08:00
|
|
|
anchors.topMargin: 20 + PageController.safeAreaTopMargin
|
2023-06-01 11:25:33 +08:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
spacing: 4
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
BackButtonType {
|
|
|
|
|
id: backButton
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "backButton"
|
2024-12-09 09:32:49 +03:00
|
|
|
}
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2025-05-02 23:54:36 -07:00
|
|
|
HeaderTypeWithButton {
|
2024-12-09 09:32:49 +03:00
|
|
|
id: headerContent
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "headerContent"
|
|
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2024-12-31 04:16:52 +01:00
|
|
|
Layout.bottomMargin: 10
|
2023-06-01 11:25:33 +08:00
|
|
|
|
2025-01-31 10:06:35 +07:00
|
|
|
actionButtonImage: "qrc:/images/controls/edit-3.svg"
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2026-05-28 10:57:08 +08:00
|
|
|
headerText: root.processedServer != null ? root.processedServer.name : ""
|
2024-12-09 09:32:49 +03:00
|
|
|
descriptionText: {
|
2026-05-28 10:57:08 +08:00
|
|
|
if (root.processedServer == null) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
if (ServersUiController.isServerFromApi(ServersUiController.processedServerId)) {
|
2024-12-09 09:32:49 +03:00
|
|
|
return root.processedServer.serverDescription
|
2026-05-28 10:57:08 +08:00
|
|
|
} else if (ServersUiController.isProcessedServerHasWriteAccess()) {
|
2024-12-09 09:32:49 +03:00
|
|
|
return root.processedServer.credentialsLogin + " · " + root.processedServer.hostName
|
|
|
|
|
} else {
|
|
|
|
|
return root.processedServer.hostName
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
2024-12-09 09:32:49 +03:00
|
|
|
}
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
actionButtonFunction: function() {
|
2025-01-31 10:06:35 +07:00
|
|
|
serverNameEditDrawer.openTriggered()
|
2024-12-09 09:32:49 +03:00
|
|
|
}
|
|
|
|
|
}
|
2023-06-20 10:25:24 +09:00
|
|
|
|
2025-01-31 10:06:35 +07:00
|
|
|
RenameServerDrawer {
|
2024-12-09 09:32:49 +03:00
|
|
|
id: serverNameEditDrawer
|
2023-06-20 10:25:24 +09:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
parent: root
|
2023-06-20 10:25:24 +09:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
expandedHeight: root.height * 0.35
|
2023-06-20 10:25:24 +09:00
|
|
|
|
2026-05-28 10:57:08 +08:00
|
|
|
serverNameText: root.processedServer != null ? root.processedServer.name : ""
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TabBar {
|
|
|
|
|
id: tabBar
|
|
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2026-05-28 10:57:08 +08:00
|
|
|
currentIndex: (ServersUiController.isServerFromApi(ServersUiController.processedServerId)
|
|
|
|
|
&& !ServersUiController.serverHasInstalledContainers(ServersUiController.processedServerId)) ?
|
2024-08-20 16:54:05 +07:00
|
|
|
root.pageSettingsServerData : root.pageSettingsServerProtocols
|
2024-04-15 21:33:20 +05:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
background: Rectangle {
|
2024-07-07 13:42:38 +03:00
|
|
|
color: AmneziaStyle.color.transparent
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
TabButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: protocolsTab
|
2023-06-23 15:24:40 +09:00
|
|
|
visible: protocolsPage.installedProtocolsCount
|
|
|
|
|
width: protocolsPage.installedProtocolsCount ? undefined : 0
|
2024-12-31 04:16:52 +01:00
|
|
|
isSelected: TabBar.tabBar.currentIndex === root.pageSettingsServerProtocols
|
2023-06-01 11:25:33 +08:00
|
|
|
text: qsTr("Protocols")
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
Keys.onReturnPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerProtocols)
|
|
|
|
|
Keys.onEnterPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerProtocols)
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
TabButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: servicesTab
|
2023-06-23 15:24:40 +09:00
|
|
|
visible: servicesPage.installedServicesCount
|
|
|
|
|
width: servicesPage.installedServicesCount ? undefined : 0
|
2024-12-31 04:16:52 +01:00
|
|
|
isSelected: TabBar.tabBar.currentIndex === root.pageSettingsServerServices
|
2023-06-01 11:25:33 +08:00
|
|
|
text: qsTr("Services")
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
Keys.onReturnPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerServices)
|
|
|
|
|
Keys.onEnterPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerServices)
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
TabButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: dataTab
|
2024-08-20 16:54:05 +07:00
|
|
|
isSelected: tabBar.currentIndex === root.pageSettingsServerData
|
2024-03-26 20:05:04 +02:00
|
|
|
text: qsTr("Management")
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
Keys.onReturnPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerData)
|
|
|
|
|
Keys.onEnterPressed: TabBar.tabBar.setCurrentIndex(root.pageSettingsServerData)
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StackLayout {
|
2024-08-20 16:54:05 +07:00
|
|
|
id: nestedStackView
|
2024-12-31 04:16:52 +01:00
|
|
|
|
2024-12-09 09:32:49 +03:00
|
|
|
Layout.fillWidth: true
|
2023-06-01 11:25:33 +08:00
|
|
|
|
2025-01-31 10:06:35 +07:00
|
|
|
currentIndex: tabBar.currentIndex
|
2023-06-01 11:25:33 +08:00
|
|
|
|
|
|
|
|
PageSettingsServerProtocols {
|
2023-06-23 15:24:40 +09:00
|
|
|
id: protocolsPage
|
2023-06-01 11:25:33 +08:00
|
|
|
stackView: root.stackView
|
|
|
|
|
}
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
PageSettingsServerServices {
|
2023-06-23 15:24:40 +09:00
|
|
|
id: servicesPage
|
2023-06-01 11:25:33 +08:00
|
|
|
stackView: root.stackView
|
|
|
|
|
}
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
PageSettingsServerData {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: dataPage
|
2023-06-01 11:25:33 +08:00
|
|
|
stackView: root.stackView
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|