Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Fix CF App Restage (#4393)
Browse files Browse the repository at this point in the history
* Remove action entityLocation (not used)

* Fix restage
- fixes #4392

* Remove RequestEntityLocation
  • Loading branch information
richard-cox committed Jun 26, 2020
1 parent c4b63e8 commit ee8b14c
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpRequest } from '@angular/common/http';

import { PaginatedAction } from '../../../store/src/types/pagination.types';
import { ICFAction, RequestEntityLocation } from '../../../store/src/types/request.types';
import { ICFAction } from '../../../store/src/types/request.types';
import { cfEntityFactory } from '../cf-entity-factory';
import { appEnvVarsEntityType, applicationEntityType, appStatsEntityType, appSummaryEntityType } from '../cf-entity-types';
import { createEntityRelationPaginationKey } from '../entity-relations/entity-relations.types';
Expand Down Expand Up @@ -39,7 +39,6 @@ export class GetAppStatsAction extends CFStartAction implements PaginatedAction,
'order-direction': 'desc',
'order-direction-field': 'index',
};
entityLocation = RequestEntityLocation.ARRAY;
}

export class GetAppEnvVarsAction extends CFStartAction implements PaginatedAction, ICFAction {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpHeaders, HttpParams, HttpRequest } from '@angular/common/http';
import { HttpParams, HttpRequest } from '@angular/common/http';

import { pick } from '../../../store/src/helpers/reducer.helper';
import { ActionMergeFunction } from '../../../store/src/types/api.types';
Expand Down Expand Up @@ -164,9 +164,6 @@ export class DeleteApplication extends CFStartAction implements ICFAction {
`apps/${guid}`,
null,
{
headers: new HttpHeaders({
'x-cap-passthrough': 'true'
}),
params: new HttpParams({
fromObject: {
recursive: 'true'
Expand All @@ -192,12 +189,7 @@ export class DeleteApplicationInstance extends CFStartAction
this.options = new HttpRequest(
'DELETE',
`apps/${appGuid}/instances/${index}`,
null,
{
headers: new HttpHeaders({
'x-cap-passthrough': 'true'
})
}
null
);
this.guid = `${appGuid}-${index}`;
}
Expand All @@ -215,11 +207,6 @@ export class RestageApplication extends CFStartAction implements ICFAction {
'POST',
`apps/${guid}/restage`,
null,
{
headers: new HttpHeaders({
'x-cap-passthrough': 'true'
})
}
);
}
actions = [RESTAGE, RESTAGE_SUCCESS, RESTAGE_FAILED];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { HttpRequest } from '@angular/common/http';
import { getActions } from '../../../store/src/actions/action.helper';
import { endpointEntityType } from '../../../store/src/helpers/stratos-entity-factory';
import { PaginatedAction } from '../../../store/src/types/pagination.types';
import { RequestEntityLocation } from '../../../store/src/types/request.types';
import { cfEntityFactory } from '../cf-entity-factory';
import { featureFlagEntityType } from '../cf-entity-types';
import { createEntityRelationPaginationKey } from '../entity-relations/entity-relations.types';
Expand All @@ -25,7 +24,6 @@ export class GetAllFeatureFlags extends CFStartAction implements PaginatedAction
actions = getActions('Feature Flags', 'Fetch all');
options: HttpRequest<any>;
flattenPagination = true;
entityLocation = RequestEntityLocation.ARRAY;
initialParams = {
page: 1,
'order-direction': 'desc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpParams, HttpRequest } from '@angular/common/http';

import { EntityCatalogEntityConfig } from '../../../store/src/entity-catalog/entity-catalog.types';
import { PaginatedAction } from '../../../store/src/types/pagination.types';
import { RequestActionEntity, RequestEntityLocation } from '../../../store/src/types/request.types';
import { RequestActionEntity } from '../../../store/src/types/request.types';
import { EntityTreeRelation } from '../entity-relations/entity-relation-tree';
import { EntityInlineChildAction, EntityInlineParentAction } from '../entity-relations/entity-relations.types';
import { CFStartAction } from './cf-action.types';
Expand Down Expand Up @@ -95,8 +95,6 @@ export class FetchRelationSingleAction extends FetchRelationAction {
populateMissing,
url,
);
this.entityLocation = RequestEntityLocation.OBJECT;
this.entity = child.entity;
}
entityLocation: RequestEntityLocation;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import { InternalAppState, IRequestTypeState } from '../../../store/src/app-stat
import { EntityCatalogTestModuleManualStore, TEST_CATALOGUE_ENTITIES } from '../../../store/src/entity-catalog-test.module';
import { entityCatalog } from '../../../store/src/entity-catalog/entity-catalog';
import { EntityCatalogEntityConfig } from '../../../store/src/entity-catalog/entity-catalog.types';
import {
EntityRequestAction,
RequestEntityLocation,
WrapperRequestActionSuccess,
} from '../../../store/src/types/request.types';
import { EntityRequestAction, WrapperRequestActionSuccess } from '../../../store/src/types/request.types';
import {
entityRelationMissingQuotaGuid,
entityRelationMissingQuotaUrl,
Expand Down Expand Up @@ -444,7 +440,6 @@ describe('Entity Relations - validate -', () => {
const associateAPIAction: EntityRequestAction = {
endpointGuid: getOrgAction.endpointGuid,
entity: getOrgAction.entity[0],
entityLocation: RequestEntityLocation.OBJECT,
guid: orgGuid,
entityType: organizationEntityType,
type: '[Entity] Associate with parent',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ import { getAPIRequestDataState, selectEntity, selectRequestInfo } from '../../.
import { selectPaginationState } from '../../../store/src/selectors/pagination.selectors';
import { APIResource, NormalizedResponse } from '../../../store/src/types/api.types';
import { isPaginatedAction, PaginatedAction, PaginationEntityState } from '../../../store/src/types/pagination.types';
import {
EntityRequestAction,
RequestEntityLocation,
WrapperRequestActionSuccess,
} from '../../../store/src/types/request.types';
import { EntityRequestAction, WrapperRequestActionSuccess } from '../../../store/src/types/request.types';
import { FetchRelationAction, FetchRelationPaginatedAction, FetchRelationSingleAction } from '../actions/relation.actions';
import { EntityTreeRelation } from './entity-relation-tree';
import { validationPostProcessor } from './entity-relations-post-processor';
Expand Down Expand Up @@ -341,7 +337,6 @@ function associateChildWithParent(
const parentAction: EntityRequestAction = {
endpointGuid: action.endpointGuid,
entity: catalogEntity.getSchema(action.parentEntityConfig.schemaKey),
entityLocation: RequestEntityLocation.OBJECT,
guid: action.parentGuid,
entityType: action.parentEntityConfig.entityType,
endpointType: action.parentEntityConfig.endpointType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { deepMergeState, mergeEntity } from '../../../../store/src/helpers/reduc
import { selectPaginationState } from '../../../../store/src/selectors/pagination.selectors';
import { APIResource } from '../../../../store/src/types/api.types';
import { PaginatedAction, PaginationEntityState } from '../../../../store/src/types/pagination.types';
import { RequestEntityLocation, WrapperRequestActionSuccess } from '../../../../store/src/types/request.types';
import { WrapperRequestActionSuccess } from '../../../../store/src/types/request.types';
import { GetOrganization } from '../../actions/organization.actions';
import { GetSpace } from '../../actions/space.actions';
import { getCFEntityKey } from '../../cf-entity-helpers';
Expand Down Expand Up @@ -105,7 +105,6 @@ export function orgSpacePostProcess(
actions: [],
endpointGuid: action.endpointGuid,
entity: userCatalogEntity.getSchema(),
entityLocation: RequestEntityLocation.ARRAY,
entityType: userCatalogEntity.definition.type,
endpointType: CF_ENDPOINT_TYPE,
type: '[Entity] Post-process Org/Space Users',
Expand Down
11 changes: 0 additions & 11 deletions src/frontend/packages/store/src/types/request.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ export interface RequestAction extends Action, BasePipelineRequestAction, Single
updatingKey?: string;
}

/**
* The entities in the response can live in a few different places. This will tell us where to look in the response to gather the entities
* @export
*/
export enum RequestEntityLocation {
RESOURCE, // The response is an object and the entities list is within a 'resource' param. Falls back to 'OBJECT' if missing.
ARRAY, // The response is an array which contains the entities
OBJECT, // The response is the entity
}

export type RequestActionEntity = EntitySchema | EntitySchema[];
export interface EntityRequestAction extends EntityCatalogEntityConfig, RequestAction {
/**
Expand All @@ -53,7 +43,6 @@ export interface EntityRequestAction extends EntityCatalogEntityConfig, RequestA
* For single entity requests
*/
guid?: string;
entityLocation?: RequestEntityLocation;
/**
* For delete requests we clear the pagination sections (include all pages) of all list matching the same entity type. In some cases,
* like local lists, we want to immediately remove that entry instead of clearing the table and refetching all data. This flag allows that
Expand Down

0 comments on commit ee8b14c

Please sign in to comment.