-
Notifications
You must be signed in to change notification settings - Fork 134
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 #4229 from cloudfoundry/backup-endpoints
Backup/Restore endpoints & tokens
- Loading branch information
Showing
61 changed files
with
1,827 additions
and
90 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
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
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: 2 additions & 5 deletions
7
...ells/cloud-foundry-cell/cloud-foundry-cell-apps/cloud-foundry-cell-apps.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
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: 2 additions & 5 deletions
7
.../cloud-foundry-cell/cloud-foundry-cell-charts/cloud-foundry-cell-charts.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
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
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
2 changes: 2 additions & 0 deletions
2
...eatures/endpoints/backup-restore/backup-checkbox-cell/backup-checkbox-cell.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,2 @@ | ||
<mat-checkbox [(ngModel)]="service.state[row.guid][config.type]" [disabled]="disabled()" (change)="validate()"> | ||
</mat-checkbox> |
Empty file.
45 changes: 45 additions & 0 deletions
45
...ures/endpoints/backup-restore/backup-checkbox-cell/backup-checkbox-cell.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,45 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { EndpointModel } from '../../../../../../store/src/types/endpoint.types'; | ||
import { BaseTestModulesNoShared } from '../../../../../test-framework/core-test.helper'; | ||
import { BackupEndpointsService } from '../backup-endpoints.service'; | ||
import { BackupEndpointTypes } from '../backup-restore.types'; | ||
import { BackupCheckboxCellComponent } from './backup-checkbox-cell.component'; | ||
|
||
describe('BackupCheckboxCellComponent', () => { | ||
let component: BackupCheckboxCellComponent; | ||
let fixture: ComponentFixture<BackupCheckboxCellComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [BackupCheckboxCellComponent], | ||
imports: [ | ||
...BaseTestModulesNoShared | ||
], | ||
providers: [ | ||
BackupEndpointsService | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BackupCheckboxCellComponent); | ||
component = fixture.componentInstance; | ||
component.config = { | ||
type: BackupEndpointTypes.ENDPOINT | ||
}; | ||
component.row = { | ||
guid: 'test', | ||
cnsi_type: 'metrics', | ||
} as EndpointModel; | ||
component.service.initialize([{ | ||
guid: 'test' | ||
} as EndpointModel]); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
.../features/endpoints/backup-restore/backup-checkbox-cell/backup-checkbox-cell.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,25 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { EndpointModel } from '../../../../../../store/src/types/endpoint.types'; | ||
import { TableCellCustom } from '../../../../shared/components/list/list.types'; | ||
import { BackupEndpointsService } from '../backup-endpoints.service'; | ||
|
||
@Component({ | ||
selector: 'app-backup-checkbox-cell', | ||
templateUrl: './backup-checkbox-cell.component.html', | ||
styleUrls: ['./backup-checkbox-cell.component.scss'] | ||
}) | ||
export class BackupCheckboxCellComponent extends TableCellCustom<EndpointModel> { | ||
|
||
constructor(public service: BackupEndpointsService) { | ||
super(); | ||
} | ||
|
||
validate() { | ||
this.service.stateUpdated(); | ||
} | ||
|
||
disabled(): boolean { | ||
return !this.service.canBackupEndpoint(this.row, this.config.type); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...res/endpoints/backup-restore/backup-connection-cell/backup-connection-cell.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,10 @@ | ||
<mat-form-field *ngIf="connectable; else unConnectable"> | ||
<mat-select [(value)]="service.state[row.guid][backupType.CONNECT]" | ||
[disabled]="!service.state[row.guid][backupType.ENDPOINT]"> | ||
<mat-option [value]="connectionTypes.NONE">None</mat-option> | ||
<mat-option [value]="connectionTypes.CURRENT" [disabled]="!!userConnectionWarning" | ||
[matTooltip]="userConnectionWarning">Current User</mat-option> | ||
<mat-option [value]="connectionTypes.ALL">All Users</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
<ng-template #unConnectable>N/A</ng-template> |
Empty file.
43 changes: 43 additions & 0 deletions
43
.../endpoints/backup-restore/backup-connection-cell/backup-connection-cell.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,43 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { EndpointModel } from '../../../../../../store/src/types/endpoint.types'; | ||
import { BaseTestModulesNoShared } from '../../../../../test-framework/core-test.helper'; | ||
import { BackupEndpointsService } from '../backup-endpoints.service'; | ||
import { BackupConnectionCellComponent } from './backup-connection-cell.component'; | ||
|
||
describe('BackupConnectionCellComponent', () => { | ||
let component: BackupConnectionCellComponent; | ||
let fixture: ComponentFixture<BackupConnectionCellComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
BackupConnectionCellComponent, | ||
], | ||
imports: [ | ||
...BaseTestModulesNoShared | ||
], | ||
providers: [ | ||
BackupEndpointsService | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BackupConnectionCellComponent); | ||
component = fixture.componentInstance; | ||
component.row = { | ||
guid: 'test', | ||
cnsi_type: 'metrics', | ||
} as EndpointModel; | ||
component.service.initialize([{ | ||
guid: 'test' | ||
} as EndpointModel]); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
...tures/endpoints/backup-restore/backup-connection-cell/backup-connection-cell.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,36 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
import { entityCatalog } from '../../../../../../store/src/entity-catalog/entity-catalog.service'; | ||
import { EndpointModel, SystemSharedUserGuid } from '../../../../../../store/src/types/endpoint.types'; | ||
import { TableCellCustom } from '../../../../shared/components/list/list.types'; | ||
import { BackupEndpointsService } from '../backup-endpoints.service'; | ||
import { BackupEndpointConnectionTypes, BackupEndpointTypes } from '../backup-restore.types'; | ||
|
||
@Component({ | ||
selector: 'app-backup-connection-cell', | ||
templateUrl: './backup-connection-cell.component.html', | ||
styleUrls: ['./backup-connection-cell.component.scss'] | ||
}) | ||
export class BackupConnectionCellComponent extends TableCellCustom<EndpointModel> implements OnInit { | ||
|
||
connectable = false; | ||
backupType = BackupEndpointTypes; | ||
connectionTypes = BackupEndpointConnectionTypes; | ||
selected: BackupEndpointConnectionTypes; | ||
userConnectionWarning: string; | ||
|
||
constructor(public service: BackupEndpointsService) { | ||
super(); | ||
} | ||
|
||
ngOnInit() { | ||
const epType = entityCatalog.getEndpoint(this.row.cnsi_type, this.row.sub_type); | ||
const epEntity = epType.definition; | ||
this.connectable = !epEntity.unConnectable; | ||
if (!this.row.user) { | ||
this.userConnectionWarning = 'User not connected'; | ||
} else if (this.row.user.guid === SystemSharedUserGuid) { | ||
this.userConnectionWarning = 'User has shared connection'; | ||
} | ||
} | ||
} |
Oops, something went wrong.