-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial Proxmox console support (#526)
* initial Proxmox console support Added support for viewing Proxmox virtual machine NoVNC consoles and sending a Ctrl+Alt+Del. Additional operations such as power on/off can be added in the future. - console route detects vm type and uses NoVNC for Proxmox or WMKS for vsphere
- Loading branch information
1 parent
eebda97
commit 52cbc37
Showing
88 changed files
with
3,526 additions
and
1,192 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
* Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
* Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
*/ | ||
*/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,8 @@ | |
left: 0px; | ||
width: 100%; | ||
} | ||
|
||
.container { | ||
height: 100%; | ||
display: block | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- | ||
Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
--> | ||
|
||
<ng-container *ngIf="{ value: isConnected$ | async } as isConnected"> | ||
<div [hidden]="!isConnected.value === true"> | ||
<div #screen id="screen" class="background screen"> | ||
<!-- This is where the remote screen will appear --> | ||
</div> | ||
</div> | ||
|
||
<div | ||
*ngIf="isConnected.value === false" | ||
class="align-items-center center align-content-center" | ||
style="width: 70%" | ||
> | ||
<h1>Connecting...</h1> | ||
</div> | ||
</ng-container> |
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,16 @@ | ||
/* | ||
Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
*/ | ||
|
||
.center { | ||
position: relative; | ||
margin: auto; | ||
top: 40%; | ||
text-align: center; | ||
} | ||
|
||
// novnc element has to have a fixed height when scaleViewport is set | ||
.screen { | ||
height: 97vh; | ||
} |
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,30 @@ | ||
/* | ||
Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
*/ | ||
|
||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { NovncComponent } from './novnc.component'; | ||
|
||
describe('NovncComponent', () => { | ||
let component: NovncComponent; | ||
let fixture: ComponentFixture<NovncComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ NovncComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(NovncComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,99 @@ | ||
/* | ||
Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
*/ | ||
|
||
import { | ||
AfterViewInit, | ||
Component, | ||
ElementRef, | ||
EventEmitter, | ||
Input, | ||
OnChanges, | ||
Output, | ||
SimpleChanges, | ||
ViewChild, | ||
} from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { NoVNCService } from '../../services/novnc/novnc.service'; | ||
|
||
@Component({ | ||
selector: 'app-novnc', | ||
templateUrl: './novnc.component.html', | ||
styleUrls: ['./novnc.component.scss'], | ||
}) | ||
export class NovncComponent implements OnChanges, AfterViewInit { | ||
@Input() ticket: string; | ||
@Input() url: string; | ||
@Input() readOnly = false; | ||
|
||
@Output() reconnect = new EventEmitter<number>(); | ||
|
||
private isConnectedSubject = new BehaviorSubject(false); | ||
public isConnected$ = this.isConnectedSubject.asObservable(); | ||
private set isConnected(val: boolean) { | ||
this.isConnectedSubject.next(val); | ||
} | ||
|
||
private failedConnectionAttempts = 0; | ||
private backgroundColor: string; | ||
|
||
@ViewChild('screen') screen: ElementRef; | ||
|
||
constructor(private novncService: NoVNCService) {} | ||
|
||
ngAfterViewInit() { | ||
this.backgroundColor = getComputedStyle( | ||
this.screen.nativeElement | ||
).backgroundColor; | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (this.url && this.ticket && (changes['url'] || changes['ticket'])) { | ||
this.startClient(this.url, this.ticket); | ||
} | ||
|
||
if (changes['readOnly']) { | ||
this.novncService.setViewOnly(this.readOnly); | ||
} | ||
} | ||
|
||
startClient(url: string, ticket: string) { | ||
this.novncService.startClient( | ||
url, | ||
ticket, | ||
'screen', | ||
this.readOnly, | ||
this.backgroundColor | ||
); | ||
|
||
this.novncService.setConnectListener(this.connected.bind(this)); | ||
this.novncService.setDisconnectListener(this.disconnected.bind(this)); | ||
this.novncService.setSecurityFailureListener( | ||
this.securityFailure.bind(this) | ||
); | ||
} | ||
|
||
connected(e) { | ||
this.isConnected = true; | ||
this.failedConnectionAttempts = 0; | ||
} | ||
|
||
// This function is called when we are disconnected | ||
disconnected(e) { | ||
this.isConnected = false; | ||
this.failedConnectionAttempts++; | ||
this.reconnect.emit(this.failedConnectionAttempts); | ||
|
||
if (e.detail.clean) { | ||
console.log('Disconnected'); | ||
} else { | ||
console.log('Something went wrong, connection is closed'); | ||
console.log(e); | ||
} | ||
} | ||
|
||
securityFailure(e) { | ||
console.log(e); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/app/components/options-bar2/options-bar2.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,20 @@ | ||
<!-- | ||
Copyright 2022 Carnegie Mellon University. All Rights Reserved. | ||
Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
--> | ||
|
||
<div class="options-container background"> | ||
<div class="options-content background"> | ||
<button mat-icon-button class="mat-small" [matMenuTriggerFor]="mainMenu"> | ||
<mat-icon class="text" svgIcon="gear" alt="Gear"></mat-icon> | ||
</button> | ||
<mat-menu #mainMenu="matMenu"> | ||
<button mat-menu-item [matMenuTriggerFor]="keyboardMenu">Keyboard</button> | ||
<mat-menu #keyboardMenu="matMenu"> | ||
<button mat-menu-item (click)="ctrlAltDel()">Send Ctrl-Alt-Del</button> | ||
</mat-menu> | ||
</mat-menu> | ||
|
||
<label class="vm-name text">{{ vm?.name }}</label> | ||
</div> | ||
</div> |
43 changes: 43 additions & 0 deletions
43
src/app/components/options-bar2/options-bar2.component.scss
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 @@ | ||
// Copyright 2021 Carnegie Mellon University. All Rights Reserved. | ||
// Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. | ||
|
||
a:visited { | ||
color: black; | ||
} | ||
|
||
.mat-expansion-panel-header { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.vm-name { | ||
font-size: small; | ||
margin-left: 10px; | ||
} | ||
|
||
.left { | ||
float: left; | ||
padding-bottom: 8px; | ||
} | ||
|
||
.mat-icon-button.mat-small { | ||
line-height: 16px; | ||
height: 16px; | ||
width: 16px; | ||
margin-top: 2px; | ||
margin-left: 10px; | ||
display: inline-block; | ||
z-index: 1; | ||
} | ||
|
||
.mat-icon { | ||
height: 18px; | ||
width: 18px; | ||
} | ||
|
||
.mat-top-button { | ||
font-size: x-small; | ||
height: 21px; | ||
line-height: 0px; | ||
margin-left: 20px; | ||
} |
Oops, something went wrong.