-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3436 from cloudfoundry-incubator/cf-org-space-values
Add cf/org/space links to service instance table using common components
- Loading branch information
Showing
35 changed files
with
461 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
.../packages/core/src/shared/components/cf-org-space-links/cf-org-space-links.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ng-container *ngIf="service?.multipleConnectedEndpoints$ | async"> | ||
<a [routerLink]="service?.getCfURL()">{{ service?.getCfName() | async }}</a> / | ||
</ng-container> | ||
<a [routerLink]="service?.getOrgURL()">{{ service?.getOrgName() | async}}</a> / | ||
<a [routerLink]="service?.getSpaceURL()" [queryParams]="spaceBreadCrumbs">{{ service?.getSpaceName() | async}}</a> |
Empty file.
32 changes: 32 additions & 0 deletions
32
...ckages/core/src/shared/components/cf-org-space-links/cf-org-space-links.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { createBasicStoreModule } from '../../../../test-framework/store-test-helper'; | ||
import { CfOrgSpaceLinksComponent } from './cf-org-space-links.component'; | ||
|
||
|
||
describe('CfOrgSpaceLinksComponent', () => { | ||
let component: CfOrgSpaceLinksComponent; | ||
let fixture: ComponentFixture<CfOrgSpaceLinksComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [CfOrgSpaceLinksComponent], | ||
imports: [ | ||
RouterTestingModule, | ||
createBasicStoreModule() | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CfOrgSpaceLinksComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
...nd/packages/core/src/shared/components/cf-org-space-links/cf-org-space-links.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
import { CfOrgSpaceLabelService } from '../../services/cf-org-space-label.service'; | ||
|
||
@Component({ | ||
selector: 'app-cf-org-space-links', | ||
templateUrl: './cf-org-space-links.component.html', | ||
styleUrls: ['./cf-org-space-links.component.scss'] | ||
}) | ||
export class CfOrgSpaceLinksComponent { | ||
|
||
@Input() service: CfOrgSpaceLabelService; | ||
@Input() spaceBreadCrumbs: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 15 additions & 7 deletions
22
...end/packages/core/src/shared/components/list/list-types/app/TableCellAppCfOrgSpaceBase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
|
||
import { AppState } from '../../../../../../../store/src/app-state'; | ||
import { APIResource } from '../../../../../../../store/src/types/api.types'; | ||
import { IApp } from '../../../../../core/cf-api.types'; | ||
import { haveMultiConnectedCfs } from '../../../../../features/cloud-foundry/cf.helpers'; | ||
import { CfOrgSpaceLabelService } from '../../../../services/cf-org-space-label.service'; | ||
import { TableCellCustom } from '../../list.types'; | ||
import { APIResource } from '../../../../../../../store/src/types/api.types'; | ||
import { AppState } from '../../../../../../../store/src/app-state'; | ||
|
||
|
||
export class TableCellAppCfOrgSpaceBase extends TableCellCustom<APIResource<IApp>> { | ||
|
||
multipleConnectedEndpoints$: Observable<boolean>; | ||
public cfOrgSpace: CfOrgSpaceLabelService; | ||
|
||
constructor(store: Store<AppState>) { | ||
constructor(private store: Store<AppState>) { | ||
super(); | ||
this.multipleConnectedEndpoints$ = haveMultiConnectedCfs(store); | ||
} | ||
|
||
protected init(cfGuid?: string, orgGuid?: string, spaceGuid?: string) { | ||
if (!this.cfOrgSpace) { | ||
this.cfOrgSpace = new CfOrgSpaceLabelService( | ||
this.store, | ||
cfGuid, | ||
orgGuid, | ||
spaceGuid | ||
); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
...ypes/app/table-cell-app-cforgspace-header/table-cell-app-cforgspace-header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
<span *ngIf="multipleConnectedEndpoints$ | async; else singleEndpoint"> | ||
CF/Org/Space | ||
</span> | ||
<ng-template #singleEndpoint> | ||
Org/Space | ||
</ng-template> | ||
{{ cfOrgSpace?.getLabel() | async}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
...ts/list/list-types/app/table-cell-app-cforgspace/table-cell-app-cforgspace.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
<span *ngIf="multipleConnectedEndpoints$ | async; else singleEndpoint"> | ||
{{endpointName$ | async }}/{{ row.entity.space.entity.organization.entity.name }}/{{ row.entity.space.entity.name }} | ||
</span> | ||
<ng-template #singleEndpoint> | ||
{{ row.entity.space.entity.organization.entity.name }}/{{ row.entity.space.entity.name }} | ||
</ng-template> | ||
<app-cf-org-space-links [service]="cfOrgSpace"></app-cf-org-space-links> |
27 changes: 12 additions & 15 deletions
27
...ents/list/list-types/app/table-cell-app-cforgspace/table-cell-app-cforgspace.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, Input } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
import { TableCellAppCfOrgSpaceBase } from '../TableCellAppCfOrgSpaceBase'; | ||
import { AppState } from '../../../../../../../../store/src/app-state'; | ||
import { EndpointModel } from '../../../../../../../../store/src/types/endpoint.types'; | ||
import { selectEntity } from '../../../../../../../../store/src/selectors/api.selectors'; | ||
import { endpointSchemaKey } from '../../../../../../../../store/src/helpers/entity-factory'; | ||
import { APIResource } from '../../../../../../../../store/src/types/api.types'; | ||
import { IApp, ISpace } from '../../../../../../core/cf-api.types'; | ||
import { TableCellAppCfOrgSpaceBase } from '../TableCellAppCfOrgSpaceBase'; | ||
|
||
@Component({ | ||
selector: 'app-table-cell-app-cforgspace', | ||
templateUrl: './table-cell-app-cforgspace.component.html', | ||
styleUrls: ['./table-cell-app-cforgspace.component.scss'], | ||
}) | ||
export class TableCellAppCfOrgSpaceComponent extends TableCellAppCfOrgSpaceBase implements OnInit { | ||
export class TableCellAppCfOrgSpaceComponent extends TableCellAppCfOrgSpaceBase { | ||
|
||
endpointName$: Observable<string>; | ||
@Input('row') | ||
set row(row: APIResource<IApp>) { | ||
if (row) { | ||
this.init(row.entity.cfGuid, (row.entity.space as APIResource<ISpace>).entity.organization_guid, row.entity.space_guid); | ||
} | ||
} | ||
|
||
constructor(private store: Store<AppState>) { | ||
constructor(store: Store<AppState>) { | ||
super(store); | ||
} | ||
|
||
ngOnInit() { | ||
this.endpointName$ = this.store.select<EndpointModel>(selectEntity(endpointSchemaKey, this.row.entity.cfGuid)).pipe( | ||
map(endpoint => endpoint ? endpoint.name : '') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.