This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(access-vm): add access VM action -> open modal window (#604)
#573 add access VM action -> open modal window
- Loading branch information
Showing
13 changed files
with
128 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { | ||
VirtualMachineAction, | ||
VmActions | ||
} from './vm-action'; | ||
import { | ||
VirtualMachine, | ||
VmState | ||
} from '../shared/vm.model'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Injectable } from '@angular/core'; | ||
import { | ||
MdDialog, | ||
MdDialogConfig | ||
} from '@angular/material'; | ||
import { VmService } from '../shared/vm.service'; | ||
import { JobsNotificationService } from '../../shared/services/jobs-notification.service'; | ||
import { DialogService } from '../../dialog/dialog-service/dialog.service'; | ||
import { VmAccessComponent } from './vm-actions-component/vm-access.component'; | ||
|
||
|
||
@Injectable() | ||
export class VmAccessAction extends VirtualMachineAction { | ||
public action = VmActions.ACCESS; | ||
public name = 'VM_PAGE.COMMANDS.VM_ACCESS'; | ||
public icon = 'computer'; | ||
|
||
constructor (private dialog: MdDialog, | ||
protected dialogService: DialogService, | ||
protected jobsNotificationService: JobsNotificationService, | ||
protected vmService: VmService){ | ||
super(dialogService, jobsNotificationService, vmService); | ||
} | ||
|
||
public canActivate(vm: VirtualMachine): boolean { | ||
return !!vm && vm.state === VmState.Running; | ||
} | ||
|
||
public activate(vm: VirtualMachine): Observable<void> { | ||
return this.dialog.open(VmAccessComponent, <MdDialogConfig>{ | ||
width: '550px', | ||
data: vm | ||
}).afterClosed(); | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
src/app/vm/vm-actions/vm-actions-component/vm-access.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,5 @@ | ||
<cs-postdeployment-dialog | ||
[vm]="vm" | ||
[dialogRef]="dialogRef" | ||
[title]="title"> | ||
</cs-postdeployment-dialog> |
26 changes: 26 additions & 0 deletions
26
src/app/vm/vm-actions/vm-actions-component/vm-access.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,26 @@ | ||
import { | ||
Component, | ||
Inject | ||
} from '@angular/core'; | ||
import { | ||
MD_DIALOG_DATA, | ||
MdDialogRef | ||
} from '@angular/material'; | ||
import { VirtualMachine } from '../../shared/vm.model'; | ||
|
||
|
||
@Component({ | ||
selector: 'cs-vm-access-dialog', | ||
templateUrl: 'vm-access.component.html' | ||
}) | ||
export class VmAccessComponent { | ||
public vm: VirtualMachine; | ||
public title = 'VM_PAGE.COMMANDS.VM_ACCESS_TITLE'; | ||
|
||
constructor( | ||
public dialogRef: MdDialogRef<VmAccessComponent>, | ||
@Inject(MD_DIALOG_DATA) data | ||
) { | ||
this.vm = data; | ||
} | ||
} |
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
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