;
private copyTryCount: number;
private destroy$ = new Subject();
@@ -146,6 +148,10 @@ export class OptionsBarComponent implements OnInit, OnDestroy {
this.vsphereService.vmResolution
.pipe(takeUntil(this.destroy$))
.subscribe((res) => (this.currentVmContainerResolution = res));
+
+ this.isAdmin$ = this.vmService
+ .getVmPermissions(this.vmId)
+ .pipe(map((x) => x.includes('ViewAdmin')));
}
ngOnDestroy() {
@@ -286,8 +292,9 @@ export class OptionsBarComponent implements OnInit, OnDestroy {
}
}
this.vsphereService.verifyCredentials(this.vmId).subscribe(
- (response) => {
+ () => {
this.uploadEnabled = true;
+ this.dialogService.message('Credentials Verified', '');
},
(error: HttpErrorResponse) => {
// error.error.title contains the relevant message
@@ -337,6 +344,22 @@ export class OptionsBarComponent implements OnInit, OnDestroy {
);
}
+ downloadFileFromVm() {
+ this.dialogService
+ .getFileUploadInfo('Download File Settings', {
+ data: { showCredentials: false },
+ })
+ .subscribe((enteredInfo) => {
+ const filePath = enteredInfo['filepath'];
+ this.vsphereService.getVmFileUrl(this.vmId, filePath).subscribe((x) => {
+ const link = document.createElement('a');
+ link.href = x.url;
+ link.download = x.fileName;
+ link.click();
+ });
+ });
+ }
+
startIsoMount() {
// refresh the iso list
this.retrievingIsos = true;
diff --git a/src/app/components/shared/file-upload-info-dialog/file-upload-info-dialog.component.html b/src/app/components/shared/file-upload-info-dialog/file-upload-info-dialog.component.html
index 282d03ba..49dbe94f 100644
--- a/src/app/components/shared/file-upload-info-dialog/file-upload-info-dialog.component.html
+++ b/src/app/components/shared/file-upload-info-dialog/file-upload-info-dialog.component.html
@@ -7,23 +7,25 @@ {{ title }}