auto reconection when current-server's defaul container hase been changed

This commit is contained in:
ronoaer 2023-09-13 20:49:44 +08:00
parent f11c65c393
commit bfc8c10f3d
10 changed files with 74 additions and 18 deletions

View file

@ -254,12 +254,26 @@ void InstallController::updateContainer(QJsonObject config)
ServerController serverController(m_settings);
connect(&serverController, &ServerController::serverIsBusy, this, &InstallController::serverIsBusy);
auto errorCode = serverController.updateContainer(serverCredentials, container, oldContainerConfig, config);
bool reinstallRequired = serverController.isReinstallContainerRequired(container, oldContainerConfig, config);
auto errorCode = serverController.updateContainer(reinstallRequired, serverCredentials, container, oldContainerConfig, config);
if (errorCode == ErrorCode::NoError) {
m_containersModel->setData(modelIndex, config, ContainersModel::Roles::ConfigRole);
m_protocolModel->updateModel(config);
emit updateContainerFinished();
bool isCurrentContainerChanged = false;
if (reinstallRequired &&
(serverIndex == m_serversModel->getDefaultServerIndex()) &&
(container == m_containersModel->getDefaultContainer()) ) {
isCurrentContainerChanged = true;
}
if (isCurrentContainerChanged) {
emit currentContainerChanged();
} else {
emit updateContainerFinished(tr("Settings updated successfully"));
}
return;
}