Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pagination of space level routes and service instance tables #2429

Merged
merged 1 commit into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AppState } from '../../../../../store/app-state';
import { APIResource } from '../../../../../store/types/api.types';
import { ServiceActionHelperService } from '../../../../data-services/service-action-helper.service';
import { ITableColumn } from '../../list-table/table.types';
import { IListAction, IListConfig, ListConfig, ListViewTypes } from '../../list.component.types';
import { defaultPaginationPageSizeOptionsTable, IListAction, IListConfig, ListViewTypes } from '../../list.component.types';
import {
TableCellServiceInstanceAppsAttachedComponent,
} from '../cf-spaces-service-instances/table-cell-service-instance-apps-attached/table-cell-service-instance-apps-attached.component';
Expand All @@ -26,16 +26,18 @@ import {
import {
TableCellServicePlanComponent,
} from '../cf-spaces-service-instances/table-cell-service-plan/table-cell-service-plan.component';
import { TableCellSpaceNameComponent } from '../cf-spaces-service-instances/table-cell-space-name/table-cell-space-name.component';
import {
TableCellSpaceNameComponent,
} from '../cf-spaces-service-instances/table-cell-space-name/table-cell-space-name.component';

interface CanCache {
[spaceGuid: string]: Observable<boolean>;
}

@Injectable()
export class CfServiceInstancesListConfigBase extends ListConfig<APIResource<IServiceInstance>>
implements IListConfig<APIResource<IServiceInstance>> {
export class CfServiceInstancesListConfigBase implements IListConfig<APIResource<IServiceInstance>> {
viewType = ListViewTypes.TABLE_ONLY;
pageSizeOptions = defaultPaginationPageSizeOptionsTable;
dataSource: ListDataSource<APIResource>;
defaultView = 'table' as ListView;
text = {
Expand Down Expand Up @@ -153,7 +155,6 @@ export class CfServiceInstancesListConfigBase extends ListConfig<APIResource<ISe
protected currentUserPermissionsService: CurrentUserPermissionsService,
private serviceActionHelperService: ServiceActionHelperService
) {
super();
}

deleteServiceInstance = (serviceInstance: APIResource<IServiceInstance>) =>
Expand All @@ -172,5 +173,7 @@ export class CfServiceInstancesListConfigBase extends ListConfig<APIResource<ISe
getMultiActions = () => [];
getSingleActions = () => [this.listActionEdit, this.listActionDetach, this.listActionDelete];
getMultiFiltersConfigs = () => [];
getColumns = () => this.serviceInstanceColumns;
getDataSource = () => null;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class CfSpaceRoutesDataSource extends ListDataSource<APIResource> {
const action = new GetSpaceRoutes(spaceGuid, cfGuid, paginationKey, [
createEntityRelationKey(routeSchemaKey, applicationSchemaKey),
createEntityRelationKey(routeSchemaKey, domainSchemaKey),
]);
], true, false);
action.initialParams['order-direction-field'] = 'creation';
const { rowStateManager, sub } = SpaceRouteDataSourceHelper.getRowStateManager(
store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CfSpacesServiceInstancesDataSource extends ListDataSource<APIResour
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, spaceSchemaKey),
createEntityRelationKey(serviceBindingSchemaKey, applicationSchemaKey),
]);
], true, false);
super({
store,
action,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class CfSpacesServiceInstancesListConfigService extends CfServiceInstance
};
}

getColumns = () => this.serviceInstanceColumns;
getDataSource = () => this.dataSource;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ export class ServiceInstancesListConfigService extends CfServiceInstancesListCon
};
}

getColumns = () => this.serviceInstanceColumns;
getDataSource = () => this.dataSource;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ListView } from '../../../../../store/actions/list.actions';
import { AppState } from '../../../../../store/app-state';
import { CfOrgSpaceDataService } from '../../../../data-services/cf-org-space-service.service';
import { ServiceActionHelperService } from '../../../../data-services/service-action-helper.service';
import { ListViewTypes } from '../../list.component.types';
import { defaultPaginationPageSizeOptionsCards, ListViewTypes } from '../../list.component.types';
import { createListFilterConfig } from '../../list.helper';
import { cfOrgSpaceFilter } from '../app/cf-apps-data-source';
import { CfServiceInstancesListConfigBase } from '../cf-services/cf-service-instances-list-config.base';
Expand All @@ -33,6 +33,7 @@ export class ServiceInstancesWallListConfigService extends CfServiceInstancesLis
defaultView = 'cards' as ListView;
cardComponent = ServiceInstanceCardComponent;
viewType = ListViewTypes.BOTH;
pageSizeOptions = defaultPaginationPageSizeOptionsCards;

constructor(store: Store<AppState>,
datePipe: DatePipe,
Expand All @@ -56,7 +57,6 @@ export class ServiceInstancesWallListConfigService extends CfServiceInstancesLis
};
}

getColumns = () => this.serviceInstanceColumns;
getDataSource = () => this.dataSource;

}
4 changes: 2 additions & 2 deletions src/frontend/app/store/actions/service-instances.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class GetServicesInstancesInSpace
createEntityRelationKey(serviceInstancesSchemaKey, serviceBindingSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey)
],
public populateMissing = true
public populateMissing = true,
public flattenPagination = true
) {
super();
this.options = new RequestOptions();
Expand All @@ -55,7 +56,6 @@ export class GetServicesInstancesInSpace
};
parentGuid: string;
parentEntitySchema = entityFactory(spaceSchemaKey);
flattenPagination = true;
}

export class GetServiceInstances
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/app/store/actions/space.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export class GetSpaceRoutes extends CFStartAction implements PaginatedAction, En
public endpointGuid: string,
public paginationKey: string,
public includeRelations = [],
public populateMissing = true
public populateMissing = true,
public flattenPagination = true
) {
super();
this.options = new RequestOptions();
Expand All @@ -113,7 +114,6 @@ export class GetSpaceRoutes extends CFStartAction implements PaginatedAction, En
entity = entityFactory(routeSchemaKey);
entityKey = routeSchemaKey;
options: RequestOptions;
flattenPagination = true;
parentEntitySchema = entityFactory(spaceSchemaKey);
}

Expand Down