From 2b81d7223289bce9b1c0a28031b1154ad86841ec Mon Sep 17 00:00:00 2001 From: piotrpekala7 <31202938+piotrpekala7@users.noreply.github.com> Date: Thu, 10 Jun 2021 13:17:01 +0200 Subject: [PATCH 1/4] Removing components related to gns3vm --- src/app/app-routing.module.ts | 2 - src/app/app.module.ts | 7 -- .../preferences/gns3vm/gns3vm.component.html | 66 -------------- .../preferences/gns3vm/gns3vm.component.scss | 12 --- .../gns3vm/gns3vm.component.spec.ts | 0 .../preferences/gns3vm/gns3vm.component.ts | 89 ------------------- .../preferences/preferences.component.html | 1 - .../components/projects/projects.component.ts | 18 ---- .../configure-gns3vm-dialog.component.html | 7 -- .../configure-gns3vm-dialog.component.scss | 0 .../configure-gns3vm-dialog.component.ts | 22 ----- src/app/models/gns3vm/gns3vm.ts | 10 --- src/app/models/gns3vm/gns3vmEngine.ts | 8 -- src/app/models/gns3vm/vm.ts | 3 - src/app/services/gns3vm.service.ts | 28 ------ 15 files changed, 273 deletions(-) delete mode 100644 src/app/components/preferences/gns3vm/gns3vm.component.html delete mode 100644 src/app/components/preferences/gns3vm/gns3vm.component.scss delete mode 100644 src/app/components/preferences/gns3vm/gns3vm.component.spec.ts delete mode 100644 src/app/components/preferences/gns3vm/gns3vm.component.ts delete mode 100644 src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.html delete mode 100644 src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.scss delete mode 100644 src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.ts delete mode 100644 src/app/models/gns3vm/gns3vm.ts delete mode 100644 src/app/models/gns3vm/gns3vmEngine.ts delete mode 100644 src/app/models/gns3vm/vm.ts delete mode 100644 src/app/services/gns3vm.service.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c1f77dd0..8f0fda8a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -24,7 +24,6 @@ import { AddIosTemplateComponent } from './components/preferences/dynamips/add-i import { CopyIosTemplateComponent } from './components/preferences/dynamips/copy-ios-template/copy-ios-template.component'; import { IosTemplateDetailsComponent } from './components/preferences/dynamips/ios-template-details/ios-template-details.component'; import { IosTemplatesComponent } from './components/preferences/dynamips/ios-templates/ios-templates.component'; -import { Gns3vmComponent } from './components/preferences/gns3vm/gns3vm.component'; import { AddIouTemplateComponent } from './components/preferences/ios-on-unix/add-iou-template/add-iou-template.component'; import { CopyIouTemplateComponent } from './components/preferences/ios-on-unix/copy-iou-template/copy-iou-template.component'; import { IouTemplateDetailsComponent } from './components/preferences/ios-on-unix/iou-template-details/iou-template-details.component'; @@ -87,7 +86,6 @@ const routes: Routes = [ resolve: { server: ServerResolve }, }, { path: 'server/:server_id/preferences', component: PreferencesComponent, canActivate: [LoginGuard] }, - { path: 'server/:server_id/preferences/gns3vm', component: Gns3vmComponent, canActivate: [LoginGuard] }, // { path: 'server/:server_id/preferences/general', component: GeneralPreferencesComponent }, { path: 'server/:server_id/preferences/builtin', component: BuiltInPreferencesComponent, canActivate: [LoginGuard] }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c49a0d9c..e1d28fdb 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -74,7 +74,6 @@ import { DynamipsPreferencesComponent } from './components/preferences/dynamips/ import { IosTemplateDetailsComponent } from './components/preferences/dynamips/ios-template-details/ios-template-details.component'; import { IosTemplatesComponent } from './components/preferences/dynamips/ios-templates/ios-templates.component'; import { GeneralPreferencesComponent } from './components/preferences/general/general-preferences.component'; -import { Gns3vmComponent } from './components/preferences/gns3vm/gns3vm.component'; import { AddIouTemplateComponent } from './components/preferences/ios-on-unix/add-iou-template/add-iou-template.component'; import { CopyIouTemplateComponent } from './components/preferences/ios-on-unix/copy-iou-template/copy-iou-template.component'; import { IouTemplateDetailsComponent } from './components/preferences/ios-on-unix/iou-template-details/iou-template-details.component'; @@ -185,7 +184,6 @@ import { NavigationDialogComponent } from './components/projects/navigation-dial import { ProjectsComponent } from './components/projects/projects.component'; import { SaveProjectDialogComponent } from './components/projects/save-project-dialog/save-project-dialog.component'; import { AddServerDialogComponent } from './components/servers/add-server-dialog/add-server-dialog.component'; -import { ConfigureGns3VMDialogComponent } from './components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component'; import { ServerDiscoveryComponent } from './components/servers/server-discovery/server-discovery.component'; import { ServersComponent } from './components/servers/servers.component'; import { ConsoleComponent } from './components/settings/console/console.component'; @@ -221,7 +219,6 @@ import { DockerConfigurationService } from './services/docker-configuration.serv import { DockerService } from './services/docker.service'; import { DrawingService } from './services/drawing.service'; import { ExternalSoftwareDefinitionService } from './services/external-software-definition.service'; -import { Gns3vmService } from './services/gns3vm.service'; import { GoogleAnalyticsService } from './services/google-analytics.service'; import { HttpServer, ServerErrorHandler } from './services/http-server.service'; import { InfoService } from './services/info.service'; @@ -435,8 +432,6 @@ import { LoggedUserComponent } from './components/users/logged-user/logged-user. AlignVerticallyActionComponent, ConfirmationBottomSheetComponent, ConfigDialogComponent, - Gns3vmComponent, - ConfigureGns3VMDialogComponent, ImportApplianceComponent, DirectLinkComponent, SystemStatusComponent, @@ -544,7 +539,6 @@ import { LoggedUserComponent } from './components/users/logged-user/logged-user. ComputeService, PacketCaptureService, NotificationService, - Gns3vmService, ThemeService, GoogleAnalyticsService, NodeConsoleService, @@ -577,7 +571,6 @@ import { LoggedUserComponent } from './components/users/logged-user/logged-user. InfoDialogComponent, ChangeSymbolDialogComponent, EditProjectDialogComponent, - ConfigureGns3VMDialogComponent, ConfiguratorDialogVpcsComponent, ConfiguratorDialogEthernetHubComponent, ConfiguratorDialogEthernetSwitchComponent, diff --git a/src/app/components/preferences/gns3vm/gns3vm.component.html b/src/app/components/preferences/gns3vm/gns3vm.component.html deleted file mode 100644 index 8f14cd4f..00000000 --- a/src/app/components/preferences/gns3vm/gns3vm.component.html +++ /dev/null @@ -1,66 +0,0 @@ -
-
-
-

GNS3 VM preferences

-
-
-
- - - Enable the GNS3 VM - - - - - {{ engine.name }} - - - - - - - {{ vm.vmname }} - - - - - Run the VM in headless mode - -
- - - - - - MB - - - - -
- - keep the GNS3 VM running - suspend the GNS3 VM - stop the GNS3 VM - -
-
- - -
-
-
diff --git a/src/app/components/preferences/gns3vm/gns3vm.component.scss b/src/app/components/preferences/gns3vm/gns3vm.component.scss deleted file mode 100644 index d1ec18bf..00000000 --- a/src/app/components/preferences/gns3vm/gns3vm.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -.form-field { - width: 100%; -} - -.select { - width: 100%; -} - -.radio-selection { - display: flex; - justify-content: space-between; -} diff --git a/src/app/components/preferences/gns3vm/gns3vm.component.spec.ts b/src/app/components/preferences/gns3vm/gns3vm.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/components/preferences/gns3vm/gns3vm.component.ts b/src/app/components/preferences/gns3vm/gns3vm.component.ts deleted file mode 100644 index 422facdc..00000000 --- a/src/app/components/preferences/gns3vm/gns3vm.component.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Gns3vm } from '../../../models/gns3vm/gns3vm'; -import { Gns3vmEngine } from '../../../models/gns3vm/gns3vmEngine'; -import { VM } from '../../../models/gns3vm/vm'; -import { Server } from '../../../models/server'; -import { Gns3vmService } from '../../../services/gns3vm.service'; -import { ServerService } from '../../../services/server.service'; -import { ToasterService } from '../../../services/toaster.service'; - -@Component({ - selector: 'app-gns3vm', - templateUrl: './gns3vm.component.html', - styleUrls: ['./gns3vm.component.scss'], -}) -export class Gns3vmComponent implements OnInit { - public server: Server; - public gns3vm: Gns3vm; - public vmEngines: Gns3vmEngine[]; - public vms: VM[] = []; - public vmForm: FormGroup; - public port: number; - - constructor( - private route: ActivatedRoute, - private serverService: ServerService, - private gns3vmService: Gns3vmService, - private router: Router, - private formBuilder: FormBuilder, - private toasterService: ToasterService - ) { - this.vmForm = this.formBuilder.group({ - ram: new FormControl(null, [Validators.required]), - vcpus: new FormControl(null, [Validators.required]), - }); - } - - ngOnInit() { - const server_id = this.route.snapshot.paramMap.get('server_id'); - this.serverService.get(parseInt(server_id, 10)).then((server: Server) => { - this.server = server; - this.gns3vmService.getGns3vm(this.server).subscribe((vm: Gns3vm) => { - this.gns3vm = vm; - this.vmForm.controls['ram'].setValue(this.gns3vm.ram); - this.vmForm.controls['vcpus'].setValue(this.gns3vm.vcpus); - if (this.gns3vm.port) this.port = this.gns3vm.port; - this.gns3vmService.getGns3vmEngines(this.server).subscribe((vmEngines: Gns3vmEngine[]) => { - this.vmEngines = vmEngines; - }); - this.gns3vmService.getVms(this.server, this.gns3vm.engine).subscribe((vms: VM[]) => { - this.vms = vms; - }); - }); - }); - } - - goBack() { - this.router.navigate(['/server', this.server.id, 'preferences']); - } - - setCloseAction(action: string) { - this.gns3vm.when_exit = action; - } - - changeVmEngine(event) { - this.gns3vmService.getVms(this.server, event.value).subscribe( - (vms: VM[]) => { - this.vms = vms; - }, - (error) => {} - ); - } - - save() { - if ((this.vmForm.valid && this.gns3vm.vmname) || (this.gns3vm.engine === 'remote' && this.gns3vm.vmname)) { - this.gns3vm.ram = this.vmForm.get('ram').value; - this.gns3vm.vcpus = this.vmForm.get('vcpus').value; - if (this.port) this.gns3vm.port = this.port; - - this.gns3vmService.updateGns3vm(this.server, this.gns3vm).subscribe(() => { - this.toasterService.success('GNS3 VM updated.'); - }); - this.goBack(); - } else { - this.toasterService.error('Fill all required fields with correct values.'); - } - } -} diff --git a/src/app/components/preferences/preferences.component.html b/src/app/components/preferences/preferences.component.html index fb92db78..2bcb9bf1 100644 --- a/src/app/components/preferences/preferences.component.html +++ b/src/app/components/preferences/preferences.component.html @@ -7,7 +7,6 @@
- GNS3 VM Built-in Dynamips IOS on Unix diff --git a/src/app/components/projects/projects.component.ts b/src/app/components/projects/projects.component.ts index c706e370..169aae4d 100644 --- a/src/app/components/projects/projects.component.ts +++ b/src/app/components/projects/projects.component.ts @@ -14,7 +14,6 @@ import { ProjectService } from '../../services/project.service'; import { RecentlyOpenedProjectService } from '../../services/recentlyOpenedProject.service'; import { Settings, SettingsService } from '../../services/settings.service'; import { ToasterService } from '../../services/toaster.service'; -import { ConfigureGns3VMDialogComponent } from '../servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component'; import { AddBlankProjectDialogComponent } from './add-blank-project-dialog/add-blank-project-dialog.component'; import { ChooseNameDialogComponent } from './choose-name-dialog/choose-name-dialog.component'; import { ConfirmationBottomSheetComponent } from './confirmation-bottomsheet/confirmation-bottomsheet.component'; @@ -64,23 +63,6 @@ export class ProjectsComponent implements OnInit { this.settings = this.settingsService.getAll(); this.projectService.projectListSubject.subscribe(() => this.refresh()); - - let gns3vmConfig = localStorage.getItem('gns3vmConfig'); - if (this.electronService.isElectronApp && gns3vmConfig !== 'configured') { - const dialogRef = this.dialog.open(ConfigureGns3VMDialogComponent, { - width: '350px', - height: '120px', - autoFocus: false, - disableClose: true, - }); - - dialogRef.afterClosed().subscribe((answer: boolean) => { - if (answer) { - localStorage.setItem('gns3vmConfig', 'configured'); - this.router.navigate(['/server', this.server.id, 'preferences', 'gns3vm']); - } - }); - } } goToPreferences() { diff --git a/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.html b/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.html deleted file mode 100644 index bc7ff337..00000000 --- a/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ message }} -
- - -
diff --git a/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.scss b/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.ts b/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.ts deleted file mode 100644 index 98c61a37..00000000 --- a/src/app/components/servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { MatDialogRef } from '@angular/material/dialog'; - -@Component({ - selector: 'app-configure-gns3-vm-dialog', - templateUrl: 'configure-gns3vm-dialog.component.html', - styleUrls: ['configure-gns3vm-dialog.component.scss'], -}) -export class ConfigureGns3VMDialogComponent implements OnInit { - public message: string = 'Do you want to configure GNS3 VM?'; - constructor(public dialogRef: MatDialogRef) {} - - ngOnInit() {} - - onNoClick(): void { - this.dialogRef.close(false); - } - - onYesClick(): void { - this.dialogRef.close(true); - } -} diff --git a/src/app/models/gns3vm/gns3vm.ts b/src/app/models/gns3vm/gns3vm.ts deleted file mode 100644 index 58df26c0..00000000 --- a/src/app/models/gns3vm/gns3vm.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface Gns3vm { - enable: boolean; - engine: string; - headless: boolean; - port: number; - ram: number; - vcpus: number; - vmname: string; - when_exit: string; -} diff --git a/src/app/models/gns3vm/gns3vmEngine.ts b/src/app/models/gns3vm/gns3vmEngine.ts deleted file mode 100644 index c63d0831..00000000 --- a/src/app/models/gns3vm/gns3vmEngine.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface Gns3vmEngine { - description: string; - engine_id: string; - name: string; - support_headless: boolean; - support_ram: boolean; - support_when_exit: boolean; -} diff --git a/src/app/models/gns3vm/vm.ts b/src/app/models/gns3vm/vm.ts deleted file mode 100644 index 856c98e7..00000000 --- a/src/app/models/gns3vm/vm.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface VM { - vmname: string; -} diff --git a/src/app/services/gns3vm.service.ts b/src/app/services/gns3vm.service.ts deleted file mode 100644 index b69a2488..00000000 --- a/src/app/services/gns3vm.service.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; -import { Gns3vm } from '../models/gns3vm/gns3vm'; -import { Gns3vmEngine } from '../models/gns3vm/gns3vmEngine'; -import { VM } from '../models/gns3vm/vm'; -import { Server } from '../models/server'; -import { HttpServer } from './http-server.service'; - -@Injectable() -export class Gns3vmService { - constructor(private httpServer: HttpServer) {} - - getGns3vm(server: Server): Observable { - return this.httpServer.get(server, '/gns3vm') as Observable; - } - - updateGns3vm(server: Server, gns3vm: Gns3vm): Observable { - return this.httpServer.put(server, `/gns3vm`, gns3vm) as Observable; - } - - getGns3vmEngines(server: Server): Observable { - return this.httpServer.get(server, '/gns3vm/engines') as Observable; - } - - getVms(server: Server, engine: string): Observable { - return this.httpServer.get(server, `/gns3vm/engines/${engine}/vms`); - } -} From 8e93fa9d36286ff45a4aa1bf13fcbcfbf8bb7f89 Mon Sep 17 00:00:00 2001 From: piotrpekala7 <31202938+piotrpekala7@users.noreply.github.com> Date: Thu, 10 Jun 2021 13:56:26 +0200 Subject: [PATCH 2/4] Update projects.component.spec.ts --- src/app/components/projects/projects.component.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/components/projects/projects.component.spec.ts b/src/app/components/projects/projects.component.spec.ts index c2f9625a..12960868 100644 --- a/src/app/components/projects/projects.component.spec.ts +++ b/src/app/components/projects/projects.component.spec.ts @@ -24,7 +24,6 @@ import { ServerService } from '../../services/server.service'; import { MockedServerService } from '../../services/server.service.spec'; import { Settings, SettingsService } from '../../services/settings.service'; import { ToasterService } from '../../services/toaster.service'; -import { ConfigureGns3VMDialogComponent } from '../servers/configure-gns3vm-dialog/configure-gns3vm-dialog.component'; import { ChooseNameDialogComponent } from './choose-name-dialog/choose-name-dialog.component'; import { ProjectsComponent } from './projects.component'; @@ -74,11 +73,11 @@ xdescribe('ProjectsComponent', () => { { provide: ElectronService, useValue: electronService }, ProgressService, ], - declarations: [ProjectsComponent, ChooseNameDialogComponent, ConfigureGns3VMDialogComponent, ProjectsFilter], + declarations: [ProjectsComponent, ChooseNameDialogComponent, ProjectsFilter], schemas: [NO_ERRORS_SCHEMA], }) .overrideModule(BrowserDynamicTestingModule, { - set: { entryComponents: [ChooseNameDialogComponent, ConfigureGns3VMDialogComponent] }, + set: { entryComponents: [ChooseNameDialogComponent] }, }) .compileComponents(); From 21dfa56b17da03b797aa03785898066e211bb7d6 Mon Sep 17 00:00:00 2001 From: piotrpekala7 <31202938+piotrpekala7@users.noreply.github.com> Date: Thu, 10 Jun 2021 15:50:13 +0200 Subject: [PATCH 3/4] Removing fields related to gns3 vm from templates --- .../cloud-nodes-add-template.component.html | 7 ------- .../cloud-nodes-add-template.component.ts | 15 ++------------- .../ethernet-hubs-add-template.component.html | 7 ------- .../ethernet-hubs-add-template.component.ts | 15 ++------------- ...thernet-switches-add-template.component.html | 7 ------- .../ethernet-switches-add-template.component.ts | 15 ++------------- .../add-docker-template.component.html | 9 +-------- .../add-docker-template.component.ts | 15 ++------------- .../add-ios-template.component.html | 9 +-------- .../add-ios-template.component.ts | 16 ++-------------- .../add-iou-template.component.html | 9 +-------- .../add-iou-template.component.ts | 15 ++------------- .../add-qemu-vm-template.component.html | 9 +-------- .../add-qemu-vm-template.component.ts | 15 ++------------- .../add-vpcs-template.component.html | 7 ------- .../add-vpcs-template.component.ts | 17 +++-------------- 16 files changed, 21 insertions(+), 166 deletions(-) diff --git a/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.html b/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.html index 89cf0f0c..9f45ad6b 100644 --- a/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.html +++ b/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.html @@ -10,13 +10,6 @@ Run the cloud node locally - Run the cloud node on the GNS3 VM
diff --git a/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.ts b/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.ts index 9910b72d..47146b34 100644 --- a/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.ts +++ b/src/app/components/preferences/built-in/cloud-nodes/cloud-nodes-add-template/cloud-nodes-add-template.component.ts @@ -20,9 +20,6 @@ export class CloudNodesAddTemplateComponent implements OnInit { server: Server; templateName: string = ''; formGroup: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -44,19 +41,11 @@ export class CloudNodesAddTemplateComponent implements OnInit { const server_id = this.route.snapshot.paramMap.get('server_id'); this.serverService.get(parseInt(server_id, 10)).then((server: Server) => { this.server = server; - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -75,7 +64,7 @@ export class CloudNodesAddTemplateComponent implements OnInit { cloudTemplate.template_id = uuid(); cloudTemplate.name = this.formGroup.get('templateName').value; - cloudTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + cloudTemplate.compute_id = 'local'; this.builtInTemplatesService.addTemplate(this.server, cloudTemplate).subscribe((cloudNodeTemplate) => { this.goBack(); diff --git a/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.html b/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.html index 0e90b602..f1bcac9a 100644 --- a/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.html +++ b/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.html @@ -10,13 +10,6 @@ Run the Ethernet Hub locally - Run the Ethernet Hub on the GNS3 VM diff --git a/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.ts b/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.ts index 7a3d4da8..025aa407 100644 --- a/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.ts +++ b/src/app/components/preferences/built-in/ethernet-hubs/ethernet-hubs-add-template/ethernet-hubs-add-template.component.ts @@ -20,9 +20,6 @@ export class EthernetHubsAddTemplateComponent implements OnInit { server: Server; templateName: string = ''; formGroup: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -45,19 +42,11 @@ export class EthernetHubsAddTemplateComponent implements OnInit { const server_id = this.route.snapshot.paramMap.get('server_id'); this.serverService.get(parseInt(server_id, 10)).then((server: Server) => { this.server = server; - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -76,7 +65,7 @@ export class EthernetHubsAddTemplateComponent implements OnInit { ethernetHubTemplate.template_id = uuid(); ethernetHubTemplate.name = this.formGroup.get('templateName').value; - ethernetHubTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + ethernetHubTemplate.compute_id = 'local'; for (let i = 0; i < this.formGroup.get('numberOfPorts').value; i++) { ethernetHubTemplate.ports_mapping.push({ diff --git a/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.html b/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.html index ca42cf47..f032d679 100644 --- a/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.html +++ b/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.html @@ -10,13 +10,6 @@ Run the Ethernet switch locally - Run the Ethernet switch on the GNS3 VM diff --git a/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.ts b/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.ts index 4bfd638c..0b22cd28 100644 --- a/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.ts +++ b/src/app/components/preferences/built-in/ethernet-switches/ethernet-switches-add-template/ethernet-switches-add-template.component.ts @@ -20,9 +20,6 @@ export class EthernetSwitchesAddTemplateComponent implements OnInit { server: Server; templateName: string = ''; formGroup: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -45,10 +42,6 @@ export class EthernetSwitchesAddTemplateComponent implements OnInit { const server_id = this.route.snapshot.paramMap.get('server_id'); this.serverService.get(parseInt(server_id, 10)).then((server: Server) => { this.server = server; - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } @@ -57,11 +50,7 @@ export class EthernetSwitchesAddTemplateComponent implements OnInit { } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -76,7 +65,7 @@ export class EthernetSwitchesAddTemplateComponent implements OnInit { ethernetSwitchTemplate.template_id = uuid(); ethernetSwitchTemplate.name = this.formGroup.get('templateName').value; - ethernetSwitchTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + ethernetSwitchTemplate.compute_id = 'local'; for (let i = 0; i < this.formGroup.get('numberOfPorts').value; i++) { ethernetSwitchTemplate.ports_mapping.push({ diff --git a/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.html b/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.html index 6742275e..07694078 100644 --- a/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.html +++ b/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.html @@ -7,19 +7,12 @@
- + Run this Docker container locally - Run this Docker container on the GNS3 VM diff --git a/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.ts b/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.ts index f7d0529d..e496b159 100644 --- a/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.ts +++ b/src/app/components/preferences/docker/add-docker-template/add-docker-template.component.ts @@ -30,9 +30,6 @@ export class AddDockerTemplateComponent implements OnInit { virtualMachineForm: FormGroup; containerNameForm: FormGroup; networkAdaptersForm: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -72,10 +69,6 @@ export class AddDockerTemplateComponent implements OnInit { this.dockerTemplate = dockerTemplate; }); - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); - this.dockerService.getImages(server).subscribe((images) => { this.dockerImages = images; }); @@ -83,11 +76,7 @@ export class AddDockerTemplateComponent implements OnInit { } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -116,7 +105,7 @@ export class AddDockerTemplateComponent implements OnInit { this.dockerTemplate.name = this.containerNameForm.get('templateName').value; this.dockerTemplate.adapters = +this.networkAdaptersForm.get('adapters').value; - this.dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + this.dockerTemplate.compute_id = 'local'; this.dockerService.addTemplate(this.server, this.dockerTemplate).subscribe((template: DockerTemplate) => { this.goBack(); diff --git a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html index 1b41b969..b51d4bf1 100644 --- a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html +++ b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html @@ -7,18 +7,11 @@
- + Run this IOS router locally - Run this IOS router on the GNS3 VM diff --git a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts index f420859a..6b3118e2 100644 --- a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts +++ b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts @@ -45,9 +45,6 @@ export class AddIosTemplateComponent implements OnInit { ciscoUrl: string = 'https://cfn.cloudapps.cisco.com/ITDIT/CFN/jsp/SearchBySoftware.jsp'; uploader: FileUploader; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -114,19 +111,11 @@ export class AddIosTemplateComponent implements OnInit { this.chassis = this.iosConfigurationService.getChassis(); this.defaultRam = this.iosConfigurationService.getDefaultRamSettings(); }); - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -174,8 +163,7 @@ export class AddIosTemplateComponent implements OnInit { if (this.networkAdaptersForTemplate.length > 0) this.completeAdaptersData(); if (this.networkModulesForTemplate.length > 0) this.completeModulesData(); - - this.iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + this.iosTemplate.compute_id = 'local'; this.iosService.addTemplate(this.server, this.iosTemplate).subscribe((template: IosTemplate) => { this.goBack(); diff --git a/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.html b/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.html index 28c73807..1b6e2b02 100644 --- a/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.html +++ b/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.html @@ -7,18 +7,11 @@
- + Run this IOU device locally - Run this IOU device on the GNS3 VM diff --git a/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.ts b/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.ts index 13a7568c..61b55071 100644 --- a/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.ts +++ b/src/app/components/preferences/ios-on-unix/add-iou-template/add-iou-template.component.ts @@ -30,9 +30,6 @@ export class AddIouTemplateComponent implements OnInit { templateNameForm: FormGroup; imageForm: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -82,10 +79,6 @@ export class AddIouTemplateComponent implements OnInit { this.templateMocksService.getIouTemplate().subscribe((iouTemplate: IouTemplate) => { this.iouTemplate = iouTemplate; }); - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } @@ -96,11 +89,7 @@ export class AddIouTemplateComponent implements OnInit { } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -134,7 +123,7 @@ export class AddIouTemplateComponent implements OnInit { this.iouTemplate.template_id = uuid(); this.iouTemplate.name = this.templateNameForm.get('templateName').value; if (this.newImageSelected) this.iouTemplate.path = this.imageForm.get('imageName').value; - this.iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + this.iouTemplate.compute_id = 'local'; if (this.selectedType === 'L2 image') { this.iouTemplate.ethernet_adapters = 4; diff --git a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html index 3620769c..a55c007b 100644 --- a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html +++ b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html @@ -7,18 +7,11 @@
- + Run this QEMU VM locally - Run this QEMU VM on the GNS3 VM diff --git a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts index 739844fb..9c3a98ae 100644 --- a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts +++ b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts @@ -36,9 +36,6 @@ export class AddQemuVmTemplateComponent implements OnInit { nameForm: FormGroup; memoryForm: FormGroup; diskForm: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -105,19 +102,11 @@ export class AddQemuVmTemplateComponent implements OnInit { }); this.consoleTypes = this.configurationService.getConsoleTypes(); - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -154,7 +143,7 @@ export class AddQemuVmTemplateComponent implements OnInit { } this.qemuTemplate.template_id = uuid(); this.qemuTemplate.name = this.nameForm.get('templateName').value; - this.qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + this.qemuTemplate.compute_id = 'local'; this.qemuService.addTemplate(this.server, this.qemuTemplate).subscribe((template: QemuTemplate) => { this.goBack(); diff --git a/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.html b/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.html index f650eb76..dd9b61f3 100644 --- a/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.html +++ b/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.html @@ -10,13 +10,6 @@ Run the VPCS node locally - Run the VPCS node on the GNS3 VM diff --git a/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.ts b/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.ts index 72feec80..964b3f9b 100644 --- a/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.ts +++ b/src/app/components/preferences/vpcs/add-vpcs-template/add-vpcs-template.component.ts @@ -20,9 +20,6 @@ export class AddVpcsTemplateComponent implements OnInit { server: Server; templateName: string = ''; templateNameForm: FormGroup; - - isGns3VmAvailable: boolean = false; - isGns3VmChosen: boolean = false; isLocalComputerChosen: boolean = true; constructor( @@ -44,19 +41,11 @@ export class AddVpcsTemplateComponent implements OnInit { const server_id = this.route.snapshot.paramMap.get('server_id'); this.serverService.get(parseInt(server_id, 10)).then((server: Server) => { this.server = server; - - this.computeService.getComputes(server).subscribe((computes: Compute[]) => { - if (computes.filter((compute) => compute.compute_id === 'vm').length > 0) this.isGns3VmAvailable = true; - }); }); } setServerType(serverType: string) { - if (serverType === 'gns3 vm' && this.isGns3VmAvailable) { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; + if (serverType === 'local') { this.isLocalComputerChosen = true; } } @@ -76,8 +65,8 @@ export class AddVpcsTemplateComponent implements OnInit { }); (vpcsTemplate.template_id = uuid()), - (vpcsTemplate.name = this.templateName), - (vpcsTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'); + (vpcsTemplate.name = this.templateName), + (vpcsTemplate.compute_id = 'local'); this.vpcsService.addTemplate(this.server, vpcsTemplate).subscribe(() => { this.goBack(); From 62c94275a9688b21c1827e8ccf50bb53cc8669aa Mon Sep 17 00:00:00 2001 From: piotrpekala7 <31202938+piotrpekala7@users.noreply.github.com> Date: Thu, 10 Jun 2021 16:21:49 +0200 Subject: [PATCH 4/4] Removing data from appliance dialog --- .../new-template-dialog.component.html | 44 +++---------------- .../new-template-dialog.component.ts | 24 +++------- 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html index 734e07d7..c1a045ba 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html @@ -129,31 +129,23 @@ {{ secondActionTitle }} - + Please configure GNS3 VM to install selected appliance - +
Server type
Install the appliance locally - Install the appliance on the GNS3 VM
@@ -302,20 +294,12 @@ Install the appliance locally - Install the appliance on the GNS3 VM
@@ -386,20 +362,12 @@ Install the appliance locally - Install the appliance on the GNS3 VM
diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts index 2b886b4c..5e6ce277 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts @@ -58,11 +58,7 @@ export class NewTemplateDialogComponent implements OnInit { public appliances: Appliance[] = []; public applianceToInstall: Appliance; public selectedImages: any[]; - - public isGns3VmAvailable = false; public isLinuxPlatform = false; - - private isGns3VmChosen = false; private isLocalComputerChosen = false; public qemuBinaries: QemuBinary[] = []; @@ -106,10 +102,6 @@ export class NewTemplateDialogComponent implements OnInit { this.computeService.getComputes(this.server).subscribe((computes) => { computes.forEach((compute) => { - if (compute.compute_id === 'vm') { - this.isGns3VmAvailable = true; - this.isGns3VmChosen = true; - } if (compute.capabilities.platform === 'linux') this.isLinuxPlatform = true; }); }); @@ -283,13 +275,7 @@ export class NewTemplateDialogComponent implements OnInit { } setServerType(serverType: string) { - if (serverType === 'gns3 vm') { - this.isGns3VmChosen = true; - this.isLocalComputerChosen = false; - } else { - this.isGns3VmChosen = false; - this.isLocalComputerChosen = true; - } + this.isLocalComputerChosen = true; } sortData(sort: Sort) { @@ -487,7 +473,7 @@ export class NewTemplateDialogComponent implements OnInit { iouTemplate.category = this.getCategory(); iouTemplate.default_name_format = this.applianceToInstall.port_name_format; iouTemplate.symbol = this.applianceToInstall.symbol; - iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + iouTemplate.compute_id = 'local'; iouTemplate.template_id = uuid(); iouTemplate.path = image.filename; iouTemplate.template_type = 'iou'; @@ -536,7 +522,7 @@ export class NewTemplateDialogComponent implements OnInit { iosTemplate.category = this.getCategory(); iosTemplate.default_name_format = this.applianceToInstall.port_name_format; iosTemplate.symbol = this.applianceToInstall.symbol; - iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + iosTemplate.compute_id = 'local'; iosTemplate.template_id = uuid(); iosTemplate.image = image.filename; iosTemplate.template_type = 'dynamips'; @@ -574,7 +560,7 @@ export class NewTemplateDialogComponent implements OnInit { dockerTemplate.category = this.getCategory(); dockerTemplate.default_name_format = this.applianceToInstall.port_name_format; dockerTemplate.symbol = this.applianceToInstall.symbol; - dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + dockerTemplate.compute_id = 'local'; dockerTemplate.template_id = uuid(); dockerTemplate.image = this.applianceToInstall.docker.image; dockerTemplate.template_type = 'docker'; @@ -631,7 +617,7 @@ export class NewTemplateDialogComponent implements OnInit { qemuTemplate.port_name_format = this.applianceToInstall.port_name_format; qemuTemplate.symbol = this.applianceToInstall.symbol; qemuTemplate.qemu_path = this.selectedBinary.path; - qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; + qemuTemplate.compute_id = 'local'; qemuTemplate.template_id = uuid(); qemuTemplate.hda_disk_image = version.images.hda_disk_image; qemuTemplate.hdb_disk_image = version.images.hdb_disk_image;