fix: no data messages, change detection for first toc link (hide console error), avoid endless spinner if no clients available
MODIFY
src/app/components/api-card-list/api-card-list.component.html
src/app/components/api-card-list/api-card-list.component.html
</ng-container>
<ng-template #NoDataMsg>
<div *ngIf="this.ready; else ErrorMsg" class="dp-center">
- <app-no-data [text]="'COMMON.NO_DATA_FOUND' | translate" [textClass]="'text-big2'"></app-no-data>
+ <app-no-data [text]="'HOME.NO_APIS_FOUND' | translate" [textClass]="'text-big2'"></app-no-data>
</div>
</ng-template>
<ng-template #ErrorMsg>

MODIFY
src/app/components/my-apps/my-apps.component.html
src/app/components/my-apps/my-apps.component.html
-<div *ngIf="contractsLoaded && !noDataFound" class="wrapper">
+<div *ngIf="contractsLoaded && contracts.length === 0" class="dp-center">
+ <app-no-data [text]="'APPS.NO_APPS_FOUND' | translate" [textClass]="'text-big2'"></app-no-data>
+</div>
+
+<div *ngIf="contractsLoaded && !noDataFound && contracts.length > 0" class="wrapper">
<div id="contracts" class="first">
<mat-card *ngFor="let cliCon of clientContractsMap | keyvalue" class="mb-40 mat-elevation-z3 client-card" [id]="tocService.formatClientId(cliCon.value[0])">
<!-- Client Header -->

MODIFY
src/app/components/my-apps/my-apps.component.ts
src/app/components/my-apps/my-apps.component.ts
@@ -76,6 +76,9 @@ export class MyAppsComponent implements OnInit {
.getEditableClients()
.pipe(
switchMap((clientSummaries: IClientSummary[]) => {
+ if (clientSummaries.length === 0){
+ this.stopMainRequest();
+ }
return forkJoin(clientSummaries.map(clientSummary => {
return this.backend.getClientVersions(
@@ -134,13 +137,17 @@ export class MyAppsComponent implements OnInit {
})
).subscribe((contracts) => {
this.getApiImages(contracts);
- this.spinnerService.stopWaiting();
- this.contractsLoaded = true;
+ this.stopMainRequest();
this.extractContracts(contracts);
this.generateTocLinks();
});
}
+ private stopMainRequest(){
+ this.spinnerService.stopWaiting();
+ this.contractsLoaded = true;
+ }
+
// TODO: include this in to the main request chain. Reminder: ApiVersions do not have api.api.image property
private getApiImages(contracts: IContractExt[]){
contracts.forEach((contract: IContractExt) => {

MODIFY
src/app/components/toc/toc.component.ts
src/app/components/toc/toc.component.ts
-import {AfterViewInit, Component, Input, OnChanges, SimpleChanges} from '@angular/core';
+import {AfterViewInit, ChangeDetectorRef, Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {ITocLink} from '../../interfaces/ITocLink';
import {Router} from "@angular/router";
@@ -11,12 +11,14 @@ export class TocComponent implements AfterViewInit{
@Input() links: ITocLink[] = [];
linksInViewPort: ITocLink[] = [];
- constructor(private router: Router) {}
+ constructor(private router: Router, private cdr: ChangeDetectorRef) {}
ngAfterViewInit() {
- if (this.links.length > 0)
+ if (this.links.length > 0) {
this.links[0].active = true;
+ this.cdr.detectChanges();
+ }
this.scroll(window.location.hash.replace('#', ''));
}

MODIFY
src/assets/i18n/en.json
src/assets/i18n/en.json
"HOME": {
"TITLE": "KoolBank Api Developer Portal",
"SUBTITLE": "Featured APIs",
- "SHOW_ALL": "Show all"
+ "SHOW_ALL": "Show all",
+ "NO_APIS_FOUND": "No APIs were found"
},
"MPLACE": {
"TITLE": "Marketplace",
"FIRST_OF": "1st of",
"RESETS_EVERY_SECOND": "Resets every second",
"NO_POLICIES_FOR_API": "No policies were found for this API",
- "APPS_AND_APIS": "Apps and APIs"
+ "APPS_AND_APIS": "Apps and APIs",
+ "NO_APPS_FOUND": "No applications were found"
},
"CLIENT_CREATE" : {
"SELECT": "Select from available Applications"

fix: no data messages, change detection for first toc link (hide console error), avoid endless spinner if no clients available