added busy indicator when saving a list of clients, on the client info panel
This commit is contained in:
parent
24ea686e4d
commit
ce2a122d51
6 changed files with 42 additions and 11 deletions
|
|
@ -79,8 +79,10 @@ void ClientManagementModel::setData(const QModelIndex &index, QVariant data, int
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_content[index.row()] = client;
|
if (m_content[index.row()] != client) {
|
||||||
emit dataChanged(index, index);
|
m_content[index.row()] = client;
|
||||||
|
emit dataChanged(index, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ClientManagementModel::roleNames() const
|
QHash<int, QByteArray> ClientManagementModel::roleNames() const
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ void ClientInfoLogic::setCurrentClientId(int index)
|
||||||
|
|
||||||
void ClientInfoLogic::onUpdatePage()
|
void ClientInfoLogic::onUpdatePage()
|
||||||
{
|
{
|
||||||
|
set_busyIndicatorIsRunning(false);
|
||||||
|
|
||||||
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||||
QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer);
|
QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer);
|
||||||
set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName);
|
set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName);
|
||||||
|
|
@ -44,6 +46,8 @@ void ClientInfoLogic::onUpdatePage()
|
||||||
|
|
||||||
void ClientInfoLogic::onLineEditNameAliasEditingFinished()
|
void ClientInfoLogic::onLineEditNameAliasEditingFinished()
|
||||||
{
|
{
|
||||||
|
set_busyIndicatorIsRunning(true);
|
||||||
|
|
||||||
auto model = qobject_cast<ClientManagementModel*>(uiLogic()->clientManagementModel());
|
auto model = qobject_cast<ClientManagementModel*>(uiLogic()->clientManagementModel());
|
||||||
auto modelIndex = model->index(m_currentClientIndex);
|
auto modelIndex = model->index(m_currentClientIndex);
|
||||||
model->setData(modelIndex, m_lineEditNameAliasText, ClientManagementModel::ClientRoles::NameRole);
|
model->setData(modelIndex, m_lineEditNameAliasText, ClientManagementModel::ClientRoles::NameRole);
|
||||||
|
|
@ -55,14 +59,16 @@ void ClientInfoLogic::onLineEditNameAliasEditingFinished()
|
||||||
auto currentMainProtocol = protocols.front();
|
auto currentMainProtocol = protocols.front();
|
||||||
auto clientsTable = model->getContent(currentMainProtocol);
|
auto clientsTable = model->getContent(currentMainProtocol);
|
||||||
ErrorCode error = m_serverController->setClientsList(m_settings->serverCredentials(uiLogic()->selectedServerIndex),
|
ErrorCode error = m_serverController->setClientsList(m_settings->serverCredentials(uiLogic()->selectedServerIndex),
|
||||||
selectedContainer,
|
selectedContainer,
|
||||||
currentMainProtocol,
|
currentMainProtocol,
|
||||||
clientsTable);
|
clientsTable);
|
||||||
if (error != ErrorCode::NoError) {
|
if (error != ErrorCode::NoError) {
|
||||||
QMessageBox::warning(nullptr, APPLICATION_NAME,
|
QMessageBox::warning(nullptr, APPLICATION_NAME,
|
||||||
tr("An error occurred while saving the list of clients.") + "\n" + errorString(error));
|
tr("An error occurred while saving the list of clients.") + "\n" + errorString(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_busyIndicatorIsRunning(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInfoLogic::onRevokeOpenVpnCertificateClicked()
|
void ClientInfoLogic::onRevokeOpenVpnCertificateClicked()
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class ClientInfoLogic : public PageLogicBase
|
||||||
AUTO_PROPERTY(QString, textAreaOpenVpnCertData)
|
AUTO_PROPERTY(QString, textAreaOpenVpnCertData)
|
||||||
AUTO_PROPERTY(QString, labelCurrentVpnProtocolText)
|
AUTO_PROPERTY(QString, labelCurrentVpnProtocolText)
|
||||||
AUTO_PROPERTY(QString, textAreaWireGuardKeyData)
|
AUTO_PROPERTY(QString, textAreaWireGuardKeyData)
|
||||||
|
AUTO_PROPERTY(bool, busyIndicatorIsRunning);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClientInfoLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
ClientInfoLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import "../../Config"
|
||||||
PageClientInfoBase {
|
PageClientInfoBase {
|
||||||
id: root
|
id: root
|
||||||
protocol: ProtocolEnum.OpenVpn
|
protocol: ProtocolEnum.OpenVpn
|
||||||
|
enabled: !ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
|
||||||
BackButton {
|
BackButton {
|
||||||
id: back
|
id: back
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +20,14 @@ PageClientInfoBase {
|
||||||
text: qsTr("Client Info")
|
text: qsTr("Client Info")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
z: 99
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
running: ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: fl
|
id: fl
|
||||||
width: root.width
|
width: root.width
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import "../../Config"
|
||||||
PageClientInfoBase {
|
PageClientInfoBase {
|
||||||
id: root
|
id: root
|
||||||
protocol: ProtocolEnum.WireGuard
|
protocol: ProtocolEnum.WireGuard
|
||||||
|
enabled: !ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
|
||||||
BackButton {
|
BackButton {
|
||||||
id: back
|
id: back
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +20,14 @@ PageClientInfoBase {
|
||||||
text: qsTr("Client Info")
|
text: qsTr("Client Info")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
z: 99
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
running: ClientInfoLogic.busyIndicatorIsRunning
|
||||||
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: fl
|
id: fl
|
||||||
width: root.width
|
width: root.width
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,14 @@ PageBase {
|
||||||
text: qsTr("Clients Management")
|
text: qsTr("Clients Management")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
z: 99
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: ClientManagementLogic.busyIndicatorIsRunning
|
||||||
|
running: ClientManagementLogic.busyIndicatorIsRunning
|
||||||
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: fl
|
id: fl
|
||||||
width: root.width
|
width: root.width
|
||||||
|
|
@ -47,12 +55,6 @@ PageBase {
|
||||||
text: ClientManagementLogic.labelCurrentVpnProtocolText
|
text: ClientManagementLogic.labelCurrentVpnProtocolText
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
visible: ClientManagementLogic.busyIndicatorIsRunning
|
|
||||||
running: ClientManagementLogic.busyIndicatorIsRunning
|
|
||||||
}
|
|
||||||
|
|
||||||
SortFilterProxyModel {
|
SortFilterProxyModel {
|
||||||
id: proxyClientManagementModel
|
id: proxyClientManagementModel
|
||||||
sourceModel: UiLogic.clientManagementModel
|
sourceModel: UiLogic.clientManagementModel
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue