Removing traceng related code

This commit is contained in:
piotrpekala7 2021-04-28 12:43:35 +02:00
parent 4eefe89eb1
commit 84f7fabdc8
26 changed files with 1 additions and 509 deletions

View File

@ -158,11 +158,6 @@ const routes: Routes = [
},
{ path: 'server/:server_id/preferences/vmware/addtemplate', component: AddVmwareTemplateComponent },
// { path: 'server/:server_id/preferences/traceng', component: TracengPreferencesComponent },
// { path: 'server/:server_id/preferences/traceng/templates', component: TracengTemplatesComponent },
// { path: 'server/:server_id/preferences/traceng/templates/:template_id', component: TracengTemplateDetailsComponent },
// { path: 'server/:server_id/preferences/traceng/addtemplate', component: AddTracengTemplateComponent },
{ path: 'server/:server_id/preferences/docker/templates', component: DockerTemplatesComponent },
{
path: 'server/:server_id/preferences/docker/templates/:template_id',

View File

@ -88,10 +88,6 @@ import { CopyQemuVmTemplateComponent } from './components/preferences/qemu/copy-
import { QemuPreferencesComponent } from './components/preferences/qemu/qemu-preferences/qemu-preferences.component';
import { QemuVmTemplateDetailsComponent } from './components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component';
import { QemuVmTemplatesComponent } from './components/preferences/qemu/qemu-vm-templates/qemu-vm-templates.component';
import { AddTracengTemplateComponent } from './components/preferences/traceng/add-traceng/add-traceng-template.component';
import { TracengPreferencesComponent } from './components/preferences/traceng/traceng-preferences/traceng-preferences.component';
import { TracengTemplateDetailsComponent } from './components/preferences/traceng/traceng-template-details/traceng-template-details.component';
import { TracengTemplatesComponent } from './components/preferences/traceng/traceng-templates/traceng-templates.component';
import { AddVirtualBoxTemplateComponent } from './components/preferences/virtual-box/add-virtual-box-template/add-virtual-box-template.component';
import { VirtualBoxPreferencesComponent } from './components/preferences/virtual-box/virtual-box-preferences/virtual-box-preferences.component';
import { VirtualBoxTemplateDetailsComponent } from './components/preferences/virtual-box/virtual-box-template-details/virtual-box-template-details.component';
@ -168,7 +164,6 @@ import { ConfiguratorDialogNatComponent } from './components/project-map/node-ed
import { ConfiguratorDialogQemuComponent } from './components/project-map/node-editors/configurator/qemu/configurator-qemu.component';
import { QemuImageCreatorComponent } from './components/project-map/node-editors/configurator/qemu/qemu-image-creator/qemu-image-creator.component';
import { ConfiguratorDialogSwitchComponent } from './components/project-map/node-editors/configurator/switch/configurator-switch.component';
import { ConfiguratorDialogTracengComponent } from './components/project-map/node-editors/configurator/traceng/configurator-traceng.component';
import { ConfiguratorDialogVirtualBoxComponent } from './components/project-map/node-editors/configurator/virtualbox/configurator-virtualbox.component';
import { ConfiguratorDialogVmwareComponent } from './components/project-map/node-editors/configurator/vmware/configurator-vmware.component';
import { ConfiguratorDialogVpcsComponent } from './components/project-map/node-editors/configurator/vpcs/configurator-vpcs.component';
@ -263,7 +258,6 @@ import { TemplateService } from './services/template.service';
import { ThemeService } from './services/theme.service';
import { ToasterService } from './services/toaster.service';
import { ToolsService } from './services/tools.service';
import { TracengService } from './services/traceng.service';
import { UpdatesService } from './services/updates.service';
import { VersionService } from './services/version.service';
import { VirtualBoxConfigurationService } from './services/virtual-box-configuration.service';
@ -424,11 +418,6 @@ import { MarkedDirective } from './directives/marked.directive';
ConfiguratorDialogIosComponent,
ConfiguratorDialogDockerComponent,
ConfiguratorDialogNatComponent,
ConfiguratorDialogTracengComponent,
AddTracengTemplateComponent,
TracengPreferencesComponent,
TracengTemplatesComponent,
TracengTemplateDetailsComponent,
QemuImageCreatorComponent,
ChooseNameDialogComponent,
StartCaptureOnStartedLinkActionComponent,
@ -549,7 +538,6 @@ import { MarkedDirective } from './directives/marked.directive';
MapSettingsService,
InfoService,
ComputeService,
TracengService,
PacketCaptureService,
NotificationService,
Gns3vmService,
@ -596,7 +584,6 @@ import { MarkedDirective } from './directives/marked.directive';
ConfiguratorDialogIosComponent,
ConfiguratorDialogDockerComponent,
ConfiguratorDialogNatComponent,
ConfiguratorDialogTracengComponent,
QemuImageCreatorComponent,
ChooseNameDialogComponent,
NavigationDialogComponent,

View File

@ -16,9 +16,6 @@
<mat-list-item routerLink="/server/{{ serverId }}/preferences/virtualbox/templates"> VirtualBox </mat-list-item>
<mat-list-item routerLink="/server/{{ serverId }}/preferences/vmware/templates"> VMware </mat-list-item>
<mat-list-item routerLink="/server/{{ serverId }}/preferences/docker/templates"> Docker </mat-list-item>
<!-- <mat-list-item routerLink="/server/{{serverId}}/preferences/traceng/templates">
TraceNG
</mat-list-item> -->
</mat-nav-list>
</div>
</div>

View File

@ -1,23 +0,0 @@
<div class="content">
<div class="default-header">
<div class="row">
<h1 class="col">New VPCS node template</h1>
</div>
</div>
<div class="default-content">
<mat-card class="matCard">
<form [formGroup]="templateNameForm">
<mat-form-field class="form-field">
<input matInput formControlName="templateName" type="text" placeholder="Template name" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput formControlName="ipAddress" type="text" placeholder="IP address" />
</mat-form-field>
</form>
</mat-card>
<div class="buttons-bar">
<button mat-button class="cancel-button" (click)="goBack()">Cancel</button>
<button mat-raised-button color="primary" (click)="addTemplate()">Add template</button>
</div>
</div>
</div>

View File

@ -1,66 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { v4 as uuid } from 'uuid';
import { Server } from '../../../../models/server';
import { TracengTemplate } from '../../../../models/templates/traceng-template';
import { ServerService } from '../../../../services/server.service';
import { TemplateMocksService } from '../../../../services/template-mocks.service';
import { ToasterService } from '../../../../services/toaster.service';
import { TracengService } from '../../../../services/traceng.service';
@Component({
selector: 'app-add-traceng-template',
templateUrl: './add-traceng-template.component.html',
styleUrls: ['./add-traceng-template.component.scss', '../../preferences.component.scss'],
})
export class AddTracengTemplateComponent implements OnInit {
server: Server;
templateName: string = '';
ipAddress: string = '';
templateNameForm: FormGroup;
constructor(
private route: ActivatedRoute,
private serverService: ServerService,
private tracengService: TracengService,
private router: Router,
private toasterService: ToasterService,
private templateMocksService: TemplateMocksService,
private formBuilder: FormBuilder
) {
this.templateNameForm = this.formBuilder.group({
templateName: new FormControl(null, [Validators.required]),
ipAddress: 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;
});
}
goBack() {
this.router.navigate(['/server', this.server.id, 'preferences', 'traceng', 'templates']);
}
addTemplate() {
if (!this.templateNameForm.invalid) {
this.templateName = this.templateNameForm.get('templateName').value;
this.ipAddress = this.templateNameForm.get('ipAddress').value;
let tracengTemplate: TracengTemplate = this.templateMocksService.getTracengTemplate();
tracengTemplate.template_id = uuid();
tracengTemplate.name = this.templateName;
tracengTemplate.ip_address = this.ipAddress;
this.tracengService.addTemplate(this.server, tracengTemplate).subscribe(() => {
this.goBack();
});
} else {
this.toasterService.error(`Fill all required fields`);
}
}
}

View File

@ -1,12 +0,0 @@
<div class="content">
<div class="default-header">
<div class="row">
<h1 class="col">TraceNG preferences</h1>
</div>
</div>
<div class="default-content">
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="tracengExecutable" placeholder="Path to TraceNG executable" />
</mat-form-field>
</div>
</div>

View File

@ -1,28 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Server } from '../../../../models/server';
import { ServerService } from '../../../../services/server.service';
@Component({
selector: 'app-traceng-preferences',
templateUrl: './traceng-preferences.component.html',
styleUrls: ['./traceng-preferences.component.scss'],
})
export class TracengPreferencesComponent implements OnInit {
server: Server;
tracengExecutable: string;
constructor(private route: ActivatedRoute, private serverService: ServerService) {}
ngOnInit() {
const server_id = this.route.snapshot.paramMap.get('server_id');
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
this.server = server;
});
}
restoreDefaults() {
this.tracengExecutable = '';
}
}

View File

@ -1,51 +0,0 @@
<div class="content" [ngClass]="{ shadowed: isSymbolSelectionOpened }">
<div class="default-header">
<div class="row">
<h1 class="col">TraceNG device configuration</h1>
</div>
</div>
<div class="default-content" *ngIf="tracengTemplate">
<mat-card class="matCard">
<form [formGroup]="inputForm">
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="tracengTemplate.name"
formControlName="templateName"
placeholder="Template name"
/>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="tracengTemplate.default_name_format"
formControlName="defaultName"
placeholder="Default name format"
/>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="tracengTemplate.symbol"
formControlName="symbol"
placeholder="Symbol"
/>
</mat-form-field>
<button mat-button class="symbolSelectionButton" (click)="chooseSymbol()">Choose symbol</button><br /><br />
</form>
</mat-card>
<div class="buttons-bar">
<button class="cancel-button" (click)="goBack()" mat-button>Cancel</button>
<button mat-raised-button color="primary" (click)="onSave()">Save</button>
</div>
</div>
</div>
<app-symbols-menu
*ngIf="isSymbolSelectionOpened && tracengTemplate"
[server]="server"
[symbol]="tracengTemplate.symbol"
(symbolChangedEmitter)="symbolChanged($event)"
></app-symbols-menu>

View File

@ -1,72 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Server } from '../../../../models/server';
import { TracengTemplate } from '../../../../models/templates/traceng-template';
import { ServerService } from '../../../../services/server.service';
import { ToasterService } from '../../../../services/toaster.service';
import { TracengService } from '../../../../services/traceng.service';
@Component({
selector: 'app-traceng-template-details',
templateUrl: './traceng-template-details.component.html',
styleUrls: ['./traceng-template-details.component.scss', '../../preferences.component.scss'],
})
export class TracengTemplateDetailsComponent implements OnInit {
server: Server;
tracengTemplate: TracengTemplate;
inputForm: FormGroup;
isSymbolSelectionOpened: boolean = false;
constructor(
private route: ActivatedRoute,
private serverService: ServerService,
private tracengService: TracengService,
private toasterService: ToasterService,
private formBuilder: FormBuilder,
private router: Router
) {
this.inputForm = this.formBuilder.group({
templateName: new FormControl('', Validators.required),
defaultName: new FormControl('', Validators.required),
symbol: new FormControl('', Validators.required),
});
}
ngOnInit() {
const server_id = this.route.snapshot.paramMap.get('server_id');
const template_id = this.route.snapshot.paramMap.get('template_id');
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
this.server = server;
this.tracengService.getTemplate(this.server, template_id).subscribe((tracengTemplate: TracengTemplate) => {
this.tracengTemplate = tracengTemplate;
});
});
}
goBack() {
this.router.navigate(['/server', this.server.id, 'preferences', 'traceng', 'templates']);
}
onSave() {
if (this.inputForm.invalid) {
this.toasterService.error(`Fill all required fields`);
} else {
this.tracengService
.saveTemplate(this.server, this.tracengTemplate)
.subscribe((tracengTemplate: TracengTemplate) => {
this.toasterService.success('Changes saved');
});
}
}
chooseSymbol() {
this.isSymbolSelectionOpened = !this.isSymbolSelectionOpened;
}
symbolChanged(chosenSymbol: string) {
this.isSymbolSelectionOpened = !this.isSymbolSelectionOpened;
this.tracengTemplate.symbol = chosenSymbol;
}
}

View File

@ -1,46 +0,0 @@
<div class="content">
<div class="default-header">
<div class="row">
<h1 class="col">TraceNG node templates</h1>
<button
*ngIf="server"
class="top-button"
class="cancel-button"
routerLink="/server/{{ server.id }}/preferences"
mat-button
>
Back
</button>
<button
*ngIf="server"
class="top-button"
routerLink="/server/{{ server.id }}/preferences/traceng/addtemplate"
mat-raised-button
color="primary"
>
Add TraceNG template
</button>
</div>
</div>
<app-empty-templates-list *ngIf="!tracengTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="tracengTemplates.length">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor="let template of tracengTemplates">
<mat-list-item class="template-name" routerLink="{{ template.template_id }}">{{
template.name
}}</mat-list-item>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>
</div>
</div>
<app-delete-template #deleteComponent [server]="server" (deleteEvent)="onDeleteEvent()"> </app-delete-template>

View File

@ -1,46 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Server } from '../../../../models/server';
import { TracengTemplate } from '../../../../models/templates/traceng-template';
import { ServerService } from '../../../../services/server.service';
import { TracengService } from '../../../../services/traceng.service';
import { DeleteTemplateComponent } from '../../common/delete-template-component/delete-template.component';
@Component({
selector: 'app-traceng-templates',
templateUrl: './traceng-templates.component.html',
styleUrls: ['./traceng-templates.component.scss', '../../preferences.component.scss'],
})
export class TracengTemplatesComponent implements OnInit {
server: Server;
tracengTemplates: TracengTemplate[] = [];
@ViewChild(DeleteTemplateComponent) deleteComponent: DeleteTemplateComponent;
constructor(
private route: ActivatedRoute,
private serverService: ServerService,
private tracengService: TracengService
) {}
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.getTemplates();
});
}
getTemplates() {
this.tracengService.getTemplates(this.server).subscribe((tracengTemplates: TracengTemplate[]) => {
this.tracengTemplates = tracengTemplates.filter((elem) => elem.template_type === 'traceng' && !elem.builtin);
});
}
deleteTemplate(template: TracengTemplate) {
this.deleteComponent.deleteItem(template.name, template.template_id);
}
onDeleteEvent() {
this.getTemplates();
}
}

View File

@ -12,7 +12,6 @@ import { ConfiguratorDialogIouComponent } from '../../../node-editors/configurat
import { ConfiguratorDialogNatComponent } from '../../../node-editors/configurator/nat/configurator-nat.component';
import { ConfiguratorDialogQemuComponent } from '../../../node-editors/configurator/qemu/configurator-qemu.component';
import { ConfiguratorDialogSwitchComponent } from '../../../node-editors/configurator/switch/configurator-switch.component';
import { ConfiguratorDialogTracengComponent } from '../../../node-editors/configurator/traceng/configurator-traceng.component';
import { ConfiguratorDialogVirtualBoxComponent } from '../../../node-editors/configurator/virtualbox/configurator-virtualbox.component';
import { ConfiguratorDialogVmwareComponent } from '../../../node-editors/configurator/vmware/configurator-vmware.component';
import { ConfiguratorDialogVpcsComponent } from '../../../node-editors/configurator/vpcs/configurator-vpcs.component';
@ -60,8 +59,6 @@ export class ConfigActionComponent {
this.dialogRef = this.dialog.open(ConfiguratorDialogSwitchComponent, this.conf);
} else if (this.node.node_type === 'atm_switch') {
this.dialogRef = this.dialog.open(ConfiguratorDialogAtmSwitchComponent, this.conf);
} else if (this.node.node_type === 'traceng') {
this.dialogRef = this.dialog.open(ConfiguratorDialogTracengComponent, this.conf);
}
let instance = this.dialogRef.componentInstance;

View File

@ -1,20 +0,0 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<div class="modal-form-container">
<div class="content">
<div class="default-content">
<mat-card class="matCard">
<form [formGroup]="generalSettingsForm">
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="node.name" formControlName="name" placeholder="Name" />
</mat-form-field>
</form>
</mat-card>
</div>
</div>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onCancelClick()" color="accent">Cancel</button>
<button mat-button (click)="onSaveClick()" tabindex="2" mat-raised-button color="primary">Apply</button>
</div>

View File

@ -1,52 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { NodeService } from '../../../../../services/node.service';
import { ToasterService } from '../../../../../services/toaster.service';
@Component({
selector: 'app-configurator-traceng',
templateUrl: './configurator-traceng.component.html',
styleUrls: ['../configurator.component.scss'],
})
export class ConfiguratorDialogTracengComponent implements OnInit {
server: Server;
node: Node;
name: string;
generalSettingsForm: FormGroup;
constructor(
public dialogRef: MatDialogRef<ConfiguratorDialogTracengComponent>,
public nodeService: NodeService,
private toasterService: ToasterService,
private formBuilder: FormBuilder
) {
this.generalSettingsForm = this.formBuilder.group({
name: new FormControl('', Validators.required),
});
}
ngOnInit() {
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
this.node = node;
this.name = node.name;
});
}
onSaveClick() {
if (this.generalSettingsForm.valid) {
this.nodeService.updateNode(this.server, this.node).subscribe(() => {
this.toasterService.success(`Node ${this.node.name} updated.`);
this.onCancelClick();
});
} else {
this.toasterService.error(`Fill all required fields.`);
}
}
onCancelClick() {
this.dialogRef.close();
}
}

View File

@ -51,7 +51,7 @@ export class CreateSnapshotDialogComponent {
}
isAlwaysRunningNode(nodeType: string) {
return !['qemu', 'docker', 'dynamips', 'vpcs', 'vmware', 'virtualbox', 'iou', 'traceng'].includes(nodeType);
return !['qemu', 'docker', 'dynamips', 'vpcs', 'vmware', 'virtualbox', 'iou'].includes(nodeType);
}
onAddClick(): void {

View File

@ -26,7 +26,6 @@ export class TemplateListDialogComponent implements OnInit {
'docker',
'dynamips',
'vpcs',
'traceng',
'virtualbox',
'vmware',
'iou',

View File

@ -30,7 +30,6 @@ export class TemplateComponent implements OnInit, OnDestroy {
'docker',
'dynamips',
'vpcs',
'traceng',
'virtualbox',
'vmware',
'iou',

View File

@ -1,12 +0,0 @@
export interface TracengTemplate {
builtin: boolean;
category: string;
compute_id: string;
console_type: string;
default_name_format: string;
ip_address: string;
name: string;
symbol: string;
template_id: string;
template_type: string;
}

View File

@ -23,8 +23,6 @@ export class InfoService {
infoList.push(`Docker ${node.name} is ${node.status}.`);
} else if (node.node_type === 'dynamips') {
infoList.push(`Dynamips ${node.name} is always on.`);
} else if (node.node_type === 'traceng') {
infoList.push(`TraceNG ${node.name} is always on.`);
} else if (node.node_type === 'virtualbox') {
infoList.push(`VirtualBox VM ${node.name} is ${node.status}.`);
} else if (node.node_type === 'vmware') {
@ -64,7 +62,6 @@ export class InfoService {
node.node_type === 'frame_relay_switch' ||
node.node_type === 'atm_switch' ||
node.node_type === 'dynamips' ||
node.node_type === 'traceng' ||
node.node_type === 'iou'
) {
return 'Command line information is not supported for this type of node.';

View File

@ -7,30 +7,12 @@ import { EthernetSwitchTemplate } from '../models/templates/ethernet-switch-temp
import { IosTemplate } from '../models/templates/ios-template';
import { IouTemplate } from '../models/templates/iou-template';
import { QemuTemplate } from '../models/templates/qemu-template';
import { TracengTemplate } from '../models/templates/traceng-template';
import { VirtualBoxTemplate } from '../models/templates/virtualbox-template';
import { VmwareTemplate } from '../models/templates/vmware-template';
import { VpcsTemplate } from '../models/templates/vpcs-template';
@Injectable()
export class TemplateMocksService {
getTracengTemplate(): TracengTemplate {
let template: TracengTemplate = {
builtin: false,
category: 'guest',
compute_id: 'local',
console_type: 'none',
default_name_format: 'TraceNG{0}',
ip_address: '',
name: '',
symbol: ':/symbols/classic/traceng.svg',
template_id: '',
template_type: 'traceng',
};
return template;
}
getQemuTemplate(): Observable<QemuTemplate> {
let template: QemuTemplate = {
adapter_type: 'e1000',

View File

@ -1,30 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Server } from '../models/server';
import { TracengTemplate } from '../models/templates/traceng-template';
import { HttpServer } from './http-server.service';
@Injectable()
export class TracengService {
constructor(private httpServer: HttpServer) {}
getTemplates(server: Server): Observable<TracengTemplate[]> {
return this.httpServer.get<TracengTemplate[]>(server, '/templates') as Observable<TracengTemplate[]>;
}
getTemplate(server: Server, template_id: string): Observable<TracengTemplate> {
return this.httpServer.get<TracengTemplate>(server, `/templates/${template_id}`) as Observable<TracengTemplate>;
}
addTemplate(server: Server, vpcsTemplate: TracengTemplate): Observable<TracengTemplate> {
return this.httpServer.post<TracengTemplate>(server, `/templates`, vpcsTemplate) as Observable<TracengTemplate>;
}
saveTemplate(server: Server, vpcsTemplate: TracengTemplate): Observable<TracengTemplate> {
return this.httpServer.put<TracengTemplate>(
server,
`/templates/${vpcsTemplate.template_id}`,
vpcsTemplate
) as Observable<TracengTemplate>;
}
}