added server availability check after entering credentials

- moved the protocol self-selection button to the PageSetupWizardEasy page
This commit is contained in:
vladimir.kuznetsov 2023-07-31 20:38:13 +09:00
parent aa66133813
commit 0058edc24e
21 changed files with 1002 additions and 463 deletions

View file

@ -17,13 +17,9 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onUpdateContainerFinished() {
//todo change to notification
PageController.showErrorMessage(qsTr("Settings updated successfully"))
PageController.showNotificationMessage(qsTr("Settings updated successfully"))
}
}

View file

@ -18,13 +18,9 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onUpdateContainerFinished() {
//todo change to notification
PageController.showErrorMessage(qsTr("Settings updated successfully"))
PageController.showNotificationMessage(qsTr("Settings updated successfully"))
}
}

View file

@ -17,13 +17,9 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onUpdateContainerFinished() {
//todo change to notification
PageController.showErrorMessage(qsTr("Settings updated successfully"))
PageController.showNotificationMessage(qsTr("Settings updated successfully"))
}
}

View file

@ -19,13 +19,9 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onUpdateContainerFinished() {
//todo change to notification
PageController.showErrorMessage(qsTr("Settings updated successfully"))
PageController.showNotificationMessage(qsTr("Settings updated successfully"))
}
}

View file

@ -20,13 +20,9 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onUpdateContainerFinished() {
//todo change to notification
PageController.showErrorMessage(qsTr("Settings updated successfully"))
PageController.showNotificationMessage(qsTr("Settings updated successfully"))
}
}

View file

@ -48,7 +48,7 @@ PageType {
Layout.topMargin: 16
text: qsTr("Language")
descriptionText: LanguageModel.getCurrentLanuageName()
descriptionText: LanguageModel.currentLanguageName
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {

View file

@ -28,11 +28,6 @@ PageType {
PageController.showErrorMessage(message)
}
function onInstallationErrorOccurred(errorMessage) {
closePage() // close deInstalling page
PageController.showErrorMessage(errorMessage)
}
function onRemoveCurrentlyProcessedServerFinished(finishedMessage) {
if (!ServersModel.getServersCount()) {
PageController.replaceStartPage()

View file

@ -94,7 +94,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 24
text: qsTr("Set up a server the easy way")
text: qsTr("Continue")
onClicked: function() {
if (!isCredentialsFilled()) {
@ -104,34 +104,41 @@ PageType {
InstallController.setShouldCreateServer(true)
InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
PageController.showBusyIndicator(true)
var isConnectionOpened = InstallController.checkSshConnection()
PageController.showBusyIndicator(false)
if (!isConnectionOpened) {
return
}
goToPage(PageEnum.PageSetupWizardEasy)
}
}
BasicButtonType {
Layout.fillWidth: true
Layout.topMargin: -8
// BasicButtonType {
// Layout.fillWidth: true
// Layout.topMargin: -8
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
pressedColor: Qt.rgba(1, 1, 1, 0.12)
disabledColor: "#878B91"
textColor: "#D7D8DB"
borderWidth: 1
// defaultColor: "transparent"
// hoveredColor: Qt.rgba(1, 1, 1, 0.08)
// pressedColor: Qt.rgba(1, 1, 1, 0.12)
// disabledColor: "#878B91"
// textColor: "#D7D8DB"
// borderWidth: 1
text: qsTr("Select protocol to install")
// text: qsTr("Select protocol to install")
onClicked: function() {
if (!isCredentialsFilled()) {
return
}
// onClicked: function() {
// if (!isCredentialsFilled()) {
// return
// }
InstallController.setShouldCreateServer(true)
InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
// InstallController.setShouldCreateServer(true)
// InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
goToPage(PageEnum.PageSetupWizardProtocols)
}
}
// goToPage(PageEnum.PageSetupWizardProtocols)
// }
// }
}
}

View file

@ -15,6 +15,8 @@ import "../Config"
PageType {
id: root
property bool isEasySetup: true
SortFilterProxyModel {
id: proxyContainersModel
sourceModel: ContainersModel
@ -64,6 +66,10 @@ PageType {
headerText: qsTr("What is the level of internet control in your region?")
}
ButtonGroup {
id: buttonGroup
}
ListView {
id: containers
width: parent.width
@ -101,6 +107,7 @@ PageType {
ButtonGroup.group: buttonGroup
onClicked: function() {
isEasySetup = true
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
containers.dockerContainer = dockerContainer
@ -117,9 +124,18 @@ PageType {
}
}
}
}
ButtonGroup {
id: buttonGroup
CardType {
implicitWidth: parent.width
headerText: qsTr("Set up a VPN yourself")
bodyText: qsTr("I want to choose a VPN protocol")
ButtonGroup.group: buttonGroup
onClicked: function() {
isEasySetup = false
}
}
@ -132,11 +148,15 @@ PageType {
text: qsTr("Continue")
onClicked: function() {
ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer)
goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(containers.dockerContainer,
containers.containerDefaultPort,
containers.containerDefaultTransportProto)
if (root.isEasySetup) {
ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer)
goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(containers.dockerContainer,
containers.containerDefaultPort,
containers.containerDefaultTransportProto)
} else {
goToPage(PageEnum.PageSetupWizardProtocols)
}
}
}
}

View file

@ -17,11 +17,6 @@ PageType {
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
closePage()
PageController.showErrorMessage(errorMessage)
}
function onInstallContainerFinished(finishedMessage) {
goToStartPage()
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) {

View file

@ -85,8 +85,7 @@ PageType {
text: qsTr("I have nothing")
onClicked: {
}
onClicked: Qt.openUrlExternally("https://ru-docs.amnezia.org/guides/hosting-instructions")
}
}

View file

@ -45,6 +45,26 @@ PageType {
}
}
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
var needCloseCurrentPage = false
var currentPageName = stackView.currentItem.objectName
if (currentPageName === PageController.getPagePath(PageEnum.PageSetupWizardInstalling)) {
needCloseCurrentPage = true
} else if (currentPageName === PageController.getPagePath(PageEnum.PageDeinstalling)) {
needCloseCurrentPage = true
}
if (needCloseCurrentPage) {
PageController.closePage()
}
}
}
StackViewType {
id: tabBarStackView