From 0cef8607c01784748719f3ef1945e57516c1a1fb Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Wed, 27 Jun 2018 16:25:07 +0100 Subject: [PATCH 01/12] Ensure we return a clean EntityInfo from entity service --- src/frontend/app/core/entity-service.ts | 24 +++++++++++-------- .../cloud-foundry-organization.service.ts | 9 +------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/frontend/app/core/entity-service.ts b/src/frontend/app/core/entity-service.ts index f2c7da1315..78c22713b4 100644 --- a/src/frontend/app/core/entity-service.ts +++ b/src/frontend/app/core/entity-service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; import { Store, compose } from '@ngrx/store'; import { tag } from 'rxjs-spy/operators/tag'; -import { interval , Observable } from 'rxjs'; -import { filter, map, publishReplay, refCount, share, tap, withLatestFrom } from 'rxjs/operators'; +import { interval, Observable, combineLatest } from 'rxjs'; +import { filter, map, publishReplay, refCount, share, tap, withLatestFrom, switchMap } from 'rxjs/operators'; import { EntityMonitor } from '../shared/monitors/entity-monitor'; import { ValidateEntitiesStart } from '../store/actions/request.actions'; @@ -122,15 +122,19 @@ export class EntityService { actionDispatch(); } }), - filter((entityRequestInfo) => { - return !!entityRequestInfo; - }), - map(([entityRequestInfo, entity]) => { - return { + switchMap(() => combineLatest( + entityMonitor.entity$, + entityMonitor.entityRequest$ + ).pipe( + filter((entityRequestInfo) => { + return !!entityRequestInfo; + }), + map(([entity, entityRequestInfo]) => ({ entityRequestInfo, - entity: entity ? entity : null - }; - }), ); + entity + })) + )) + ); } private isEntityAvailable(entity, entityRequestInfo: RequestInfoState) { diff --git a/src/frontend/app/features/cloud-foundry/services/cloud-foundry-organization.service.ts b/src/frontend/app/features/cloud-foundry/services/cloud-foundry-organization.service.ts index ceb108b618..2021e05e04 100644 --- a/src/frontend/app/features/cloud-foundry/services/cloud-foundry-organization.service.ts +++ b/src/frontend/app/features/cloud-foundry/services/cloud-foundry-organization.service.ts @@ -97,14 +97,7 @@ export class CloudFoundryOrganizationService { private initialiseObservables() { this.org$ = this.orgEntityService.entityObs$.pipe( - filter(o => !!o && !!o.entity), - switchMap(() => combineLatest( - this.orgEntityService.entityMonitor.entity$, - this.orgEntityService.entityMonitor.entityRequest$)), - map(([entity, entityRequestInfo]) => ({ - entityRequestInfo, - entity - })) + filter(o => !!o && !!o.entity) ); this.initialiseOrgObservables(); From ff384847ffd23b1aea83e40d6c496a8963f35b9c Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 29 Jun 2018 10:33:24 +0100 Subject: [PATCH 02/12] WIP Aot fixes --- angular.json | 3 +- src/frontend/app/core/entity-service.ts | 34 +++++++------------ .../applications/application.service.ts | 33 +++++++----------- .../application/application-base.component.ts | 27 +++++++++++++-- .../service-base/service-base.component.ts | 10 ++---- .../service-catalog.helpers.ts | 3 +- .../card-app-instances.component.ts | 10 +++--- .../full-screen-stepper.component.html | 3 -- .../full-screen-stepper.component.scss | 0 .../full-screen-stepper.component.spec.ts | 25 -------------- .../full-screen-stepper.component.ts | 15 -------- .../metadata-item/metadata-item.component.ts | 10 +++--- .../usage-gauge/usage-gauge.component.ts | 14 ++++---- .../cf-org-space-service.service.ts | 3 +- src/frontend/app/shared/entity.tokens.ts | 3 ++ 15 files changed, 77 insertions(+), 116 deletions(-) delete mode 100644 src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.html delete mode 100644 src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.scss delete mode 100644 src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.spec.ts delete mode 100644 src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.ts create mode 100644 src/frontend/app/shared/entity.tokens.ts diff --git a/angular.json b/angular.json index 50aaef0a10..242598b489 100644 --- a/angular.json +++ b/angular.json @@ -34,7 +34,7 @@ "sourceMap": false, "extractCss": true, "namedChunks": false, - "aot": false, + "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": false, @@ -48,6 +48,7 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { + "aot": true, "sslCert": "dev-ssl/server.crt", "proxyConfig": "proxy.conf.js", "ssl": true, diff --git a/src/frontend/app/core/entity-service.ts b/src/frontend/app/core/entity-service.ts index 78c22713b4..bbf022fbe4 100644 --- a/src/frontend/app/core/entity-service.ts +++ b/src/frontend/app/core/entity-service.ts @@ -1,23 +1,15 @@ import { Injectable } from '@angular/core'; -import { Store, compose } from '@ngrx/store'; -import { tag } from 'rxjs-spy/operators/tag'; -import { interval, Observable, combineLatest } from 'rxjs'; -import { filter, map, publishReplay, refCount, share, tap, withLatestFrom, switchMap } from 'rxjs/operators'; - +import { compose, Store } from '@ngrx/store'; +import { combineLatest, Observable } from 'rxjs'; +import { filter, map, publishReplay, refCount, switchMap, tap, withLatestFrom } from 'rxjs/operators'; import { EntityMonitor } from '../shared/monitors/entity-monitor'; import { ValidateEntitiesStart } from '../store/actions/request.actions'; import { AppState } from '../store/app-state'; -import { - ActionState, - RequestInfoState, - RequestSectionKeys, - TRequestTypeKeys, - UpdatingSection, -} from '../store/reducers/api-request-reducer/types'; +import { ActionState, RequestInfoState, RequestSectionKeys, TRequestTypeKeys, UpdatingSection } from '../store/reducers/api-request-reducer/types'; import { getEntityUpdateSections, getUpdateSectionById } from '../store/selectors/api.selectors'; import { APIResource, EntityInfo } from '../store/types/api.types'; import { ICFAction, IRequestAction } from '../store/types/request.types'; -import { composeFn } from './../store/helpers/reducer.helper'; + type PollUntil = (apiResource: APIResource, updatingState: ActionState) => boolean; @@ -123,16 +115,16 @@ export class EntityService { } }), switchMap(() => combineLatest( - entityMonitor.entity$, - entityMonitor.entityRequest$ + entityMonitor.entity$, + entityMonitor.entityRequest$ ).pipe( - filter((entityRequestInfo) => { - return !!entityRequestInfo; - }), - map(([entity, entityRequestInfo]) => ({ + filter((entityRequestInfo) => { + return !!entityRequestInfo; + }), + map(([entity, entityRequestInfo]) => ({ entityRequestInfo, - entity - })) + entity + })) )) ); } diff --git a/src/frontend/app/features/applications/application.service.ts b/src/frontend/app/features/applications/application.service.ts index f7985c3fa6..7f9d6e5bc9 100644 --- a/src/frontend/app/features/applications/application.service.ts +++ b/src/frontend/app/features/applications/application.service.ts @@ -1,25 +1,15 @@ -import { of as observableOf, Observable } from 'rxjs'; - -import { startWith, combineLatest, first, publishReplay, refCount, filter, map, switchMap } from 'rxjs/operators'; -import { Injectable } from '@angular/core'; +import { Injectable, InjectionToken, Inject } from '@angular/core'; import { Store } from '@ngrx/store'; - +import { Observable } from 'rxjs'; +import { combineLatest, filter, first, map, publishReplay, refCount, startWith, switchMap } from 'rxjs/operators'; import { IApp, IOrganization, ISpace } from '../../core/cf-api.types'; import { EntityService } from '../../core/entity-service'; import { EntityServiceFactory } from '../../core/entity-service-factory.service'; -import { - ApplicationStateData, - ApplicationStateService, -} from '../../shared/components/application-state/application-state.service'; +import { ApplicationStateData, ApplicationStateService } from '../../shared/components/application-state/application-state.service'; 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, GetAppEnvVarsAction, GetAppStatsAction, GetAppSummaryAction } from '../../store/actions/app-metadata.actions'; import { GetApplication, UpdateApplication, UpdateExistingApplication } from '../../store/actions/application.actions'; import { AppState } from '../../store/app-state'; import { @@ -33,7 +23,7 @@ import { routeSchemaKey, serviceBindingSchemaKey, spaceSchemaKey, - stackSchemaKey, + stackSchemaKey } from '../../store/helpers/entity-factory'; import { createEntityRelationKey } from '../../store/helpers/entity-relations.types'; import { ActionState, rootUpdatingKey } from '../../store/reducers/api-request-reducer/types'; @@ -45,13 +35,16 @@ import { PaginationEntityState } from '../../store/types/pagination.types'; import { getCurrentPageRequestInfo, getPaginationObservables, - PaginationObservables, + PaginationObservables } from './../../store/reducers/pagination-reducer/pagination-reducer.helper'; import { ApplicationEnvVarsService, - EnvVarStratosProject, + EnvVarStratosProject } from './application/application-tabs-base/tabs/build-tab/application-env-vars.service'; import { getRoute, isTCPRoute } from './routes/routes.helper'; +import { CF_GUID, APP_GUID } from '../../shared/entity.tokens'; + + export function createGetApplicationAction(guid: string, endpointGuid: string) { return new GetApplication( @@ -81,8 +74,8 @@ export class ApplicationService { private appSummaryEntityService: EntityService; constructor( - public cfGuid: string, - public appGuid: string, + @Inject(CF_GUID) public cfGuid, + @Inject(APP_GUID) public appGuid, private store: Store, private entityServiceFactory: EntityServiceFactory, private appStateService: ApplicationStateService, diff --git a/src/frontend/app/features/applications/application/application-base.component.ts b/src/frontend/app/features/applications/application/application-base.component.ts index 42daf32d9c..621bdc5b2c 100644 --- a/src/frontend/app/features/applications/application/application-base.component.ts +++ b/src/frontend/app/features/applications/application/application-base.component.ts @@ -10,9 +10,10 @@ import { AppState } from '../../../store/app-state'; import { applicationSchemaKey, entityFactory } from '../../../store/helpers/entity-factory'; import { ApplicationService, createGetApplicationAction } from '../application.service'; import { ApplicationEnvVarsService } from './application-tabs-base/tabs/build-tab/application-env-vars.service'; +import { CF_GUID, APP_GUID } from '../../../shared/entity.tokens'; -function applicationServiceFactory( +export function applicationServiceFactory( store: Store, activatedRoute: ActivatedRoute, entityServiceFactory: EntityServiceFactory, @@ -32,7 +33,7 @@ function applicationServiceFactory( ); } -function entityServiceFactory( +export function entityServiceFactory( _entityServiceFactory: EntityServiceFactory, activatedRoute: ActivatedRoute ) { @@ -46,16 +47,36 @@ function entityServiceFactory( ); } +export function getGuids(type?: string) { + return (activatedRoute: ActivatedRoute) => { + const { id, cfId } = activatedRoute.snapshot.params; + if (type) { + return cfId; + } + return id; + }; +} + @Component({ selector: 'app-application-base', templateUrl: './application-base.component.html', styleUrls: ['./application-base.component.scss'], providers: [ ApplicationService, + { + provide: CF_GUID, + useFactory: getGuids('cf'), + deps: [ActivatedRoute] + }, + { + provide: APP_GUID, + useFactory: getGuids(), + deps: [ActivatedRoute] + }, { provide: ApplicationService, useFactory: applicationServiceFactory, - deps: [Store, ActivatedRoute, EntityServiceFactory, ApplicationStateService, ApplicationEnvVarsService, PaginationMonitorFactory] + deps: [CF_GUID, APP_GUID, Store, EntityServiceFactory, ApplicationStateService, ApplicationEnvVarsService, PaginationMonitorFactory] }, { provide: EntityService, diff --git a/src/frontend/app/features/service-catalog/service-base/service-base.component.ts b/src/frontend/app/features/service-catalog/service-base/service-base.component.ts index 7ac70e0076..21db4f3292 100644 --- a/src/frontend/app/features/service-catalog/service-base/service-base.component.ts +++ b/src/frontend/app/features/service-catalog/service-base/service-base.component.ts @@ -1,23 +1,19 @@ -import { Component, OnDestroy } from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; -import { Observable , Subscription } from 'rxjs'; -import { map, publishReplay, refCount } from 'rxjs/operators'; - import { EntityServiceFactory } from '../../../core/entity-service-factory.service'; -import { ISubHeaderTabs } from '../../../shared/components/page-subheader/page-subheader.types'; import { PaginationMonitorFactory } from '../../../shared/monitors/pagination-monitor.factory'; import { AppState } from '../../../store/app-state'; import { ServicesService } from '../services.service'; -function servicesServiceFactory( + +export function servicesServiceFactory( store: Store, activatedRoute: ActivatedRoute, entityServiceFactory: EntityServiceFactory, paginationMonitorFactory: PaginationMonitorFactory ) { - const { id, cfId } = activatedRoute.snapshot.params; return new ServicesService(store, entityServiceFactory, activatedRoute, paginationMonitorFactory); } diff --git a/src/frontend/app/features/service-catalog/service-catalog.helpers.ts b/src/frontend/app/features/service-catalog/service-catalog.helpers.ts index f5a06ff689..115ee49886 100644 --- a/src/frontend/app/features/service-catalog/service-catalog.helpers.ts +++ b/src/frontend/app/features/service-catalog/service-catalog.helpers.ts @@ -7,13 +7,12 @@ import { PaginationMonitorFactory } from '../../shared/monitors/pagination-monit import { ServicesService } from './services.service'; import { Provider } from '@angular/core'; -function servicesServiceFactory( +export function servicesServiceFactory( store: Store, activatedRoute: ActivatedRoute, entityServiceFactory: EntityServiceFactory, paginationMonitorFactory: PaginationMonitorFactory ) { - const { id, cfId } = activatedRoute.snapshot.params; return new ServicesService(store, entityServiceFactory, activatedRoute, paginationMonitorFactory); } diff --git a/src/frontend/app/shared/components/cards/card-app-instances/card-app-instances.component.ts b/src/frontend/app/shared/components/cards/card-app-instances/card-app-instances.component.ts index 4fd128b31c..928fda78c8 100644 --- a/src/frontend/app/shared/components/cards/card-app-instances/card-app-instances.component.ts +++ b/src/frontend/app/shared/components/cards/card-app-instances/card-app-instances.component.ts @@ -1,7 +1,7 @@ import { CardStatus } from './../../application-state/application-state.service'; import { Component, ElementRef, Input, OnDestroy, OnInit, Renderer, ViewChild } from '@angular/core'; import { Store } from '@ngrx/store'; -import { Observable , Subscription } from 'rxjs'; +import { Observable, Subscription } from 'rxjs'; import { ApplicationService } from '../../../../features/applications/application.service'; import { AppMetadataTypes } from '../../../../store/actions/app-metadata.actions'; @@ -40,16 +40,16 @@ export class CardAppInstancesComponent implements OnInit, OnDestroy { } private currentCount: 0; - private editCount: 0; + public editCount: 0; private sub: Subscription; - private isEditing = false; + public isEditing = false; - private editValue: any; + public editValue: any; // Observable on the running instances count for the application - private runningInstances$: Observable; + public runningInstances$: Observable; private app: any; diff --git a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.html b/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.html deleted file mode 100644 index d3707ef900..0000000000 --- a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.scss b/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.spec.ts b/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.spec.ts deleted file mode 100644 index c9a98deeac..0000000000 --- a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FullScreenStepperComponent } from './full-screen-stepper.component'; - -describe('FullScreenStepperComponent', () => { - let component: FullScreenStepperComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ FullScreenStepperComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FullScreenStepperComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should be created', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.ts b/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.ts deleted file mode 100644 index 43fa8d5e13..0000000000 --- a/src/frontend/app/shared/components/full-screen-stepper/full-screen-stepper.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-full-screen-stepper', - templateUrl: './full-screen-stepper.component.html', - styleUrls: ['./full-screen-stepper.component.scss'] -}) -export class FullScreenStepperComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/frontend/app/shared/components/metadata-item/metadata-item.component.ts b/src/frontend/app/shared/components/metadata-item/metadata-item.component.ts index b2ce5a1fc3..e20582819a 100644 --- a/src/frontend/app/shared/components/metadata-item/metadata-item.component.ts +++ b/src/frontend/app/shared/components/metadata-item/metadata-item.component.ts @@ -9,16 +9,16 @@ export class MetadataItemComponent implements OnInit { constructor() { } - @Input('icon') private icon: string; + @Input('icon') public icon: string; - @Input('iconFont') private iconFont: string; + @Input('iconFont') public iconFont: string; - @Input('label') private label: string; + @Input('label') public label: string; - @Input('tooltip') private tooltip: string; + @Input('tooltip') public tooltip: string; // Are we editing? - @Input('edit') private edit: boolean; + @Input('edit') public edit: boolean; ngOnInit() { } diff --git a/src/frontend/app/shared/components/usage-gauge/usage-gauge.component.ts b/src/frontend/app/shared/components/usage-gauge/usage-gauge.component.ts index 00f2e95ef6..065c1141c5 100644 --- a/src/frontend/app/shared/components/usage-gauge/usage-gauge.component.ts +++ b/src/frontend/app/shared/components/usage-gauge/usage-gauge.component.ts @@ -7,22 +7,22 @@ import { Component, OnInit, Input } from '@angular/core'; }) export class UsageGaugeComponent implements OnInit { - @Input('title') private title: string; + @Input('title') public title: string; - @Input('value') private value: number; + @Input('value') public value: number; - @Input('valueText') private valueText: string; + @Input('valueText') public valueText: string; - @Input('barOnly') private barOnly: boolean; + @Input('barOnly') public barOnly: boolean; // Change bar color to warning if this threshold is reached - @Input('warningAt') private warningAt: number; + @Input('warningAt') public warningAt: number; // Change bar color to error if this threshold is reached - @Input('errorAt') private errorAt: number; + @Input('errorAt') public errorAt: number; constructor() { } - ngOnInit() {} + ngOnInit() { } } diff --git a/src/frontend/app/shared/data-services/cf-org-space-service.service.ts b/src/frontend/app/shared/data-services/cf-org-space-service.service.ts index 54ea904ebc..7f418cb700 100644 --- a/src/frontend/app/shared/data-services/cf-org-space-service.service.ts +++ b/src/frontend/app/shared/data-services/cf-org-space-service.service.ts @@ -94,10 +94,9 @@ export class CfOrgSpaceDataService implements OnDestroy { constructor( private store: Store, public paginationMonitorFactory: PaginationMonitorFactory, - @Optional() private _selectMode: CfOrgSpaceSelectMode ) { // Note - normal optional parameter notation won't work with injectable - this.selectMode = _selectMode || this.selectMode; + this.selectMode = this.selectMode; this.createCf(); this.init(); this.createOrg(); diff --git a/src/frontend/app/shared/entity.tokens.ts b/src/frontend/app/shared/entity.tokens.ts new file mode 100644 index 0000000000..865f22ce3b --- /dev/null +++ b/src/frontend/app/shared/entity.tokens.ts @@ -0,0 +1,3 @@ +import { InjectionToken, Injectable } from '@angular/core'; +export const CF_GUID = new InjectionToken('cfGuid'); +export const APP_GUID = new InjectionToken('appGuid'); From 94a602da4fbbdf279044dee81096c1b8a4b28a9e Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 29 Jun 2018 12:15:56 +0100 Subject: [PATCH 03/12] WIP Fixing aot template errors --- angular.json | 2 +- .../application-instance-chart.component.ts | 2 +- .../application-tabs-base.component.ts | 2 +- .../instances-tab.component.html | 2 +- ...pplication-step-source-upload.component.ts | 4 ++-- .../deploy-application-step3.component.html | 2 +- .../deploy-application-step3.component.ts | 2 +- .../deploy-application.component.html | 4 ++-- .../deploy-application.component.ts | 4 +++- .../edit-application.component.ts | 2 +- .../add-routes/add-routes.component.html | 3 --- .../edit-space/edit-space.component.ts | 4 ++-- .../cloud-foundry-space-base.component.html | 2 +- .../cloud-foundry-space-base.component.ts | 2 +- .../cloud-foundry-space-summary.component.ts | 2 +- ...-foundry-organization-summary.component.ts | 2 +- .../cloud-foundry-summary-tab.component.ts | 2 +- .../manage-users-confirm.component.ts | 2 +- .../dashboard-base.component.ts | 4 ++-- .../create-endpoint-cf-step-1.component.html | 6 +++--- .../add-service-instance.component.ts | 21 +++++++++---------- .../add-service-instance/csi-mode.service.ts | 2 +- .../specify-details-step.component.ts | 21 ++++++------------- .../app-action-monitor.component.ts | 17 +++++++-------- .../card-cf-info/card-cf-info.component.ts | 4 ++-- .../card-cf-org-usage.component.ts | 2 +- .../card-cf-org-user-details.component.ts | 6 +++--- .../card-cf-space-details.component.ts | 2 +- .../card-cf-usage/card-cf-usage.component.ts | 4 ++-- .../card-cf-user-info.component.ts | 4 ++-- .../service-summary-card.component.ts | 11 +++------- .../list/list-cards/cards.component.html | 2 +- .../list/list-cards/cards.component.ts | 5 +++-- .../table-cell-actions.component.ts | 4 ++-- .../table-cell-radio.component.html | 2 +- .../list/list-table/table.component.ts | 6 +++--- .../table-cell-usage.component.ts | 8 +++---- .../endpoint-card.component.ts | 4 ++-- .../ring-chart/ring-chart.component.ts | 6 +++++- .../running-instances.component.ts | 2 +- .../upload-progress-indicator.component.html | 5 ++--- 41 files changed, 90 insertions(+), 103 deletions(-) diff --git a/angular.json b/angular.json index 242598b489..aa3ecce56a 100644 --- a/angular.json +++ b/angular.json @@ -37,7 +37,7 @@ "aot": true, "extractLicenses": true, "vendorChunk": false, - "buildOptimizer": false, + "buildOptimizer": true, "fileReplacements": [{ "replace": "src/frontend/environments/environment.ts", "with": "src/frontend/environments/environment.prod.ts" diff --git a/src/frontend/app/features/applications/application/application-instance-chart/application-instance-chart.component.ts b/src/frontend/app/features/applications/application/application-instance-chart/application-instance-chart.component.ts index 4b5ca021a0..168050efbf 100644 --- a/src/frontend/app/features/applications/application/application-instance-chart/application-instance-chart.component.ts +++ b/src/frontend/app/features/applications/application/application-instance-chart/application-instance-chart.component.ts @@ -29,7 +29,7 @@ export class ApplicationInstanceChartComponent implements OnInit { private seriesTranslation: string; @Input('title') - private title: string; + public title: string; public instanceChartConfig: MetricsLineChartConfig; diff --git a/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts b/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts index 62816ee56f..9a399b55a9 100644 --- a/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts +++ b/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts @@ -57,7 +57,7 @@ export class ApplicationTabsBaseComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, private router: Router, - private applicationService: ApplicationService, + public applicationService: ApplicationService, private entityService: EntityService, private store: Store, private confirmDialog: ConfirmationDialogService, diff --git a/src/frontend/app/features/applications/application/application-tabs-base/tabs/instances-tab/instances-tab.component.html b/src/frontend/app/features/applications/application/application-tabs-base/tabs/instances-tab/instances-tab.component.html index 621976e17f..5140d94bdc 100644 --- a/src/frontend/app/features/applications/application/application-tabs-base/tabs/instances-tab/instances-tab.component.html +++ b/src/frontend/app/features/applications/application/application-tabs-base/tabs/instances-tab/instances-tab.component.html @@ -4,7 +4,7 @@ - + diff --git a/src/frontend/app/features/applications/deploy-application/deploy-application-step-source-upload/deploy-application-step-source-upload.component.ts b/src/frontend/app/features/applications/deploy-application/deploy-application-step-source-upload/deploy-application-step-source-upload.component.ts index eb7a4f3e6a..aa09dd6a26 100644 --- a/src/frontend/app/features/applications/deploy-application/deploy-application-step-source-upload/deploy-application-step-source-upload.component.ts +++ b/src/frontend/app/features/applications/deploy-application/deploy-application-step-source-upload/deploy-application-step-source-upload.component.ts @@ -17,13 +17,13 @@ import { StepOnNextFunction } from '../../../../shared/components/stepper/step/s }) export class DeployApplicationStepSourceUploadComponent implements OnDestroy { - private deployer: DeployApplicationDeployer; + public deployer: DeployApplicationDeployer; public valid$: Observable; constructor(private store: Store, public cfOrgSpaceService: CfOrgSpaceDataService, - private http: HttpClient, + http: HttpClient, ) { this.deployer = new DeployApplicationDeployer(store, cfOrgSpaceService, http); this.valid$ = this.deployer.fileTransferStatus$.pipe( diff --git a/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.html b/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.html index aea9797187..c6670a819d 100644 --- a/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.html +++ b/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.html @@ -1,5 +1,5 @@
{{ deployer.streamTitle }}
- +
diff --git a/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.ts b/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.ts index e819d6b62b..ee9b6722e5 100644 --- a/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.ts +++ b/src/frontend/app/features/applications/deploy-application/deploy-application-step3/deploy-application-step3.component.ts @@ -46,7 +46,7 @@ export class DeployApplicationStep3Component implements OnDestroy { // Observable for when the deploy modal can be closed closeable$: Observable; - private deployer: DeployApplicationDeployer; + public deployer: DeployApplicationDeployer; private deploySub: Subscription; private errorSub: Subscription; diff --git a/src/frontend/app/features/applications/deploy-application/deploy-application.component.html b/src/frontend/app/features/applications/deploy-application/deploy-application.component.html index 3db859bcfb..14abf2be59 100644 --- a/src/frontend/app/features/applications/deploy-application/deploy-application.component.html +++ b/src/frontend/app/features/applications/deploy-application/deploy-application.component.html @@ -4,10 +4,10 @@ - + - + diff --git a/src/frontend/app/features/applications/deploy-application/deploy-application.component.ts b/src/frontend/app/features/applications/deploy-application/deploy-application.component.ts index 0f2ea1c891..787d5d9d64 100644 --- a/src/frontend/app/features/applications/deploy-application/deploy-application.component.ts +++ b/src/frontend/app/features/applications/deploy-application/deploy-application.component.ts @@ -1,5 +1,5 @@ -import {of as observableOf, Observable , Subscription } from 'rxjs'; +import { of as observableOf, Observable, Subscription } from 'rxjs'; import { Component, OnInit } from '@angular/core'; import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; import { ActivatedRoute } from '@angular/router'; @@ -29,6 +29,7 @@ export class DeployApplicationComponent implements OnInit, OnDestroy { initCfOrgSpaceService: Subscription[] = []; deployButtonText = 'Deploy'; skipConfig$: Observable = observableOf(false); + isRedeploy: boolean; constructor( private store: Store, @@ -36,6 +37,7 @@ export class DeployApplicationComponent implements OnInit, OnDestroy { private activatedRoute: ActivatedRoute ) { this.appGuid = this.activatedRoute.snapshot.queryParams['appGuid']; + this.isRedeploy = !!this.appGuid; this.skipConfig$ = this.store.select(selectApplicationSource).pipe( map((appSource: DeployApplicationSource) => { diff --git a/src/frontend/app/features/applications/edit-application/edit-application.component.ts b/src/frontend/app/features/applications/edit-application/edit-application.component.ts index ae2e877e4d..b929ac0b2c 100644 --- a/src/frontend/app/features/applications/edit-application/edit-application.component.ts +++ b/src/frontend/app/features/applications/edit-application/edit-application.component.ts @@ -33,7 +33,7 @@ export class EditApplicationComponent implements OnInit, OnDestroy { appNameChecking: AppNameUniqueChecking = new AppNameUniqueChecking(); constructor( - private applicationService: ApplicationService, + public applicationService: ApplicationService, private entityService: EntityService, private store: Store, private fb: FormBuilder, diff --git a/src/frontend/app/features/applications/routes/add-routes/add-routes.component.html b/src/frontend/app/features/applications/routes/add-routes/add-routes.component.html index 0178ffd113..d55df4fa5f 100644 --- a/src/frontend/app/features/applications/routes/add-routes/add-routes.component.html +++ b/src/frontend/app/features/applications/routes/add-routes/add-routes.component.html @@ -1,7 +1,4 @@
- - -
Create a new route or map an existing one.
diff --git a/src/frontend/app/features/cloud-foundry/edit-space/edit-space.component.ts b/src/frontend/app/features/cloud-foundry/edit-space/edit-space.component.ts index 676d42e54e..76fb5def9f 100644 --- a/src/frontend/app/features/cloud-foundry/edit-space/edit-space.component.ts +++ b/src/frontend/app/features/cloud-foundry/edit-space/edit-space.component.ts @@ -16,7 +16,7 @@ import { CloudFoundrySpaceService } from '../services/cloud-foundry-space.servic }) export class EditSpaceComponent implements OnInit { - spaceName: Observable; + spaceName$: Observable; spaceUrl: string; constructor(private cfSpaceService: CloudFoundrySpaceService) { @@ -25,7 +25,7 @@ export class EditSpaceComponent implements OnInit { `${cfSpaceService.cfGuid}/organizations/` + `${cfSpaceService.orgGuid}/spaces/` + `${cfSpaceService.spaceGuid}/summary`; - this.spaceName = cfSpaceService.space$.pipe( + this.spaceName$ = cfSpaceService.space$.pipe( map(s => s.entity.entity.name) ); } diff --git a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.html b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.html index 34b3a4a260..ee58dd042a 100644 --- a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.html +++ b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.html @@ -1,7 +1,7 @@

{{ name$ | async }}

- diff --git a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.ts b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.ts index 7c188c6801..262ecdab84 100644 --- a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.ts +++ b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.ts @@ -73,7 +73,7 @@ export class CloudFoundrySpaceBaseComponent implements OnDestroy { constructor( public cfEndpointService: CloudFoundryEndpointService, public cfSpaceService: CloudFoundrySpaceService, - private cfOrgService: CloudFoundryOrganizationService, + public cfOrgService: CloudFoundryOrganizationService, private store: Store, currentUserPermissionsService: CurrentUserPermissionsService, private confirmDialog: ConfirmationDialogService diff --git a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.ts b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.ts index 987ca77b4a..b0112ea62b 100644 --- a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.ts +++ b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.ts @@ -8,5 +8,5 @@ import { CloudFoundrySpaceService } from '../../../../../services/cloud-foundry- }) export class CloudFoundrySpaceSummaryComponent { - constructor(private cfSpaceService: CloudFoundrySpaceService) { } + constructor(public cfSpaceService: CloudFoundrySpaceService) { } } diff --git a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-summary/cloud-foundry-organization-summary.component.ts b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-summary/cloud-foundry-organization-summary.component.ts index b4c96fff19..f65c20a060 100644 --- a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-summary/cloud-foundry-organization-summary.component.ts +++ b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-organizations/cloud-foundry-organization-summary/cloud-foundry-organization-summary.component.ts @@ -14,7 +14,7 @@ import { CloudFoundryOrganizationService } from '../../../services/cloud-foundry export class CloudFoundryOrganizationSummaryComponent { appLink: Function; - constructor(private store: Store, private cfOrgService: CloudFoundryOrganizationService) { + constructor(private store: Store, public cfOrgService: CloudFoundryOrganizationService) { this.appLink = () => { goToAppWall(store, cfOrgService.cfGuid, cfOrgService.orgGuid); }; diff --git a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-summary-tab/cloud-foundry-summary-tab.component.ts b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-summary-tab/cloud-foundry-summary-tab.component.ts index f3716770e6..f6a02cdc2b 100644 --- a/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-summary-tab/cloud-foundry-summary-tab.component.ts +++ b/src/frontend/app/features/cloud-foundry/tabs/cloud-foundry-summary-tab/cloud-foundry-summary-tab.component.ts @@ -12,7 +12,7 @@ import { AppState } from '../../../../store/app-state'; export class CloudFoundrySummaryTabComponent { appLink: Function; - constructor(private store: Store, private cfEndpointService: CloudFoundryEndpointService) { + constructor(private store: Store, public cfEndpointService: CloudFoundryEndpointService) { this.appLink = () => { goToAppWall(store, cfEndpointService.cfGuid); }; diff --git a/src/frontend/app/features/cloud-foundry/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts b/src/frontend/app/features/cloud-foundry/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts index d99bab8ecd..26275eca2e 100644 --- a/src/frontend/app/features/cloud-foundry/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts +++ b/src/frontend/app/features/cloud-foundry/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts @@ -77,7 +77,7 @@ export class UsersRolesConfirmComponent implements OnInit, AfterContentInit { userSchemaKey = cfUserSchemaKey; monitorState = AppMonitorComponentTypes.UPDATE; private cfAndOrgGuid$: Observable<{ cfGuid: string, orgGuid: string }>; - private orgName$ = new BehaviorSubject(''); + public orgName$ = new BehaviorSubject(''); private updateChanges = new BehaviorSubject(0); private nameCache: { diff --git a/src/frontend/app/features/dashboard/dashboard-base/dashboard-base.component.ts b/src/frontend/app/features/dashboard/dashboard-base/dashboard-base.component.ts index 55d8ca73ae..0b74c72200 100644 --- a/src/frontend/app/features/dashboard/dashboard-base/dashboard-base.component.ts +++ b/src/frontend/app/features/dashboard/dashboard-base/dashboard-base.component.ts @@ -1,5 +1,5 @@ -import {of as observableOf, Observable , Subscription } from 'rxjs'; +import { of as observableOf, Observable, Subscription } from 'rxjs'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { AfterContentInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatDrawer } from '@angular/material'; @@ -42,7 +42,7 @@ export class DashboardBaseComponent implements OnInit, OnDestroy, AfterContentIn private openCloseSub: Subscription; private closeSub: Subscription; - private fullView: boolean; + public fullView: boolean; private routeChangeSubscription: Subscription; diff --git a/src/frontend/app/features/endpoints/create-endpoint/create-endpoint-cf-step-1/create-endpoint-cf-step-1.component.html b/src/frontend/app/features/endpoints/create-endpoint/create-endpoint-cf-step-1/create-endpoint-cf-step-1.component.html index 13414d37bd..153fe75647 100644 --- a/src/frontend/app/features/endpoints/create-endpoint/create-endpoint-cf-step-1/create-endpoint-cf-step-1.component.html +++ b/src/frontend/app/features/endpoints/create-endpoint/create-endpoint-cf-step-1/create-endpoint-cf-step-1.component.html @@ -7,15 +7,15 @@ - + Name is required Name is not unique - + URL is required Invalid API URL URL is not unique - Skip SSL validation for the endpoint + Skip SSL validation for the endpoint diff --git a/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts b/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts index 620165185f..2ebc00832e 100644 --- a/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts +++ b/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts @@ -58,7 +58,6 @@ import { CsiModeService } from '../csi-mode.service'; export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit { initialisedService$: Observable; skipApps$: Observable; - cancelUrl: string; marketPlaceMode: boolean; cSIHelperService: CreateServiceInstanceHelperService; displaySelectServiceStep: boolean; @@ -76,7 +75,7 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit private cfOrgSpaceService: CfOrgSpaceDataService, private csiGuidsService: CsiGuidsService, private entityServiceFactory: EntityServiceFactory, - private modeService: CsiModeService, + public modeService: CsiModeService, private paginationMonitorFactory: PaginationMonitorFactory ) { this.inMarketplaceMode = this.modeService.isMarketplaceMode(); @@ -102,15 +101,15 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit this.skipApps$ = this.store.select(selectCreateServiceInstance).pipe( filter(p => !!p && !!p.spaceGuid && !!p.cfGuid), switchMap(createServiceInstance => { - const paginationKey = createEntityRelationPaginationKey(spaceSchemaKey, createServiceInstance.spaceGuid); - return getPaginationObservables>({ - store: this.store, - action: new GetAllAppsInSpace(createServiceInstance.cfGuid, createServiceInstance.spaceGuid, paginationKey), - paginationMonitor: this.paginationMonitorFactory.create(paginationKey, entityFactory(applicationSchemaKey)) - }, true).entities$; - }), - map(apps => apps.length === 0) - ); + const paginationKey = createEntityRelationPaginationKey(spaceSchemaKey, createServiceInstance.spaceGuid); + return getPaginationObservables>({ + store: this.store, + action: new GetAllAppsInSpace(createServiceInstance.cfGuid, createServiceInstance.spaceGuid, paginationKey), + paginationMonitor: this.paginationMonitorFactory.create(paginationKey, entityFactory(applicationSchemaKey)) + }, true).entities$; + }), + map(apps => apps.length === 0) + ); } onNext = () => { diff --git a/src/frontend/app/shared/components/add-service-instance/csi-mode.service.ts b/src/frontend/app/shared/components/add-service-instance/csi-mode.service.ts index b40f0e3d2d..13e6db1d9f 100644 --- a/src/frontend/app/shared/components/add-service-instance/csi-mode.service.ts +++ b/src/frontend/app/shared/components/add-service-instance/csi-mode.service.ts @@ -31,7 +31,7 @@ export class CsiModeService { private mode: string; public viewDetail: ViewDetail; - private cancelUrl: string; + public cancelUrl: string; // This property is only used when launching the Create Service Instance Wizard from the Marketplace spaceScopedDetails: SpaceScopedService = { isSpaceScoped: false }; diff --git a/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts b/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts index f2052d002f..8046655bda 100644 --- a/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts +++ b/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts @@ -2,7 +2,6 @@ import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes'; import { AfterContentInit, Component, Input, OnDestroy } from '@angular/core'; import { AbstractControl, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'; import { MatChipInputEvent } from '@angular/material'; -import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs'; import { @@ -17,37 +16,31 @@ import { startWith, switchMap, take, - tap, + tap } from 'rxjs/operators'; - import { IServiceInstance } from '../../../../core/cf-api-svc.types'; import { getServiceJsonParams } from '../../../../features/service-catalog/services-helper'; import { GetAppEnvVarsAction } from '../../../../store/actions/app-metadata.actions'; -import { - SetCreateServiceInstanceOrg, - SetServiceInstanceGuid, -} from '../../../../store/actions/create-service-instance.actions'; +import { SetCreateServiceInstanceOrg, SetServiceInstanceGuid } from '../../../../store/actions/create-service-instance.actions'; import { RouterNav } from '../../../../store/actions/router.actions'; import { CreateServiceBinding } from '../../../../store/actions/service-bindings.actions'; -import { CreateServiceInstance, UpdateServiceInstance, GetServiceInstance } from '../../../../store/actions/service-instances.actions'; +import { CreateServiceInstance, GetServiceInstance, UpdateServiceInstance } from '../../../../store/actions/service-instances.actions'; import { AppState } from '../../../../store/app-state'; import { serviceBindingSchemaKey, serviceInstancesSchemaKey } from '../../../../store/helpers/entity-factory'; import { RequestInfoState } from '../../../../store/reducers/api-request-reducer/types'; import { selectRequestInfo } from '../../../../store/selectors/api.selectors'; import { selectCreateServiceInstance, - selectCreateServiceInstanceSpaceGuid, + selectCreateServiceInstanceSpaceGuid } from '../../../../store/selectors/create-service-instance.selectors'; import { APIResource, NormalizedResponse } from '../../../../store/types/api.types'; import { CreateServiceInstanceState } from '../../../../store/types/create-service-instance.types'; -import { PaginationMonitorFactory } from '../../../monitors/pagination-monitor.factory'; import { StepOnNextResult } from '../../stepper/step/step.component'; import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; import { CsiGuidsService } from '../csi-guids.service'; import { CsiModeService } from '../csi-mode.service'; -import { GetSpace } from '../../../../store/actions/space.actions'; -import { APIResponse } from '../../../../store/actions/request.actions'; + const enum FormMode { CreateServiceInstance = 'create-service-instance', @@ -125,10 +118,8 @@ export class SpecifyDetailsStepComponent implements OnDestroy, AfterContentInit constructor( private store: Store, private cSIHelperServiceFactory: CreateServiceInstanceHelperServiceFactory, - private activatedRoute: ActivatedRoute, - private paginationMonitorFactory: PaginationMonitorFactory, private csiGuidsService: CsiGuidsService, - private modeService: CsiModeService + public modeService: CsiModeService ) { this.setupForms(); diff --git a/src/frontend/app/shared/components/app-action-monitor/app-action-monitor.component.ts b/src/frontend/app/shared/components/app-action-monitor/app-action-monitor.component.ts index ef6b56b93b..03cd650f91 100644 --- a/src/frontend/app/shared/components/app-action-monitor/app-action-monitor.component.ts +++ b/src/frontend/app/shared/components/app-action-monitor/app-action-monitor.component.ts @@ -1,17 +1,16 @@ -import {of as observableOf, never as observableNever, Observable } from 'rxjs'; -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { DataSource } from '@angular/cdk/table'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { schema } from 'normalizr'; -import { AppMonitorComponentTypes, IApplicationMonitorComponentState } from '../app-action-monitor-icon/app-action-monitor-icon.component'; +import { never as observableNever, Observable, of as observableOf } from 'rxjs'; import { rootUpdatingKey } from '../../../store/reducers/api-request-reducer/types'; -import { MatTableDataSource } from '@angular/material'; -import { DataSource } from '@angular/cdk/table'; +import { AppMonitorComponentTypes, IApplicationMonitorComponentState } from '../app-action-monitor-icon/app-action-monitor-icon.component'; import { ITableListDataSource } from '../list/data-sources-controllers/list-data-source-types'; -import { ITableColumn } from '../list/list-table/table.types'; import { - TableCellRequestMonitorIconComponent, - ITableCellRequestMonitorIconConfig + ITableCellRequestMonitorIconConfig, + TableCellRequestMonitorIconComponent } from '../list/list-table/table-cell-request-monitor-icon/table-cell-request-monitor-icon.component'; +import { ITableColumn } from '../list/list-table/table.types'; @Component({ selector: 'app-action-monitor', @@ -50,7 +49,7 @@ export class AppActionMonitorComponent implements OnInit { @Output('currentState') public currentState: EventEmitter; - private dataSource: DataSource; + public dataSource: DataSource; public allColumns: ITableColumn[] = []; diff --git a/src/frontend/app/shared/components/cards/card-cf-info/card-cf-info.component.ts b/src/frontend/app/shared/components/cards/card-cf-info/card-cf-info.component.ts index 408321bf85..694808f07f 100644 --- a/src/frontend/app/shared/components/cards/card-cf-info/card-cf-info.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-info/card-cf-info.component.ts @@ -14,7 +14,7 @@ import { ICfV2Info } from '../../../../core/cf-api.types'; export class CardCfInfoComponent implements OnInit, OnDestroy { apiUrl: string; subs: Subscription[] = []; - constructor(private cfEndpointService: CloudFoundryEndpointService) { } + constructor(public cfEndpointService: CloudFoundryEndpointService) { } description$: Observable; @@ -49,7 +49,7 @@ export class CardCfInfoComponent implements OnInit, OnDestroy { let desc = '-'; if (entity && entity.entity && entity.entity.entity) { const metadata = entity.entity.entity; - if (metadata.description.length === 0 ) { + if (metadata.description.length === 0) { // No descripion - custom overrides if (metadata.support === 'pcfdev@pivotal.io') { desc = 'PCF Dev'; diff --git a/src/frontend/app/shared/components/cards/card-cf-org-usage/card-cf-org-usage.component.ts b/src/frontend/app/shared/components/cards/card-cf-org-usage/card-cf-org-usage.component.ts index a250ae468f..9074b08c69 100644 --- a/src/frontend/app/shared/components/cards/card-cf-org-usage/card-cf-org-usage.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-org-usage/card-cf-org-usage.component.ts @@ -10,5 +10,5 @@ import { styleUrls: ['./card-cf-org-usage.component.scss'] }) export class CardCfOrgUsageComponent { - constructor(private cfOrganizationService: CloudFoundryOrganizationService) { } + constructor(public cfOrganizationService: CloudFoundryOrganizationService) { } } diff --git a/src/frontend/app/shared/components/cards/card-cf-org-user-details/card-cf-org-user-details.component.ts b/src/frontend/app/shared/components/cards/card-cf-org-user-details/card-cf-org-user-details.component.ts index 3663cc521d..83434b40de 100644 --- a/src/frontend/app/shared/components/cards/card-cf-org-user-details/card-cf-org-user-details.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-org-user-details/card-cf-org-user-details.component.ts @@ -13,8 +13,8 @@ import { CfUserService } from '../../../data-services/cf-user.service'; }) export class CardCfOrgUserDetailsComponent { constructor( - private cfOrgService: CloudFoundryOrganizationService, - private cfUserService: CfUserService, - private cfEndpointService: CloudFoundryEndpointService + public cfOrgService: CloudFoundryOrganizationService, + public cfUserService: CfUserService, + public cfEndpointService: CloudFoundryEndpointService ) { } } diff --git a/src/frontend/app/shared/components/cards/card-cf-space-details/card-cf-space-details.component.ts b/src/frontend/app/shared/components/cards/card-cf-space-details/card-cf-space-details.component.ts index 615f8bd6bb..aef42dea12 100644 --- a/src/frontend/app/shared/components/cards/card-cf-space-details/card-cf-space-details.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-space-details/card-cf-space-details.component.ts @@ -12,7 +12,7 @@ import { map } from 'rxjs/operators'; export class CardCfSpaceDetailsComponent { allowSshStatus$: Observable; - constructor(private cfSpaceService: CloudFoundrySpaceService) { + constructor(public cfSpaceService: CloudFoundrySpaceService) { this.allowSshStatus$ = cfSpaceService.allowSsh$.pipe( map(status => status === 'false' ? 'Disabled' : 'Enabled') ); diff --git a/src/frontend/app/shared/components/cards/card-cf-usage/card-cf-usage.component.ts b/src/frontend/app/shared/components/cards/card-cf-usage/card-cf-usage.component.ts index 62aeb9741c..5cc867c759 100644 --- a/src/frontend/app/shared/components/cards/card-cf-usage/card-cf-usage.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-usage/card-cf-usage.component.ts @@ -7,7 +7,7 @@ import { CloudFoundryEndpointService } from '../../../../features/cloud-foundry/ styleUrls: ['./card-cf-usage.component.scss'] }) export class CardCfUsageComponent implements OnInit { - constructor(private cfEndpointService: CloudFoundryEndpointService) {} + constructor(public cfEndpointService: CloudFoundryEndpointService) { } - ngOnInit() {} + ngOnInit() { } } diff --git a/src/frontend/app/shared/components/cards/card-cf-user-info/card-cf-user-info.component.ts b/src/frontend/app/shared/components/cards/card-cf-user-info/card-cf-user-info.component.ts index 3ff21e4106..b5249f66f3 100644 --- a/src/frontend/app/shared/components/cards/card-cf-user-info/card-cf-user-info.component.ts +++ b/src/frontend/app/shared/components/cards/card-cf-user-info/card-cf-user-info.component.ts @@ -7,9 +7,9 @@ import { CloudFoundryEndpointService } from '../../../../features/cloud-foundry/ styleUrls: ['./card-cf-user-info.component.scss'] }) export class CardCfUserInfoComponent implements OnInit { - constructor(private cfEndpointService: CloudFoundryEndpointService) {} + constructor(public cfEndpointService: CloudFoundryEndpointService) { } - ngOnInit() {} + ngOnInit() { } isAdmin(user) { return user && user.admin ? 'Yes' : 'No'; diff --git a/src/frontend/app/shared/components/cards/service-summary-card/service-summary-card.component.ts b/src/frontend/app/shared/components/cards/service-summary-card/service-summary-card.component.ts index 08bcbeda9f..ba5739f798 100644 --- a/src/frontend/app/shared/components/cards/service-summary-card/service-summary-card.component.ts +++ b/src/frontend/app/shared/components/cards/service-summary-card/service-summary-card.component.ts @@ -1,17 +1,13 @@ import { Component } from '@angular/core'; -import { Store } from '@ngrx/store'; import { Observable, of as observableOf } from 'rxjs'; import { tap } from 'rxjs/operators'; - import { IService } from '../../../../core/cf-api-svc.types'; import { ServicesService } from '../../../../features/service-catalog/services.service'; import { AppChip } from '../../../../shared/components/chips/chips.component'; -import { - ServiceTag, -} from '../../../../shared/components/list/list-types/cf-services/cf-service-card/cf-service-card.component'; -import { AppState } from '../../../../store/app-state'; +import { ServiceTag } from '../../../../shared/components/list/list-types/cf-services/cf-service-card/cf-service-card.component'; import { APIResource } from '../../../../store/types/api.types'; + @Component({ selector: 'app-service-summary-card', templateUrl: './service-summary-card.component.html', @@ -21,8 +17,7 @@ export class ServiceSummaryCardComponent { tags: AppChip[] = []; service$: Observable>; constructor( - private store: Store, - private servicesService: ServicesService + public servicesService: ServicesService ) { this.service$ = servicesService.service$; diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.html b/src/frontend/app/shared/components/list/list-cards/cards.component.html index 3fd0470e7d..8052bb1761 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.html +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.ts b/src/frontend/app/shared/components/list/list-cards/cards.component.ts index ba2926f922..bbee1c592b 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.ts +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.ts @@ -1,7 +1,7 @@ import { Component, Input } from '@angular/core'; import { IListDataSource } from '../data-sources-controllers/list-data-source-types'; -import { TableCellCustom } from '../list.types'; +import { CardCell } from '../list.types'; @Component({ selector: 'app-cards', @@ -9,6 +9,7 @@ import { TableCellCustom } from '../list.types'; styleUrls: ['./cards.component.scss'] }) export class CardsComponent { + public columns = CardCell.columns; @Input('dataSource') dataSource: IListDataSource; - @Input('component') component: TableCellCustom; + @Input('component') component: CardCell; } diff --git a/src/frontend/app/shared/components/list/list-table/table-cell-actions/table-cell-actions.component.ts b/src/frontend/app/shared/components/list/list-table/table-cell-actions/table-cell-actions.component.ts index 7feec3b77b..5526e0b9ae 100644 --- a/src/frontend/app/shared/components/list/list-table/table-cell-actions/table-cell-actions.component.ts +++ b/src/frontend/app/shared/components/list/list-table/table-cell-actions/table-cell-actions.component.ts @@ -30,8 +30,8 @@ export class TableCellActionsComponent extends TableCellCustom implements } } - private busy$: Observable; - private show$: Observable; + public busy$: Observable; + public show$: Observable; actions: IListAction[]; obs: { diff --git a/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html b/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html index 7e53fb658f..23933ff168 100644 --- a/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html +++ b/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html @@ -1 +1 @@ - + diff --git a/src/frontend/app/shared/components/list/list-table/table.component.ts b/src/frontend/app/shared/components/list/list-table/table.component.ts index 770848268e..e3635c692b 100644 --- a/src/frontend/app/shared/components/list/list-table/table.component.ts +++ b/src/frontend/app/shared/components/list/list-table/table.component.ts @@ -1,7 +1,7 @@ -import {combineLatest as observableCombineLatest, Observable , Subscription } from 'rxjs'; +import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs'; -import {tap} from 'rxjs/operators'; +import { tap } from 'rxjs/operators'; import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatSort, Sort } from '@angular/material'; import { Store } from '@ngrx/store'; @@ -49,7 +49,7 @@ export class TableComponent implements OnInit, OnDestroy { @Input('dataSource') dataSource: ITableListDataSource; @Input('paginationController') paginationController = null as IListPaginationController; @Input('columns') columns: ITableColumn[]; - private columnNames: string[]; + public columnNames: string[]; @Input('fixedRowHeight') fixedRowHeight = false; diff --git a/src/frontend/app/shared/components/list/list-types/app-instance/table-cell-usage/table-cell-usage.component.ts b/src/frontend/app/shared/components/list/list-types/app-instance/table-cell-usage/table-cell-usage.component.ts index cf9897a619..8db854cb45 100644 --- a/src/frontend/app/shared/components/list/list-types/app-instance/table-cell-usage/table-cell-usage.component.ts +++ b/src/frontend/app/shared/components/list/list-types/app-instance/table-cell-usage/table-cell-usage.component.ts @@ -8,12 +8,12 @@ import { TableCellCustom } from '../../../list.types'; }) export class TableCellUsageComponent extends TableCellCustom implements OnInit { - private value: string; - private label: string; + public value: (row: T) => string; + public label: (row: T) => string; ngOnInit() { - this.value = this.config ? this.config.value : row => 0; - this.label = this.config ? this.config.label : row => '-'; + this.value = this.config ? this.config.value : () => '0'; + this.label = this.config ? this.config.label : () => '-'; } } diff --git a/src/frontend/app/shared/components/list/list-types/cf-endpoints/cf-endpoint-card/endpoint-card.component.ts b/src/frontend/app/shared/components/list/list-types/cf-endpoints/cf-endpoint-card/endpoint-card.component.ts index 42442646ca..a3b6a0e54d 100644 --- a/src/frontend/app/shared/components/list/list-types/cf-endpoints/cf-endpoint-card/endpoint-card.component.ts +++ b/src/frontend/app/shared/components/list/list-types/cf-endpoints/cf-endpoint-card/endpoint-card.component.ts @@ -15,7 +15,7 @@ export class CfEndpointCardComponent extends CardCell implements static columns = 2; - private status$ = new ReplaySubject(); + public status$ = new ReplaySubject(); @Input('row') row: EndpointModel; @@ -33,7 +33,7 @@ export class CfEndpointCardComponent extends CardCell implements this.status$.next(this.mapStatus(row)); } - private getEndpointUrl(row: EndpointModel) { + public getEndpointUrl(row: EndpointModel) { return getFullEndpointApiUrl(row); } diff --git a/src/frontend/app/shared/components/ring-chart/ring-chart.component.ts b/src/frontend/app/shared/components/ring-chart/ring-chart.component.ts index aa42da66e6..7ac32733f4 100644 --- a/src/frontend/app/shared/components/ring-chart/ring-chart.component.ts +++ b/src/frontend/app/shared/components/ring-chart/ring-chart.component.ts @@ -13,13 +13,17 @@ export class RingChartComponent implements OnInit { colors: ColorHelper; @Input() data: any; - @Input() label = 'Total'; + @Input() label = 'Total'; @Input() scheme: any = 'cool'; + @Input() onClick: ($event: Event) => void; + @Input() onActivate: ($event: Event) => void; + @Input() onDeactivate: ($event: Event) => void; @Input() valueFormatting: (value: number) => any = value => value; @Input() nameFormatting: (value: string) => any = label => label; @Input() percentageFormatting: (value: number) => any = percentage => percentage; + constructor() { } ngOnInit() { diff --git a/src/frontend/app/shared/components/running-instances/running-instances.component.ts b/src/frontend/app/shared/components/running-instances/running-instances.component.ts index 1048d4be48..52fb1a08e5 100644 --- a/src/frontend/app/shared/components/running-instances/running-instances.component.ts +++ b/src/frontend/app/shared/components/running-instances/running-instances.component.ts @@ -21,7 +21,7 @@ export class RunningInstancesComponent implements OnInit { @Input('appGuid') appGuid; // Observable on the running instances count for the application - private runningInstances$: Observable; + public runningInstances$: Observable; constructor( private store: Store, diff --git a/src/frontend/app/shared/components/upload-progress-indicator/upload-progress-indicator.component.html b/src/frontend/app/shared/components/upload-progress-indicator/upload-progress-indicator.component.html index 2f13cad1de..299b82cb6c 100644 --- a/src/frontend/app/shared/components/upload-progress-indicator/upload-progress-indicator.component.html +++ b/src/frontend/app/shared/components/upload-progress-indicator/upload-progress-indicator.component.html @@ -1,7 +1,6 @@ -
+
cloud_upload done - +
- From 6f4eb589528e068458989044d0127b02f92aa413 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 29 Jun 2018 15:56:07 +0100 Subject: [PATCH 04/12] Fix up inports and use inject tokens --- package-lock.json | 35 +++++++++---------- package.json | 2 +- src/frontend/app/core/entity-service.ts | 9 +++-- .../application/application-base.component.ts | 19 +++++----- .../application-tabs-base.component.ts | 5 +-- .../edit-application.component.ts | 4 +-- .../connect-endpoint-dialog.component.ts | 6 ++-- .../edit-profile-info.component.ts | 4 +-- .../add-service-instance.component.ts | 4 +-- ...instance-helper-service-factory.service.ts | 6 ++-- .../create-service-instance-helper.service.ts | 8 ++--- .../select-plan-step.component.spec.ts | 13 ++++--- .../select-plan-step.component.ts | 4 +-- .../select-service.component.spec.ts | 3 +- .../specify-details-step.component.ts | 4 +-- .../cf-select-users-list-config.service.ts | 6 +--- ...f-users-space-roles-list-config.service.ts | 6 ++-- src/frontend/app/shared/entity.tokens.ts | 3 ++ 18 files changed, 68 insertions(+), 73 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6262a3f541..691a0478ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -514,9 +514,9 @@ } }, "@swimlane/ngx-charts": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@swimlane/ngx-charts/-/ngx-charts-7.4.0.tgz", - "integrity": "sha512-RcZas49AbHmKCX3PHiEI+VS2dgutfEzw7CvK/LXU1Plp8rMb+ly/zUoRIDJnyzBVuuy1z05miKUK6UolQlCzxQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@swimlane/ngx-charts/-/ngx-charts-8.1.0.tgz", + "integrity": "sha512-jjcIwt5uQXoBaQwCgHPqpzSoNJj68PiKItMYg6RVyqLua67vZ90ZdxzuYPsYpRtDIXJiV5/gXuDtD3ZrjtdQCA==", "requires": { "d3-array": "1.2.1", "d3-brush": "1.0.4", @@ -7235,15 +7235,15 @@ } }, "jasmine-core": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.0.0.tgz", - "integrity": "sha1-jNsgzzNrG4aDDtxYsaiqxHRV6Uw=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.1.0.tgz", + "integrity": "sha1-pHheE11d9lAk38kiSVPfWFvSdmw=", "dev": true }, "jasmine-spec-reporter": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.1.1.tgz", - "integrity": "sha1-Wm1Yq11hvqcwn7wnkjlRF1axtYg=", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", "dev": true, "requires": { "colors": "1.1.2" @@ -7609,9 +7609,9 @@ } }, "karma-coverage-istanbul-reporter": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-1.4.3.tgz", - "integrity": "sha1-O13/RmT6W41RlrmInj9hwforgNk=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.1.tgz", + "integrity": "sha512-UcgrHkFehI5+ivMouD8NH/UOHiX4oCAtwaANylzPFdcAuD52fnCUuelacq2gh8tZ4ydhU3+xiXofSq7j5Ehygw==", "dev": true, "requires": { "istanbul-api": "1.3.1", @@ -7625,13 +7625,10 @@ "dev": true }, "karma-jasmine-html-reporter": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-0.2.2.tgz", - "integrity": "sha1-SKjl7xiAdhfuK14zwRlMNbQ5Ukw=", - "dev": true, - "requires": { - "karma-jasmine": "1.1.2" - } + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-1.1.0.tgz", + "integrity": "sha512-uhNED+4B1axgptXkM8cCa3kztpQqsPrOxhfbjr4FdunNexnU6+cF2bfiIeGfsFMhphVyOMKy/S9LFaOFj8VXRA==", + "dev": true }, "karma-source-map-support": { "version": "1.3.0", diff --git a/package.json b/package.json index ce5bfe6c55..490519c816 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@ngrx/router-store": "^6.0.1", "@ngrx/store": "^6.0.1", "@ngrx/store-devtools": "^6.0.1", - "@swimlane/ngx-charts": "^7.4.0", + "@swimlane/ngx-charts": "^8.1.0", "angular2-virtual-scroll": "^0.3.1", "core-js": "^2.5.7", "hammerjs": "^2.0.8", diff --git a/src/frontend/app/core/entity-service.ts b/src/frontend/app/core/entity-service.ts index bbf022fbe4..2f99f92a99 100644 --- a/src/frontend/app/core/entity-service.ts +++ b/src/frontend/app/core/entity-service.ts @@ -5,7 +5,13 @@ import { filter, map, publishReplay, refCount, switchMap, tap, withLatestFrom } import { EntityMonitor } from '../shared/monitors/entity-monitor'; import { ValidateEntitiesStart } from '../store/actions/request.actions'; import { AppState } from '../store/app-state'; -import { ActionState, RequestInfoState, RequestSectionKeys, TRequestTypeKeys, UpdatingSection } from '../store/reducers/api-request-reducer/types'; +import { + ActionState, + RequestInfoState, + RequestSectionKeys, + TRequestTypeKeys, + UpdatingSection +} from '../store/reducers/api-request-reducer/types'; import { getEntityUpdateSections, getUpdateSectionById } from '../store/selectors/api.selectors'; import { APIResource, EntityInfo } from '../store/types/api.types'; import { ICFAction, IRequestAction } from '../store/types/request.types'; @@ -27,7 +33,6 @@ export function isEntityBlocked(entityRequestInfo: RequestInfoState) { /** * Designed to be used in a service factory provider */ -@Injectable() export class EntityService { constructor( diff --git a/src/frontend/app/features/applications/application/application-base.component.ts b/src/frontend/app/features/applications/application/application-base.component.ts index 621bdc5b2c..3daffee49f 100644 --- a/src/frontend/app/features/applications/application/application-base.component.ts +++ b/src/frontend/app/features/applications/application/application-base.component.ts @@ -1,27 +1,26 @@ -import { Component, HostBinding } from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; - -import { EntityService } from '../../../core/entity-service'; import { EntityServiceFactory } from '../../../core/entity-service-factory.service'; import { ApplicationStateService } from '../../../shared/components/application-state/application-state.service'; +import { APP_GUID, CF_GUID, ENTITY_SERVICE } from '../../../shared/entity.tokens'; import { PaginationMonitorFactory } from '../../../shared/monitors/pagination-monitor.factory'; import { AppState } from '../../../store/app-state'; import { applicationSchemaKey, entityFactory } from '../../../store/helpers/entity-factory'; import { ApplicationService, createGetApplicationAction } from '../application.service'; import { ApplicationEnvVarsService } from './application-tabs-base/tabs/build-tab/application-env-vars.service'; -import { CF_GUID, APP_GUID } from '../../../shared/entity.tokens'; + export function applicationServiceFactory( + cfId: string, + id: string, store: Store, - activatedRoute: ActivatedRoute, entityServiceFactory: EntityServiceFactory, appStateService: ApplicationStateService, appEnvVarsService: ApplicationEnvVarsService, paginationMonitorFactory: PaginationMonitorFactory ) { - const { id, cfId } = activatedRoute.snapshot.params; return new ApplicationService( cfId, id, @@ -34,10 +33,10 @@ export function applicationServiceFactory( } export function entityServiceFactory( + cfId: string, + id: string, _entityServiceFactory: EntityServiceFactory, - activatedRoute: ActivatedRoute ) { - const { id, cfId } = activatedRoute.snapshot.params; return _entityServiceFactory.create( applicationSchemaKey, entityFactory(applicationSchemaKey), @@ -79,9 +78,9 @@ export function getGuids(type?: string) { deps: [CF_GUID, APP_GUID, Store, EntityServiceFactory, ApplicationStateService, ApplicationEnvVarsService, PaginationMonitorFactory] }, { - provide: EntityService, + provide: ENTITY_SERVICE, useFactory: entityServiceFactory, - deps: [EntityServiceFactory, ActivatedRoute] + deps: [CF_GUID, APP_GUID, EntityServiceFactory] }, ] diff --git a/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts b/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts index 9a399b55a9..fd80c2318b 100644 --- a/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts +++ b/src/frontend/app/features/applications/application/application-tabs-base/application-tabs-base.component.ts @@ -1,5 +1,5 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, Inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Store } from '@ngrx/store'; import { Observable, Subscription, combineLatest as observableCombineLatest, of as observableOf } from 'rxjs'; @@ -20,6 +20,7 @@ import { APIResource } from '../../../../store/types/api.types'; import { EndpointModel } from '../../../../store/types/endpoint.types'; import { ApplicationService } from '../../application.service'; import { EndpointsService } from './../../../../core/endpoints.service'; +import { ENTITY_SERVICE } from '../../../../shared/entity.tokens'; // Confirmation dialogs @@ -58,7 +59,7 @@ export class ApplicationTabsBaseComponent implements OnInit, OnDestroy { private route: ActivatedRoute, private router: Router, public applicationService: ApplicationService, - private entityService: EntityService, + @Inject(ENTITY_SERVICE) private entityService: EntityService, private store: Store, private confirmDialog: ConfirmationDialogService, private endpointsService: EndpointsService diff --git a/src/frontend/app/features/applications/edit-application/edit-application.component.ts b/src/frontend/app/features/applications/edit-application/edit-application.component.ts index b929ac0b2c..43f9d1ce74 100644 --- a/src/frontend/app/features/applications/edit-application/edit-application.component.ts +++ b/src/frontend/app/features/applications/edit-application/edit-application.component.ts @@ -2,13 +2,12 @@ import { of as observableOf, Observable, Subscription } from 'rxjs'; import { map, filter, take } from 'rxjs/operators'; -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Http } from '@angular/http'; import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material'; import { Store } from '@ngrx/store'; -import { EntityService } from '../../../core/entity-service'; import { StepOnNextFunction } from '../../../shared/components/stepper/step/step.component'; import { AppMetadataTypes } from '../../../store/actions/app-metadata.actions'; import { SetCFDetails, SetNewAppName } from '../../../store/actions/create-applications-page.actions'; @@ -34,7 +33,6 @@ export class EditApplicationComponent implements OnInit, OnDestroy { constructor( public applicationService: ApplicationService, - private entityService: EntityService, private store: Store, private fb: FormBuilder, private http: Http, diff --git a/src/frontend/app/features/endpoints/connect-endpoint-dialog/connect-endpoint-dialog.component.ts b/src/frontend/app/features/endpoints/connect-endpoint-dialog/connect-endpoint-dialog.component.ts index 372e48a938..4025ae0396 100644 --- a/src/frontend/app/features/endpoints/connect-endpoint-dialog/connect-endpoint-dialog.component.ts +++ b/src/frontend/app/features/endpoints/connect-endpoint-dialog/connect-endpoint-dialog.component.ts @@ -55,9 +55,9 @@ export class ConnectEndpointDialogComponent implements OnDestroy { ]; private hasAttemptedConnect: boolean; - private authTypesForEndpoint = []; + public authTypesForEndpoint = []; - private canShareEndpointToken = false; + public canShareEndpointToken = false; // We need a delay to ensure the BE has finished registering the endpoint. // If we don't do this and if we're quick enough, we can navigate to the application page @@ -198,7 +198,7 @@ export class ConnectEndpointDialogComponent implements OnDestroy { ); } - submit(event) { + submit() { this.hasAttemptedConnect = true; const { guid, authType, authValues, systemShared } = this.endpointForm.value; this.store.dispatch(new ConnectEndpoint( diff --git a/src/frontend/app/features/user-profile/edit-profile-info/edit-profile-info.component.ts b/src/frontend/app/features/user-profile/edit-profile-info/edit-profile-info.component.ts index 80b077ac72..763a0cd042 100644 --- a/src/frontend/app/features/user-profile/edit-profile-info/edit-profile-info.component.ts +++ b/src/frontend/app/features/user-profile/edit-profile-info/edit-profile-info.component.ts @@ -52,9 +52,9 @@ export class EditProfileInfoComponent implements OnInit, OnDestroy { // Only allow password change if user has the 'password.write' group - private canChangePassword = this.currentUserPermissionsService.can(CurrentUserPermissions.PASSWORD_CHANGE); + public canChangePassword = this.currentUserPermissionsService.can(CurrentUserPermissions.PASSWORD_CHANGE); - private passwordRequired = false; + public passwordRequired = false; ngOnInit() { this.userProfileService.fetchUserProfile(); diff --git a/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts b/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts index 2ebc00832e..4177a31438 100644 --- a/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts +++ b/src/frontend/app/shared/components/add-service-instance/add-service-instance/add-service-instance.component.ts @@ -38,7 +38,7 @@ import { APIResource } from '../../../../store/types/api.types'; import { CfOrgSpaceDataService } from '../../../data-services/cf-org-space-service.service'; import { PaginationMonitorFactory } from '../../../monitors/pagination-monitor.factory'; import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; -import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; +import { CreateServiceInstanceHelper } from '../create-service-instance-helper.service'; import { CsiGuidsService } from '../csi-guids.service'; import { CsiModeService } from '../csi-mode.service'; @@ -59,7 +59,7 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit initialisedService$: Observable; skipApps$: Observable; marketPlaceMode: boolean; - cSIHelperService: CreateServiceInstanceHelperService; + cSIHelperService: CreateServiceInstanceHelper; displaySelectServiceStep: boolean; displaySelectCfStep: boolean; title$: Observable; diff --git a/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper-service-factory.service.ts b/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper-service-factory.service.ts index fa27fcf86f..cfc47105b5 100644 --- a/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper-service-factory.service.ts +++ b/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper-service-factory.service.ts @@ -4,7 +4,7 @@ import { Store } from '@ngrx/store'; import { EntityServiceFactory } from '../../../core/entity-service-factory.service'; import { PaginationMonitorFactory } from '../../monitors/pagination-monitor.factory'; -import { CreateServiceInstanceHelperService } from './create-service-instance-helper.service'; +import { CreateServiceInstanceHelper } from './create-service-instance-helper.service'; import { AppState } from '../../../store/app-state'; import { isMarketplaceMode, isAppServicesMode, isServicesWallMode } from '../../../features/service-catalog/services-helper'; @@ -12,7 +12,7 @@ import { isMarketplaceMode, isAppServicesMode, isServicesWallMode } from '../../ export class CreateServiceInstanceHelperServiceFactory { private serviceInstanceCache: { - [key: string]: CreateServiceInstanceHelperService + [key: string]: CreateServiceInstanceHelper } = {}; constructor( private store: Store, @@ -27,7 +27,7 @@ export class CreateServiceInstanceHelperServiceFactory { ) { const key = `${cfGuid}-${serviceGuid}`; if (!this.serviceInstanceCache[key]) { - const instance = new CreateServiceInstanceHelperService( + const instance = new CreateServiceInstanceHelper( this.store, serviceGuid, cfGuid, diff --git a/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper.service.ts b/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper.service.ts index 71ba9b0f8b..7651e56321 100644 --- a/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper.service.ts +++ b/src/frontend/app/shared/components/add-service-instance/create-service-instance-helper.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { Store } from '@ngrx/store'; import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs'; import { filter, first, map, publishReplay, refCount, share, switchMap } from 'rxjs/operators'; @@ -31,10 +31,10 @@ import { selectCreateServiceInstanceServicePlan } from '../../../store/selectors import { APIResource } from '../../../store/types/api.types'; import { QParam } from '../../../store/types/pagination.types'; import { PaginationMonitorFactory } from '../../monitors/pagination-monitor.factory'; +import { CF_GUID } from '../../entity.tokens'; -@Injectable() -export class CreateServiceInstanceHelperService { +export class CreateServiceInstanceHelper { servicePlanVisibilities$: Observable[]>; service$: Observable>; // Is instance being created from the Marketplace @@ -43,7 +43,7 @@ export class CreateServiceInstanceHelperService { constructor( private store: Store, public serviceGuid: string, - public cfGuid: string, + @Inject(CF_GUID) public cfGuid: string, private entityServiceFactory: EntityServiceFactory, private paginationMonitorFactory: PaginationMonitorFactory ) { diff --git a/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.spec.ts b/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.spec.ts index 01f20ece81..63d946bfac 100644 --- a/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.spec.ts +++ b/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.spec.ts @@ -1,16 +1,15 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - import { EntityServiceFactory } from '../../../../core/entity-service-factory.service'; -import { BaseTestModules, BaseTestModulesNoShared } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; -import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; -import { SelectPlanStepComponent } from './select-plan-step.component'; -import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; -import { CsiGuidsService } from '../csi-guids.service'; -import { PaginationMonitorFactory } from '../../../monitors/pagination-monitor.factory'; +import { BaseTestModulesNoShared } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { EntityMonitorFactory } from '../../../monitors/entity-monitor.factory.service'; +import { PaginationMonitorFactory } from '../../../monitors/pagination-monitor.factory'; import { CardStatusComponent } from '../../cards/card-status/card-status.component'; import { MetadataItemComponent } from '../../metadata-item/metadata-item.component'; +import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; +import { CsiGuidsService } from '../csi-guids.service'; import { CsiModeService } from '../csi-mode.service'; +import { SelectPlanStepComponent } from './select-plan-step.component'; + describe('SelectPlanStepComponent', () => { let component: SelectPlanStepComponent; diff --git a/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.ts b/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.ts index 802e427271..aae7a0e068 100644 --- a/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.ts +++ b/src/frontend/app/shared/components/add-service-instance/select-plan-step/select-plan-step.component.ts @@ -43,7 +43,7 @@ import { APIResource, EntityInfo } from '../../../../store/types/api.types'; import { CardStatus } from '../../application-state/application-state.service'; import { StepOnNextResult } from '../../stepper/step/step.component'; import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; -import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; +import { CreateServiceInstanceHelper } from '../create-service-instance-helper.service'; import { CsiGuidsService } from '../csi-guids.service'; import { CsiModeService } from '../csi-mode.service'; import { NoServicePlansComponent } from '../no-service-plans/no-service-plans.component'; @@ -66,7 +66,7 @@ interface ServicePlan { }) export class SelectPlanStepComponent implements OnDestroy { selectedService$: Observable; - cSIHelperService: CreateServiceInstanceHelperService; + cSIHelperService: CreateServiceInstanceHelper; @ViewChild('noplans', { read: ViewContainerRef }) noPlansDiv: ViewContainerRef; diff --git a/src/frontend/app/shared/components/add-service-instance/select-service/select-service.component.spec.ts b/src/frontend/app/shared/components/add-service-instance/select-service/select-service.component.spec.ts index 05806def21..a7b20665b2 100644 --- a/src/frontend/app/shared/components/add-service-instance/select-service/select-service.component.spec.ts +++ b/src/frontend/app/shared/components/add-service-instance/select-service/select-service.component.spec.ts @@ -4,7 +4,7 @@ import { EntityServiceFactory } from '../../../../core/entity-service-factory.se import { PaginationMonitorFactory } from '../../../monitors/pagination-monitor.factory'; import { BaseTestModules, BaseTestModulesNoShared } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ServicesWallService } from '../../../../features/services/services/services-wall.service'; -import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; +import { CreateServiceInstanceHelper } from '../create-service-instance-helper.service'; import { SelectServiceComponent } from './select-service.component'; import { CsiGuidsService } from '../csi-guids.service'; import { EntityMonitorFactory } from '../../../monitors/entity-monitor.factory.service'; @@ -21,7 +21,6 @@ describe('SelectServiceComponent', () => { PaginationMonitorFactory, ServicesWallService, EntityServiceFactory, - CreateServiceInstanceHelperService, CsiGuidsService, EntityMonitorFactory ] diff --git a/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts b/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts index 8046655bda..99f4e58f4b 100644 --- a/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts +++ b/src/frontend/app/shared/components/add-service-instance/specify-details-step/specify-details-step.component.ts @@ -37,7 +37,7 @@ import { APIResource, NormalizedResponse } from '../../../../store/types/api.typ import { CreateServiceInstanceState } from '../../../../store/types/create-service-instance.types'; import { StepOnNextResult } from '../../stepper/step/step.component'; import { CreateServiceInstanceHelperServiceFactory } from '../create-service-instance-helper-service-factory.service'; -import { CreateServiceInstanceHelperService } from '../create-service-instance-helper.service'; +import { CreateServiceInstanceHelper } from '../create-service-instance-helper.service'; import { CsiGuidsService } from '../csi-guids.service'; import { CsiModeService } from '../csi-mode.service'; @@ -79,7 +79,7 @@ export class SpecifyDetailsStepComponent implements OnDestroy, AfterContentInit createNewInstanceForm: FormGroup; serviceInstances$: Observable[]>; bindableServiceInstances$: Observable[]>; - cSIHelperService: CreateServiceInstanceHelperService; + cSIHelperService: CreateServiceInstanceHelper; allServiceInstances$: Observable[]>; validate: BehaviorSubject = new BehaviorSubject(false); allServiceInstanceNames: string[]; diff --git a/src/frontend/app/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts b/src/frontend/app/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts index 31006561f3..adceaf62ec 100644 --- a/src/frontend/app/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts +++ b/src/frontend/app/shared/components/list/list-types/cf-select-users/cf-select-users-list-config.service.ts @@ -1,8 +1,6 @@ -import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { first, map, publishReplay, refCount, tap } from 'rxjs/operators'; - import { waitForCFPermissions } from '../../../../../features/cloud-foundry/cf.helpers'; import { ListView } from '../../../../../store/actions/list.actions'; import { AppState } from '../../../../../store/app-state'; @@ -12,8 +10,6 @@ import { CfUserService } from '../../../../data-services/cf-user.service'; import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, IMultiListAction, ListViewTypes } from '../../list.component.types'; import { CfSelectUsersDataSourceService } from './cf-select-users-data-source.service'; - -@Injectable() export class CfSelectUsersListConfigService implements IListConfig> { viewType = ListViewTypes.TABLE_ONLY; dataSource: CfSelectUsersDataSourceService; @@ -40,7 +36,7 @@ export class CfSelectUsersListConfigService implements IListConfig; - constructor(private store: Store, private cfGuid: string) { + constructor(private store: Store, cfGuid: string) { this.initialised = waitForCFPermissions(store, cfGuid).pipe( first(), tap(cf => { diff --git a/src/frontend/app/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts b/src/frontend/app/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts index ffdb29d120..2c75102772 100644 --- a/src/frontend/app/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts +++ b/src/frontend/app/shared/components/list/list-types/cf-users-org-space-roles/cf-users-space-roles-list-config.service.ts @@ -1,9 +1,8 @@ -import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { BehaviorSubject } from 'rxjs'; import { first } from 'rxjs/operators'; - import { ISpace } from '../../../../../core/cf-api.types'; +import { CurrentUserPermissionsService } from '../../../../../core/current-user-permissions.service'; import { ListView } from '../../../../../store/actions/list.actions'; import { AppState } from '../../../../../store/app-state'; import { selectUsersRolesRoles } from '../../../../../store/selectors/users-roles.selector'; @@ -13,9 +12,8 @@ import { ITableColumn } from '../../list-table/table.types'; import { IListConfig, ListViewTypes } from '../../list.component.types'; import { CfUsersSpaceRolesDataSourceService } from './cf-users-space-roles-data-source.service'; import { TableCellRoleOrgSpaceComponent } from './table-cell-org-space-role/table-cell-org-space-role.component'; -import { CurrentUserPermissionsService } from '../../../../../core/current-user-permissions.service'; -@Injectable() + export class CfUsersSpaceRolesListConfigService implements IListConfig> { viewType = ListViewTypes.TABLE_ONLY; dataSource: CfUsersSpaceRolesDataSourceService; diff --git a/src/frontend/app/shared/entity.tokens.ts b/src/frontend/app/shared/entity.tokens.ts index 865f22ce3b..9348ae964d 100644 --- a/src/frontend/app/shared/entity.tokens.ts +++ b/src/frontend/app/shared/entity.tokens.ts @@ -1,3 +1,6 @@ import { InjectionToken, Injectable } from '@angular/core'; +import { EntityService } from '../core/entity-service'; export const CF_GUID = new InjectionToken('cfGuid'); export const APP_GUID = new InjectionToken('appGuid'); + +export const ENTITY_SERVICE = new InjectionToken(null); From 8fae526929f702e2a76f0d7a4a03b0a1de2b7f19 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 29 Jun 2018 16:39:12 +0100 Subject: [PATCH 05/12] Test entity service provider fixed --- .../app/test-framework/entity-service.helper.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/frontend/app/test-framework/entity-service.helper.ts b/src/frontend/app/test-framework/entity-service.helper.ts index 331ae6ba7e..dabbb30701 100644 --- a/src/frontend/app/test-framework/entity-service.helper.ts +++ b/src/frontend/app/test-framework/entity-service.helper.ts @@ -1,11 +1,10 @@ -import { IRequestAction } from '../store/types/request.types'; -import { Action, Store } from '@ngrx/store'; -import { AppState } from '../store/app-state'; -import { EntityService } from '../core/entity-service'; +import { Store } from '@ngrx/store'; import { schema } from 'normalizr'; -import { RequestSectionKeys } from '../store/reducers/api-request-reducer/types'; -import { EntityMonitor } from '../shared/monitors/entity-monitor'; import { EntityServiceFactory } from '../core/entity-service-factory.service'; +import { ENTITY_SERVICE } from '../shared/entity.tokens'; +import { AppState } from '../store/app-state'; +import { RequestSectionKeys } from '../store/reducers/api-request-reducer/types'; +import { IRequestAction } from '../store/types/request.types'; export function generateTestEntityServiceProvider( guid: string, @@ -27,7 +26,7 @@ export function generateTestEntityServiceProvider( } return { - provide: EntityService, + provide: ENTITY_SERVICE, useFactory, deps: [Store, EntityServiceFactory] }; From 7339dc3deeeaf2557328fee1df237000d2f09a10 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Fri, 29 Jun 2018 17:06:47 +0100 Subject: [PATCH 06/12] Test fix --- src/frontend/app/core/entity-service.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend/app/core/entity-service.spec.ts b/src/frontend/app/core/entity-service.spec.ts index 0454a569c1..defcfa96ee 100644 --- a/src/frontend/app/core/entity-service.spec.ts +++ b/src/frontend/app/core/entity-service.spec.ts @@ -9,6 +9,7 @@ import { generateTestEntityServiceProvider } from '../test-framework/entity-serv import { createBasicStoreModule } from '../test-framework/store-test-helper'; import { EntityService } from './entity-service'; import { EntityServiceFactory } from './entity-service-factory.service'; +import { ENTITY_SERVICE } from '../shared/entity.tokens'; const appId = '4e4858c4-24ab-4caf-87a8-7703d1da58a0'; const cfId = '01ccda9d-8f40-4dd0-bc39-08eea68e364f'; @@ -36,12 +37,12 @@ describe('EntityServiceService', () => { }); }); - it('should be created', inject([EntityService], (service: EntityService) => { + it('should be created', inject([ENTITY_SERVICE], (service: EntityService) => { expect(service).toBeTruthy(); })); it('should poll', (done) => { - inject([EntityService, XHRBackend], (service: EntityService, mockBackend: MockBackend) => { + inject([ENTITY_SERVICE, XHRBackend], (service: EntityService, mockBackend: MockBackend) => { const sub = service.poll(1).subscribe(a => { sub.unsubscribe(); expect(sub.closed).toBeTruthy(); From 3f78935325a78021e71b8ac1cd3b1f08098f567a Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Tue, 3 Jul 2018 11:55:44 +0100 Subject: [PATCH 07/12] Fixed issues after adding aot --- .../list/data-sources-controllers/list-data-source-types.ts | 2 +- .../app/shared/components/list/list-cards/cards.component.html | 2 +- .../app/shared/components/list/list-cards/cards.component.ts | 1 - .../app/shared/data-services/cf-org-space-service.service.ts | 2 -- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/frontend/app/shared/components/list/data-sources-controllers/list-data-source-types.ts b/src/frontend/app/shared/components/list/data-sources-controllers/list-data-source-types.ts index 00ad527cae..80937a9201 100644 --- a/src/frontend/app/shared/components/list/data-sources-controllers/list-data-source-types.ts +++ b/src/frontend/app/shared/components/list/data-sources-controllers/list-data-source-types.ts @@ -65,7 +65,7 @@ export interface IListDataSource extends ICoreListDataSource { selectedRows$: ReplaySubject>; // Select items - remove once ng-content can exist in md-table getRowUniqueId: getRowUniqueId; selectAllFilteredRows(); // Select items - remove once ng-content can exist in md-table - selectedRowToggle(row: T); // Select items - remove once ng-content can exist in md-table + selectedRowToggle(row: T, multiMode?: boolean); // Select items - remove once ng-content can exist in md-table selectClear(); startEdit(row: T); // Edit items - remove once ng-content can exist in md-table diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.html b/src/frontend/app/shared/components/list/list-cards/cards.component.html index 8052bb1761..3fd0470e7d 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.html +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.ts b/src/frontend/app/shared/components/list/list-cards/cards.component.ts index bbee1c592b..ffa261a7d1 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.ts +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.ts @@ -9,7 +9,6 @@ import { CardCell } from '../list.types'; styleUrls: ['./cards.component.scss'] }) export class CardsComponent { - public columns = CardCell.columns; @Input('dataSource') dataSource: IListDataSource; @Input('component') component: CardCell; } diff --git a/src/frontend/app/shared/data-services/cf-org-space-service.service.ts b/src/frontend/app/shared/data-services/cf-org-space-service.service.ts index 7f418cb700..a8de9bb292 100644 --- a/src/frontend/app/shared/data-services/cf-org-space-service.service.ts +++ b/src/frontend/app/shared/data-services/cf-org-space-service.service.ts @@ -95,8 +95,6 @@ export class CfOrgSpaceDataService implements OnDestroy { private store: Store, public paginationMonitorFactory: PaginationMonitorFactory, ) { - // Note - normal optional parameter notation won't work with injectable - this.selectMode = this.selectMode; this.createCf(); this.init(); this.createOrg(); From f6af89aa7156c1866fbe28daec35061c9b53bc9d Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 4 Jul 2018 11:18:46 +0100 Subject: [PATCH 08/12] Fix table radio select (see bind existing route) --- .../list-table/table-cell-radio/table-cell-radio.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html b/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html index 23933ff168..7e53fb658f 100644 --- a/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html +++ b/src/frontend/app/shared/components/list/list-table/table-cell-radio/table-cell-radio.component.html @@ -1 +1 @@ - + From 08ac00d3e7d962c743e9587272caf704b5935acb Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 4 Jul 2018 12:48:09 +0100 Subject: [PATCH 09/12] Fix custom cards list columns - See cf's page (multiple connected endpoints) --- .../components/list/list-cards/card/card.component.ts | 6 +++--- .../components/list/list-cards/cards.component.html | 2 +- .../shared/components/list/list-cards/cards.component.ts | 9 ++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/frontend/app/shared/components/list/list-cards/card/card.component.ts b/src/frontend/app/shared/components/list/list-cards/card/card.component.ts index 04c8e46a08..2c446c3a57 100644 --- a/src/frontend/app/shared/components/list/list-cards/card/card.component.ts +++ b/src/frontend/app/shared/components/list/list-cards/card/card.component.ts @@ -25,7 +25,7 @@ import { import { CfServiceCardComponent } from '../../list-types/cf-services/cf-service-card/cf-service-card.component'; import { CfSpaceCardComponent } from '../../list-types/cf-spaces/cf-space-card/cf-space-card.component'; import { CfStacksCardComponent } from '../../list-types/cf-stacks/cf-stacks-card/cf-stacks-card.component'; -import { TableCellCustom } from '../../list.types'; +import { TableCellCustom, CardCell } from '../../list.types'; import { ServiceInstanceCardComponent } from '../../list-types/services-wall/service-instance-card/service-instance-card.component'; export const listCards = [ @@ -57,7 +57,7 @@ export class CardComponent implements OnInit, OnChanges { @ViewChild('target', { read: ViewContainerRef }) target; - cardComponent: TableCellCustom; + cardComponent: CardCell; constructor(private componentFactoryResolver: ComponentFactoryResolver) { } @@ -68,7 +68,7 @@ export class CardComponent implements OnInit, OnChanges { const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.component); // Add to target to ensure ngcontent is correct in new component const componentRef = this.target.createComponent(componentFactory); - this.cardComponent = >componentRef.instance; + this.cardComponent = >componentRef.instance; this.cardComponent.row = this.item; this.cardComponent.dataSource = this.dataSource; } diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.html b/src/frontend/app/shared/components/list/list-cards/cards.component.html index 3fd0470e7d..8052bb1761 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.html +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/frontend/app/shared/components/list/list-cards/cards.component.ts b/src/frontend/app/shared/components/list/list-cards/cards.component.ts index ffa261a7d1..7987da3471 100644 --- a/src/frontend/app/shared/components/list/list-cards/cards.component.ts +++ b/src/frontend/app/shared/components/list/list-cards/cards.component.ts @@ -9,6 +9,13 @@ import { CardCell } from '../list.types'; styleUrls: ['./cards.component.scss'] }) export class CardsComponent { + public columns = CardCell.columns; @Input('dataSource') dataSource: IListDataSource; - @Input('component') component: CardCell; + private _component: CardCell; + @Input('component') + get component() { return this._component; } + set component(cardCell) { + this._component = cardCell; + this.columns = cardCell['columns']; + } } From b62d6738c6ca2c1eca207757eb4d33e7af05d32a Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 4 Jul 2018 13:04:44 +0100 Subject: [PATCH 10/12] Add npm script to run `start` with `max_old_space_size` --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5e2f5f361f..306ac56392 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "build-dev": "ng build --dev --preserve-symlinks", "ng": "ng", "start": "npm run customize && ng serve", + "start-high-mem": "npm run customize && node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve", "start-prod": "ng serve --prod --source-map=true", "test": "ng test --code-coverage", "test-debug": "ng test --watch=true --source-map=true", From ff8eefe8e01349aba059cd1a5126ca29803c623a Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Wed, 4 Jul 2018 16:19:35 +0100 Subject: [PATCH 11/12] Remove source maps from serve --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 306ac56392..3b3d2bff94 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "ng": "ng", "start": "npm run customize && ng serve", "start-high-mem": "npm run customize && node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve", - "start-prod": "ng serve --prod --source-map=true", + "start-prod": "ng serve --prod", "test": "ng test --code-coverage", "test-debug": "ng test --watch=true --source-map=true", "test-headless": "HEADLESS=true npm run test", From 2682146612d009491ba9cbdefd9c78783020e85d Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Thu, 19 Jul 2018 10:16:12 +0100 Subject: [PATCH 12/12] tidy up preserve sym links --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3b3d2bff94..0839929bde 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "test-backend-dev": "STRATOS_USE_GO_CONVEY=true gulp test-backend", "update-webdriver": "webdriver-manager update", "build": "ng build --prod", - "build-cf": "node --max_old_space_size=1128 --optimize_for_size --gc_interval=100 node_modules/@angular/cli/bin/ng build --prod --preserve-symlinks --aot=false --build-optimizer=false", - "build-dev": "ng build --dev --preserve-symlinks", + "build-cf": "node --max_old_space_size=1128 --optimize_for_size --gc_interval=100 node_modules/@angular/cli/bin/ng build --prod --aot=false --build-optimizer=false", + "build-dev": "ng build --dev", "ng": "ng", "start": "npm run customize && ng serve", "start-high-mem": "npm run customize && node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve",