diff --git a/src/app/components/project-map/project-map.component.html b/src/app/components/project-map/project-map.component.html index 0fa2d1b6..3ff59f03 100644 --- a/src/app/components/project-map/project-map.component.html +++ b/src/app/components/project-map/project-map.component.html @@ -111,6 +111,10 @@ + + + + + - + diff --git a/src/app/components/project-map/project-map.component.scss b/src/app/components/project-map/project-map.component.scss index 118c8972..e7458af0 100644 --- a/src/app/components/project-map/project-map.component.scss +++ b/src/app/components/project-map/project-map.component.scss @@ -111,7 +111,7 @@ mat-divider.divider { font-weight: bold; mat-icon { - margin-top: 8px; + margin-left: -6px; } } @@ -126,7 +126,7 @@ mat-divider.divider { font-weight: bold; mat-icon { - margin-top: 8px; + margin-left: -6px; } } } diff --git a/src/app/components/project-map/project-map.component.ts b/src/app/components/project-map/project-map.component.ts index 4835ffb4..b9ff6f07 100644 --- a/src/app/components/project-map/project-map.component.ts +++ b/src/app/components/project-map/project-map.component.ts @@ -407,6 +407,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy { this.mapChangeDetectorRef.detectChanges(); } + //here we should support adding multiple nodes on single click onNodeCreation(template: Template) { if(!template) { return; diff --git a/src/app/components/template/template-list-dialog/template-list-dialog.component.html b/src/app/components/template/template-list-dialog/template-list-dialog.component.html index 3eea74e5..137c5a8d 100644 --- a/src/app/components/template/template-list-dialog/template-list-dialog.component.html +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.html @@ -1,22 +1,78 @@ +
+

Add a node

+ +
-
- - - +
+
Template
- - + + + + + + + + {{type}} + + + + + + + {{template.name}} + + + + + +
+
Configuration
+
+
+ + + + + + +
+ +
+
Position
+
+
+ Left:  + + + + Top:  + + + +
+
diff --git a/src/app/components/template/template-list-dialog/template-list-dialog.component.scss b/src/app/components/template/template-list-dialog/template-list-dialog.component.scss index 6b2a2818..62ee0283 100644 --- a/src/app/components/template/template-list-dialog/template-list-dialog.component.scss +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.scss @@ -8,8 +8,8 @@ } .mat-table { - overflow: auto; - max-height: 400px; + height: 200px; + overflow: scroll; } .mat-form-field { @@ -17,11 +17,21 @@ flex-grow: 1; } +.form-field { + width: 100%; +} + div { scrollbar-color: darkgrey #263238; scrollbar-width: thin; } +h6 { + margin-top: 5px; + margin-bottom: 10px; + color: #0097a7; +} + mat-table { scrollbar-color: darkgrey #263238; scrollbar-width: thin; @@ -36,6 +46,17 @@ mat-table { } ::-webkit-scrollbar-thumb { -background-color: darkgrey; -outline: 1px solid #263238; + background-color: darkgrey; + outline: 1px solid #263238; +} + +.filterBox { + display: flex; + justify-content: space-between; +} + +.title-container { + display: flex; + align-items: baseline; + justify-content: space-between; } diff --git a/src/app/components/template/template-list-dialog/template-list-dialog.component.ts b/src/app/components/template/template-list-dialog/template-list-dialog.component.ts index 471305f3..328be6f2 100644 --- a/src/app/components/template/template-list-dialog/template-list-dialog.component.ts +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.ts @@ -8,6 +8,7 @@ import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'; import { Server } from '../../../models/server'; import { TemplateService } from '../../../services/template.service'; import { Template } from '../../../models/template'; +import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; @Component({ selector: 'app-template-list-dialog', @@ -19,32 +20,51 @@ export class TemplateListDialogComponent implements OnInit { templateDatabase: TemplateDatabase; dataSource: TemplateDataSource; displayedColumns = ['name']; + templateTypes: string[] = ['cloud', 'ethernet_hub', 'ethernet_switch', 'docker', 'dynamips', 'vpcs', 'traceng', 'virtualbox', 'vmware', 'iou', 'qemu']; + selectedType: string; + configurationForm: FormGroup; + positionForm: FormGroup; + templates: Template[]; + searchText: string; @ViewChild('filter', {static: true}) filter: ElementRef; constructor( public dialogRef: MatDialogRef, private templateService: TemplateService, + private formBuilder: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any ) { this.server = data['server']; + this.configurationForm = this.formBuilder.group({ + name: new FormControl('new node', Validators.required), + numberOfNodes: new FormControl(1, Validators.required) + }); + this.positionForm = this.formBuilder.group({ + top: new FormControl(0, Validators.required), + left: new FormControl(0, Validators.required) + }); } ngOnInit() { - this.templateDatabase = new TemplateDatabase(this.server, this.templateService); - this.dataSource = new TemplateDataSource(this.templateDatabase); + // this.templateDatabase = new TemplateDatabase(this.server, this.templateService); + // this.dataSource = new TemplateDataSource(this.templateDatabase); - fromEvent(this.filter.nativeElement, 'keyup') - .pipe( - debounceTime(150), - distinctUntilChanged() - ) - .subscribe(() => { - if (!this.dataSource) { - return; - } - this.dataSource.filter = this.filter.nativeElement.value; - }); + this.templateService.list(this.server).subscribe((listOfTemplates: Template[]) => { + this.templates = listOfTemplates; + }); + + // fromEvent(this.filter.nativeElement, 'keyup') + // .pipe( + // debounceTime(150), + // distinctUntilChanged() + // ) + // .subscribe(() => { + // if (!this.dataSource) { + // return; + // } + // this.dataSource.filter = this.filter.nativeElement.value; + // }); } onNoClick(): void { @@ -54,6 +74,17 @@ export class TemplateListDialogComponent implements OnInit { addNode(template: Template): void { this.dialogRef.close(template); } + + filterTemplates(event) { + console.log('filter event ', event); + } + + chooseTemplate(event) { + console.log('choose event ', event); + } + + onAddClick(): void { + } } export class TemplateDatabase { diff --git a/src/app/components/template/template.component.html b/src/app/components/template/template.component.html index c4fec0c6..a9535011 100644 --- a/src/app/components/template/template.component.html +++ b/src/app/components/template/template.component.html @@ -1 +1 @@ - + diff --git a/src/app/components/template/template.component.ts b/src/app/components/template/template.component.ts index 9b6675ca..8df8e513 100644 --- a/src/app/components/template/template.component.ts +++ b/src/app/components/template/template.component.ts @@ -21,7 +21,6 @@ export class TemplateComponent implements OnInit { listTemplatesModal() { const dialogRef = this.dialog.open(TemplateListDialogComponent, { width: '600px', - height: '560px', data: { server: this.server },