Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the VPN status in the UI #1204

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
</mat-checkbox>
</td>
<td>
<i
[class]="app.status === 1 ? 'dot-green' : 'dot-red'"
[matTooltip]="(app.status === 1 ? 'apps.status-running-tooltip' : 'apps.status-stopped-tooltip') | translate"
></i>
<i [class]="getStateClass(app)" [matTooltip]="getStateTooltip(app) | translate"></i>
</td>
<td>
{{ app.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,32 @@ export class NodeAppsListComponent implements OnDestroy {
return null;
}

/**
* Gets the class for the app status dot.
*/
getStateClass(app: Application): string {
if (app.status === 1) {
return 'dot-green';
} else if (app.name === 'vpn-client' && app.status === 3) {
return 'dot-yellow';
}

return 'dot-red';
}

/**
* Gets the tooltip text for the app status dot.
*/
getStateTooltip(app: Application): string {
if (app.status === 1) {
return 'apps.status-running-tooltip';
} else if (app.name === 'vpn-client' && app.status === 3) {
return 'apps.status-connecting-tooltip';
}

return 'apps.status-stopped-tooltip';
}

/**
* Changes the selection state of an entry (modifies the state of its checkbox).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ export class VpnClientService {
// Get the required data from the app properties.
if (appData) {
vpnClientData = new VpnClientAppData();
vpnClientData.running = appData.status === 1;
vpnClientData.running = appData.status === 1 || appData.status === 3;
vpnClientData.connectionDuration = appData.connection_duration;

vpnClientData.appState = AppState.Stopped;
Expand Down
1 change: 1 addition & 0 deletions static/skywire-manager-src/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"status-stopped": "Stopped",
"status-failed": "Failed",
"status-running-tooltip": "App is currently running",
"status-connecting-tooltip": "App is currently connecting",
"status-stopped-tooltip": "App is currently stopped",
"status-failed-tooltip": "Something went wrong. Check the app's messages for more information"
},
Expand Down
1 change: 1 addition & 0 deletions static/skywire-manager-src/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@
"status-stopped": "Detenida",
"status-failed": "Fallida",
"status-running-tooltip": "La aplicación está actualmente corriendo",
"status-connecting-tooltip": "La aplicación está actualmente conectando",
"status-stopped-tooltip": "La aplicación está actualmente detenida",
"status-failed-tooltip": "Algo salió mal. Revise los mensajes de la aplicación para más información"
},
Expand Down
1 change: 1 addition & 0 deletions static/skywire-manager-src/src/assets/i18n/es_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@
"status-stopped": "Stopped",
"status-failed": "Failed",
"status-running-tooltip": "App is currently running",
"status-connecting-tooltip": "App is currently connecting",
"status-stopped-tooltip": "App is currently stopped",
"status-failed-tooltip": "Something went wrong. Check the app's messages for more information"
},
Expand Down