Skip to content

Commit

Permalink
Improvements for the UI (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
Senyoret1 authored Dec 10, 2023
1 parent 9f64cd8 commit 2c99655
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 6 deletions.
6 changes: 6 additions & 0 deletions static/skywire-manager-src/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
<router-outlet *ngIf="hypervisorPkObtained || inLoginPage"></router-outlet>
<app-loading-indicator class="h-100" *ngIf="!hypervisorPkObtained && !inLoginPage"></app-loading-indicator>
</div>

<div class="connection-problem-container" *ngIf="showingDataProblemMsg">
<span class="blinking">
<mat-icon [inline]="true">error_outline</mat-icon> {{ 'common.data-update-problems' | translate }}
</span>
</div>
15 changes: 15 additions & 0 deletions static/skywire-manager-src/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,18 @@
left: 0;
position: fixed;
}

.connection-problem-container {
position: fixed;
bottom: 0;
right: 0;
background-color: red;
padding: 0px 10px 5px;
font-size: 10px;
opacity: 0.75;

mat-icon {
position: relative;
top: 4px;
}
}
16 changes: 16 additions & 0 deletions static/skywire-manager-src/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class AppComponent {
pkErrorShown = false;
pkErrorsFound = 0;

showingDataProblemMsg = false;

obtainPkSubscription: Subscription;

constructor(
Expand Down Expand Up @@ -108,6 +110,20 @@ export class AppComponent {
}
}

/**
* Shows a box at the bottom-right corner indicating that there is a problem getting the data.
*/
showDataProblemMsg() {
this.showingDataProblemMsg = true;
}

/**
* Hides the box at the bottom-right corner indicating that there is a problem getting the data.
*/
hideDataProblemMsg() {
this.showingDataProblemMsg = false;
}

/**
* Gets the pk of the hypervisor. After that, it initializes services and allows the app to start working.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ $top-bar-height: 56px;
flex-direction: row-reverse;
font-size: $font-size-mini-plus;

mat-icon {
position: relative;
top: 3px;
}

.connection-error-msg-vpn {
margin: -5px 5px 5px 10px;
color: $yellow-clear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { NodeData, UpdateAllComponent } from '../../layout/update-all/update-all
import { BulkRewardAddressChangerComponent, BulkRewardAddressParams, NodeToEditData } from '../../layout/bulk-reward-address-changer/bulk-reward-address-changer.component';
import { MultipleNodeDataService, MultipleNodesBackendData } from 'src/app/services/multiple-node-data.service';
import { PageBaseComponent } from 'src/app/utils/page-base';
import { AppComponent } from 'src/app/app.component';

/**
* Page for showing the node list.
Expand Down Expand Up @@ -409,6 +410,7 @@ export class NodeListComponent extends PageBaseComponent implements OnInit, OnDe
this.lastUpdate = result.momentOfLastCorrectUpdate;
this.secondsSinceLastUpdate = Math.floor((Date.now() - result.momentOfLastCorrectUpdate) / 1000);
this.errorsUpdating = false;
AppComponent.currentInstance.hideDataProblemMsg();

if (this.lastUpdateRequestedManually) {
// Show a confirmation msg.
Expand All @@ -429,6 +431,7 @@ export class NodeListComponent extends PageBaseComponent implements OnInit, OnDe

// Stop the loading indicator and show a warning icon.
this.errorsUpdating = true;
AppComponent.currentInstance.showDataProblemMsg();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SnackbarService } from '../../../services/snackbar.service';
import { NodeActionsHelper } from './actions/node-actions-helper';
import { SingleNodeBackendData, SingleNodeDataService, TrafficData } from 'src/app/services/single-node-data.service';
import { PageBaseComponent } from 'src/app/utils/page-base';
import { AppComponent } from 'src/app/app.component';

/**
* Main page used for showing the details of a node. It is in charge of loading
Expand Down Expand Up @@ -320,6 +321,7 @@ export class NodeComponent extends PageBaseComponent implements OnInit, OnDestro
this.lastUpdate = result.momentOfLastCorrectUpdate;
this.secondsSinceLastUpdate = Math.floor((Date.now() - result.momentOfLastCorrectUpdate) / 1000);
this.errorsUpdating = false;
AppComponent.currentInstance.hideDataProblemMsg();

if (this.lastUpdateRequestedManually) {
// Show a confirmation msg.
Expand Down Expand Up @@ -347,6 +349,7 @@ export class NodeComponent extends PageBaseComponent implements OnInit, OnDestro

// Stop the loading indicator and show a warning icon.
this.errorsUpdating = true;
AppComponent.currentInstance.showDataProblemMsg();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { environment } from 'src/environments/environment';
import { SnackbarService } from './snackbar.service';
import { processServiceError } from '../utils/errors';
import { OperationError } from '../utils/operation-error';
import { AppComponent } from '../app.component';

/**
* States in which the VPN client app of the local visor can be.
Expand Down Expand Up @@ -576,6 +577,7 @@ export class VpnClientService {
mergeMap(() => this.getVpnClientState()),
retryWhen(err => err.pipe(mergeMap((error: OperationError) => {
this.errorSubject.next(true);
AppComponent.currentInstance.showDataProblemMsg();

error = processServiceError(error);
// If the problem was because the user is not authorized, don't retry.
Expand All @@ -599,6 +601,7 @@ export class VpnClientService {
).subscribe(appData => {
if (appData) {
this.errorSubject.next(false);
AppComponent.currentInstance.hideDataProblemMsg();

// Remove the busy state of the initial check.
if (this.lastServiceState === VpnServiceStates.PerformingInitialCheck) {
Expand Down
3 changes: 2 additions & 1 deletion static/skywire-manager-src/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"no": "No",
"unknown": "Unknown",
"close": "Close",
"window-size-error": "The window is too narrow for the content."
"window-size-error": "The window is too narrow for the content.",
"data-update-problems": "Problem updating the data."
},

"labeled-element": {
Expand Down
3 changes: 2 additions & 1 deletion static/skywire-manager-src/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"no": "No",
"unknown": "Desconocido",
"close": "Cerrar",
"window-size-error": "La ventana es demasiado estrecha para el contenido."
"window-size-error": "La ventana es demasiado estrecha para el contenido.",
"data-update-problems": "Problema actualizando los datos."
},

"labeled-element": {
Expand Down
3 changes: 2 additions & 1 deletion static/skywire-manager-src/src/assets/i18n/es_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"no": "No",
"unknown": "Unknown",
"close": "Close",
"window-size-error": "The window is too narrow for the content."
"window-size-error": "The window is too narrow for the content.",
"data-update-problems": "Problem updating the data."
},

"labeled-element": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,5 @@ $responsive-table-colors: (
// Allows to remove the margin at the right of the last mat-icon element inside
// generic-title-container, to make it be shown correctly when there is a paginator.
.paginator-icons-fixer {
mat-icon:last-of-type {
margin-right: 0 !important;
}
margin-right: 0 !important;
}

0 comments on commit 2c99655

Please sign in to comment.