fix: do not load policy probes if client is in awaiting approval state
Closes:
MODIFY
src/app/components/account-idm/account-idm.component.ts
src/app/components/account-idm/account-idm.component.ts
@@ -34,6 +34,5 @@ export class AccountIdmComponent implements OnInit {
ngOnInit() {
this.keycloakToken = this.keycloakHelper.decodeCurrentKeyloakToken();
- console.log(this.keycloakToken);
}
}

MODIFY
src/app/components/my-apps/my-apps.component.ts
src/app/components/my-apps/my-apps.component.ts
@@ -248,8 +248,8 @@ export class MyAppsComponent implements OnInit {
})
)
.subscribe({
- next: (probes: IPolicyProbe[]) => {
- policy.probe = probes[0];
+ next: (probe: IPolicyProbe) => {
+ policy.probe = probe;
this.policyService.setGaugeDataForPolicy(policy);
},
complete: () => {

MODIFY
src/app/services/policy/policy.service.ts
src/app/services/policy/policy.service.ts
@@ -25,7 +25,7 @@ import {
} from '../../interfaces/IPolicy';
import { map, switchMap, tap } from 'rxjs/operators';
import { BackendService } from '../backend/backend.service';
-import { forkJoin, Observable, of } from 'rxjs';
+import { EMPTY, forkJoin, Observable, of } from 'rxjs';
import { formatBytes, formatBytesAsObject } from '../../shared/utility';
import { IContractExt } from '../../interfaces/IContractExt';
import { TranslateService } from '@ngx-translate/core';
@@ -203,9 +203,18 @@ export class PolicyService {
public getPolicyProbe(
contract: IContractExt,
- policy: IPolicy
- ): Observable<IPolicyProbe[]> {
- return this.backendService.getPolicyProbe(contract, policy);
+ policy: IPolicyExt
+ ): Observable<IPolicyProbe> {
+ if (contract.client.status === 'Registered') {
+ return this.backendService.getPolicyProbe(contract, policy).pipe(
+ switchMap((probes: IPolicyProbe[]) => {
+ // currently we only have one probe result
+ return of(probes[0]);
+ })
+ );
+ } else {
+ return EMPTY;
+ }
}
public getTranslationForPeriod(period: string): string {

MODIFY
src/assets/i18n/en.json
src/assets/i18n/en.json
"NO_CLIENTS_FOUND": "No clients were found",
"FAILED_WHILE_FETCHING_CLIENTS": "Failed while fetching clients",
"REMOVE_CLIENT_FAILED": "Failed while removing the client",
- "NO_PROBES": "Failed while fetching the current policy data",
+ "NO_PROBES": "There is no policy data for the current API",
"RETIRED_API": "This API is retired and can no longer be used.",
"SELECT": "Select from available Clients",
"CLIENT_TOOLTIP": "Client Organization: {{ client.client.organization.name }}\nClient Name (Version): {{ client.client.name }} ({{ client.version }})",

fix: do not load policy probes if client is in awaiting approval state

Closes: #134