Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/show_Last_Service_Binding #2

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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",
@@ -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",
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
@@ -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 { TableCellLastServiceBindingComponent } 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,
TableCellLastServiceBindingComponent,
TableCellRouteAppsAttachedComponent,
CfOrgPermissionCellComponent,
CfSpacePermissionCellComponent,
@@ -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
@@ -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 { TableCellLastServiceBindingComponent } from '../cf-spaces-service-instances/table-cell-last-service-binding/table-cell-last-service-binding.component';

interface CanCache {
[spaceGuid: string]: Observable<boolean>;
@@ -86,6 +87,12 @@ export class CfServiceInstancesListConfigBase implements IListConfig<APIResource
cellComponent: TableCellServiceLastOpComponent,
cellFlex: '2'
},
{
columnId: 'lastServiceBinding',
headerCell: () => 'Last Service Binding',
cellComponent: TableCellLastServiceBindingComponent,
cellFlex: '2'
},
{
columnId: 'dashboard',
headerCell: () => 'Dashboard',
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 { ServiceInstanceLastServiceBindingComponent } from '../../../../service-instance-last-service-binding/service-instance-last-service-binding.component';
import { TableCellLastServiceBindingComponent } from './table-cell-last-service-binding.component';

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

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

beforeEach(() => {
fixture = TestBed.createComponent(TableCellLastServiceBindingComponent);
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 TableCellLastServiceBindingComponent 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
@@ -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>
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>

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.last-service-op {
&--row1 {
align-items: center;
display: flex;
justify-content: flex-start;
padding-bottom: 5px;
}
&--item {
padding-right: 5px;
}
}

.align-right {
.last-service-op--row1 {
justify-content: flex-end;
}
.last-service-op--item {
padding-left: 5px;
padding-right: 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 { ServiceInstanceLastServiceBindingComponent } from './service-instance-last-service-binding.component';

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

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

beforeEach(() => {
fixture = TestBed.createComponent(ServiceInstanceLastServiceBindingComponent);
component = fixture.componentInstance;
component.serviceInstance = {
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,18 @@
import { Component, Input, OnInit } from '@angular/core';

import { APIResource } from '../../../../../store/src/types/api.types';
import { IServiceInstance } from '../../../cf-api-svc.types';

@Component({
selector: 'app-service-instance-last-service-binding',
templateUrl: './service-instance-last-service-binding.component.html',
styleUrls: ['./service-instance-last-service-binding.component.scss']
})
export class ServiceInstanceLastServiceBindingComponent implements OnInit {
@Input() serviceInstance: APIResource<IServiceInstance>;
@Input() alignRight = false;

ngOnInit() {
console.log(this.serviceInstance)
}
}
46 changes: 34 additions & 12 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -32,17 +32,39 @@
],
"preserveSymlinks": true,
"paths": {
"@stratosui/core": ["frontend/packages/core/src/public-api.ts"],
"@stratosui/extension": ["frontend/packages/extension/src/public-api.ts"],
"@stratosui/store": ["frontend/packages/store/src/public-api.ts"],
"@stratosui/shared": ["frontend/packages/shared/src/public-api.ts"],
"@stratosui/store/testing": ["frontend/packages/store/testing/public-api.ts"],
"@stratosui/cloud-foundry": ["frontend/packages/cloud-foundry/src/public_api.ts"],
"@stratosui/cf-autoscaler": ["frontend/packages/cf-autoscaler/src/public_api.ts"],
"@example/extensions": ["frontend/packages/example-extensions/src/public-api.ts"],
"@stratosui/kubernetes": ["frontend/packages/kubernetes/src/public-api.ts"],
"@stratosui/desktop-extensions": ["frontend/packages/desktop-extensions/src/public-api.ts"],
"@stratosui/git": ["frontend/packages/git/src/public_api.ts"]
"@stratosui/core": [
"frontend/packages/core/src/public-api.ts"
],
"@stratosui/extension": [
"frontend/packages/extension/src/public-api.ts"
],
"@stratosui/store": [
"frontend/packages/store/src/public-api.ts"
],
"@stratosui/shared": [
"frontend/packages/shared/src/public-api.ts"
],
"@stratosui/store/testing": [
"frontend/packages/store/testing/public-api.ts"
],
"@stratosui/cloud-foundry": [
"frontend/packages/cloud-foundry/src/public_api.ts"
],
"@stratosui/cf-autoscaler": [
"frontend/packages/cf-autoscaler/src/public_api.ts"
],
"@example/extensions": [
"frontend/packages/example-extensions/src/public-api.ts"
],
"@stratosui/kubernetes": [
"frontend/packages/kubernetes/src/public-api.ts"
],
"@stratosui/desktop-extensions": [
"frontend/packages/desktop-extensions/src/public-api.ts"
],
"@stratosui/git": [
"frontend/packages/git/src/public_api.ts"
]
}
}
}
}