Skip to content

Commit

Permalink
Merge pull request #1 from cloudfoundry-incubator/add-si-accepts-inco…
Browse files Browse the repository at this point in the history
…mplete

Updates to accepts_incomplete location
  • Loading branch information
forbushbl committed Dec 14, 2018
2 parents 7ded3d3 + 5f8a41a commit 9e36648
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 50 deletions.
4 changes: 4 additions & 0 deletions docs/status_updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Weekly status updates are published here.

## 12th October 2018

The team have been preparing for and attending the CF Summit in Basel.

## 5th October 2018

The team have been preparing for the CF Summit in Basel next week.
Expand Down
31 changes: 12 additions & 19 deletions src/frontend/app/features/applications/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ import {
import { APP_GUID, CF_GUID } from '../../shared/entity.tokens';
import { PaginationMonitor } from '../../shared/monitors/pagination-monitor';
import { PaginationMonitorFactory } from '../../shared/monitors/pagination-monitor.factory';
import {
AppMetadataTypes,
GetAppEnvVarsAction,
GetAppStatsAction,
GetAppSummaryAction,
} from '../../store/actions/app-metadata.actions';
import { AppMetadataTypes, GetAppStatsAction, GetAppSummaryAction } from '../../store/actions/app-metadata.actions';
import { GetApplication, UpdateApplication, UpdateExistingApplication } from '../../store/actions/application.actions';
import { GetSpace } from '../../store/actions/space.actions';
import { AppState } from '../../store/app-state';
import {
appEnvVarsSchemaKey,
applicationSchemaKey,
appStatsSchemaKey,
appSummarySchemaKey,
Expand Down Expand Up @@ -173,15 +167,15 @@ export class ApplicationService {
});
return appStateService.get(app, appInstances);
})
).pipe(publishReplay(1), refCount(), );
).pipe(publishReplay(1), refCount());
}

private constructCoreObservables() {
// First set up all the base observables
this.app$ = this.appEntityService.waitForEntity$;
const moreWaiting$ = this.app$.pipe(
filter(entityInfo => !!(entityInfo.entity && entityInfo.entity.entity && entityInfo.entity.entity.cfGuid)),
map(entityInfo => entityInfo.entity.entity), );
map(entityInfo => entityInfo.entity.entity));
this.appSpace$ = moreWaiting$.pipe(
first(),
switchMap(app => {
Expand All @@ -206,16 +200,15 @@ export class ApplicationService {
))
);

this.isDeletingApp$ = this.appEntityService.isDeletingEntity$.pipe(publishReplay(1), refCount(), );
this.isDeletingApp$ = this.appEntityService.isDeletingEntity$.pipe(publishReplay(1), refCount());

this.waitForAppEntity$ = this.appEntityService.waitForEntity$.pipe(publishReplay(1), refCount(), );
this.waitForAppEntity$ = this.appEntityService.waitForEntity$.pipe(publishReplay(1), refCount());

this.appSummary$ = this.waitForAppEntity$.pipe(
switchMap(() => this.appSummaryEntityService.entityObs$),
publishReplay(1),
refCount()
);
const action = new GetAppEnvVarsAction(this.appGuid, this.cfGuid);

this.appEnvVars = this.appEnvVarsService.createEnvVarsObs(this.appGuid, this.cfGuid);
}
Expand All @@ -235,7 +228,7 @@ export class ApplicationService {
// willing to do this to speed up the initial fetch for a running application.
this.appStats$ = appStats.entities$;

this.appStatsFetching$ = appStats.pagination$.pipe(publishReplay(1), refCount(), );
this.appStatsFetching$ = appStats.pagination$.pipe(publishReplay(1), refCount());

this.application$ = this.waitForAppEntity$.pipe(
combineLatest(this.store.select(endpointEntitiesSelector)),
Expand All @@ -249,17 +242,17 @@ export class ApplicationService {
stack: entity.entity.stack,
cf: endpoints[entity.entity.cfGuid],
};
}), publishReplay(1), refCount(), );
}), publishReplay(1), refCount());

this.applicationState$ = this.waitForAppEntity$.pipe(
combineLatest(this.appStats$.pipe(startWith(null))),
map(([appInfo, appStatsArray]: [EntityInfo, APIResource<AppStat>[]]) => {
return this.appStateService.get(appInfo.entity.entity, appStatsArray ? appStatsArray.map(apiResource => apiResource.entity) : null);
}), publishReplay(1), refCount(), );
}), publishReplay(1), refCount());

this.applicationStratProject$ = this.appEnvVars.entities$.pipe(map(applicationEnvVars => {
return this.appEnvVarsService.FetchStratosProject(applicationEnvVars[0].entity);
}), publishReplay(1), refCount(), );
}), publishReplay(1), refCount());

this.applicationRunning$ = this.application$.pipe(
map(app => app ? app.app.entity.state === 'STARTED' : false)
Expand All @@ -280,15 +273,15 @@ export class ApplicationService {
map(ev => getCurrentPageRequestInfo(ev).busy),
startWith(false),
publishReplay(1),
refCount(), );
refCount());

this.isUpdatingEnvVars$ = this.appEnvVars.pagination$.pipe(map(
ev => getCurrentPageRequestInfo(ev).busy && ev.ids[ev.currentPage]
), startWith(false), publishReplay(1), refCount(), );
), startWith(false), publishReplay(1), refCount());

this.isFetchingStats$ = this.appStatsFetching$.pipe(map(
appStats => appStats ? getCurrentPageRequestInfo(appStats).busy : false
), startWith(false), publishReplay(1), refCount(), );
), startWith(false), publishReplay(1), refCount());

this.applicationUrl$ = this.appSummaryEntityService.entityObs$.pipe(
map(({ entity }) => entity),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@

import { distinct, map, combineLatest } from 'rxjs/operators';
import { Component, HostBinding, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { combineLatest, distinct, map } from 'rxjs/operators';

import { AppState } from '../../../../../../store/app-state';
import { EntityInfo } from '../../../../../../store/types/api.types';
import { AppSummary } from '../../../../../../store/types/app-metadata.types';
import { getFullEndpointApiUrl } from '../../../../../endpoints/endpoint-helpers';
import { ApplicationMonitorService } from '../../../../application-monitor.service';
import { ApplicationData, ApplicationService } from '../../../../application.service';


@Component({
selector: 'app-build-tab',
templateUrl: './build-tab.component.html',
Expand Down Expand Up @@ -40,7 +37,7 @@ export class BuildTabComponent implements OnInit {
),
map(([app, appSummary]: [ApplicationData, EntityInfo<AppSummary>]) => {
return app.fetching || appSummary.entityRequestInfo.fetching;
}), distinct(), );
}), distinct());

this.sshStatus$ = this.applicationService.application$.pipe(
combineLatest(this.applicationService.appSpace$),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { HttpClient } from '@angular/common/http';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Observable, of as observableOf, Subject, Subscription } from 'rxjs';
import websocketConnect from 'rxjs-websockets';
Expand Down Expand Up @@ -64,8 +63,6 @@ export class DeployApplicationDeployer {
// Are we deploying?
deploying = false;

private hasSentSource = false;

private inputStream;

private isOpen = false;
Expand All @@ -79,7 +76,6 @@ export class DeployApplicationDeployer {
constructor(
private store: Store<AppState>,
public cfOrgSpaceService: CfOrgSpaceDataService,
private http: HttpClient,
) { }

updateStatus(error = false, errorMsg?: string) {
Expand Down Expand Up @@ -152,7 +148,7 @@ export class DeployApplicationDeployer {
filter((log) => log.type === SocketEventTypes.DATA),
map((log) => log.message),
share(),
);
);
this.msgSub = this.messages.subscribe();
})
).subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ export class DeployApplicationStepSourceUploadComponent implements OnDestroy {

public valid$: Observable<boolean>;

constructor(private store: Store<AppState>,
constructor(store: Store<AppState>,
public cfOrgSpaceService: CfOrgSpaceDataService,
http: HttpClient,
) {
this.deployer = new DeployApplicationDeployer(store, cfOrgSpaceService, http);
this.deployer = new DeployApplicationDeployer(store, cfOrgSpaceService);
this.valid$ = this.deployer.fileTransferStatus$.pipe(
filter(status => !!status),
map((status: FileTransferStatus) => status.filesSent === status.totalFiles),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { HttpClient } from '@angular/common/http';
import { Component, Input, OnDestroy } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { Store } from '@ngrx/store';
Expand All @@ -18,14 +17,11 @@ import {
import { StepOnNextFunction } from '../../../../shared/components/stepper/step/step.component';
import { CfOrgSpaceDataService } from '../../../../shared/data-services/cf-org-space-service.service';
import { GetAppEnvVarsAction } from '../../../../store/actions/app-metadata.actions';
import { GetApplication } from '../../../../store/actions/application.actions';
import { DeleteDeployAppSection } from '../../../../store/actions/deploy-applications.actions';
import { RouterNav } from '../../../../store/actions/router.actions';
import { AppState } from '../../../../store/app-state';
import { DeployApplicationDeployer } from '../deploy-application-deployer';
import { FileScannerInfo } from '../deploy-application-step2/deploy-application-fs/deploy-application-fs-scanner';

// Interval to check for new application
const APP_CHECK_INTERVAL = 3000;

@Component({
selector: 'app-deploy-application-step3',
Expand Down Expand Up @@ -53,9 +49,8 @@ export class DeployApplicationStep3Component implements OnDestroy {
private store: Store<AppState>,
snackBar: MatSnackBar,
public cfOrgSpaceService: CfOrgSpaceDataService,
http: HttpClient,
) {
this.deployer = new DeployApplicationDeployer(store, cfOrgSpaceService, http);
this.deployer = new DeployApplicationDeployer(store, cfOrgSpaceService);
// Observables
this.errorSub = this.deployer.status$.pipe(
filter((status) => status.error)
Expand Down Expand Up @@ -129,6 +124,8 @@ export class DeployApplicationStep3Component implements OnDestroy {
this.store.dispatch(new RouterNav({ path: ['applications', cfGuid, this.appGuid] }));
if (this.appGuid) {
this.store.dispatch(new GetAppEnvVarsAction(this.appGuid, cfGuid));
// Ensure the application package_state is correct
this.store.dispatch(new GetApplication(this.appGuid, cfGuid));
}
return observableOf({ success: true });
}
Expand Down
19 changes: 10 additions & 9 deletions src/frontend/app/store/actions/service-instances.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ import {
applicationSchemaKey,
entityFactory,
organizationSchemaKey,
serviceBindingNoBindingsSchemaKey,
serviceBindingSchemaKey,
serviceInstancesSchemaKey,
serviceInstancesWithSpaceSchemaKey,
servicePlanSchemaKey,
serviceSchemaKey,
spaceSchemaKey,
serviceBindingNoBindingsSchemaKey,
} from '../helpers/entity-factory';
import {
createEntityRelationKey,
EntityInlineChildAction,
EntityInlineParentAction,
} from '../helpers/entity-relations/entity-relations.types';
import { createEntityRelationKey, EntityInlineParentAction } from '../helpers/entity-relations/entity-relations.types';
import { PaginationAction } from '../types/pagination.types';
import { CFStartAction, ICFAction } from '../types/request.types';
import { getActions } from './action.helper';
Expand Down Expand Up @@ -82,9 +78,10 @@ export class DeleteServiceInstance extends CFStartAction implements ICFAction {
constructor(public endpointGuid: string, public guid: string) {
super();
this.options = new RequestOptions();
this.options.url = `service_instances/${guid}?accepts_incomplete=true`;
this.options.url = `service_instances/${guid}`;
this.options.method = 'delete';
this.options.params = new URLSearchParams();
this.options.params.set('accepts_incomplete', 'true');
this.options.params.set('async', 'false');
this.options.params.set('recursive', 'true');
this.options.headers = new Headers();
Expand All @@ -107,7 +104,9 @@ export class CreateServiceInstance extends CFStartAction implements ICFAction {
) {
super();
this.options = new RequestOptions();
this.options.url = `service_instances?accepts_incomplete=true`;
this.options.url = `service_instances`;
this.options.params = new URLSearchParams();
this.options.params.set('accepts_incomplete', 'true');
this.options.method = 'post';
this.options.body = {
name: name,
Expand Down Expand Up @@ -136,7 +135,9 @@ export class UpdateServiceInstance extends CreateServiceInstance {
) {
super(endpointGuid, guid, name, servicePlanGuid, spaceGuid, params, tags);
this.options.method = 'put';
this.options.url = `service_instances/${this.guid}?accepts_incomplete=true`;
this.options.url = `${this.options.url}/${this.guid}`;
this.options.params = new URLSearchParams();
this.options.params.set('accepts_incomplete', 'true');
this.actions = getActions('Service Instances', 'Update Service Instance');
}
updatingKey = UpdateServiceInstance.updateServiceInstance;
Expand Down

0 comments on commit 9e36648

Please sign in to comment.