parent
cdf46c968a
commit
fd98ef1250
11 changed files with 475 additions and 276 deletions
|
@ -296,6 +296,15 @@ void InstallController::updateContainer(QJsonObject config)
|
|||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
|
||||
void InstallController::rebootCurrentlyProcessedServer()
|
||||
{
|
||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
||||
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
||||
|
||||
m_serversModel->rebootServer();
|
||||
emit rebootCurrentlyProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
|
||||
}
|
||||
|
||||
void InstallController::removeCurrentlyProcessedServer()
|
||||
{
|
||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
||||
|
|
|
@ -31,6 +31,7 @@ public slots:
|
|||
void updateContainer(QJsonObject config);
|
||||
|
||||
void removeCurrentlyProcessedServer();
|
||||
void rebootCurrentlyProcessedServer();
|
||||
void removeAllContainers();
|
||||
void removeCurrentlyProcessedContainer();
|
||||
|
||||
|
@ -53,6 +54,7 @@ signals:
|
|||
|
||||
void scanServerFinished(bool isInstalledContainerFound);
|
||||
|
||||
void rebootCurrentlyProcessedServerFinished(const QString &finishedMessage);
|
||||
void removeCurrentlyProcessedServerFinished(const QString &finishedMessage);
|
||||
void removeAllContainersFinished(const QString &finishedMessage);
|
||||
void removeCurrentlyProcessedContainerFinished(const QString &finishedMessage);
|
||||
|
|
|
@ -435,6 +435,15 @@ ErrorCode ServersModel::removeAllContainers()
|
|||
return errorCode;
|
||||
}
|
||||
|
||||
ErrorCode ServersModel::rebootServer()
|
||||
{
|
||||
ServerController serverController(m_settings);
|
||||
auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex);
|
||||
|
||||
ErrorCode errorCode = serverController.rebootServer(credentials);
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
ErrorCode ServersModel::removeContainer(const int containerIndex)
|
||||
{
|
||||
ServerController serverController(m_settings);
|
||||
|
|
|
@ -88,6 +88,7 @@ public slots:
|
|||
|
||||
ErrorCode removeContainer(const int containerIndex);
|
||||
ErrorCode removeAllContainers();
|
||||
ErrorCode rebootServer();
|
||||
|
||||
void setDefaultContainer(const int containerIndex);
|
||||
DockerContainer getDefaultContainer();
|
||||
|
|
|
@ -38,6 +38,10 @@ PageType {
|
|||
PageController.showNotificationMessage(finishedMessage)
|
||||
}
|
||||
|
||||
function onRebootCurrentlyProcessedServerFinished(finishedMessage) {
|
||||
PageController.showNotificationMessage(finishedMessage)
|
||||
}
|
||||
|
||||
function onRemoveAllContainersFinished(finishedMessage) {
|
||||
PageController.closePage() // close deInstalling page
|
||||
PageController.showNotificationMessage(finishedMessage)
|
||||
|
@ -128,6 +132,39 @@ PageType {
|
|||
visible: content.isServerWithWriteAccess
|
||||
}
|
||||
|
||||
LabelWithButtonType {
|
||||
visible: content.isServerWithWriteAccess
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Reboot server")
|
||||
textColor: "#EB5757"
|
||||
|
||||
clickedFunction: function() {
|
||||
questionDrawer.headerText = qsTr("Do you want to reboot the server?")
|
||||
questionDrawer.descriptionText = qsTr("The reboot process may take approximately 30 seconds. Are you sure you wish to proceed?")
|
||||
questionDrawer.yesButtonText = qsTr("Continue")
|
||||
questionDrawer.noButtonText = qsTr("Cancel")
|
||||
|
||||
questionDrawer.yesButtonFunction = function() {
|
||||
questionDrawer.visible = false
|
||||
PageController.showBusyIndicator(true)
|
||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||
ConnectionController.closeConnection()
|
||||
}
|
||||
InstallController.rebootCurrentlyProcessedServer()
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
questionDrawer.noButtonFunction = function() {
|
||||
questionDrawer.visible = false
|
||||
}
|
||||
questionDrawer.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
DividerType {
|
||||
visible: content.isServerWithWriteAccess
|
||||
}
|
||||
|
||||
LabelWithButtonType {
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
@ -135,7 +172,7 @@ PageType {
|
|||
textColor: "#EB5757"
|
||||
|
||||
clickedFunction: function() {
|
||||
questionDrawer.headerText = qsTr("Remove server?")
|
||||
questionDrawer.headerText = qsTr("Do you want to remove the server?")
|
||||
questionDrawer.descriptionText = qsTr("All installed AmneziaVPN services will still remain on the server.")
|
||||
questionDrawer.yesButtonText = qsTr("Continue")
|
||||
questionDrawer.noButtonText = qsTr("Cancel")
|
||||
|
@ -166,7 +203,7 @@ PageType {
|
|||
textColor: "#EB5757"
|
||||
|
||||
clickedFunction: function() {
|
||||
questionDrawer.headerText = qsTr("Clear server from Amnezia software?")
|
||||
questionDrawer.headerText = qsTr("Do you want to clear server from Amnezia software?")
|
||||
questionDrawer.descriptionText = qsTr("All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted.")
|
||||
questionDrawer.yesButtonText = qsTr("Continue")
|
||||
questionDrawer.noButtonText = qsTr("Cancel")
|
||||
|
@ -188,7 +225,7 @@ PageType {
|
|||
|
||||
DividerType {
|
||||
visible: content.isServerWithWriteAccess
|
||||
}
|
||||
}
|
||||
|
||||
QuestionDrawer {
|
||||
id: questionDrawer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue