diff --git a/src/frontend/app/store/actions/pagination.actions.ts b/src/frontend/app/store/actions/pagination.actions.ts index 68d5e48051..4a5aba3ad5 100644 --- a/src/frontend/app/store/actions/pagination.actions.ts +++ b/src/frontend/app/store/actions/pagination.actions.ts @@ -1,7 +1,6 @@ import { Action } from '@ngrx/store'; -import { createEntityRelationPaginationKey } from '../helpers/entity-relations/entity-relations.types'; -import { PaginationAction, PaginationClientFilter, PaginationParam } from '../types/pagination.types'; +import { BasePaginatedAction, PaginationClientFilter, PaginationParam } from '../types/pagination.types'; export const CLEAR_PAGINATION_OF_TYPE = '[Pagination] Clear all pages of type'; export const CLEAR_PAGINATION_OF_ENTITY = '[Pagination] Clear pagination of entity'; @@ -36,13 +35,13 @@ export class ClearPaginationOfEntity implements Action { type = CLEAR_PAGINATION_OF_ENTITY; } -export class ResetPagination implements PaginationAction { +export class ResetPagination implements BasePaginatedAction { constructor(public entityKey: string, public paginationKey: string) { } type = RESET_PAGINATION; } -export class CreatePagination implements PaginationAction { +export class CreatePagination implements BasePaginatedAction { /** * @param entityKey * @param paginationKey @@ -54,13 +53,13 @@ export class CreatePagination implements PaginationAction { } -export class ClearPages implements PaginationAction { +export class ClearPages implements BasePaginatedAction { constructor(public entityKey: string, public paginationKey: string) { } type = CLEAR_PAGES; } -export class SetPage implements PaginationAction { +export class SetPage implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -71,7 +70,7 @@ export class SetPage implements PaginationAction { type = SET_PAGE; } -export class SetResultCount implements PaginationAction { +export class SetResultCount implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -81,7 +80,7 @@ export class SetResultCount implements PaginationAction { type = SET_RESULT_COUNT; } -export class SetClientPageSize implements PaginationAction { +export class SetClientPageSize implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -91,7 +90,7 @@ export class SetClientPageSize implements PaginationAction { type = SET_CLIENT_PAGE_SIZE; } -export class SetClientPage implements PaginationAction { +export class SetClientPage implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -101,7 +100,7 @@ export class SetClientPage implements PaginationAction { type = SET_CLIENT_PAGE; } -export class SetClientFilter implements PaginationAction { +export class SetClientFilter implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -111,7 +110,7 @@ export class SetClientFilter implements PaginationAction { type = SET_CLIENT_FILTER; } -export class SetParams implements PaginationAction { +export class SetParams implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -135,7 +134,7 @@ export class SetInitialParams implements SetParams { type = SET_INITIAL_PARAMS; } -export class AddParams implements PaginationAction { +export class AddParams implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, @@ -146,7 +145,7 @@ export class AddParams implements PaginationAction { type = ADD_PARAMS; } -export class RemoveParams implements PaginationAction { +export class RemoveParams implements BasePaginatedAction { constructor( public entityKey: string, public paginationKey: string, diff --git a/src/frontend/app/store/actions/service-broker.actions.ts b/src/frontend/app/store/actions/service-broker.actions.ts index afbbdc64b4..b61a4e8383 100644 --- a/src/frontend/app/store/actions/service-broker.actions.ts +++ b/src/frontend/app/store/actions/service-broker.actions.ts @@ -1,11 +1,11 @@ import { RequestOptions, URLSearchParams } from '@angular/http'; import { entityFactory, serviceBrokerSchemaKey } from '../helpers/entity-factory'; -import { PaginationAction } from '../types/pagination.types'; +import { PaginatedAction } from '../types/pagination.types'; import { CFStartAction, IRequestAction } from '../types/request.types'; import { getActions } from './action.helper'; -export class GetServiceBrokers extends CFStartAction implements PaginationAction { +export class GetServiceBrokers extends CFStartAction implements PaginatedAction { constructor( public endpointGuid: string, public paginationKey: string, diff --git a/src/frontend/app/store/actions/service-instances.actions.ts b/src/frontend/app/store/actions/service-instances.actions.ts index 6921739e93..fdc213ebfc 100644 --- a/src/frontend/app/store/actions/service-instances.actions.ts +++ b/src/frontend/app/store/actions/service-instances.actions.ts @@ -13,7 +13,7 @@ import { spaceSchemaKey, } from '../helpers/entity-factory'; import { createEntityRelationKey, EntityInlineParentAction } from '../helpers/entity-relations/entity-relations.types'; -import { PaginationAction } from '../types/pagination.types'; +import { PaginatedAction } from '../types/pagination.types'; import { CFStartAction, ICFAction } from '../types/request.types'; import { getActions } from './action.helper'; @@ -29,7 +29,7 @@ export const getServiceInstanceRelations = [ ]; export class GetServiceInstances - extends CFStartAction implements PaginationAction, EntityInlineParentAction { + extends CFStartAction implements PaginatedAction, EntityInlineParentAction { constructor( public endpointGuid: string, public paginationKey: string, @@ -139,7 +139,7 @@ export class UpdateServiceInstance extends CreateServiceInstance { } export class ListServiceBindingsForInstance - extends CFStartAction implements PaginationAction, EntityInlineParentAction { + extends CFStartAction implements PaginatedAction, EntityInlineParentAction { constructor( public endpointGuid: string, public serviceInstanceGuid: string, diff --git a/src/frontend/app/store/actions/service-plan-visibility.actions.ts b/src/frontend/app/store/actions/service-plan-visibility.actions.ts index f5aee532b8..09c8eaff90 100644 --- a/src/frontend/app/store/actions/service-plan-visibility.actions.ts +++ b/src/frontend/app/store/actions/service-plan-visibility.actions.ts @@ -8,11 +8,11 @@ import { spaceSchemaKey, } from '../helpers/entity-factory'; import { createEntityRelationKey } from '../helpers/entity-relations/entity-relations.types'; -import { PaginationAction } from '../types/pagination.types'; +import { PaginatedAction } from '../types/pagination.types'; import { CFStartAction } from '../types/request.types'; import { getActions } from './action.helper'; -export class GetServicePlanVisibilities extends CFStartAction implements PaginationAction { +export class GetServicePlanVisibilities extends CFStartAction implements PaginatedAction { constructor( public endpointGuid: string, public paginationKey: string, diff --git a/src/frontend/app/store/actions/service-plan.actions.ts b/src/frontend/app/store/actions/service-plan.actions.ts index f2fb80d413..8632f09c34 100644 --- a/src/frontend/app/store/actions/service-plan.actions.ts +++ b/src/frontend/app/store/actions/service-plan.actions.ts @@ -1,22 +1,21 @@ import { RequestOptions, URLSearchParams } from '@angular/http'; import { + applicationSchemaKey, entityFactory, organizationSchemaKey, - servicePlanSchemaKey, - servicePlanVisibilitySchemaKey, - spaceSchemaKey, - serviceInstancesSchemaKey, serviceBindingSchemaKey, - applicationSchemaKey, + serviceInstancesSchemaKey, + servicePlanSchemaKey, serviceSchemaKey, + spaceSchemaKey, } from '../helpers/entity-factory'; import { createEntityRelationKey } from '../helpers/entity-relations/entity-relations.types'; -import { PaginationAction } from '../types/pagination.types'; +import { PaginatedAction } from '../types/pagination.types'; import { CFStartAction } from '../types/request.types'; import { getActions } from './action.helper'; -export class GetServicePlanServiceInstances extends CFStartAction implements PaginationAction { +export class GetServicePlanServiceInstances extends CFStartAction implements PaginatedAction { constructor( public servicePlanGuid: string, public endpointGuid: string, diff --git a/src/frontend/app/store/actions/service.actions.ts b/src/frontend/app/store/actions/service.actions.ts index 2c76b9a00c..bd310fb049 100644 --- a/src/frontend/app/store/actions/service.actions.ts +++ b/src/frontend/app/store/actions/service.actions.ts @@ -2,11 +2,11 @@ import { RequestOptions, URLSearchParams } from '@angular/http'; import { entityFactory, servicePlanSchemaKey, serviceSchemaKey } from '../helpers/entity-factory'; import { createEntityRelationKey, EntityInlineParentAction } from '../helpers/entity-relations/entity-relations.types'; -import { PaginationAction } from '../types/pagination.types'; +import { PaginatedAction } from '../types/pagination.types'; import { CFStartAction } from '../types/request.types'; import { getActions } from './action.helper'; -export class GetAllServices extends CFStartAction implements PaginationAction, EntityInlineParentAction { +export class GetAllServices extends CFStartAction implements PaginatedAction, EntityInlineParentAction { constructor( public paginationKey: string, public endpointGuid: string = null, @@ -53,7 +53,7 @@ export class GetService extends CFStartAction implements EntityInlineParentActio options: RequestOptions; } -export class GetServicePlansForService extends CFStartAction implements PaginationAction { +export class GetServicePlansForService extends CFStartAction implements PaginatedAction { constructor( public serviceGuid: string, public endpointGuid: string, diff --git a/src/frontend/app/store/actions/space.actions.ts b/src/frontend/app/store/actions/space.actions.ts index 2eb8128269..d84c1ffb54 100644 --- a/src/frontend/app/store/actions/space.actions.ts +++ b/src/frontend/app/store/actions/space.actions.ts @@ -17,7 +17,7 @@ import { EntityInlineChildAction, EntityInlineParentAction, } from '../helpers/entity-relations/entity-relations.types'; -import { PaginatedAction, PaginationAction, QParam } from '../types/pagination.types'; +import { PaginatedAction, QParam } from '../types/pagination.types'; import { CFStartAction, ICFAction } from '../types/request.types'; import { getActions } from './action.helper'; import { GetAllOrgUsers } from './organization.actions'; @@ -217,7 +217,7 @@ export class GetAllSpaceUsers extends GetAllOrgUsers { } -export class GetAllServicesForSpace extends CFStartAction implements PaginationAction, EntityInlineParentAction { +export class GetAllServicesForSpace extends CFStartAction implements PaginatedAction, EntityInlineParentAction { constructor( public paginationKey: string, public endpointGuid: string = null, @@ -248,7 +248,7 @@ export class GetAllServicesForSpace extends CFStartAction implements PaginationA export class GetServiceInstancesForSpace - extends CFStartAction implements PaginationAction, EntityInlineParentAction, EntityInlineChildAction { + extends CFStartAction implements PaginatedAction, EntityInlineParentAction, EntityInlineChildAction { constructor( public spaceGuid: string, public endpointGuid: string, diff --git a/src/frontend/app/store/actions/system.actions.ts b/src/frontend/app/store/actions/system.actions.ts index 7c9031e503..c916b62398 100644 --- a/src/frontend/app/store/actions/system.actions.ts +++ b/src/frontend/app/store/actions/system.actions.ts @@ -1,6 +1,5 @@ import { Action } from '@ngrx/store'; -import { PaginationAction } from '../types/pagination.types'; import { SystemInfo } from '../types/system.types'; import { GetAllEndpoints } from './endpoint.actions'; diff --git a/src/frontend/app/store/helpers/store-helpers.ts b/src/frontend/app/store/helpers/store-helpers.ts index 39b71857a7..a49ce4c8f6 100644 --- a/src/frontend/app/store/helpers/store-helpers.ts +++ b/src/frontend/app/store/helpers/store-helpers.ts @@ -5,16 +5,16 @@ import { first, map, pairwise, skipWhile } from 'rxjs/operators'; import { AppState } from '../app-state'; import { ActionState } from '../reducers/api-request-reducer/types'; import { selectPaginationState } from '../selectors/pagination.selectors'; -import { PaginationAction, PaginationEntityState } from '../types/pagination.types'; +import { BasePaginatedAction, PaginationEntityState } from '../types/pagination.types'; -export const fetchPaginationStateFromAction = (store: Store, action: PaginationAction) => +export const fetchPaginationStateFromAction = (store: Store, action: BasePaginatedAction) => store.select(selectPaginationState(action.entityKey, action.paginationKey)); /** * Using the given action wait until the associated pagination section changes from busy to not busy */ -export const createPaginationCompleteWatcher = (store: Store, action: PaginationAction): Observable => +export const createPaginationCompleteWatcher = (store: Store, action: BasePaginatedAction): Observable => fetchPaginationStateFromAction(store, action).pipe( map((paginationState: PaginationEntityState) => { const pageRequest: ActionState = diff --git a/src/frontend/app/store/reducers/pagination-reducer/pagination-reducer-update.ts b/src/frontend/app/store/reducers/pagination-reducer/pagination-reducer-update.ts index ca0b979609..518315bc16 100644 --- a/src/frontend/app/store/reducers/pagination-reducer/pagination-reducer-update.ts +++ b/src/frontend/app/store/reducers/pagination-reducer/pagination-reducer-update.ts @@ -1,7 +1,4 @@ -import { RequestAction } from '../../types/request.types'; -import { State } from '@ngrx/store'; -import { AppState } from '../../app-state'; -import { PaginationAction, PaginationEntityState } from '../../types/pagination.types'; +import { PaginationEntityState } from '../../types/pagination.types'; export function paginationPageBusy(state: PaginationEntityState, action): PaginationEntityState { const { busy, apiAction, error } = action; diff --git a/src/frontend/app/store/types/pagination.types.ts b/src/frontend/app/store/types/pagination.types.ts index f8f9b6a0e0..bb5f2bacff 100644 --- a/src/frontend/app/store/types/pagination.types.ts +++ b/src/frontend/app/store/types/pagination.types.ts @@ -47,12 +47,12 @@ export class PaginationEntityState { seed?: string; } -export interface PaginationAction extends Action { +export interface BasePaginatedAction extends Action { entityKey: string; paginationKey: string; } -export interface PaginatedAction extends PaginationAction, IRequestAction { +export interface PaginatedAction extends BasePaginatedAction, IRequestAction { actions: string[]; flattenPagination?: boolean; initialParams?: PaginationParam;