mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-10-04 08:42:08 +00:00
refactor: fix new Angular warnings
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
<ion-toolbar color="primary" mode="md">
|
<ion-toolbar color="primary" mode="md">
|
||||||
<ion-segment (ionChange)="segmentChanged($event)" [value]="selectedSemesterUID" mode="md">
|
<ion-segment (ionChange)="segmentChanged($event)" [value]="selectedSemesterUID" mode="md">
|
||||||
@for (semester of availableSemesters; track semester) {
|
@for (semester of availableSemesters; track semester.uid) {
|
||||||
<ion-segment-button [value]="semester.uid">
|
<ion-segment-button [value]="semester.uid">
|
||||||
<ion-label>{{ semester.acronym }}</ion-label>
|
<ion-label>{{ semester.acronym }}</ion-label>
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<ion-content>
|
<ion-content>
|
||||||
@if (catalogs && catalogs.length > 0) {
|
@if (catalogs && catalogs.length > 0) {
|
||||||
<ion-list>
|
<ion-list>
|
||||||
@for (catalog of catalogs; track catalog) {
|
@for (catalog of catalogs; track catalog.uid) {
|
||||||
<ion-item button="true" lines="inset" (click)="notifySelect(catalog)">
|
<ion-item button="true" lines="inset" (click)="notifySelect(catalog)">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ catalog.name }}</h2>
|
<h2>{{ catalog.name }}</h2>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
@if (!catalogs) {
|
@if (!catalogs) {
|
||||||
<ion-list>
|
<ion-list>
|
||||||
@for (skeleton of [].constructor(10); track skeleton) {
|
@for (skeleton of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; track skeleton) {
|
||||||
<stapps-skeleton-list-item> </stapps-skeleton-list-item>
|
<stapps-skeleton-list-item> </stapps-skeleton-list-item>
|
||||||
}
|
}
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
</ion-button>
|
</ion-button>
|
||||||
@if (items | async; as items) {
|
@if (items | async; as items) {
|
||||||
<simple-swiper @fade>
|
<simple-swiper @fade>
|
||||||
@for (item of items; track item) {
|
@for (item of items; track item.uid) {
|
||||||
<stapps-data-list-item
|
<stapps-data-list-item
|
||||||
[hideThumbnail]="true"
|
[hideThumbnail]="true"
|
||||||
[listItemEndInteraction]="false"
|
[listItemEndInteraction]="false"
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
</ion-button>
|
</ion-button>
|
||||||
@if (jobs | async; as jobs) {
|
@if (jobs | async; as jobs) {
|
||||||
<simple-swiper @fade>
|
<simple-swiper @fade>
|
||||||
@for (item of jobs; track item) {
|
@for (item of jobs; track item.uid) {
|
||||||
<stapps-data-list-item
|
<stapps-data-list-item
|
||||||
[hideThumbnail]="true"
|
[hideThumbnail]="true"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
@if (dishes | async; as dishes) {
|
@if (dishes | async; as dishes) {
|
||||||
@if (dishes.length > 0) {
|
@if (dishes.length > 0) {
|
||||||
<simple-swiper @fade>
|
<simple-swiper @fade>
|
||||||
@for (dish of dishes; track dish) {
|
@for (dish of dishes; track dish.uid) {
|
||||||
<stapps-data-list-item
|
<stapps-data-list-item
|
||||||
[hideThumbnail]="true"
|
[hideThumbnail]="true"
|
||||||
[item]="dish"
|
[item]="dish"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
@if (items | async; as items) {
|
@if (items | async; as items) {
|
||||||
@if (items.length !== 0) {
|
@if (items.length !== 0) {
|
||||||
@for (item of items; track item) {
|
@for (item of items; track item.uid) {
|
||||||
<stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item">
|
<stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item">
|
||||||
<ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)">
|
<ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)">
|
||||||
<ion-icon slot="icon-only" name="delete" [size]="24"></ion-icon>
|
<ion-icon slot="icon-only" name="delete" [size]="24"></ion-icon>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
@if (content && isThing(content[0])) {
|
@if (content && isThing(content[0])) {
|
||||||
@for (thing of $any(content); track thing) {
|
@for (thing of $any(content); track thing.uid) {
|
||||||
<a [routerLink]="['/data-detail', thing.uid]">
|
<a [routerLink]="['/data-detail', thing.uid]">
|
||||||
<p>{{ 'name' | thingTranslate: thing }}</p>
|
<p>{{ 'name' | thingTranslate: thing }}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
@if (itemStream | async; as items) {
|
@if (itemStream | async; as items) {
|
||||||
<ng-content select="[header]"></ng-content>
|
<ng-content select="[header]"></ng-content>
|
||||||
<ion-list [style.display]="items && items.length ? 'block' : 'none'">
|
<ion-list [style.display]="items && items.length ? 'block' : 'none'">
|
||||||
@for (item of items; track item) {
|
@for (item of items; track item.uid) {
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
||||||
></ng-container>
|
></ng-container>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</ion-text>
|
</ion-text>
|
||||||
</ion-list-header>
|
</ion-list-header>
|
||||||
}
|
}
|
||||||
@for (item of items; track item) {
|
@for (item of items; track item.uid) {
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
||||||
></ng-container>
|
></ng-container>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
<ion-list>
|
<ion-list>
|
||||||
@for (skeleton of [].constructor(skeletonItems); track skeleton) {
|
@for (skeleton of [1, 2, 3, 4, 5, 6]; track skeleton) {
|
||||||
<stapps-skeleton-list-item [hideThumbnail]="singleType"> </stapps-skeleton-list-item>
|
<stapps-skeleton-list-item [hideThumbnail]="singleType"> </stapps-skeleton-list-item>
|
||||||
}
|
}
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<ion-list slot="content" lines="none">
|
<ion-list slot="content" lines="none">
|
||||||
@for (item of entry[1]._ || []; track item) {
|
@for (item of entry[1]._ || []; track item.uid) {
|
||||||
<div class="tree-indicator">
|
<div class="tree-indicator">
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
*ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
<ion-card>
|
<ion-card>
|
||||||
<ion-card-header>{{ 'superCatalogs' | propertyNameTranslate: 'catalog' | titlecase }}</ion-card-header>
|
<ion-card-header>{{ 'superCatalogs' | propertyNameTranslate: 'catalog' | titlecase }}</ion-card-header>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
@for (item of item.catalogs; track item) {
|
@for (item of item.catalogs; track item.uid) {
|
||||||
<event-route-path
|
<event-route-path
|
||||||
[maxItems]="1"
|
[maxItems]="1"
|
||||||
[itemsAfterCollapse]="1"
|
[itemsAfterCollapse]="1"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
-->
|
-->
|
||||||
@if (item.workLocations) {
|
@if (item.workLocations) {
|
||||||
<ion-list>
|
<ion-list>
|
||||||
@for (contactPoint of contactPoints; track contactPoint; let i = $index) {
|
@for (contactPoint of contactPoints; track contactPoint.uid; let i = $index) {
|
||||||
<ion-card>
|
<ion-card>
|
||||||
<ion-card-header>
|
<ion-card-header>
|
||||||
@if (item.workLocations.length > 1) {
|
@if (item.workLocations.length > 1) {
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import {IonFabButton} from '@ionic/angular/standalone';
|
|||||||
import {MapService} from '@maplibre/ngx-maplibre-gl';
|
import {MapService} from '@maplibre/ngx-maplibre-gl';
|
||||||
import {MapEventType} from 'maplibre-gl';
|
import {MapEventType} from 'maplibre-gl';
|
||||||
import {map, mergeMap, fromEventPattern, merge} from 'rxjs';
|
import {map, mergeMap, fromEventPattern, merge} from 'rxjs';
|
||||||
import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'stapps-compass-control',
|
selector: 'stapps-compass-control',
|
||||||
templateUrl: './compass-control.html',
|
templateUrl: './compass-control.html',
|
||||||
styleUrl: './compass-control.scss',
|
styleUrl: './compass-control.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
imports: [AsyncPipe, IonIconDirective, IonFabButton],
|
imports: [AsyncPipe, IonFabButton],
|
||||||
})
|
})
|
||||||
export class CompassControlComponent {
|
export class CompassControlComponent {
|
||||||
transform = this.mapService.mapCreated$.pipe(
|
transform = this.mapService.mapCreated$.pipe(
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||||
import {MapIconDirective} from '../map-icon.directive';
|
|
||||||
import {FeatureCollection, Point} from 'geojson';
|
import {FeatureCollection, Point} from 'geojson';
|
||||||
import {SCFeatureProperties} from '../feature-collection.pipe';
|
import {SCFeatureProperties} from '../feature-collection.pipe';
|
||||||
import {animate, style, transition, trigger} from '@angular/animations';
|
import {animate, style, transition, trigger} from '@angular/animations';
|
||||||
@@ -19,7 +18,6 @@ import {PoiMarkerComponent} from './poi-marker.component';
|
|||||||
styleUrl: './poi-markers.scss',
|
styleUrl: './poi-markers.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
imports: [
|
imports: [
|
||||||
MapIconDirective,
|
|
||||||
MglClusterLeavesPipe,
|
MglClusterLeavesPipe,
|
||||||
GeoJSONSourceComponent,
|
GeoJSONSourceComponent,
|
||||||
MarkersForClustersComponent,
|
MarkersForClustersComponent,
|
||||||
|
|||||||
@@ -14,21 +14,15 @@
|
|||||||
*/
|
*/
|
||||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||||
import {LngLatBoundsLike, MapLibreEvent} from 'maplibre-gl';
|
import {LngLatBoundsLike, MapLibreEvent} from 'maplibre-gl';
|
||||||
import {
|
import {ControlComponent, MapComponent, ScaleControlDirective} from '@maplibre/ngx-maplibre-gl';
|
||||||
ControlComponent,
|
|
||||||
GeolocateControlDirective,
|
|
||||||
MapComponent,
|
|
||||||
ScaleControlDirective,
|
|
||||||
} from '@maplibre/ngx-maplibre-gl';
|
|
||||||
import {TranslateModule} from '@ngx-translate/core';
|
import {TranslateModule} from '@ngx-translate/core';
|
||||||
import {ActivatedRoute, RouterLink} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {MapAuto3dDirective} from './map-auto-3d.directive';
|
import {MapAuto3dDirective} from './map-auto-3d.directive';
|
||||||
import {MediaQueryPipe} from '../../util/media-query.pipe';
|
import {MediaQueryPipe} from '../../util/media-query.pipe';
|
||||||
import {DataProvider} from '../data/data.provider';
|
import {DataProvider} from '../data/data.provider';
|
||||||
import {SCSearchFilter, SCThingType} from '@openstapps/core';
|
import {SCSearchFilter, SCThingType} from '@openstapps/core';
|
||||||
import {DataModule} from '../data/data.module';
|
import {DataModule} from '../data/data.module';
|
||||||
import {AsyncPipe} from '@angular/common';
|
import {AsyncPipe} from '@angular/common';
|
||||||
import {GeolocateControlComponent} from './controls/geolocate-control.component';
|
|
||||||
import {CompassControlComponent} from './controls/compass-control.component';
|
import {CompassControlComponent} from './controls/compass-control.component';
|
||||||
import {MapSizeFixDirective} from './map-size-fix.directive';
|
import {MapSizeFixDirective} from './map-size-fix.directive';
|
||||||
import {MapDataProvider} from './map-data.provider';
|
import {MapDataProvider} from './map-data.provider';
|
||||||
@@ -38,8 +32,8 @@ import {BuildingMarkersComponent} from './elements/building-markers.component';
|
|||||||
import {PoiMarkersComponent} from './elements/poi-markers.component';
|
import {PoiMarkersComponent} from './elements/poi-markers.component';
|
||||||
import {AttributionComponent} from './controls/attribution.component';
|
import {AttributionComponent} from './controls/attribution.component';
|
||||||
import {filter, map} from 'rxjs';
|
import {filter, map} from 'rxjs';
|
||||||
import {IonButton, IonContent, IonLabel, IonRouterLink} from '@ionic/angular/standalone';
|
import {IonContent} from '@ionic/angular/standalone';
|
||||||
import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
import {GeolocateControlComponent} from './controls/geolocate-control.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main page of the map
|
* The main page of the map
|
||||||
@@ -63,23 +57,17 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
|||||||
ControlComponent,
|
ControlComponent,
|
||||||
DataModule,
|
DataModule,
|
||||||
GeolocateControlComponent,
|
GeolocateControlComponent,
|
||||||
GeolocateControlDirective,
|
|
||||||
IonIconDirective,
|
|
||||||
MapAuto3dDirective,
|
MapAuto3dDirective,
|
||||||
MapComponent,
|
MapComponent,
|
||||||
MapSizeFixDirective,
|
MapSizeFixDirective,
|
||||||
MapStylePipe,
|
MapStylePipe,
|
||||||
MediaQueryPipe,
|
MediaQueryPipe,
|
||||||
PoiMarkersComponent,
|
PoiMarkersComponent,
|
||||||
RouterLink,
|
|
||||||
ScaleControlDirective,
|
ScaleControlDirective,
|
||||||
ThingPoiFeatureCollectionPipe,
|
ThingPoiFeatureCollectionPipe,
|
||||||
ThingPolygonFeatureCollectionPipe,
|
ThingPolygonFeatureCollectionPipe,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
IonContent,
|
IonContent,
|
||||||
IonLabel,
|
|
||||||
IonRouterLink,
|
|
||||||
IonButton,
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class MapPageComponent {
|
export class MapPageComponent {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
import {ChangeDetectionStrategy, Component, HostBinding, Input, inject} from '@angular/core';
|
import {ChangeDetectionStrategy, Component, HostBinding, Input, inject} from '@angular/core';
|
||||||
import {RouterLink} from '@angular/router';
|
import {RouterLink} from '@angular/router';
|
||||||
import {ControlComponent, MapComponent, MarkerComponent} from '@maplibre/ngx-maplibre-gl';
|
import {ControlComponent, MapComponent} from '@maplibre/ngx-maplibre-gl';
|
||||||
import {AnimationController, IonRouterLink} from '@ionic/angular/standalone';
|
import {AnimationController, IonRouterLink} from '@ionic/angular/standalone';
|
||||||
import {GeoNavigationDirective} from './geo-navigation.directive';
|
import {GeoNavigationDirective} from './geo-navigation.directive';
|
||||||
import {TranslateModule} from '@ngx-translate/core';
|
import {TranslateModule} from '@ngx-translate/core';
|
||||||
@@ -51,7 +51,6 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
|||||||
MapComponent,
|
MapComponent,
|
||||||
MapSizeFixDirective,
|
MapSizeFixDirective,
|
||||||
MapStylePipe,
|
MapStylePipe,
|
||||||
MarkerComponent,
|
|
||||||
MediaQueryPipe,
|
MediaQueryPipe,
|
||||||
PoiMarkersComponent,
|
PoiMarkersComponent,
|
||||||
RouterLink,
|
RouterLink,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if (news.length > 0) {
|
@if (news.length > 0) {
|
||||||
@for (item of news; track item) {
|
@for (item of news; track item.uid) {
|
||||||
<stapps-news-item [item]="item"></stapps-news-item>
|
<stapps-news-item [item]="item"></stapps-news-item>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||||
import {IdCardsProvider} from './id-cards.provider';
|
import {IdCardsProvider} from './id-cards.provider';
|
||||||
import {SCIdCard} from '@openstapps/core';
|
import {SCIdCard} from '@openstapps/core';
|
||||||
import {AsyncPipe, TitleCasePipe} from '@angular/common';
|
import {AsyncPipe} from '@angular/common';
|
||||||
import {ThingTranslateModule} from '../../translation/thing-translate.module';
|
import {ThingTranslateModule} from '../../translation/thing-translate.module';
|
||||||
import {UtilModule} from '../../util/util.module';
|
import {UtilModule} from '../../util/util.module';
|
||||||
import {IdCardComponent} from './id-card.component';
|
import {IdCardComponent} from './id-card.component';
|
||||||
@@ -29,15 +29,7 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
|||||||
styleUrls: ['id-cards.scss'],
|
styleUrls: ['id-cards.scss'],
|
||||||
providers: [IdCardsProvider],
|
providers: [IdCardsProvider],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
imports: [
|
imports: [AsyncPipe, ThingTranslateModule, UtilModule, IdCardComponent, TranslateModule, IonIconDirective],
|
||||||
AsyncPipe,
|
|
||||||
ThingTranslateModule,
|
|
||||||
UtilModule,
|
|
||||||
IdCardComponent,
|
|
||||||
TranslateModule,
|
|
||||||
TitleCasePipe,
|
|
||||||
IonIconDirective,
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class IdCardsComponent {
|
export class IdCardsComponent {
|
||||||
idCards: Observable<SCIdCard[]> = this.idCardsProvider.getIdCards();
|
idCards: Observable<SCIdCard[]> = this.idCardsProvider.getIdCards();
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ export class ArrayJoinPipe implements PipeTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(anArray)) {
|
if (!Array.isArray(anArray)) {
|
||||||
throw new SyntaxError(`Wrong parameter in ArrayJoinPipe. Expected a valid Array, received: ${anArray}`);
|
logger.warn(`Wrong parameter in ArrayJoinPipe. Expected a valid Array, received: ${anArray}`);
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = anArray.join(separator);
|
this.value = anArray.join(separator);
|
||||||
@@ -77,9 +78,10 @@ export class SentenceCasePipe implements PipeTransform {
|
|||||||
|
|
||||||
transform(aString: string | unknown): string {
|
transform(aString: string | unknown): string {
|
||||||
if (typeof aString !== 'string') {
|
if (typeof aString !== 'string') {
|
||||||
throw new SyntaxError(
|
if (aString !== undefined) {
|
||||||
`Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`,
|
logger.warn(`Wrong parameter in SentenceCasePipe. Expected a valid String, received: ${aString}`);
|
||||||
);
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = aString.slice(0, 1).toUpperCase() + aString.slice(1);
|
this.value = aString.slice(0, 1).toUpperCase() + aString.slice(1);
|
||||||
@@ -103,9 +105,8 @@ export class StringSplitPipe implements PipeTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof aString !== 'string') {
|
if (typeof aString !== 'string') {
|
||||||
throw new SyntaxError(
|
logger.warn(`Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`);
|
||||||
`Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`,
|
return [];
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = aString.split(splitter);
|
this.value = aString.split(splitter);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {Subscription} from 'rxjs';
|
|||||||
import {TranslateService} from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {ThingTranslateService} from './thing-translate.service';
|
import {ThingTranslateService} from './thing-translate.service';
|
||||||
import {isThing, SCThings, SCThingType} from '@openstapps/core';
|
import {isThing, SCThings, SCThingType} from '@openstapps/core';
|
||||||
|
import {logger} from '../_helpers/ts-logger';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Pipe({
|
@Pipe({
|
||||||
@@ -51,9 +52,10 @@ export class PropertyNameTranslatePipe implements PipeTransform, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isThing(thingOrType) && typeof thingOrType !== 'string') {
|
if (!isThing(thingOrType) && typeof thingOrType !== 'string') {
|
||||||
throw new SyntaxError(
|
logger.warn(
|
||||||
`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing or String, received: ${thingOrType}`,
|
`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing or String, received: ${thingOrType}`,
|
||||||
);
|
);
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the params, in case they change
|
// store the params, in case they change
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {TranslateService} from '@ngx-translate/core';
|
|||||||
import {isThing, SCThings, SCThingWithoutReferences} from '@openstapps/core';
|
import {isThing, SCThings, SCThingWithoutReferences} from '@openstapps/core';
|
||||||
import {Subscription} from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
import {ThingTranslateService} from './thing-translate.service';
|
import {ThingTranslateService} from './thing-translate.service';
|
||||||
|
import {logger} from '../_helpers/ts-logger';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Pipe({
|
@Pipe({
|
||||||
@@ -52,9 +53,8 @@ export class ThingTranslatePipe implements PipeTransform, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isThing(thing)) {
|
if (!isThing(thing)) {
|
||||||
throw new SyntaxError(
|
logger.warn(`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing, received: ${thing}`);
|
||||||
`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing, received: ${thing}`,
|
return {} as never;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the params, in case they change
|
// store the params, in case they change
|
||||||
|
|||||||
Reference in New Issue
Block a user