Skip to content

Commit

Permalink
Add 'Last Service Binding' column to grid view and list view
Browse files Browse the repository at this point in the history
  • Loading branch information
kristelaK committed Nov 11, 2024
1 parent 0e59cd8 commit 65ee673
Show file tree
Hide file tree
Showing 14 changed files with 351 additions and 109 deletions.
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@
"@angular-devkit/schematics": "^14.2.12",
"@angular/cli": "^14.2.12",
"@angular/language-service": "^14.2.12",
"@cypress/request": "^3.0.0",
"@schematics/angular": "^9.1.5",
"@types/hammerjs": "^2.0.46",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.8",
"@types/js-yaml": "^3.12.5",
Expand Down Expand Up @@ -169,7 +171,6 @@
"protractor": "^7.0.0",
"ps-node": "^0.1.6",
"q": "^1.4.1",
"@cypress/request": "^3.0.0",
"rxjs-tslint": "^0.1.8",
"ts-node": "^8.8.2",
"tslint": "~6.1.0",
Expand Down
196 changes: 100 additions & 96 deletions src/frontend/packages/cloud-foundry/src/shared/cf-shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,14 @@ import { AppNameUniqueDirective } from './directives/app-name-unique.directive/a
import { CfUserPermissionDirective } from './directives/cf-user-permission/cf-user-permission.directive';
import { ApplicationStateService } from './services/application-state.service';
import { CloudFoundryUserProvidedServicesService } from './services/cloud-foundry-user-provided-services.service';
import { TableCellServiceLastServiceBindingComponent } from './components/list/list-types/cf-spaces-service-instances/table-cell-last-service-binding/table-cell-last-service-binding.component';
import { ServiceInstanceLastServiceBindingComponent } from './components/service-instance-last-service-binding/service-instance-last-service-binding.component';

const cfListTableCells: Type<TableCellCustom<any>>[] = [
TableCellServiceInstanceAppsAttachedComponent,
TableCellServiceComponent,
TableCellServiceLastOpComponent,
TableCellServiceLastServiceBindingComponent,
TableCellRouteAppsAttachedComponent,
CfOrgPermissionCellComponent,
CfSpacePermissionCellComponent,
Expand Down Expand Up @@ -261,102 +264,103 @@ const cfListCards: Type<CardCell<any>>[] = [
];

@NgModule({
imports: [
CommonModule,
CoreModule,
SharedModule,
ApplicationModule,
MaterialDesignFrameworkModule,
],
declarations: [
ServiceIconComponent,
CfEndpointDetailsComponent,
CliCommandComponent,
CliInfoComponent,
CfEndpointsMissingComponent,
CfRoleCheckboxComponent,
CfOrgSpaceLinksComponent,
SelectServiceComponent,
SpecifyDetailsStepComponent,
AddServiceInstanceComponent,
SelectPlanStepComponent,
NoServicePlansComponent,
BindAppsStepComponent,
SpecifyUserProvidedDetailsComponent,
AddServiceInstanceBaseStepComponent,
SchemaFormComponent,
CardAppStatusComponent,
CardAppInstancesComponent,
CardAppUsageComponent,
CardAppUptimeComponent,
CardCfInfoComponent,
CardCfUserInfoComponent,
CardCfOrgUserDetailsComponent,
CardCfSpaceDetailsComponent,
ServiceSummaryCardComponent,
ServiceBrokerCardComponent,
ServiceRecentInstancesCardComponent,
CompactServiceInstanceCardComponent,
RunningInstancesComponent,
ServicePlanPublicComponent,
ServicePlanPriceComponent,
CreateApplicationStep1Component,
EventTabActorIconPipe,
CloudFoundryEventsListComponent,
EventMetadataComponent,
...cfListTableCells,
...cfListCards,
ServiceInstanceLastOpComponent,
TableCellFeatureFlagDescriptionComponent,
AppNameUniqueDirective,
ApplicationInstanceChartComponent,
EnvVarViewComponent,
CfUserPermissionDirective
],
exports: [
ServiceIconComponent,
CfEndpointDetailsComponent,
CliCommandComponent,
CliInfoComponent,
CfEndpointsMissingComponent,
CfRoleCheckboxComponent,
CfOrgSpaceLinksComponent,
SelectServiceComponent,
SpecifyDetailsStepComponent,
AddServiceInstanceComponent,
SelectPlanStepComponent,
NoServicePlansComponent,
BindAppsStepComponent,
SpecifyUserProvidedDetailsComponent,
AddServiceInstanceBaseStepComponent,
CfServiceCardComponent,
SchemaFormComponent,
CardAppStatusComponent,
CardAppInstancesComponent,
CardAppUsageComponent,
CardAppUptimeComponent,
CardCfInfoComponent,
CardCfUserInfoComponent,
CardCfOrgUserDetailsComponent,
CardCfSpaceDetailsComponent,
ServiceSummaryCardComponent,
ServiceBrokerCardComponent,
ServiceRecentInstancesCardComponent,
CompactServiceInstanceCardComponent,
RunningInstancesComponent,
ServicePlanPublicComponent,
ServicePlanPriceComponent,
CreateApplicationStep1Component,
CloudFoundryEventsListComponent,
AppNameUniqueDirective,
ApplicationInstanceChartComponent,
EnvVarViewComponent,
CfUserPermissionDirective
],
providers: [
ApplicationStateService,
CloudFoundryUserProvidedServicesService
]
imports: [
CommonModule,
CoreModule,
SharedModule,
ApplicationModule,
MaterialDesignFrameworkModule,
],
declarations: [
ServiceIconComponent,
CfEndpointDetailsComponent,
CliCommandComponent,
CliInfoComponent,
CfEndpointsMissingComponent,
CfRoleCheckboxComponent,
CfOrgSpaceLinksComponent,
SelectServiceComponent,
SpecifyDetailsStepComponent,
AddServiceInstanceComponent,
SelectPlanStepComponent,
NoServicePlansComponent,
BindAppsStepComponent,
SpecifyUserProvidedDetailsComponent,
AddServiceInstanceBaseStepComponent,
SchemaFormComponent,
CardAppStatusComponent,
CardAppInstancesComponent,
CardAppUsageComponent,
CardAppUptimeComponent,
CardCfInfoComponent,
CardCfUserInfoComponent,
CardCfOrgUserDetailsComponent,
CardCfSpaceDetailsComponent,
ServiceSummaryCardComponent,
ServiceBrokerCardComponent,
ServiceRecentInstancesCardComponent,
CompactServiceInstanceCardComponent,
RunningInstancesComponent,
ServicePlanPublicComponent,
ServicePlanPriceComponent,
CreateApplicationStep1Component,
EventTabActorIconPipe,
CloudFoundryEventsListComponent,
EventMetadataComponent,
...cfListTableCells,
...cfListCards,
ServiceInstanceLastOpComponent,
ServiceInstanceLastServiceBindingComponent,
TableCellFeatureFlagDescriptionComponent,
AppNameUniqueDirective,
ApplicationInstanceChartComponent,
EnvVarViewComponent,
CfUserPermissionDirective
],
exports: [
ServiceIconComponent,
CfEndpointDetailsComponent,
CliCommandComponent,
CliInfoComponent,
CfEndpointsMissingComponent,
CfRoleCheckboxComponent,
CfOrgSpaceLinksComponent,
SelectServiceComponent,
SpecifyDetailsStepComponent,
AddServiceInstanceComponent,
SelectPlanStepComponent,
NoServicePlansComponent,
BindAppsStepComponent,
SpecifyUserProvidedDetailsComponent,
AddServiceInstanceBaseStepComponent,
CfServiceCardComponent,
SchemaFormComponent,
CardAppStatusComponent,
CardAppInstancesComponent,
CardAppUsageComponent,
CardAppUptimeComponent,
CardCfInfoComponent,
CardCfUserInfoComponent,
CardCfOrgUserDetailsComponent,
CardCfSpaceDetailsComponent,
ServiceSummaryCardComponent,
ServiceBrokerCardComponent,
ServiceRecentInstancesCardComponent,
CompactServiceInstanceCardComponent,
RunningInstancesComponent,
ServicePlanPublicComponent,
ServicePlanPriceComponent,
CreateApplicationStep1Component,
CloudFoundryEventsListComponent,
AppNameUniqueDirective,
ApplicationInstanceChartComponent,
EnvVarViewComponent,
CfUserPermissionDirective
],
providers: [
ApplicationStateService,
CloudFoundryUserProvidedServicesService
]
})
export class CloudFoundrySharedModule { }

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
TableCellServiceLastOpComponent,
} from '../cf-spaces-service-instances/table-cell-service-last-op/table-cell-service-last-op.component';
import { TableCellServiceComponent } from '../cf-spaces-service-instances/table-cell-service/table-cell-service.component';
import { TableCellServiceLastServiceBindingComponent } from '../cf-spaces-service-instances/table-cell-last-service-binding/table-cell-last-service-binding.component';

interface CanCache {
[spaceGuid: string]: Observable<boolean>;
Expand Down Expand Up @@ -86,6 +87,12 @@ export class CfServiceInstancesListConfigBase implements IListConfig<APIResource
cellComponent: TableCellServiceLastOpComponent,
cellFlex: '2'
},
{
columnId: 'lastServiceBinding',
headerCell: () => 'Last Service Binding',
cellComponent: TableCellServiceLastServiceBindingComponent,
cellFlex: '2'
},
{
columnId: 'dashboard',
headerCell: () => 'Dashboard',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<app-service-instance-last-service-binding *ngIf="isUserProvidedServiceInstance === false; else upsi" [serviceInstance]="row"
[alignRight]="false"></app-service-instance-last-service-binding >
<ng-template #upsi>-</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import {
BooleanIndicatorComponent,
} from '../../../../../../../../core/src/shared/components/boolean-indicator/boolean-indicator.component';
import { BaseTestModulesNoShared } from '../../../../../../../../core/test-framework/core-test.helper';
import { EntityMonitorFactory } from '../../../../../../../../store/src/monitors/entity-monitor.factory.service';
import { ServiceInstanceLastOpComponent } from '../../../../service-instance-last-op/service-instance-last-op.component';
import { TableCellServiceLastServiceBindingComponent } from './table-cell-last-service-binding.component';

describe('TableCellServiceLastServiceBindingComponent', () => {
let component: TableCellServiceLastServiceBindingComponent;
let fixture: ComponentFixture<TableCellServiceLastServiceBindingComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
TableCellServiceLastServiceBindingComponent,
ServiceInstanceLastOpComponent,
BooleanIndicatorComponent
],
imports: [...BaseTestModulesNoShared],
providers: [EntityMonitorFactory]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(TableCellServiceLastServiceBindingComponent);
component = fixture.componentInstance;
component.row = {
entity: {
service_plan_guid: '',
space_guid: '',
dashboard_url: '',
type: '',
service_guid: '',
service_plan_url: '',
service_bindings_url: '',
service_keys_url: '',
routes_url: '',
service_url: '',
},
metadata: {
created_at: '',
guid: '',
updated_at: '',
url: ''
}
};
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component, Input, OnInit } from '@angular/core';

import { TableCellCustom } from '../../../../../../../../core/src/shared/components/list/list.types';
import { APIResource } from '../../../../../../../../store/src/types/api.types';
import { IServiceInstance } from '../../../../../../cf-api-svc.types';
import { userProvidedServiceInstanceEntityType } from '../../../../../../cf-entity-types';

@Component({
selector: 'app-table-cell-last-service-binding',
templateUrl: './table-cell-last-service-binding.component.html',
styleUrls: ['./table-cell-last-service-binding.component.scss']
})
export class TableCellServiceLastServiceBindingComponent extends TableCellCustom<APIResource<IServiceInstance>> implements OnInit {
// tslint:disable-next-line:ban-types
isUserProvidedServiceInstance: Boolean;


ngOnInit() {
this.isUserProvidedServiceInstance = this.entityKey === userProvidedServiceInstanceEntityType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
</app-service-instance-last-op>
</app-meta-card-value>
</app-meta-card-item>
<app-meta-card-item>
<app-meta-card-key> Last Service Binding </app-meta-card-key>
<app-meta-card-value>
<app-service-instance-last-service-binding [alignRight]="true" [serviceInstance]="serviceInstanceEntity">
</app-service-instance-last-service-binding>
</app-meta-card-value>
</app-meta-card-item>
<app-meta-card-item>
<app-meta-card-key>Dashboard</app-meta-card-key>
<app-meta-card-value>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="last-service-op" [ngClass]="{ 'align-right': alignRight}" *ngIf="serviceInstance.entity.service_bindings?.length > 0; else noServiceBinding">
<div *ngIf="serviceInstance.entity.service_bindings as sb">
<div *ngIf="sb[sb.length -1].entity.last_operation as sb_lo">
<div class="last-service-op--row1">
{{sb_lo.type | titlecase }}
<app-boolean-indicator *ngIf="sb_lo.state==='in progress'; else normalIndicator" class="last-service-op--item" [isTrue]="true"
type="progress-progress" [subtle]="false" [showText]="false"></app-boolean-indicator>
<ng-template #normalIndicator>
<app-boolean-indicator class="last-service-op--item" [isTrue]="sb_lo.state==='succeeded'" type="yes-no" [subtle]="false"
[showText]="false">
</app-boolean-indicator>
</ng-template>
</div>
<div class="last-service-op--row2">{{ sb_lo.created_at | date:'medium' }}</div>
</div>
</div>
</div>

<ng-template #noServiceBinding>-</ng-template>

Loading

0 comments on commit 65ee673

Please sign in to comment.