mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
refactor: remove serverConfig struct (#2595)
* refactor: remove serverConfig struct * refactor: add warnings for api v1 configs * refactor: moved the server type definition to a separate namespace * refactor: simplified gateway stacks * fix: fixed server description * fix: fixed postAsync reply usage * fix: fixed validateConfig call * fix: fixed server name in notifications * fix: fixed initPrepareConfigHandler for lagacy configs
This commit is contained in:
@@ -8,46 +8,46 @@ ExportUiController::ExportUiController(ExportController* exportController, QObje
|
||||
{
|
||||
}
|
||||
|
||||
void ExportUiController::generateFullAccessConfig(int serverIndex)
|
||||
void ExportUiController::generateFullAccessConfig(const QString &serverId)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateFullAccessConfig(serverIndex);
|
||||
auto result = m_exportController->generateFullAccessConfig(serverId);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
void ExportUiController::generateConnectionConfig(int serverIndex, int containerIndex, const QString &clientName)
|
||||
void ExportUiController::generateConnectionConfig(const QString &serverId, int containerIndex, const QString &clientName)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateConnectionConfig(serverIndex, containerIndex, clientName);
|
||||
auto result = m_exportController->generateConnectionConfig(serverId, containerIndex, clientName);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
void ExportUiController::generateOpenVpnConfig(int serverIndex, const QString &clientName)
|
||||
void ExportUiController::generateOpenVpnConfig(const QString &serverId, const QString &clientName)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateOpenVpnConfig(serverIndex, clientName);
|
||||
auto result = m_exportController->generateOpenVpnConfig(serverId, clientName);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
void ExportUiController::generateWireGuardConfig(int serverIndex, const QString &clientName)
|
||||
void ExportUiController::generateWireGuardConfig(const QString &serverId, const QString &clientName)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateWireGuardConfig(serverIndex, clientName);
|
||||
auto result = m_exportController->generateWireGuardConfig(serverId, clientName);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
void ExportUiController::generateAwgConfig(int serverIndex, int containerIndex, const QString &clientName)
|
||||
void ExportUiController::generateAwgConfig(const QString &serverId, int containerIndex, const QString &clientName)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateAwgConfig(serverIndex, containerIndex, clientName);
|
||||
auto result = m_exportController->generateAwgConfig(serverId, containerIndex, clientName);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
|
||||
void ExportUiController::generateXrayConfig(int serverIndex, const QString &clientName)
|
||||
void ExportUiController::generateXrayConfig(const QString &serverId, const QString &clientName)
|
||||
{
|
||||
clearPreviousConfig();
|
||||
auto result = m_exportController->generateXrayConfig(serverIndex, clientName);
|
||||
auto result = m_exportController->generateXrayConfig(serverId, clientName);
|
||||
applyExportResult(result);
|
||||
}
|
||||
|
||||
@@ -71,20 +71,20 @@ void ExportUiController::exportConfig(const QString &fileName)
|
||||
SystemController::saveFile(fileName, m_config);
|
||||
}
|
||||
|
||||
void ExportUiController::updateClientManagementModel(int serverIndex, int containerIndex)
|
||||
void ExportUiController::updateClientManagementModel(const QString &serverId, int containerIndex)
|
||||
{
|
||||
m_exportController->updateClientManagementModel(serverIndex, containerIndex);
|
||||
m_exportController->updateClientManagementModel(serverId, containerIndex);
|
||||
}
|
||||
|
||||
void ExportUiController::revokeConfig(int row, int serverIndex, int containerIndex)
|
||||
void ExportUiController::revokeConfig(int row, const QString &serverId, int containerIndex)
|
||||
{
|
||||
m_exportController->revokeConfig(row, serverIndex, containerIndex);
|
||||
m_exportController->revokeConfig(row, serverId, containerIndex);
|
||||
emit revokeConfigFinished();
|
||||
}
|
||||
|
||||
void ExportUiController::renameClient(int row, const QString &clientName, int serverIndex, int containerIndex)
|
||||
void ExportUiController::renameClient(int row, const QString &clientName, const QString &serverId, int containerIndex)
|
||||
{
|
||||
m_exportController->renameClient(row, clientName, serverIndex, containerIndex);
|
||||
m_exportController->renameClient(row, clientName, serverId, containerIndex);
|
||||
}
|
||||
|
||||
int ExportUiController::getQrCodesCount()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QObject>
|
||||
|
||||
#include "core/controllers/selfhosted/exportController.h"
|
||||
#include "core/utils/errorCodes.h"
|
||||
|
||||
class ExportUiController : public QObject
|
||||
{
|
||||
@@ -17,12 +18,13 @@ public:
|
||||
Q_PROPERTY(QString nativeConfigString READ getNativeConfigString NOTIFY exportConfigChanged)
|
||||
|
||||
public slots:
|
||||
void generateFullAccessConfig(int serverIndex);
|
||||
void generateConnectionConfig(int serverIndex, int containerIndex, const QString &clientName);
|
||||
void generateOpenVpnConfig(int serverIndex, const QString &clientName);
|
||||
void generateWireGuardConfig(int serverIndex, const QString &clientName);
|
||||
void generateAwgConfig(int serverIndex, int containerIndex, const QString &clientName);
|
||||
void generateXrayConfig(int serverIndex, const QString &clientName);
|
||||
void generateFullAccessConfig(const QString &serverId);
|
||||
|
||||
void generateConnectionConfig(const QString &serverId, int containerIndex, const QString &clientName);
|
||||
void generateOpenVpnConfig(const QString &serverId, const QString &clientName);
|
||||
void generateWireGuardConfig(const QString &serverId, const QString &clientName);
|
||||
void generateAwgConfig(const QString &serverId, int containerIndex, const QString &clientName);
|
||||
void generateXrayConfig(const QString &serverId, const QString &clientName);
|
||||
|
||||
QString getConfig();
|
||||
QString getNativeConfigString();
|
||||
@@ -30,9 +32,11 @@ public slots:
|
||||
|
||||
void exportConfig(const QString &fileName);
|
||||
|
||||
void updateClientManagementModel(int serverIndex, int containerIndex);
|
||||
void revokeConfig(int row, int serverIndex, int containerIndex);
|
||||
void renameClient(int row, const QString &clientName, int serverIndex, int containerIndex);
|
||||
void updateClientManagementModel(const QString &serverId, int containerIndex);
|
||||
|
||||
void revokeConfig(int row, const QString &serverId, int containerIndex);
|
||||
|
||||
void renameClient(int row, const QString &clientName, const QString &serverId, int containerIndex);
|
||||
|
||||
signals:
|
||||
void generateConfig(int type);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "core/controllers/selfhosted/installController.h"
|
||||
#include "core/utils/selfhosted/sshSession.h"
|
||||
#include "core/utils/networkUtilities.h"
|
||||
#include "logger.h"
|
||||
#include "core/utils/protocolEnum.h"
|
||||
#include "core/protocols/protocolUtils.h"
|
||||
#include "core/utils/constants/configKeys.h"
|
||||
@@ -27,33 +26,12 @@
|
||||
#include "ui/models/services/socks5ProxyConfigModel.h"
|
||||
#include "ui/models/services/torConfigModel.h"
|
||||
#include "core/utils/utilities.h"
|
||||
#include "core/models/serverConfig.h"
|
||||
#include "core/models/containerConfig.h"
|
||||
#include "core/models/protocols/awgProtocolConfig.h"
|
||||
#include "core/models/protocols/wireGuardProtocolConfig.h"
|
||||
#include "core/models/protocols/openVpnProtocolConfig.h"
|
||||
#include "core/models/protocols/xrayProtocolConfig.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
Logger logger("InstallUiController");
|
||||
|
||||
namespace configKey
|
||||
{
|
||||
constexpr char serviceInfo[] = "service_info";
|
||||
constexpr char serviceType[] = "service_type";
|
||||
constexpr char serviceProtocol[] = "service_protocol";
|
||||
constexpr char userCountryCode[] = "user_country_code";
|
||||
|
||||
constexpr char serverCountryCode[] = "server_country_code";
|
||||
constexpr char serverCountryName[] = "server_country_name";
|
||||
constexpr char availableCountries[] = "available_countries";
|
||||
|
||||
constexpr char apiConfig[] = "api_config";
|
||||
constexpr char authData[] = "auth_data";
|
||||
}
|
||||
}
|
||||
|
||||
InstallUiController::InstallUiController(InstallController *installController,
|
||||
ServersController *serversController,
|
||||
SettingsController *settingsController,
|
||||
@@ -101,19 +79,18 @@ InstallUiController::~InstallUiController()
|
||||
{
|
||||
}
|
||||
|
||||
void InstallUiController::install(DockerContainer container, int port, TransportProto transportProto, int serverIndex)
|
||||
void InstallUiController::install(DockerContainer container, int port, TransportProto transportProto, const QString &serverId)
|
||||
{
|
||||
const bool isNewServer = serverIndex < 0;
|
||||
const bool isNewServer = serverId.isEmpty();
|
||||
|
||||
ServerCredentials serverCredentials;
|
||||
if (isNewServer) {
|
||||
serverCredentials = m_processedServerCredentials;
|
||||
} else {
|
||||
serverCredentials = m_serversController->getServerCredentials(serverIndex);
|
||||
serverCredentials = m_serversController->getServerCredentials(serverId);
|
||||
m_processedServerCredentials = ServerCredentials();
|
||||
}
|
||||
|
||||
QMap<DockerContainer, QJsonObject> preparedContainers;
|
||||
QString finishMessage;
|
||||
ErrorCode errorCode;
|
||||
|
||||
@@ -131,9 +108,13 @@ void InstallUiController::install(DockerContainer container, int port, Transport
|
||||
return;
|
||||
}
|
||||
|
||||
int serverIndex = m_serversController->getServersCount() - 1;
|
||||
ServerConfig serverConfig = m_serversController->getServerConfig(serverIndex);
|
||||
QMap<DockerContainer, ContainerConfig> containers = serverConfig.containers();
|
||||
const QString newServerId = m_serversController->getServerId(m_serversController->getServersCount() - 1);
|
||||
const auto admin = m_serversController->selfHostedAdminConfig(newServerId);
|
||||
if (!admin.has_value()) {
|
||||
emit installationErrorOccurred(ErrorCode::InternalError);
|
||||
return;
|
||||
}
|
||||
QMap<DockerContainer, ContainerConfig> containers = admin->containers;
|
||||
int containersCount = containers.size();
|
||||
|
||||
if (wasContainerInstalled) {
|
||||
@@ -148,20 +129,28 @@ void InstallUiController::install(DockerContainer container, int port, Transport
|
||||
|
||||
emit installServerFinished(finishMessage);
|
||||
} else {
|
||||
ServerConfig serverConfig = m_serversController->getServerConfig(serverIndex);
|
||||
QMap<DockerContainer, ContainerConfig> containers = serverConfig.containers();
|
||||
const auto adminBefore = m_serversController->selfHostedAdminConfig(serverId);
|
||||
if (!adminBefore.has_value()) {
|
||||
emit installationErrorOccurred(ErrorCode::InternalError);
|
||||
return;
|
||||
}
|
||||
QMap<DockerContainer, ContainerConfig> containers = adminBefore->containers;
|
||||
int containersCount = containers.size();
|
||||
|
||||
bool wasContainerInstalled = false;
|
||||
errorCode = m_installController->installContainer(serverIndex, container, port, transportProto,
|
||||
errorCode = m_installController->installContainer(serverId, container, port, transportProto,
|
||||
wasContainerInstalled);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
return;
|
||||
}
|
||||
|
||||
ServerConfig newServerConfig = m_serversController->getServerConfig(serverIndex);
|
||||
QMap<DockerContainer, ContainerConfig> newContainers = newServerConfig.containers();
|
||||
const auto adminAfter = m_serversController->selfHostedAdminConfig(serverId);
|
||||
if (!adminAfter.has_value()) {
|
||||
emit installationErrorOccurred(ErrorCode::InternalError);
|
||||
return;
|
||||
}
|
||||
QMap<DockerContainer, ContainerConfig> newContainers = adminAfter->containers;
|
||||
int newContainersCount = newContainers.size();
|
||||
|
||||
bool hasNewContainers = (newContainersCount - containersCount) > (wasContainerInstalled ? 1 : 0);
|
||||
@@ -181,17 +170,25 @@ void InstallUiController::install(DockerContainer container, int port, Transport
|
||||
}
|
||||
}
|
||||
|
||||
void InstallUiController::scanServerForInstalledContainers(int serverIndex)
|
||||
void InstallUiController::scanServerForInstalledContainers(const QString &serverId)
|
||||
{
|
||||
ServerConfig serverBefore = m_serversController->getServerConfig(serverIndex);
|
||||
QMap<DockerContainer, ContainerConfig> containersBefore = serverBefore.containers();
|
||||
const auto serverBefore = m_serversController->selfHostedAdminConfig(serverId);
|
||||
if (!serverBefore.has_value()) {
|
||||
emit installationErrorOccurred(ErrorCode::InternalError);
|
||||
return;
|
||||
}
|
||||
QMap<DockerContainer, ContainerConfig> containersBefore = serverBefore->containers;
|
||||
int containersCountBefore = containersBefore.size();
|
||||
|
||||
ErrorCode errorCode = m_installController->scanServerForInstalledContainers(serverIndex);
|
||||
ErrorCode errorCode = m_installController->scanServerForInstalledContainers(serverId);
|
||||
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
ServerConfig serverAfter = m_serversController->getServerConfig(serverIndex);
|
||||
QMap<DockerContainer, ContainerConfig> containersAfter = serverAfter.containers();
|
||||
const auto serverAfter = m_serversController->selfHostedAdminConfig(serverId);
|
||||
if (!serverAfter.has_value()) {
|
||||
emit installationErrorOccurred(ErrorCode::InternalError);
|
||||
return;
|
||||
}
|
||||
QMap<DockerContainer, ContainerConfig> containersAfter = serverAfter->containers;
|
||||
int containersCountAfter = containersAfter.size();
|
||||
|
||||
bool isInstalledContainerAdded = containersCountAfter > containersCountBefore;
|
||||
@@ -202,7 +199,7 @@ void InstallUiController::scanServerForInstalledContainers(int serverIndex)
|
||||
emit installationErrorOccurred(errorCode);
|
||||
}
|
||||
|
||||
void InstallUiController::updateContainer(int serverIndex, int containerIndex, int protocolIndex)
|
||||
void InstallUiController::updateContainer(const QString &serverId, int containerIndex, int protocolIndex)
|
||||
{
|
||||
DockerContainer container = static_cast<DockerContainer>(containerIndex);
|
||||
|
||||
@@ -250,32 +247,26 @@ void InstallUiController::updateContainer(int serverIndex, int containerIndex, i
|
||||
default:
|
||||
return;
|
||||
}
|
||||
ContainerConfig oldContainerConfig = m_serversController->getContainerConfig(serverIndex, container);
|
||||
ContainerConfig oldContainerConfig = m_serversController->getContainerConfig(serverId, container);
|
||||
|
||||
ErrorCode errorCode = m_installController->updateContainer(serverIndex, container, oldContainerConfig, containerConfig);
|
||||
ErrorCode errorCode = m_installController->updateContainer(serverId, container, oldContainerConfig, containerConfig);
|
||||
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
ContainerConfig updatedConfig = m_serversController->getContainerConfig(serverIndex, container);
|
||||
ContainerConfig updatedConfig = m_serversController->getContainerConfig(serverId, container);
|
||||
m_protocolModel->updateModel(updatedConfig);
|
||||
|
||||
auto defaultContainer = m_serversController->getServerConfig(serverIndex).defaultContainer();
|
||||
if ((serverIndex == m_serversController->getDefaultServerIndex()) && (container == defaultContainer)) {
|
||||
emit currentContainerUpdated();
|
||||
} else {
|
||||
emit updateContainerFinished(tr("Settings updated successfully"));
|
||||
}
|
||||
|
||||
emit updateContainerFinished(tr("Settings updated successfully"));
|
||||
return;
|
||||
}
|
||||
|
||||
emit installationErrorOccurred(errorCode);
|
||||
}
|
||||
|
||||
void InstallUiController::rebootServer(int serverIndex)
|
||||
void InstallUiController::rebootServer(const QString &serverId)
|
||||
{
|
||||
QString serverName = m_serversController->getServerConfig(serverIndex).displayName();
|
||||
const QString serverName = m_serversController->notificationDisplayName(serverId);
|
||||
|
||||
const auto errorCode = m_installController->rebootServer(serverIndex);
|
||||
const auto errorCode = m_installController->rebootServer(serverId);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
emit rebootServerFinished(tr("Server '%1' was rebooted").arg(serverName));
|
||||
} else {
|
||||
@@ -283,19 +274,22 @@ void InstallUiController::rebootServer(int serverIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void InstallUiController::removeServer(int serverIndex)
|
||||
void InstallUiController::removeServer(const QString &serverId)
|
||||
{
|
||||
QString serverName = m_serversController->getServerConfig(serverIndex).displayName();
|
||||
if (serverId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
const QString serverName = m_serversController->notificationDisplayName(serverId);
|
||||
|
||||
m_serversController->removeServer(serverIndex);
|
||||
m_serversController->removeServer(serverId);
|
||||
emit removeServerFinished(tr("Server '%1' was removed").arg(serverName));
|
||||
}
|
||||
|
||||
void InstallUiController::removeAllContainers(int serverIndex)
|
||||
void InstallUiController::removeAllContainers(const QString &serverId)
|
||||
{
|
||||
QString serverName = m_serversController->getServerConfig(serverIndex).displayName();
|
||||
const QString serverName = m_serversController->notificationDisplayName(serverId);
|
||||
|
||||
ErrorCode errorCode = m_installController->removeAllContainers(serverIndex);
|
||||
ErrorCode errorCode = m_installController->removeAllContainers(serverId);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
emit removeAllContainersFinished(tr("All containers from server '%1' have been removed").arg(serverName));
|
||||
return;
|
||||
@@ -303,14 +297,14 @@ void InstallUiController::removeAllContainers(int serverIndex)
|
||||
emit installationErrorOccurred(errorCode);
|
||||
}
|
||||
|
||||
void InstallUiController::removeContainer(int serverIndex, int containerIndex)
|
||||
void InstallUiController::removeContainer(const QString &serverId, int containerIndex)
|
||||
{
|
||||
QString serverName = m_serversController->getServerConfig(serverIndex).displayName();
|
||||
const QString serverName = m_serversController->notificationDisplayName(serverId);
|
||||
|
||||
DockerContainer container = static_cast<DockerContainer>(containerIndex);
|
||||
QString containerName = ContainerUtils::containerHumanNames().value(container);
|
||||
|
||||
ErrorCode errorCode = m_installController->removeContainer(serverIndex, container);
|
||||
ErrorCode errorCode = m_installController->removeContainer(serverId, container);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
|
||||
emit removeContainerFinished(tr("%1 has been removed from the server '%2'").arg(containerName, serverName));
|
||||
@@ -319,17 +313,17 @@ void InstallUiController::removeContainer(int serverIndex, int containerIndex)
|
||||
emit installationErrorOccurred(errorCode);
|
||||
}
|
||||
|
||||
void InstallUiController::clearCachedProfile(int serverIndex, int containerIndex)
|
||||
void InstallUiController::clearCachedProfile(const QString &serverId, int containerIndex)
|
||||
{
|
||||
DockerContainer container = static_cast<DockerContainer>(containerIndex);
|
||||
if (ContainerUtils::containerService(container) == ServiceType::Other) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_installController->clearCachedProfile(serverIndex, container);
|
||||
m_installController->clearCachedProfile(serverId, container);
|
||||
|
||||
emit cachedProfileCleared(tr("%1 cached profile cleared").arg(ContainerUtils::containerHumanNames().value(container)));
|
||||
ContainerConfig updatedConfig = m_serversController->getContainerConfig(serverIndex, container);
|
||||
ContainerConfig updatedConfig = m_serversController->getContainerConfig(serverId, container);
|
||||
m_protocolModel->updateModel(updatedConfig);
|
||||
}
|
||||
|
||||
@@ -354,9 +348,9 @@ void InstallUiController::setProcessedServerCredentials(const QString &hostName,
|
||||
m_processedServerCredentials.secretData = secretData;
|
||||
}
|
||||
|
||||
void InstallUiController::mountSftpDrive(int serverIndex, const QString &port, const QString &password, const QString &username)
|
||||
void InstallUiController::mountSftpDrive(const QString &serverId, const QString &port, const QString &password, const QString &username)
|
||||
{
|
||||
ServerCredentials serverCredentials = m_serversController->getServerCredentials(serverIndex);
|
||||
ServerCredentials serverCredentials = m_serversController->getServerCredentials(serverId);
|
||||
ErrorCode errorCode = m_installController->mountSftpDrive(serverCredentials, port, password, username);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
@@ -399,40 +393,35 @@ void InstallUiController::setEncryptedPassphrase(QString passphrase)
|
||||
|
||||
void InstallUiController::addEmptyServer()
|
||||
{
|
||||
SelfHostedServerConfig serverConfig;
|
||||
serverConfig.hostName = m_processedServerCredentials.hostName;
|
||||
serverConfig.userName = m_processedServerCredentials.userName;
|
||||
serverConfig.password = m_processedServerCredentials.secretData;
|
||||
serverConfig.port = m_processedServerCredentials.port;
|
||||
serverConfig.description = m_settingsController->nextAvailableServerName();
|
||||
serverConfig.defaultContainer = DockerContainer::None;
|
||||
|
||||
m_serversController->addServer(ServerConfig(serverConfig));
|
||||
m_installController->addEmptyServer(m_processedServerCredentials);
|
||||
emit installServerFinished(tr("Server added successfully"));
|
||||
}
|
||||
|
||||
void InstallUiController::validateConfig()
|
||||
{
|
||||
int serverIndex = m_serversController->getDefaultServerIndex();
|
||||
m_installController->validateConfig(serverIndex);
|
||||
const QString serverId = m_serversController->getDefaultServerId();
|
||||
if (serverId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
m_installController->validateConfig(serverId);
|
||||
}
|
||||
|
||||
void InstallUiController::updateProtocols(int serverIndex, int containerIndex)
|
||||
void InstallUiController::updateProtocols(const QString &serverId, int containerIndex)
|
||||
{
|
||||
DockerContainer container = static_cast<DockerContainer>(containerIndex);
|
||||
ContainerConfig containerConfig = m_serversController->getContainerConfig(serverIndex, container);
|
||||
ContainerConfig containerConfig = m_serversController->getContainerConfig(serverId, container);
|
||||
containerConfig.container = container;
|
||||
m_protocolModel->updateModel(containerConfig);
|
||||
}
|
||||
|
||||
void InstallUiController::openServerSettings(int serverIndex, int containerIndex, int protocolIndex)
|
||||
void InstallUiController::openServerSettings(const QString &serverId, int containerIndex, int protocolIndex)
|
||||
{
|
||||
updateProtocolConfigModel(serverIndex, containerIndex, protocolIndex);
|
||||
updateProtocolConfigModel(serverId, containerIndex, protocolIndex);
|
||||
}
|
||||
|
||||
void InstallUiController::openClientSettings(int serverIndex, int containerIndex, int protocolIndex)
|
||||
void InstallUiController::openClientSettings(const QString &serverId, int containerIndex, int protocolIndex)
|
||||
{
|
||||
updateProtocolConfigModel(serverIndex, containerIndex, protocolIndex);
|
||||
updateProtocolConfigModel(serverId, containerIndex, protocolIndex);
|
||||
}
|
||||
|
||||
int InstallUiController::defaultPort(int protocolIndex)
|
||||
@@ -465,10 +454,10 @@ bool InstallUiController::defaultTransportProtoChangeable(int protocolIndex)
|
||||
return ProtocolUtils::defaultTransportProtoChangeable(proto);
|
||||
}
|
||||
|
||||
void InstallUiController::updateProtocolConfigModel(int serverIndex, int containerIndex, int protocolIndex)
|
||||
void InstallUiController::updateProtocolConfigModel(const QString &serverId, int containerIndex, int protocolIndex)
|
||||
{
|
||||
DockerContainer container = static_cast<DockerContainer>(containerIndex);
|
||||
ContainerConfig containerConfig = m_serversController->getContainerConfig(serverIndex, container);
|
||||
ContainerConfig containerConfig = m_serversController->getContainerConfig(serverId, container);
|
||||
containerConfig.container = container;
|
||||
Proto protocolType = static_cast<Proto>(protocolIndex);
|
||||
|
||||
@@ -490,4 +479,3 @@ void InstallUiController::updateProtocolConfigModel(int serverIndex, int contain
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,24 +52,24 @@ public:
|
||||
~InstallUiController();
|
||||
|
||||
public slots:
|
||||
void install(DockerContainer container, int port, TransportProto transportProto, int serverIndex);
|
||||
void install(DockerContainer container, int port, TransportProto transportProto, const QString &serverId);
|
||||
void setProcessedServerCredentials(const QString &hostName, const QString &userName, const QString &secretData);
|
||||
void clearProcessedServerCredentials();
|
||||
|
||||
void scanServerForInstalledContainers(int serverIndex);
|
||||
void scanServerForInstalledContainers(const QString &serverId);
|
||||
|
||||
void updateContainer(int serverIndex, int containerIndex, int protocolIndex);
|
||||
void updateContainer(const QString &serverId, int containerIndex, int protocolIndex);
|
||||
|
||||
void removeServer(int serverIndex);
|
||||
void rebootServer(int serverIndex);
|
||||
void removeAllContainers(int serverIndex);
|
||||
void removeContainer(int serverIndex, int containerIndex);
|
||||
void removeServer(const QString &serverId);
|
||||
void rebootServer(const QString &serverId);
|
||||
void removeAllContainers(const QString &serverId);
|
||||
void removeContainer(const QString &serverId, int containerIndex);
|
||||
|
||||
void clearCachedProfile(int serverIndex, int containerIndex);
|
||||
void clearCachedProfile(const QString &serverId, int containerIndex);
|
||||
|
||||
QRegularExpression ipAddressRegExp();
|
||||
|
||||
void mountSftpDrive(int serverIndex, const QString &port, const QString &password, const QString &username);
|
||||
void mountSftpDrive(const QString &serverId, const QString &port, const QString &password, const QString &username);
|
||||
|
||||
bool checkSshConnection();
|
||||
|
||||
@@ -78,12 +78,12 @@ public slots:
|
||||
void addEmptyServer();
|
||||
|
||||
void validateConfig();
|
||||
|
||||
Q_INVOKABLE void updateProtocols(int serverIndex, int containerIndex);
|
||||
|
||||
void openServerSettings(int serverIndex, int containerIndex, int protocolIndex);
|
||||
void openClientSettings(int serverIndex, int containerIndex, int protocolIndex);
|
||||
|
||||
|
||||
Q_INVOKABLE void updateProtocols(const QString &serverId, int containerIndex);
|
||||
|
||||
void openServerSettings(const QString &serverId, int containerIndex, int protocolIndex);
|
||||
void openClientSettings(const QString &serverId, int containerIndex, int protocolIndex);
|
||||
|
||||
int defaultPort(int protocolIndex);
|
||||
int getPortForInstall(int protocolIndex);
|
||||
int defaultTransportProto(int protocolIndex);
|
||||
@@ -114,8 +114,6 @@ signals:
|
||||
void serverIsBusy(const bool isBusy);
|
||||
void cancelInstallation();
|
||||
|
||||
void currentContainerUpdated();
|
||||
|
||||
void cachedProfileCleared(const QString &message);
|
||||
void apiConfigRemoved(const QString &message);
|
||||
|
||||
@@ -145,7 +143,7 @@ private:
|
||||
|
||||
QString m_privateKeyPassphrase;
|
||||
|
||||
void updateProtocolConfigModel(int serverIndex, int containerIndex, int protocolIndex);
|
||||
void updateProtocolConfigModel(const QString &serverId, int containerIndex, int protocolIndex);
|
||||
};
|
||||
|
||||
#endif // INSTALLUICONTROLLER_H
|
||||
|
||||
Reference in New Issue
Block a user