2023-05-27 22:46:41 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
import ProtocolEnum 1.0
|
|
|
|
|
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
2023-06-05 15:49:10 +08:00
|
|
|
import "../Components"
|
2023-05-27 22:46:41 +08:00
|
|
|
|
|
|
|
|
PageType {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-06-21 20:56:00 +09:00
|
|
|
Connections {
|
|
|
|
|
target: InstallController
|
|
|
|
|
|
|
|
|
|
function onScanServerFinished(isInstalledContainerFound) {
|
|
|
|
|
var message = ""
|
|
|
|
|
if (isInstalledContainerFound) {
|
|
|
|
|
message = qsTr("All installed containers have been added to the application")
|
|
|
|
|
} else {
|
2023-09-01 00:48:58 +05:00
|
|
|
message = qsTr("No new installed containers found")
|
2023-06-21 20:56:00 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageController.showErrorMessage(message)
|
|
|
|
|
}
|
2023-07-31 00:13:08 +09:00
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
function onRemoveProcessedServerFinished(finishedMessage) {
|
2023-07-31 00:13:08 +09:00
|
|
|
if (!ServersModel.getServersCount()) {
|
|
|
|
|
PageController.replaceStartPage()
|
|
|
|
|
} else {
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToStartPage()
|
|
|
|
|
PageController.goToPage(PageEnum.PageSettingsServersList)
|
2023-07-31 00:13:08 +09:00
|
|
|
}
|
|
|
|
|
PageController.showNotificationMessage(finishedMessage)
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
function onRebootProcessedServerFinished(finishedMessage) {
|
2024-02-04 18:52:03 +02:00
|
|
|
PageController.showNotificationMessage(finishedMessage)
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-31 00:13:08 +09:00
|
|
|
function onRemoveAllContainersFinished(finishedMessage) {
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.closePage() // close deInstalling page
|
2023-07-31 00:13:08 +09:00
|
|
|
PageController.showNotificationMessage(finishedMessage)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onRemoveCurrentlyProcessedContainerFinished(finishedMessage) {
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.closePage() // close deInstalling page
|
|
|
|
|
PageController.closePage() // close page with remove button
|
2023-07-31 00:13:08 +09:00
|
|
|
PageController.showNotificationMessage(finishedMessage)
|
|
|
|
|
}
|
2023-06-21 20:56:00 +09:00
|
|
|
}
|
|
|
|
|
|
2023-08-16 12:11:34 +05:00
|
|
|
Connections {
|
|
|
|
|
target: SettingsController
|
|
|
|
|
function onChangeSettingsFinished(finishedMessage) {
|
|
|
|
|
PageController.showNotificationMessage(finishedMessage)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
Connections {
|
|
|
|
|
target: ServersModel
|
|
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
function onProcessedServerIndexChanged() {
|
|
|
|
|
content.isServerWithWriteAccess = ServersModel.isProcessedServerHasWriteAccess()
|
2023-06-23 15:24:40 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-27 22:46:41 +08:00
|
|
|
FlickableType {
|
|
|
|
|
id: fl
|
2023-06-20 10:25:24 +09:00
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: parent.bottom
|
2023-05-27 22:46:41 +08:00
|
|
|
contentHeight: content.height
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: content
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
property bool isServerWithWriteAccess: ServersModel.isProcessedServerHasWriteAccess()
|
2023-06-23 15:24:40 +09:00
|
|
|
|
2023-05-27 22:46:41 +08:00
|
|
|
LabelWithButtonType {
|
2023-06-23 15:24:40 +09:00
|
|
|
visible: content.isServerWithWriteAccess
|
2023-05-27 22:46:41 +08:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2023-06-21 20:56:00 +09:00
|
|
|
text: qsTr("Clear Amnezia cache")
|
|
|
|
|
descriptionText: qsTr("May be needed when changing other settings")
|
2023-05-27 22:46:41 +08:00
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2024-02-16 15:24:06 +05:00
|
|
|
var headerText = qsTr("Clear cached profiles?")
|
|
|
|
|
var descriptionText = qsTr("")
|
|
|
|
|
var yesButtonText = qsTr("Continue")
|
|
|
|
|
var noButtonText = qsTr("Cancel")
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
var yesButtonFunction = function() {
|
2023-08-28 14:18:41 +03:00
|
|
|
PageController.showBusyIndicator(true)
|
|
|
|
|
SettingsController.clearCachedProfiles()
|
|
|
|
|
PageController.showBusyIndicator(false)
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
var noButtonFunction = function() {
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
|
|
|
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
2023-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
DividerType {
|
|
|
|
|
visible: content.isServerWithWriteAccess
|
|
|
|
|
}
|
2023-05-27 22:46:41 +08:00
|
|
|
|
2023-06-21 20:56:00 +09:00
|
|
|
LabelWithButtonType {
|
2023-06-23 15:24:40 +09:00
|
|
|
visible: content.isServerWithWriteAccess
|
2023-06-21 20:56:00 +09:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2023-07-31 12:54:59 +09:00
|
|
|
text: qsTr("Check the server for previously installed Amnezia services")
|
2023-07-24 16:33:58 +09:00
|
|
|
descriptionText: qsTr("Add them to the application if they were not displayed")
|
2023-06-21 20:56:00 +09:00
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2023-07-04 09:58:19 +09:00
|
|
|
PageController.showBusyIndicator(true)
|
2023-06-21 20:56:00 +09:00
|
|
|
InstallController.scanServerForInstalledContainers()
|
2023-07-04 09:58:19 +09:00
|
|
|
PageController.showBusyIndicator(false)
|
2023-06-21 20:56:00 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
DividerType {
|
|
|
|
|
visible: content.isServerWithWriteAccess
|
|
|
|
|
}
|
2023-06-21 20:56:00 +09:00
|
|
|
|
2024-02-04 18:52:03 +02:00
|
|
|
LabelWithButtonType {
|
|
|
|
|
visible: content.isServerWithWriteAccess
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
text: qsTr("Reboot server")
|
|
|
|
|
textColor: "#EB5757"
|
|
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2024-02-16 15:24:06 +05:00
|
|
|
var headerText = qsTr("Do you want to reboot the server?")
|
|
|
|
|
var descriptionText = qsTr("The reboot process may take approximately 30 seconds. Are you sure you wish to proceed?")
|
|
|
|
|
var yesButtonText = qsTr("Continue")
|
|
|
|
|
var noButtonText = qsTr("Cancel")
|
2024-02-04 18:52:03 +02:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
var yesButtonFunction = function() {
|
2024-02-04 18:52:03 +02:00
|
|
|
PageController.showBusyIndicator(true)
|
|
|
|
|
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
|
|
|
|
ConnectionController.closeConnection()
|
|
|
|
|
}
|
2024-02-19 19:54:15 +05:00
|
|
|
InstallController.rebootProcessedServer()
|
2024-02-04 18:52:03 +02:00
|
|
|
PageController.showBusyIndicator(false)
|
|
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
var noButtonFunction = function() {
|
2024-02-04 18:52:03 +02:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
|
|
|
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
2024-02-04 18:52:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DividerType {
|
|
|
|
|
visible: content.isServerWithWriteAccess
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-27 22:46:41 +08:00
|
|
|
LabelWithButtonType {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
text: qsTr("Remove server from application")
|
2023-05-27 22:46:41 +08:00
|
|
|
textColor: "#EB5757"
|
|
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2024-02-16 15:24:06 +05:00
|
|
|
var headerText = qsTr("Do you want to remove the server from application?")
|
|
|
|
|
var descriptionText = qsTr("All installed AmneziaVPN services will still remain on the server.")
|
|
|
|
|
var yesButtonText = qsTr("Continue")
|
|
|
|
|
var noButtonText = qsTr("Cancel")
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
var yesButtonFunction = function() {
|
2023-07-31 00:13:08 +09:00
|
|
|
PageController.showBusyIndicator(true)
|
2023-08-02 20:37:43 +09:00
|
|
|
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
2023-06-05 15:49:10 +08:00
|
|
|
ConnectionController.closeConnection()
|
|
|
|
|
}
|
2024-02-19 19:54:15 +05:00
|
|
|
InstallController.removeProcessedServer()
|
2023-07-31 00:13:08 +09:00
|
|
|
PageController.showBusyIndicator(false)
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
var noButtonFunction = function() {
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
|
|
|
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
2023-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DividerType {}
|
|
|
|
|
|
|
|
|
|
LabelWithButtonType {
|
2023-06-23 15:24:40 +09:00
|
|
|
visible: content.isServerWithWriteAccess
|
2023-05-27 22:46:41 +08:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
text: qsTr("Clear server from Amnezia software")
|
2023-05-27 22:46:41 +08:00
|
|
|
textColor: "#EB5757"
|
|
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2024-02-16 15:24:06 +05:00
|
|
|
var headerText = qsTr("Do you want to clear server from Amnezia software?")
|
|
|
|
|
var descriptionText = qsTr("All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted.")
|
|
|
|
|
var yesButtonText = qsTr("Continue")
|
|
|
|
|
var noButtonText = qsTr("Cancel")
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
var yesButtonFunction = function() {
|
2024-02-09 23:23:26 +05:00
|
|
|
PageController.goToPage(PageEnum.PageDeinstalling)
|
|
|
|
|
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
|
|
|
|
ConnectionController.closeConnection()
|
|
|
|
|
}
|
|
|
|
|
InstallController.removeAllContainers()
|
|
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
var noButtonFunction = function() {
|
2024-02-09 23:23:26 +05:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
|
|
|
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
2024-02-09 23:23:26 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DividerType {
|
|
|
|
|
visible: content.isServerWithWriteAccess
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LabelWithButtonType {
|
2024-02-19 19:54:15 +05:00
|
|
|
visible: ServersModel.getProcessedServerData("isServerFromApi")
|
2024-02-09 23:23:26 +05:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
text: qsTr("Reset API config")
|
|
|
|
|
textColor: "#EB5757"
|
|
|
|
|
|
|
|
|
|
clickedFunction: function() {
|
2024-02-16 15:24:06 +05:00
|
|
|
var headerText = qsTr("Do you want to reset API config?")
|
|
|
|
|
var descriptionText = ""
|
|
|
|
|
var yesButtonText = qsTr("Continue")
|
|
|
|
|
var noButtonText = qsTr("Cancel")
|
2024-02-09 23:23:26 +05:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
var yesButtonFunction = function() {
|
2024-02-09 23:23:26 +05:00
|
|
|
PageController.showBusyIndicator(true)
|
|
|
|
|
ApiController.clearApiConfig()
|
|
|
|
|
PageController.showBusyIndicator(false)
|
|
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
var noButtonFunction = function() {
|
2024-02-09 23:23:26 +05:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
|
|
|
|
|
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
2024-02-09 23:23:26 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DividerType {
|
2024-02-19 19:54:15 +05:00
|
|
|
visible: ServersModel.getProcessedServerData("isServerFromApi")
|
2024-02-09 23:23:26 +05:00
|
|
|
}
|
2023-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|