Skip to content

Commit

Permalink
feat: add popup if ARLAS server becomes unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
QuCMGisaia committed Dec 20, 2024
1 parent 9fac621 commit 06bad5b
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ $error-color: #ce3d38;
.title {
font-size: $default-font-size;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
}

.content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ export class ErrorService {

public listenToArlasCollaborativeErrors() {
this.arlasErrorsSubscription = this.arlasCollaborationService.collaborationErrorBus.subscribe((e: any) => {
if (e >= 400) {
if (e.status >= 400) {
this.emitBackendError(e.status, e.message, marker('ARLAS-server'));
} else if (!e.status) {
// In case ARLAS-server got down during the use of the app
this.emitUnavailableService(marker('ARLAS-server'));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ export class FetchInterceptorService {
}
} else if (code >= 400) {
let message: string = marker('An error occured.');
switch (code) {
case 400: {
message = marker('An error occured when requesting data.');
break;
};
case 404: {
message = marker('The requested data does not exist.');
break;
};

if (code === 400) {
message = marker('An error occured when requesting data.');
} else if (code === 404) {
message = marker('The requested data does not exist.');
}
this.errorService.emitBackendError(code, message, marker('ARLAS-server'));
}
Expand Down
6 changes: 3 additions & 3 deletions projects/arlas-toolkit/src/lib/tools/errors/backend-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { ArlasError } from './error';


export class BackendError extends ArlasError {
private service: string = marker('ARLAS backend services');
private hubUrl: string;
private readonly service: string = marker('ARLAS backend services');
private readonly hubUrl: string;

public constructor(status: number, message: string, hubUrl: string, service?: string) {
super(status);
Expand Down Expand Up @@ -54,7 +54,7 @@ export class BackendError extends ArlasError {
}

private goToArlasHub() {
if (!!this.hubUrl) {
if (this.hubUrl) {
window.open(this.hubUrl, '_self');
}
}
Expand Down
19 changes: 10 additions & 9 deletions src/app/components/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@
.shortcut {
padding: 0 8px;
height: fit-content;
}

::ng-deep.title {
height: 28px;
}

::ng-deep.open_title {
margin-bottom: 0;
}
::ng-deep.title {
height: 28px;
}

::ng-deep.open_title {
margin-bottom: 0;
}

::ng-deep.content {
top: 52px !important;
::ng-deep.content {
top: 52px !important;
}
}

::ng-deep.arlas-timeline--tools {
Expand Down
18 changes: 8 additions & 10 deletions src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,14 @@ export class HomeComponent implements OnInit {
@ViewChild('share', { static: false }) private shareComponent: ShareComponent;

public constructor(
private arlasStartupService: ArlasStartupService,
private arlasConfigService: ArlasConfigService,
private arlasIamService: ArlasIamService,
private processService: ProcessService,
private arlasAuthentService: ArlasAuthentificationService,
private analyticsService: AnalyticsService,
private collaborativeService: ArlasCollaborativesearchService,
private arlasOverlayService: ArlasOverlayService,
private dialog: MatDialog,
private errorService: ErrorService
private readonly arlasStartupService: ArlasStartupService,
private readonly arlasConfigService: ArlasConfigService,
private readonly arlasIamService: ArlasIamService,
private readonly processService: ProcessService,
private readonly arlasAuthentService: ArlasAuthentificationService,
private readonly analyticsService: AnalyticsService,
private readonly collaborativeService: ArlasCollaborativesearchService,
private readonly dialog: MatDialog
) { }

public ngOnInit(): void {
Expand Down
6 changes: 3 additions & 3 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"year": "year",
"You are about to create a new permission on data, based on the current filters applied to": "You are about to create a new permission on data, based on the current filters applied to ",
"Add permission description": "Add a description to the permission:",
"course.distance.gps.travelled_m": "Distance"


"course.distance.gps.travelled_m": "Distance",
"The connection is lost": "The connection to {{service}} is lost.",
"The service is unavailable": "{{service}} is unavailable."
}
171 changes: 5 additions & 166 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,53 +133,6 @@
"type": "term"
}
]
},
{
"identifier": "courses-track.duration_s-numeric-bucket-Count--50",
"name": "Duration",
"title": "Duration",
"collection": "courses",
"icon": "hourglass_bottom",
"charttype": "bars",
"isOneDimension": false,
"type": "histogram",
"numberOfBuckets": 50,
"jsonpath": "$.count",
"aggregationmodels": [
{
"type": "histogram",
"field": "track.duration_s"
}
]
},
{
"identifier": "courses-arrival.address.country-count-undefined-avg-track.duration_s",
"name": "Table",
"title": "Table",
"icon": "flag",
"type": "metricstable",
"numberOfBuckets": 10,
"sort": {
"collection": "courses",
"termfield": "arrival.address.country",
"order": "desc",
"on": "count"
},
"configuration": [
{
"termfield": "arrival.address.country",
"collection": "courses",
"metrics": [
{
"metric": "count"
},
{
"metric": "avg",
"field": "track.duration_s"
}
]
}
]
}
],
"components": {
Expand Down Expand Up @@ -361,18 +314,18 @@
"value": "Eq",
"display": true
},
"useColorService": false,
"useColorService": true,
"useColorFromData": false,
"unit": "",
"chartWidth": 445
"chartWidth": 217
},
"contributorId": "courses-object.mmsi-10-Count-desc-count",
"uuid": "b63abbdd-764d-4994-81a8-b9396efe9d73",
"usage": "analytics"
},
{
"componentType": "donut",
"showExportCsv": true,
"showExportCsv": "",
"input": {
"id": "courses-object.ship_type-10-",
"customizedCssClass": "arlas-donuts-analytics",
Expand All @@ -386,120 +339,6 @@
"usage": "analytics"
}
]
},
{
"groupId": "Boat-1",
"title": "Duration",
"tab": "Boat",
"icon": "hourglass_bottom",
"components": [
{
"input": {
"id": "courses-track.duration_s-numeric-bucket-Count--50",
"isHistogramSelectable": true,
"multiselectable": true,
"topOffsetRemoveInterval": 40,
"leftOffsetRemoveInterval": 18,
"brushHandlesHeightWeight": 0.8,
"yAxisStartsFromZero": true,
"chartType": "bars",
"chartTitle": "Duration",
"chartHeight": 100,
"chartWidth": 445,
"xAxisPosition": "bottom",
"descriptionPosition": "bottom",
"xTicks": 4,
"yTicks": 1,
"xLabels": 4,
"yLabels": 4,
"xUnit": "s",
"yUnit": "courses",
"chartXLabel": "Duration",
"chartYLabel": "Count",
"shortYLabels": false,
"showXTicks": true,
"showYTicks": true,
"showXLabels": true,
"showYLabels": true,
"showHorizontalLines": true,
"barWeight": 0.8,
"dataType": "numeric",
"customizedCssClass": "arlas-histogram-analytics",
"isSmoothedCurve": false
},
"componentType": "histogram",
"showExportCsv": true,
"contributorId": "courses-track.duration_s-numeric-bucket-Count--50",
"uuid": "6b4e34d9-a785-40e0-a2bd-c6df150efdac",
"usage": "analytics"
},
{
"input": {
"id": "courses-track.duration_s-numeric-bucket-Count--50",
"isHistogramSelectable": true,
"multiselectable": true,
"topOffsetRemoveInterval": 40,
"leftOffsetRemoveInterval": 18,
"brushHandlesHeightWeight": 0.8,
"yAxisStartsFromZero": true,
"chartType": "bars",
"chartTitle": "Duration",
"chartHeight": 100,
"chartWidth": 445,
"xAxisPosition": "bottom",
"descriptionPosition": "bottom",
"xTicks": 4,
"yTicks": 1,
"xLabels": 4,
"yLabels": 4,
"xUnit": "s",
"yUnit": "courses",
"chartXLabel": "Duration",
"chartYLabel": "Count",
"shortYLabels": false,
"showXTicks": true,
"showYTicks": true,
"showXLabels": true,
"showYLabels": true,
"showHorizontalLines": true,
"barWeight": 0.8,
"dataType": "numeric",
"customizedCssClass": "arlas-histogram-analytics",
"isSmoothedCurve": false
},
"componentType": "histogram",
"showExportCsv": true,
"contributorId": "courses-track.duration_s-numeric-bucket-Count--50",
"uuid": "6b4e34d9-a785-40e0-a2bd-c6df150ffdac",
"usage": "analytics"
}
]
},
{
"groupId": "Boat-2",
"title": "Country statistics",
"tab": "Boat",
"icon": "flag",
"components": [
{
"componentType": "metricstable",
"input": {
"filterOperator": {
"value": "Eq",
"display": false
},
"useColorService": false,
"normaliseBy": "column",
"showRowField": false,
"applyColorTo": "row",
"headerDisplayMode": "title",
"selectWithCheckbox": false
},
"contributorId": "courses-arrival.address.country-count-undefined-avg-track.duration_s",
"uuid": "7e5a5e3e-fff5-434a-9d4d-054f144d389e",
"usage": "analytics"
}
]
}
],
"filters_shortcuts": [],
Expand Down Expand Up @@ -572,7 +411,7 @@
"externalNode": {}
},
"server": {
"url": "http://localhost/arlas",
"url": "http://merolla/arlas",
"max_age_cache": 120,
"collection": {
"name": "courses"
Expand Down Expand Up @@ -600,4 +439,4 @@
}
},
"resources": {}
}
}
2 changes: 1 addition & 1 deletion src/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authentication:
auth_mode: 'iam'
force_connect: false
threshold: 5000
url: http://localhost:80/arlas_iam_server
url: https://localhost/arlas_iam_server
sign_up_enabled: true
process:
- name: download
Expand Down

0 comments on commit 06bad5b

Please sign in to comment.