Commit ca0b2966 authored by Vitali Stupin's avatar Vitali Stupin

fixing missing translations

parent 78d31ca6
......@@ -8,7 +8,7 @@
<p [innerHTML]="'subsystemList.intro.p5' | translate"></p>
<div class="alert alert-warning" role="alert" *ngIf="message">
{{message}}
{{message | translate}}
</div>
<div class="btn-group" role="group" [attr.aria-label]="'subsystemList.selectInstance' | translate">
......
<app-header></app-header>
<h3>{{'subsystem.heading' | translate:{"subsystem": subsystemId, "instance": getInstance()} }}</h3>
<h3>{{'subsystem.heading' | translate:{"subsystem": subsystemId, "instance": getInstance() === "" ? paramsInstance : getInstance()} }}</h3>
<p [innerHTML]="'subsystem.intro.p1' | translate"></p>
<div class="alert alert-warning" role="alert" *ngIf="message">
{{message}}
{{message | translate:{"subsystem": subsystemId} }}
</div>
<button type="button" class="btn btn-secondary" (click)="goToList()">{{'subsystem.allSystemsBtn' | translate}}</button>
......
......@@ -78,7 +78,7 @@ describe('SubsystemComponent', () => {
fixture = TestBed.createComponent(SubsystemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
expect(component.message).toBe('Incorrect instance!');
expect(component.message).toBe('subsystem.incorrectInstanceWarning');
});
it('should detect when instance is not selected', () => {
......@@ -99,11 +99,21 @@ describe('SubsystemComponent', () => {
});
it('should detect incorrect subsystem', () => {
subsystemsService.subsystemsSubject = new BehaviorSubject([]);
subsystemsService.subsystemsSubject = new BehaviorSubject([
{
memberClass: '',
subsystemCode: '',
xRoadInstance: '',
subsystemStatus: '',
memberCode: '',
fullSubsystemName: 'INST/CLASS/MEMBER2/SYSTEM',
methods: []
}
]);
fixture = TestBed.createComponent(SubsystemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
expect(component.message).toBe('Subsystem "INST/CLASS/MEMBER/SYSTEM" cannot be found!');
expect(component.message).toBe('subsystem.subsystemNotFoundWarning');
});
it('should scroll to position', () => {
......
......@@ -13,6 +13,8 @@ import { filter } from 'rxjs/operators';
export class SubsystemComponent implements OnInit, AfterViewInit, OnDestroy {
subsystemId = '';
message = '';
// Contains instance from route.params (for displaying warning)
paramsInstance = '';
private scrollSubject: BehaviorSubject<any> = new BehaviorSubject(null);
private routerScrollSubscription: Subscription;
private routeSubscription: Subscription;
......@@ -67,8 +69,8 @@ export class SubsystemComponent implements OnInit, AfterViewInit, OnDestroy {
this.routeSubscription = this.route.params.subscribe( params => {
// Checking if instance is correct
if (!this.subsystemsService.getInstances().includes(params.instance)) {
// TODO: translation!
this.message = 'Incorrect instance!';
this.paramsInstance = params.instance;
this.message = 'subsystem.incorrectInstanceWarning';
return;
}
this.subsystemId = params.instance + '/' + params.class + '/' + params.member + '/' + params.subsystem;
......@@ -79,9 +81,8 @@ export class SubsystemComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.subsystemsSubscription = this.subsystemsService.subsystemsSubject.subscribe(subsystems => {
const subsystem = this.getSubsystem(subsystems, this.subsystemId);
if (!subsystem && !this.message) {
// TODO: translation!
this.message = 'Subsystem "' + this.subsystemId + '" cannot be found!';
if (!subsystem && !this.message && subsystems.length) {
this.message = 'subsystem.subsystemNotFoundWarning';
} else {
this.subsystemSubject.next(subsystem);
}
......@@ -99,26 +100,12 @@ export class SubsystemComponent implements OnInit, AfterViewInit, OnDestroy {
}
ngOnDestroy() {
// TODO: optimize this...
if (this.routerScrollSubscription) {
this.routerScrollSubscription.unsubscribe();
}
if (this.routeSubscription) {
this.routeSubscription.unsubscribe();
}
if (this.warningsSubscription) {
this.warningsSubscription.unsubscribe();
}
if (this.scrollSubjectSubscription) {
this.scrollSubjectSubscription.unsubscribe();
}
if (this.subsystemsSubscription) {
this.subsystemsSubscription.unsubscribe();
}
/*this.routerScrollSubscription.unsubscribe();
this.routerScrollSubscription.unsubscribe();
this.routeSubscription.unsubscribe();
this.warningsSubscription.unsubscribe();
this.scrollSubjectSubscription.unsubscribe();
this.subsystemsSubscription.unsubscribe();*/
if (this.subsystemsSubscription) {
this.subsystemsSubscription.unsubscribe();
}
}
}
import { Injectable, Output, EventEmitter } from '@angular/core';
import { Injectable, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, of, BehaviorSubject, Subject } from 'rxjs';
import { catchError, debounceTime, distinctUntilChanged } from 'rxjs/operators';
......@@ -96,8 +96,7 @@ export class SubsystemsService {
*/
private handleError<T>(result?: T) {
return (error: any): Observable<T> => {
// TODO: translation!
this.emitWarning('Error while loading data from server!');
this.emitWarning('service.dataLoadingError');
// Let the app keep running by returning an empty result.
return of(result);
};
......
{
"index": {
"title": "X-tee Subsystems and Methods catalogue"
"index": {
"title": "X-tee Subsystems and Methods catalogue"
},
"service": {
"dataLoadingError": "Error while loading data from server!"
},
"subsystemList": {
"heading": "Catalogue of all X-tee subsystems with methods and WSDL descriptions",
"intro": {
"p1": "This catalogue is generated by making getWsdl requests from RIA's Monitoring Security Server to all X-tee subsystems.",
"p2": "Subsystems with the <span class=\"badge badge-secondary\">Empty</span> icon have no X-Tee services available.",
"p3": "Subsystems with the <span class=\"badge badge-danger\">Error</span> icon either could not be reached by RIA's Monitoring Security Server or there was some other error during the request.",
"p4": "Catalogue in JSON form: <a href=\"{{jsonUrl}}\" target=\"_blank\">JSON</a>",
"p5": "Support: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"subsystemList": {
"heading": "Catalogue of all X-tee subsystems with methods and WSDL descriptions",
"intro": {
"p1": "This catalogue is generated by making getWsdl requests from RIA's Monitoring Security Server to all X-tee subsystems.",
"p2": "Subsystems with the <span class=\"badge badge-secondary\">Empty</span> icon have no X-Tee services available.",
"p3": "Subsystems with the <span class=\"badge badge-danger\">Error</span> icon either could not be reached by RIA's Monitoring Security Server or there was some other error during the request.",
"p4": "Catalogue in JSON form: <a href=\"{{jsonUrl}}\" target=\"_blank\">JSON</a>",
"p5": "Support: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"selectInstance": "Select X-tee instance"
"selectInstance": "Select X-tee instance"
},
"search": {
"searchFilters": "Search filters",
"nameFilter": "Filter by name",
"limit": "Amount of subsystems to display",
"nonEmpty": "Show only producer subsystems",
"allOption": "All"
},
"subsystem": {
"heading": "Subsystem {{subsystem}} with methods and WSDL descriptions for X-tee instance \"{{instance}}\"",
"intro": {
"p1": "Support: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"search": {
"searchFilters": "Search filters",
"nameFilter": "Filter by name",
"limit": "Amount of subsystems to display",
"nonEmpty": "Show only producer subsystems",
"allOption": "All"
},
"subsystem": {
"heading": "Subsystem {{subsystem}} with methods and WSDL descriptions for X-tee instance \"{{instance}}\"",
"intro": {
"p1": "Support: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"statusEmpty": "Empty",
"statusError": "Error",
"statusWsdlError": "Error while downloading or parsing of WSDL",
"statusWsdlTimeout": "WSDL query timed out",
"statusWsdlSkipped": "WSDL skipped due to previous Timeout",
"allSystemsBtn": "Show all subsystems",
"statusErrorInfo": "Subsystem either could not be reached by RIA's Monitoring Security Server or there was some other error during the request.",
"statusEmptyInfo": "Subsystem does not have any methods.",
"moreMethods": "{{count}} more ..."
}
"statusEmpty": "Empty",
"statusError": "Error",
"statusWsdlError": "Error while downloading or parsing of WSDL",
"statusWsdlTimeout": "WSDL query timed out",
"statusWsdlSkipped": "WSDL skipped due to previous Timeout",
"allSystemsBtn": "Show all subsystems",
"statusErrorInfo": "Subsystem either could not be reached by RIA's Monitoring Security Server or there was some other error during the request.",
"statusEmptyInfo": "Subsystem does not have any methods.",
"moreMethods": "{{count}} more ...",
"incorrectInstanceWarning": "Incorrect instance!",
"subsystemNotFoundWarning": "Subsystem \"{{subsystem}}\" cannot be found!"
}
}
{
"index": {
"title": "X-tee alamsüsteemide ja teenuste kataloog"
"index": {
"title": "X-tee alamsüsteemide ja teenuste kataloog"
},
"service": {
"dataLoadingError": "Viga andmete laadimisel serverist!"
},
"subsystemList": {
"heading": "X-tee alamsüsteemide kataloog teenuste ja WSDL kirjeldustega",
"intro": {
"p1": "Antud kataloog on genereeritud saates getWsdl päringud RIA monitooringu turvaserverist kõigi X-tee alamsüsteemide pihta.",
"p2": "Alamsüsteemid <span class=\"badge badge-secondary\">Tühi</span> ikooniga ei oma X-tee teenuseid.",
"p3": "Alamsüsteemid <span class=\"badge badge-danger\">Viga</span> ikooniga kas ei ole ligipääsetavad RIA monitooringu turvaserveri poolt, või päringu tegemisel ilmnes muu viga.",
"p4": "Kataloog JSON kujul: <a href=\"{{jsonUrl}}\" target=\"_blank\">JSON</a>",
"p5": "Kasutajatugi: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"subsystemList": {
"heading": "X-tee alamsüsteemide kataloog teenuste ja WSDL kirjeldustega",
"intro": {
"p1": "Antud kataloog on genereeritud saates getWsdl päringud RIA monitooringu turvaserverist kõigi X-tee alamsüsteemide pihta.",
"p2": "Alamsüsteemid <span class=\"badge badge-secondary\">Tühi</span> ikooniga ei oma X-tee teenuseid.",
"p3": "Alamsüsteemid <span class=\"badge badge-danger\">Viga</span> ikooniga kas ei ole ligipääsetavad RIA monitooringu turvaserveri poolt, või päringu tegemisel ilmnes muu viga.",
"p4": "Kataloog JSON kujul: <a href=\"{{jsonUrl}}\" target=\"_blank\">JSON</a>",
"p5": "Kasutajatugi: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"selectInstance": "Vali X-tee instants"
"selectInstance": "Vali X-tee instants"
},
"search": {
"searchFilters": "Otsingu filtrid",
"nameFilter": "Filtreeri nime järgi",
"limit": "Alamsüsteemide näitamise piirang",
"nonEmpty": "Näita vaid teenustepakkujad",
"allOption": "Kõik"
},
"subsystem": {
"heading": "Alamsüsteem {{subsystem}} teenuste ja WSDL kirjeldustega X-tee instantsi \"{{instance}}\" jaoks",
"intro": {
"p1": "Kasutajatugi: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"search": {
"searchFilters": "Otsingu filtrid",
"nameFilter": "Filtreeri nime järgi",
"limit": "Alamsüsteemide näitamise piirang",
"nonEmpty": "Näita vaid teenustepakkujad",
"allOption": "Kõik"
},
"subsystem": {
"heading": "Alamsüsteem {{subsystem}} teenuste ja WSDL kirjeldustega X-tee instantsi \"{{instance}}\" jaoks",
"intro": {
"p1": "Kasutajatugi: <a href=\"mailto:help@ria.ee\">help@ria.ee</a>"
},
"statusEmpty": "Tühi",
"statusError": "Viga",
"statusWsdlError": "Viga WSDL'i laadimisel või töötlemisel",
"statusWsdlTimeout": "WSDL'i laadimine aegus",
"statusWsdlSkipped": "Eelneva aegumise tõttu WSDL'i laadimine pole teostatud",
"allSystemsBtn": "Näita kõiki alamsüsteeme",
"statusErrorInfo": "Alamsüsteem kas ei ole ligipääsetav RIA monitooringu turvaserveri poolt, või päringu tegemisel ilmnes muu viga.",
"statusEmptyInfo": "Alamsüsteem ei oma X-tee teenuseid.",
"moreMethods": "veel {{count}} ..."
}
}
"statusEmpty": "Tühi",
"statusError": "Viga",
"statusWsdlError": "Viga WSDL'i laadimisel või töötlemisel",
"statusWsdlTimeout": "WSDL'i laadimine aegus",
"statusWsdlSkipped": "Eelneva aegumise tõttu WSDL'i laadimine pole teostatud",
"allSystemsBtn": "Näita kõiki alamsüsteeme",
"statusErrorInfo": "Alamsüsteem kas ei ole ligipääsetav RIA monitooringu turvaserveri poolt, või päringu tegemisel ilmnes muu viga.",
"statusEmptyInfo": "Alamsüsteem ei oma X-tee teenuseid.",
"moreMethods": "veel {{count}} ...",
"incorrectInstanceWarning": "Vale instants!",
"subsystemNotFoundWarning": "Alamsüsteem \"{{subsystem}}\" ei ole leitud!"
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment