Skip to content

Commit

Permalink
Merge pull request #2584 from cloudfoundry-incubator/fix-services-wal…
Browse files Browse the repository at this point in the history
…l-exceptiohn

Clear service instances pagination after disconnecting an endpoint
  • Loading branch information
richard-cox authored Jun 29, 2018
2 parents 6fbc52a + 31221f6 commit d604302
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { ListDataSource } from '../../../shared/components/list/data-sources-controllers/list-data-source';
import {
CfServicesListConfigService,
} from '../../../shared/components/list/list-types/cf-services/cf-services-list-config.service';
import { ListConfig } from '../../../shared/components/list/list.component.types';
import { CloudFoundryService } from '../../../shared/data-services/cloud-foundry.service';
import { APIResource } from '../../../store/types/api.types';
import { getActiveRouteCfOrgSpaceProvider } from '../../cloud-foundry/cf.helpers';

@Component({
Expand All @@ -29,7 +27,10 @@ export class ServiceCatalogPageComponent {

constructor(public cloudFoundryService: CloudFoundryService) {
this.cfIds$ = cloudFoundryService.cFEndpoints$.pipe(
map(endpoints => endpoints.map(endpoint => endpoint.guid))
map(endpoints => endpoints
.filter(endpoint => endpoint.connectionStatus === 'connected')
.map(endpoint => endpoint.guid)
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export class ServicesWallComponent implements OnDestroy {

this.canCreateServiceInstance = CurrentUserPermissions.SERVICE_INSTANCE_CREATE;
this.cfIds$ = cloudFoundryService.cFEndpoints$.pipe(
map(endpoints => endpoints.map(endpoint => endpoint.guid))
map(endpoints => endpoints
.filter(endpoint => endpoint.connectionStatus === 'connected')
.map(endpoint => endpoint.guid)
)
);

this.initCfOrgSpaceService = initCfOrgSpaceService(this.store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
organizationSchemaKey,
serviceSchemaKey,
spaceSchemaKey,
serviceInstancesSchemaKey,
} from '../../helpers/entity-factory';
import { PaginationState } from '../../types/pagination.types';

Expand All @@ -29,6 +30,7 @@ export function clearEndpointEntities(state: PaginationState, action: EndpointAc
newState = paginationClearType(newState, organizationSchemaKey, defaultPaginationEntityState);
newState = paginationClearType(newState, serviceSchemaKey, defaultPaginationEntityState);
newState = paginationClearType(newState, cfUserSchemaKey, defaultPaginationEntityState);
newState = paginationClearType(newState, serviceInstancesSchemaKey, defaultPaginationEntityState);
return newState;
}
return state;
Expand Down

0 comments on commit d604302

Please sign in to comment.