diff --git a/client/ui/models/clientManagementModel.cpp b/client/ui/models/clientManagementModel.cpp index 9e372d37..768adaef 100644 --- a/client/ui/models/clientManagementModel.cpp +++ b/client/ui/models/clientManagementModel.cpp @@ -79,8 +79,10 @@ void ClientManagementModel::setData(const QModelIndex &index, QVariant data, int } else { return; } - m_content[index.row()] = client; - emit dataChanged(index, index); + if (m_content[index.row()] != client) { + m_content[index.row()] = client; + emit dataChanged(index, index); + } } QHash ClientManagementModel::roleNames() const diff --git a/client/ui/pages_logic/ClientInfoLogic.cpp b/client/ui/pages_logic/ClientInfoLogic.cpp index 74e3b4df..503d91f4 100644 --- a/client/ui/pages_logic/ClientInfoLogic.cpp +++ b/client/ui/pages_logic/ClientInfoLogic.cpp @@ -21,6 +21,8 @@ void ClientInfoLogic::setCurrentClientId(int index) void ClientInfoLogic::onUpdatePage() { + set_busyIndicatorIsRunning(false); + DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex); QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer); set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName); @@ -44,6 +46,8 @@ void ClientInfoLogic::onUpdatePage() void ClientInfoLogic::onLineEditNameAliasEditingFinished() { + set_busyIndicatorIsRunning(true); + auto model = qobject_cast(uiLogic()->clientManagementModel()); auto modelIndex = model->index(m_currentClientIndex); model->setData(modelIndex, m_lineEditNameAliasText, ClientManagementModel::ClientRoles::NameRole); @@ -55,14 +59,16 @@ void ClientInfoLogic::onLineEditNameAliasEditingFinished() auto currentMainProtocol = protocols.front(); auto clientsTable = model->getContent(currentMainProtocol); ErrorCode error = m_serverController->setClientsList(m_settings->serverCredentials(uiLogic()->selectedServerIndex), - selectedContainer, - currentMainProtocol, - clientsTable); + selectedContainer, + currentMainProtocol, + clientsTable); if (error != ErrorCode::NoError) { QMessageBox::warning(nullptr, APPLICATION_NAME, tr("An error occurred while saving the list of clients.") + "\n" + errorString(error)); } } + + set_busyIndicatorIsRunning(false); } void ClientInfoLogic::onRevokeOpenVpnCertificateClicked() diff --git a/client/ui/pages_logic/ClientInfoLogic.h b/client/ui/pages_logic/ClientInfoLogic.h index 25d57fb1..0e6b537f 100644 --- a/client/ui/pages_logic/ClientInfoLogic.h +++ b/client/ui/pages_logic/ClientInfoLogic.h @@ -14,6 +14,7 @@ class ClientInfoLogic : public PageLogicBase AUTO_PROPERTY(QString, textAreaOpenVpnCertData) AUTO_PROPERTY(QString, labelCurrentVpnProtocolText) AUTO_PROPERTY(QString, textAreaWireGuardKeyData) + AUTO_PROPERTY(bool, busyIndicatorIsRunning); public: ClientInfoLogic(UiLogic *uiLogic, QObject *parent = nullptr); diff --git a/client/ui/qml/Pages/ClientInfo/PageClientInfoOpenVPN.qml b/client/ui/qml/Pages/ClientInfo/PageClientInfoOpenVPN.qml index ee8c7241..38dd00bb 100644 --- a/client/ui/qml/Pages/ClientInfo/PageClientInfoOpenVPN.qml +++ b/client/ui/qml/Pages/ClientInfo/PageClientInfoOpenVPN.qml @@ -9,6 +9,8 @@ import "../../Config" PageClientInfoBase { id: root protocol: ProtocolEnum.OpenVpn + enabled: !ClientInfoLogic.busyIndicatorIsRunning + BackButton { id: back } @@ -18,6 +20,14 @@ PageClientInfoBase { text: qsTr("Client Info") } + BusyIndicator { + z: 99 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + visible: ClientInfoLogic.busyIndicatorIsRunning + running: ClientInfoLogic.busyIndicatorIsRunning + } + Flickable { id: fl width: root.width diff --git a/client/ui/qml/Pages/ClientInfo/PageClientInfoWireGuard.qml b/client/ui/qml/Pages/ClientInfo/PageClientInfoWireGuard.qml index 78b49e31..97bd4b0d 100644 --- a/client/ui/qml/Pages/ClientInfo/PageClientInfoWireGuard.qml +++ b/client/ui/qml/Pages/ClientInfo/PageClientInfoWireGuard.qml @@ -9,6 +9,8 @@ import "../../Config" PageClientInfoBase { id: root protocol: ProtocolEnum.WireGuard + enabled: !ClientInfoLogic.busyIndicatorIsRunning + BackButton { id: back } @@ -18,6 +20,14 @@ PageClientInfoBase { text: qsTr("Client Info") } + BusyIndicator { + z: 99 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + visible: ClientInfoLogic.busyIndicatorIsRunning + running: ClientInfoLogic.busyIndicatorIsRunning + } + Flickable { id: fl width: root.width diff --git a/client/ui/qml/Pages/PageClientManagement.qml b/client/ui/qml/Pages/PageClientManagement.qml index 89a8e192..d4bed80c 100644 --- a/client/ui/qml/Pages/PageClientManagement.qml +++ b/client/ui/qml/Pages/PageClientManagement.qml @@ -23,6 +23,14 @@ PageBase { text: qsTr("Clients Management") } + BusyIndicator { + z: 99 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + visible: ClientManagementLogic.busyIndicatorIsRunning + running: ClientManagementLogic.busyIndicatorIsRunning + } + Flickable { id: fl width: root.width @@ -47,12 +55,6 @@ PageBase { text: ClientManagementLogic.labelCurrentVpnProtocolText } - BusyIndicator { - anchors.horizontalCenter: parent.horizontalCenter - visible: ClientManagementLogic.busyIndicatorIsRunning - running: ClientManagementLogic.busyIndicatorIsRunning - } - SortFilterProxyModel { id: proxyClientManagementModel sourceModel: UiLogic.clientManagementModel