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 @@
-
-
-
-
-
- Enable the GNS3 VM
-
-
-
-
- {{ engine.name }}
-
-
-
-
-
-
- {{ vm.vmname }}
-
-
-
-
- Run the VM in headless mode
-
-
-
- keep the GNS3 VM running
- suspend the GNS3 VM
- stop the GNS3 VM
-
-
-
- Cancel
- Save
-
-
-
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 }}
-
- No
-
- Yes
-
-
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