Merge pull request #668 from GNS3/During-adding-the-node-customer-is-able-to-change-the-server-where-node-should-be-located-at

Option to choose server type for node added
This commit is contained in:
piotrpekala7 2020-01-20 04:02:06 -08:00 committed by GitHub
commit eab9bca34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -423,7 +423,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
if(!nodeAddedEvent) {
return;
}
this.nodeService.createFromTemplate(this.server, this.project, nodeAddedEvent.template, nodeAddedEvent.x, nodeAddedEvent.y, 'local').subscribe((node: Node) => {
this.nodeService.createFromTemplate(this.server, this.project, nodeAddedEvent.template, nodeAddedEvent.x, nodeAddedEvent.y, nodeAddedEvent.server).subscribe((node: Node) => {
if (nodeAddedEvent.name !== nodeAddedEvent.template.name) {
node.name = nodeAddedEvent.name;
this.nodeService.updateNode(this.server, node).subscribe(()=>{});

View File

@ -46,6 +46,14 @@
<input type="number" matInput formControlName="numberOfNodes" placeholder="Enter number of nodes (default value is 1)" />
</mat-form-field>
</form>
<mat-select
*ngIf="selectedTemplate"
placeholder="Choose server for node"
[(ngModel)]="selectedTemplate.compute_id">
<mat-option *ngFor="let type of nodeServers" [value]="type">
{{type}}
</mat-option>
</mat-select>
<div class="title-container">
<h6>Position</h6>

View File

@ -27,6 +27,8 @@ export class TemplateListDialogComponent implements OnInit {
selectedTemplate: Template;
searchText: string = '';
nodeServers: string[] = ['local', 'vm']
constructor(
public dialogRef: MatDialogRef<TemplateListDialogComponent>,
private templateService: TemplateService,
@ -82,6 +84,7 @@ export class TemplateListDialogComponent implements OnInit {
} else {
let event: NodeAddedEvent = {
template: this.selectedTemplate,
server: this.selectedTemplate.compute_id,
name: this.configurationForm.get('name').value,
numberOfNodes: this.configurationForm.get('numberOfNodes').value,
x: x,
@ -95,6 +98,7 @@ export class TemplateListDialogComponent implements OnInit {
export interface NodeAddedEvent {
template: Template,
server: string,
name: string,
numberOfNodes: number;
x: number;