bugfix: fixed qml warnings when loading user list on PageShare (#1119)

This commit is contained in:
Nethius 2024-10-11 05:58:30 +04:00 committed by GitHub
parent d4fff4af3c
commit 399a8c6d28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,6 +77,7 @@ ErrorCode ClientManagementModel::updateModel(const DockerContainer container, co
{ {
beginResetModel(); beginResetModel();
m_clientsTable = QJsonArray(); m_clientsTable = QJsonArray();
endResetModel();
ErrorCode error = ErrorCode::NoError; ErrorCode error = ErrorCode::NoError;
@ -90,10 +91,10 @@ ErrorCode ClientManagementModel::updateModel(const DockerContainer container, co
const QByteArray clientsTableString = serverController->getTextFileFromContainer(container, credentials, clientsTableFile, error); const QByteArray clientsTableString = serverController->getTextFileFromContainer(container, credentials, clientsTableFile, error);
if (error != ErrorCode::NoError) { if (error != ErrorCode::NoError) {
logger.error() << "Failed to get the clientsTable file from the server"; logger.error() << "Failed to get the clientsTable file from the server";
endResetModel();
return error; return error;
} }
beginResetModel();
m_clientsTable = QJsonDocument::fromJson(clientsTableString).array(); m_clientsTable = QJsonDocument::fromJson(clientsTableString).array();
if (m_clientsTable.isEmpty()) { if (m_clientsTable.isEmpty()) {
@ -601,5 +602,6 @@ QHash<int, QByteArray> ClientManagementModel::roleNames() const
roles[LatestHandshakeRole] = "latestHandshake"; roles[LatestHandshakeRole] = "latestHandshake";
roles[DataReceivedRole] = "dataReceived"; roles[DataReceivedRole] = "dataReceived";
roles[DataSentRole] = "dataSent"; roles[DataSentRole] = "dataSent";
roles[AllowedIpsRole] = "allowedIps";
return roles; return roles;
} }