mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 05:27:56 +00:00
Finish to rename server to controller
This commit is contained in:
parent
7c343c51be
commit
8929d1d659
@ -15,7 +15,7 @@ files:
|
||||
- renderer.js
|
||||
- sentry.js
|
||||
- installed-software.js
|
||||
- local-server.js
|
||||
- local-controller.js
|
||||
- console-executor.js
|
||||
- package.json
|
||||
|
||||
|
@ -30,7 +30,7 @@ exports.stopLocalController = async (controller) => {
|
||||
return await stop(controller.name);
|
||||
}
|
||||
|
||||
exports.getrunningControllers = () => {
|
||||
exports.getRunningControllers = () => {
|
||||
return Object.keys(runningControllers);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ const routes: Routes = [
|
||||
{ path: 'installed-software', component: InstalledSoftwareComponent },
|
||||
{ path: 'controller/:controller_id/systemstatus', component: SystemStatusComponent, canActivate: [LoginGuard] },
|
||||
|
||||
{ path: 'controller/:server_ip/:server_port/project/:project_id', component: DirectLinkComponent, canActivate: [LoginGuard] },
|
||||
{ path: 'controller/:controller_ip/:controller_port/project/:project_id', component: DirectLinkComponent, canActivate: [LoginGuard] },
|
||||
{
|
||||
path: 'controller/:controller_id/project/:project_id/snapshots',
|
||||
component: ListOfSnapshotsComponent,
|
||||
|
@ -2,7 +2,7 @@ import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
import{ Controller } from '../../../models/controller';
|
||||
import { Controller } from '../../../models/controller';
|
||||
import { ControllerService } from '../../../services/controller.service';
|
||||
import { ToasterService } from '../../../services/toaster.service';
|
||||
|
||||
@ -36,10 +36,10 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
async getLocations() {
|
||||
const localServers = await this.numberOfLocalServers();
|
||||
const localControllers = await this.numberOfLocalControllers();
|
||||
|
||||
let locations = [];
|
||||
if (this.electronService.isElectronApp && localServers === 0) {
|
||||
if (this.electronService.isElectronApp && localControllers === 0) {
|
||||
locations.push({ key: 'local', name: 'Local' });
|
||||
}
|
||||
locations.push({ key: 'remote', name: 'Remote' });
|
||||
@ -47,14 +47,14 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
async getDefaultLocation() {
|
||||
const localServers = await this.numberOfLocalServers();
|
||||
if (this.electronService.isElectronApp && localServers === 0) {
|
||||
const localControllers = await this.numberOfLocalControllers();
|
||||
if (this.electronService.isElectronApp && localControllers === 0) {
|
||||
return 'local';
|
||||
}
|
||||
return 'remote';
|
||||
}
|
||||
|
||||
async numberOfLocalServers() {
|
||||
async numberOfLocalControllers() {
|
||||
const controllers = await this.controllerService.findAll();
|
||||
|
||||
return controllers.filter((controller) => controller.location === 'local').length;
|
||||
@ -68,16 +68,16 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
return 3080;
|
||||
}
|
||||
|
||||
async getDefaultLocalServerPath() {
|
||||
async getDefaultLocalControllerPath() {
|
||||
if (this.electronService.isElectronApp) {
|
||||
return await this.electronService.remote.require('./local-server.js').getLocalServerPath();
|
||||
return await this.electronService.remote.require('./local-controller.js').getLocalControllerPath();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
async getDefaultUbridgePath() {
|
||||
if (this.electronService.isElectronApp) {
|
||||
return await this.electronService.remote.require('./local-server.js').getUbridgePath();
|
||||
return await this.electronService.remote.require('./local-controller.js').getUbridgePath();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -85,7 +85,7 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
async ngOnInit() {
|
||||
this.locations = await this.getLocations();
|
||||
|
||||
const defaultLocalServerPath = await this.getDefaultLocalServerPath();
|
||||
const defaultLocalControllerPath = await this.getDefaultLocalControllerPath();
|
||||
const defaultUbridgePath = await this.getDefaultUbridgePath();
|
||||
|
||||
this.controllerForm.get('location').valueChanges.subscribe((location: string) => {
|
||||
@ -93,7 +93,7 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
const ubridgePathControl = this.controllerForm.get('ubridge_path');
|
||||
|
||||
if (location === 'local') {
|
||||
pathControl.setValue(defaultLocalServerPath);
|
||||
pathControl.setValue(defaultLocalControllerPath);
|
||||
pathControl.setValidators([Validators.required]);
|
||||
|
||||
ubridgePathControl.setValue(defaultUbridgePath);
|
||||
@ -125,14 +125,14 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
const controller:Controller = Object.assign({}, this.controllerForm.value);
|
||||
this.controllerService.checkServerVersion(controller).subscribe(
|
||||
(serverInfo) => {
|
||||
if (serverInfo.version.split('.')[0] >= 3) {
|
||||
this.controllerService.checkControllerVersion(controller).subscribe(
|
||||
(controllerInfo) => {
|
||||
if (controllerInfo.version.split('.')[0] >= 3) {
|
||||
this.dialogRef.close(controller);
|
||||
this.toasterService.success(`Server ${controller.name} added.`);
|
||||
this.toasterService.success(`Controller ${controller.name} added.`);
|
||||
} else {
|
||||
this.dialogRef.close();
|
||||
this.toasterService.error(`Server version is not supported.`);
|
||||
this.toasterService.error(`Controller version is not supported.`);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
|
@ -1,12 +1,12 @@
|
||||
<mat-card class="info" *ngIf="discoveredServer">
|
||||
<mat-card class="info" *ngIf="discoveredController">
|
||||
<mat-card-content align="center">
|
||||
We've discovered GNS3 controller on <b>{{ discoveredServer?.host }}:{{ discoveredServer?.port }}</b
|
||||
We've discovered GNS3 controller on <b>{{ discoveredController?.host }}:{{ discoveredController?.port }}</b
|
||||
>, would you like to add to the list?
|
||||
</mat-card-content>
|
||||
<mat-card-actions align="right">
|
||||
<button mat-button color="accent" (click)="ignore(discoveredServer)">NO</button>
|
||||
<button mat-button (click)="accept(discoveredServer)">YES</button>
|
||||
<button mat-button color="accent" (click)="ignore(discoveredController)">NO</button>
|
||||
<button mat-button (click)="accept(discoveredController)">YES</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
<mat-divider *ngIf="discoveredServer"></mat-divider>
|
||||
<mat-divider *ngIf="discoveredController"></mat-divider>
|
||||
|
@ -53,7 +53,7 @@ describe('isAvailable', () => {
|
||||
|
||||
const getVersionSpy = spyOn(mockedVersionService, 'get').and.returnValue(Observable.of(version));
|
||||
|
||||
component.isServerAvailable('127.0.0.1', 3080).subscribe((s) => {
|
||||
component.isControllerAvailable('127.0.0.1', 3080).subscribe((s) => {
|
||||
expect(s.host).toEqual('127.0.0.1');
|
||||
expect(s.port).toEqual(3080);
|
||||
});
|
||||
@ -75,7 +75,7 @@ describe('isAvailable', () => {
|
||||
);
|
||||
let hasExecuted = false;
|
||||
|
||||
component.isServerAvailable('127.0.0.1', 3080).subscribe(
|
||||
component.isControllerAvailable('127.0.0.1', 3080).subscribe(
|
||||
(ver) => { },
|
||||
(err) => {
|
||||
hasExecuted = true;
|
||||
@ -93,7 +93,7 @@ describe('discovery', () => {
|
||||
const version = new Version();
|
||||
version.version = '2.1.8';
|
||||
|
||||
spyOn(component, 'isServerAvailable').and.callFake((ip, port) => {
|
||||
spyOn(component, 'isControllerAvailable').and.callFake((ip, port) => {
|
||||
const controller = new Controller ();
|
||||
controller.host = ip;
|
||||
controller.port = port;
|
||||
@ -124,20 +124,20 @@ describe('discoverFirstAvailableController', () => {
|
||||
});
|
||||
|
||||
it('should get first controller from discovered and with no added before', fakeAsync(() => {
|
||||
expect(component.discoveredServer).toBeUndefined();
|
||||
expect(component.discoveredController).toBeUndefined();
|
||||
component.discoverFirstAvailableController();
|
||||
tick();
|
||||
expect(component.discoveredServer.host).toEqual('199.111.111.1');
|
||||
expect(component.discoveredServer.port).toEqual(3333);
|
||||
expect(component.discoveredController.host).toEqual('199.111.111.1');
|
||||
expect(component.discoveredController.port).toEqual(3333);
|
||||
}));
|
||||
|
||||
it('should get first controller from discovered and with already added', fakeAsync(() => {
|
||||
mockedControllerService.controllers.push(controller);
|
||||
|
||||
expect(component.discoveredServer).toBeUndefined();
|
||||
expect(component.discoveredController).toBeUndefined();
|
||||
component.discoverFirstAvailableController();
|
||||
tick();
|
||||
expect(component.discoveredServer).toBeUndefined();
|
||||
expect(component.discoveredController).toBeUndefined();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -146,14 +146,14 @@ describe('accepting and ignoring found controller', () => {
|
||||
beforeEach(() => {
|
||||
controller = new Controller ();
|
||||
(controller.host = '199.111.111.1'), (controller.port = 3333);
|
||||
component.discoveredServer = controller;
|
||||
component.discoveredController = controller;
|
||||
});
|
||||
|
||||
describe('accept', () => {
|
||||
it('should add new controller', fakeAsync(() => {
|
||||
component.accept(controller);
|
||||
tick();
|
||||
expect(component.discoveredServer).toBeNull();
|
||||
expect(component.discoveredController).toBeNull();
|
||||
expect(mockedControllerService.controllers[0].host).toEqual('199.111.111.1');
|
||||
expect(mockedControllerService.controllers[0].name).toEqual('199.111.111.1');
|
||||
expect(mockedControllerService.controllers[0].location).toEqual('remote');
|
||||
@ -164,7 +164,7 @@ describe('accepting and ignoring found controller', () => {
|
||||
it('should reject controller', fakeAsync(() => {
|
||||
component.ignore(controller);
|
||||
tick();
|
||||
expect(component.discoveredServer).toBeNull();
|
||||
expect(component.discoveredController).toBeNull();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { forkJoin, from } from 'rxjs';
|
||||
import { map } from 'rxjs//operators';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { Controller, ServerProtocol } from '../../../models/controller';
|
||||
import { Controller, ControllerProtocol } from '../../../models/controller';
|
||||
import { Version } from '../../../models/version';
|
||||
import { ControllerDatabase } from '../../../services/controller.database';
|
||||
import { ControllerService } from '../../../services/controller.service';
|
||||
@ -15,14 +15,14 @@ import { VersionService } from '../../../services/version.service';
|
||||
styleUrls: ['./controller-discovery.component.scss'],
|
||||
})
|
||||
export class ControllerDiscoveryComponent implements OnInit {
|
||||
private defaultServers = [
|
||||
private defaultControllers = [
|
||||
{
|
||||
host: '127.0.0.1',
|
||||
port: 3080,
|
||||
},
|
||||
];
|
||||
|
||||
discoveredServer: Controller;
|
||||
discoveredController: Controller;
|
||||
|
||||
constructor(
|
||||
private versionService: VersionService,
|
||||
@ -32,16 +32,16 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.controllerService.isServiceInitialized) this.discoverFirstServer();
|
||||
if (this.controllerService.isServiceInitialized) this.discoverFirstController();
|
||||
this.controllerService.serviceInitialized.subscribe(async (value: boolean) => {
|
||||
if (value) {
|
||||
this.discoverFirstServer();
|
||||
this.discoverFirstController();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async discoverFirstServer() {
|
||||
let discovered = await this.discoverServers();
|
||||
async discoverFirstController() {
|
||||
let discovered = await this.discoverControllers();
|
||||
let local = await this.controllerService.findAll();
|
||||
|
||||
local.forEach((added) => {
|
||||
@ -51,16 +51,16 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
});
|
||||
|
||||
if (discovered.length > 0) {
|
||||
this.discoveredServer = discovered.shift();
|
||||
this.discoveredController = discovered.shift();
|
||||
}
|
||||
}
|
||||
|
||||
async discoverServers() {
|
||||
async discoverControllers() {
|
||||
let discoveredControllers: Controller[] = [];
|
||||
this.defaultServers.forEach(async (testServer) => {
|
||||
this.defaultControllers.forEach(async (testController) => {
|
||||
const controller = new Controller();
|
||||
controller.host = testServer.host;
|
||||
controller.port = testServer.port;
|
||||
controller.host = testController.host;
|
||||
controller.port = testController.port;
|
||||
let version = await this.versionService
|
||||
.get(controller)
|
||||
.toPromise()
|
||||
@ -79,7 +79,7 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
});
|
||||
});
|
||||
if (discovered.length > 0) {
|
||||
this.discoveredServer = discovered.shift();
|
||||
this.discoveredController = discovered.shift();
|
||||
}
|
||||
},
|
||||
(error) => {}
|
||||
@ -89,9 +89,9 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
discovery(): Observable<Controller[]> {
|
||||
const queries: Observable<Controller>[] = [];
|
||||
|
||||
this.defaultServers.forEach((testServer) => {
|
||||
this.defaultControllers.forEach((testController) => {
|
||||
queries.push(
|
||||
this.isServerAvailable(testServer.host, testServer.port).catch((err) => {
|
||||
this.isControllerAvailable(testController.host, testController.port).catch((err) => {
|
||||
return Observable.of(null);
|
||||
})
|
||||
);
|
||||
@ -105,7 +105,7 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
isServerAvailable(ip: string, port: number): Observable<Controller> {
|
||||
isControllerAvailable(ip: string, port: number): Observable<Controller> {
|
||||
const controller = new Controller();
|
||||
controller.host = ip;
|
||||
controller.port = port;
|
||||
@ -113,7 +113,7 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
}
|
||||
|
||||
ignore(controller: Controller) {
|
||||
this.discoveredServer = null;
|
||||
this.discoveredController = null;
|
||||
}
|
||||
|
||||
accept(controller: Controller) {
|
||||
@ -122,11 +122,11 @@ export class ControllerDiscoveryComponent implements OnInit {
|
||||
}
|
||||
|
||||
controller.location = 'remote';
|
||||
controller.protocol = location.protocol as ServerProtocol;
|
||||
controller.protocol = location.protocol as ControllerProtocol;
|
||||
|
||||
this.controllerService.create(controller).then((created: Controller) => {
|
||||
this.controllerDatabase.addServer(created);
|
||||
this.discoveredServer = null;
|
||||
this.controllerDatabase.addController(created);
|
||||
this.discoveredController = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import { MockedRouter } from 'app/common/progress/progress.component.spec';
|
||||
describe('ControllersComponent', () => {
|
||||
let component: ControllersComponent;
|
||||
let fixture: ComponentFixture<ControllersComponent>;
|
||||
let serverMockedService: MockedControllerService
|
||||
let controllerMockedService: MockedControllerService
|
||||
let mockedActivatedRoute: MockedActivatedRoute
|
||||
let mockedRouter : MockedRouter
|
||||
|
||||
@ -41,7 +41,7 @@ describe('ControllersComponent', () => {
|
||||
MatBottomSheet,
|
||||
ChildProcessService,
|
||||
ChangeDetectorRef,
|
||||
{ provide: ControllerService, useValue: serverMockedService },
|
||||
{ provide: ControllerService, useValue: controllerMockedService },
|
||||
{ provide: ActivatedRoute, useValue: mockedActivatedRoute },
|
||||
{ provide: Router, useValue: mockedRouter },
|
||||
]
|
||||
|
@ -7,7 +7,7 @@ import { ChildProcessService } from 'ngx-childprocess';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
import { merge, Observable, Subscription } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import {Controller , ServerProtocol } from '../../models/controller';
|
||||
import {Controller , ControllerProtocol } from '../../models/controller';
|
||||
import { ControllerManagementService } from '../../services/controller-management.service';
|
||||
import { ControllerDatabase } from '../../services/controller.database';
|
||||
import { ControllerService } from '../../services/controller.service';
|
||||
@ -39,22 +39,22 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
) { }
|
||||
|
||||
getControllers() {
|
||||
const runningServersNames = this.controllerManagement.getRunningServers();
|
||||
const runningControllerNames = this.controllerManagement.getRunningControllers();
|
||||
|
||||
this.controllerService.findAll().then((controllers:Controller []) => {
|
||||
controllers.forEach((controller) => {
|
||||
const serverIndex = runningServersNames.findIndex((controllerName) => controller.name === controllerName);
|
||||
if (serverIndex >= 0) {
|
||||
const controllerIndex = runningControllerNames.findIndex((controllerName) => controller.name === controllerName);
|
||||
if (controllerIndex >= 0) {
|
||||
controller.status = 'running';
|
||||
}
|
||||
});
|
||||
|
||||
controllers.forEach((controller) => {
|
||||
this.controllerService.checkServerVersion(controller).subscribe(
|
||||
(serverInfo) => {
|
||||
if (serverInfo.version.split('.')[0] >= 3) {
|
||||
if (!controller.protocol) controller.protocol = location.protocol as ServerProtocol;
|
||||
if (!this.controllerDatabase.find(controller.name)) this.controllerDatabase.addServer(controller);
|
||||
this.controllerService.checkControllerVersion(controller).subscribe(
|
||||
(controllerInfo) => {
|
||||
if (controllerInfo.version.split('.')[0] >= 3) {
|
||||
if (!controller.protocol) controller.protocol = location.protocol as ControllerProtocol;
|
||||
if (!this.controllerDatabase.find(controller.name)) this.controllerDatabase.addController(controller);
|
||||
}
|
||||
},
|
||||
(error) => { }
|
||||
@ -123,7 +123,7 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
dialogRef.afterClosed().subscribe((controller) => {
|
||||
if (controller) {
|
||||
this.controllerService.create(controller).then((created:Controller ) => {
|
||||
this.controllerDatabase.addServer(created);
|
||||
this.controllerDatabase.addController(created);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -6,10 +6,10 @@
|
||||
</div>
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<form [formGroup]="serverForm">
|
||||
<form [formGroup]="controllerForm">
|
||||
<mat-form-field>
|
||||
<input matInput tabindex="1" formControlName="name" placeholder="Name" />
|
||||
<mat-error *ngIf="serverForm.get('name').hasError('required')">You must enter a value</mat-error>
|
||||
<mat-error *ngIf="controllerForm.get('name').hasError('required')">You must enter a value</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
@ -26,7 +26,7 @@
|
||||
</form>
|
||||
</mat-card>
|
||||
<div class="buttons-bar">
|
||||
<button mat-raised-button color="primary" (click)="createServer()">Add controller</button>
|
||||
<button mat-raised-button color="primary" (click)="createController()">Add controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@ export class DirectLinkComponent implements OnInit {
|
||||
{ key: 'remote', name: 'Remote' },
|
||||
];
|
||||
|
||||
serverForm = new FormGroup({
|
||||
controllerForm = new FormGroup({
|
||||
name: new FormControl('', [Validators.required]),
|
||||
location: new FormControl(''),
|
||||
protocol: new FormControl('http:')
|
||||
@ -52,8 +52,8 @@ export class DirectLinkComponent implements OnInit {
|
||||
}
|
||||
|
||||
private async getControllers() {
|
||||
this.controllerIp = this.route.snapshot.paramMap.get('server_ip');
|
||||
this.controllerPort = +this.route.snapshot.paramMap.get('server_port');
|
||||
this.controllerIp = this.route.snapshot.paramMap.get('controller_ip');
|
||||
this.controllerPort = +this.route.snapshot.paramMap.get('controller_port');
|
||||
this.projectId = this.route.snapshot.paramMap.get('project_id');
|
||||
|
||||
const controllers = await this.controllerService.findAll();
|
||||
@ -66,22 +66,22 @@ export class DirectLinkComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public createServer() {
|
||||
if (!this.serverForm.get('name').hasError && !this.serverForm.get('location').hasError && !this.serverForm.get('protocol').hasError) {
|
||||
public createController() {
|
||||
if (!this.controllerForm.get('name').hasError && !this.controllerForm.get('location').hasError && !this.controllerForm.get('protocol').hasError) {
|
||||
this.toasterService.error('Please use correct values');
|
||||
return;
|
||||
}
|
||||
|
||||
let serverToAdd:Controller = new Controller ();
|
||||
serverToAdd.host = this.controllerIp;
|
||||
serverToAdd.port = this.controllerPort;
|
||||
let controllerToAdd:Controller = new Controller ();
|
||||
controllerToAdd.host = this.controllerIp;
|
||||
controllerToAdd.port = this.controllerPort;
|
||||
|
||||
serverToAdd.name = this.serverForm.get('name').value;
|
||||
serverToAdd.location = this.serverForm.get('location').value;
|
||||
serverToAdd.protocol = this.serverForm.get('protocol').value;
|
||||
controllerToAdd.name = this.controllerForm.get('name').value;
|
||||
controllerToAdd.location = this.controllerForm.get('location').value;
|
||||
controllerToAdd.protocol = this.controllerForm.get('protocol').value;
|
||||
|
||||
this.controllerService.create(serverToAdd).then((addedServer:Controller ) => {
|
||||
this.router.navigate(['/controller', addedServer.id, 'project', this.projectId]);
|
||||
this.controllerService.create(controllerToAdd).then((addedController:Controller ) => {
|
||||
this.router.navigate(['/controller', addedController.id, 'project', this.projectId]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ export class NodeDraggedComponent implements OnInit, OnDestroy {
|
||||
node.x += draggedEvent.dx;
|
||||
node.y += draggedEvent.dy;
|
||||
|
||||
this.nodeService.updatePosition(this.controller, this.project, node, node.x, node.y).subscribe((serverNode: Node) => {
|
||||
this.nodesDataSource.update(serverNode);
|
||||
this.nodeService.updatePosition(this.controller, this.project, node, node.x, node.y).subscribe((controllerNode: Node) => {
|
||||
this.nodesDataSource.update(controllerNode);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ export class NodeLabelDraggedComponent implements OnInit, OnDestroy {
|
||||
const label = this.mapLabelToLabel.convert(mapLabel);
|
||||
node.label = label;
|
||||
|
||||
this.nodeService.updateLabel(this.controller, node, node.label).subscribe((serverNode: Node) => {
|
||||
this.nodesDataSource.update(serverNode);
|
||||
this.nodeService.updateLabel(this.controller, node, node.label).subscribe((controllerNode: Node) => {
|
||||
this.nodesDataSource.update(controllerNode);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class ExportPortableProjectComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.controller = this.data.serverDetails;
|
||||
this.controller = this.data.controllerDetails;
|
||||
this.project = this.data.projectDetails;
|
||||
this.fileName = this.project.name + '.gns3project';
|
||||
await this.formControls();
|
||||
|
@ -27,7 +27,7 @@ describe('AddImageDialogComponent', () => {
|
||||
let component: AddImageDialogComponent;
|
||||
let fixture: ComponentFixture<AddImageDialogComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedImageManagerService = new MockedImageManagerService()
|
||||
let mockedToasterService = new MockedToasterService()
|
||||
|
||||
@ -42,7 +42,7 @@ describe('AddImageDialogComponent', () => {
|
||||
MatSnackBarModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: ImageManagerService, useValue: mockedImageManagerService },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
|
@ -7,7 +7,7 @@ import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { ToasterService } from 'app/services/toaster.service';
|
||||
import { MockedToasterService } from 'app/services/toaster.service.spec';
|
||||
import{ Server } from 'http';
|
||||
import { Server } from 'http';
|
||||
import { of } from 'rxjs';
|
||||
import { ImageManagerService } from '../../../services/image-manager.service';
|
||||
import { ControllerService } from '../../../services/controller.service';
|
||||
@ -25,7 +25,7 @@ export class MockedImageManagerService {
|
||||
describe('DeleteAllImageFilesDialogComponent', () => {
|
||||
let component: DeleteAllImageFilesDialogComponent;
|
||||
let fixture: ComponentFixture<DeleteAllImageFilesDialogComponent>;
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedImageManagerService = new MockedImageManagerService()
|
||||
let mockedToasterService = new MockedToasterService()
|
||||
|
||||
@ -39,7 +39,7 @@ export class MockedImageManagerService {
|
||||
MatDialogModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: ImageManagerService, useValue: mockedImageManagerService },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: {} },
|
||||
{ provide: MatDialogRef, useValue: {} },
|
||||
|
@ -37,7 +37,7 @@ describe('ImageManagerComponent', () => {
|
||||
let component: ImageManagerComponent;
|
||||
let fixture: ComponentFixture<ImageManagerComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedImageManagerService = new MockedImageManagerService()
|
||||
let mockedProgressService = new MockedProgressService()
|
||||
let mockedVersionService = new MockedVersionService()
|
||||
@ -59,7 +59,7 @@ describe('ImageManagerComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: ImageManagerService, useValue: mockedImageManagerService },
|
||||
{ provide: ProgressService, useValue: mockedProgressService },
|
||||
{ provide: VersionService, useValue: mockedVersionService },
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run the cloud node locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -33,7 +33,7 @@ describe('CloudNodesAddTemplateComponent', () => {
|
||||
let component: CloudNodesAddTemplateComponent;
|
||||
let fixture: ComponentFixture<CloudNodesAddTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
@ -56,7 +56,7 @@ describe('CloudNodesAddTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
|
@ -44,8 +44,8 @@ export class CloudNodesAddTemplateComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ describe('CloudNodesTemplateDetailsComponent', () => {
|
||||
let component: CloudNodesTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<CloudNodesTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -60,7 +60,7 @@ describe('CloudNodesTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('CloudNodesTemplatesComponent', () => {
|
||||
let component: CloudNodesTemplatesComponent;
|
||||
let fixture: ComponentFixture<CloudNodesTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('CloudNodesTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
],
|
||||
declarations: [CloudNodesTemplatesComponent],
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run the Ethernet Hub locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -33,7 +33,7 @@ describe('EthernetHubsAddTemplateComponent', () => {
|
||||
let component: EthernetHubsAddTemplateComponent;
|
||||
let fixture: ComponentFixture<EthernetHubsAddTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
@ -59,7 +59,7 @@ describe('EthernetHubsAddTemplateComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
|
@ -45,8 +45,8 @@ export class EthernetHubsAddTemplateComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ describe('EthernetHubsTemplateDetailsComponent', () => {
|
||||
let component: EthernetHubsTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<EthernetHubsTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -60,7 +60,7 @@ describe('EthernetHubsTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('EthernetHubsTemplatesComponent', () => {
|
||||
let component: EthernetHubsTemplatesComponent;
|
||||
let fixture: ComponentFixture<EthernetHubsTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('EthernetHubsTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
],
|
||||
declarations: [EthernetHubsTemplatesComponent],
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run the Ethernet switch locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -33,7 +33,7 @@ describe('EthernetSwitchesAddTemplateComponent', () => {
|
||||
let component: EthernetSwitchesAddTemplateComponent;
|
||||
let fixture: ComponentFixture<EthernetSwitchesAddTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
@ -59,7 +59,7 @@ describe('EthernetSwitchesAddTemplateComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
|
@ -49,8 +49,8 @@ export class EthernetSwitchesAddTemplateComponent implements OnInit {
|
||||
this.router.navigate(['/controller', this.controller.id, 'preferences', 'builtin', 'ethernet-switches']);
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ describe('EthernetSwitchesTemplateDetailsComponent', () => {
|
||||
let component: EthernetSwitchesTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<EthernetSwitchesTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -61,7 +61,7 @@ describe('EthernetSwitchesTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('EthernetSwitchesTemplatesComponent', () => {
|
||||
let component: EthernetSwitchesTemplatesComponent;
|
||||
let fixture: ComponentFixture<EthernetSwitchesTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('EthernetSwitchesTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
],
|
||||
declarations: [EthernetSwitchesTemplatesComponent],
|
||||
|
@ -7,10 +7,10 @@
|
||||
<div class="default-content">
|
||||
<div class="container mat-elevation-z8">
|
||||
<mat-vertical-stepper [linear]="true">
|
||||
<mat-step label="Server type" [completed]="isLocalComputerChosen">
|
||||
<mat-step label="Controller type" [completed]="isLocalComputerChosen">
|
||||
<mat-radio-group class="radio-group">
|
||||
<!-- <mat-radio-button class="radio-button" value="1" (click)="setServerType('remote computer')">Run this Docker container on a remote computer</mat-radio-button> -->
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<!-- <mat-radio-button class="radio-button" value="1" (click)="setControllerType('remote compute')">Run this Docker container on a remote compute</mat-radio-button> -->
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run this Docker container locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -41,7 +41,7 @@ xdescribe('AddDockerTemplateComponent', () => {
|
||||
let component: AddDockerTemplateComponent;
|
||||
let fixture: ComponentFixture<AddDockerTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedDockerService = new MockedDockerService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -72,7 +72,7 @@ xdescribe('AddDockerTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: DockerService, useValue: mockedDockerService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
@ -106,7 +106,7 @@ xdescribe('AddDockerTemplateComponent', () => {
|
||||
await fixture.whenStable().then(() => {
|
||||
let selectedLabel = fixture.nativeElement.querySelector('[aria-selected="true"]');
|
||||
|
||||
expect(selectedLabel.textContent).toMatch('Server type');
|
||||
expect(selectedLabel.textContent).toMatch('Controller type');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -75,8 +75,8 @@ export class AddDockerTemplateComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ describe('DockerTemplateDetailsComponent', () => {
|
||||
let component: DockerTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<DockerTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedDockerService = new MockedDockerService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -58,7 +58,7 @@ describe('DockerTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: DockerService, useValue: mockedDockerService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: DockerConfigurationService, useClass: DockerConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('DockerTemplatesComponent', () => {
|
||||
let component: DockerTemplatesComponent;
|
||||
let fixture: ComponentFixture<DockerTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedDockerService = new MockedDockerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -44,7 +44,7 @@ describe('DockerTemplatesComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: DockerService, useValue: mockedDockerService },
|
||||
],
|
||||
declarations: [DockerTemplatesComponent],
|
||||
|
@ -7,9 +7,9 @@
|
||||
<div class="default-content" *ngIf="iosTemplate">
|
||||
<div class="container mat-elevation-z8">
|
||||
<mat-vertical-stepper [linear]="true">
|
||||
<mat-step label="Server type" [completed]="isLocalComputerChosen">
|
||||
<mat-step label="Controller type" [completed]="isLocalComputerChosen">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run this IOS router locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -39,7 +39,7 @@ xdescribe('AddIosTemplateComponent', () => {
|
||||
let component: AddIosTemplateComponent;
|
||||
let fixture: ComponentFixture<AddIosTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIosService = new MockedIosService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -67,7 +67,7 @@ xdescribe('AddIosTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IosService, useValue: mockedIosService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
|
@ -133,8 +133,8 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ describe('DynamipsPreferencesComponent', () => {
|
||||
let component: DynamipsPreferencesComponent;
|
||||
let fixture: ComponentFixture<DynamipsPreferencesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
let mockedServerSettingsService = new MockedControllerSettingsService();
|
||||
let mockedControllerSettingsService = new MockedControllerSettingsService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
|
||||
beforeEach(async() => {
|
||||
@ -44,8 +44,8 @@ describe('DynamipsPreferencesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerSettingsService, useValue: mockedServerSettingsService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: ControllerSettingsService, useValue: mockedControllerSettingsService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
],
|
||||
declarations: [DynamipsPreferencesComponent],
|
||||
|
@ -35,7 +35,7 @@ describe('IosTemplateDetailsComponent', () => {
|
||||
let component: IosTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<IosTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIosService = new MockedIosService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -58,7 +58,7 @@ describe('IosTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IosService, useValue: mockedIosService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: IosConfigurationService, useClass: IosConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('IosTemplatesComponent', () => {
|
||||
let component: IosTemplatesComponent;
|
||||
let fixture: ComponentFixture<IosTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIosService = new MockedIosService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('IosTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IosService, useValue: mockedIosService },
|
||||
],
|
||||
declarations: [IosTemplatesComponent],
|
||||
|
@ -7,9 +7,9 @@
|
||||
<div class="default-content">
|
||||
<div class="container mat-elevation-z8">
|
||||
<mat-vertical-stepper [linear]="true">
|
||||
<mat-step label="Server type" [completed]="isLocalComputerChosen">
|
||||
<mat-step label="Controller type" [completed]="isLocalComputerChosen">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run this IOU device locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -39,7 +39,7 @@ xdescribe('AddIouTemplateComponent', () => {
|
||||
let component: AddIouTemplateComponent;
|
||||
let fixture: ComponentFixture<AddIouTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIouService = new MockedIouService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -67,7 +67,7 @@ xdescribe('AddIouTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IouService, useValue: mockedIouService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
|
@ -107,8 +107,8 @@ export class AddIouTemplateComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ describe('IouTemplateDetailsComponent', () => {
|
||||
let component: IouTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<IouTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIouService = new MockedIouService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -55,7 +55,7 @@ describe('IouTemplateDetailsComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IouService, useValue: mockedIouService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: IouConfigurationService, useClass: IouConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('IouTemplatesComponent', () => {
|
||||
let component: IouTemplatesComponent;
|
||||
let fixture: ComponentFixture<IouTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedIouService = new MockedIouService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -44,7 +44,7 @@ describe('IouTemplatesComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: IouService, useValue: mockedIouService },
|
||||
],
|
||||
declarations: [IouTemplatesComponent],
|
||||
|
@ -7,9 +7,9 @@
|
||||
<div class="default-content">
|
||||
<div class="container mat-elevation-z8">
|
||||
<mat-vertical-stepper [linear]="true">
|
||||
<mat-step label="Server type" [completed]="isLocalComputerChosen">
|
||||
<mat-step label="Controller type" [completed]="isLocalComputerChosen">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run this QEMU VM locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -46,7 +46,7 @@ xdescribe('AddQemuVmTemplateComponent', () => {
|
||||
let component: AddQemuVmTemplateComponent;
|
||||
let fixture: ComponentFixture<AddQemuVmTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedQemuService = new MockedQemuService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -77,7 +77,7 @@ xdescribe('AddQemuVmTemplateComponent', () => {
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: QemuService, useValue: mockedQemuService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
|
@ -134,8 +134,8 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ describe('QemuPreferencesComponent', () => {
|
||||
let component: QemuPreferencesComponent;
|
||||
let fixture: ComponentFixture<QemuPreferencesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
let mockedServerSettingsService = new MockedControllerSettingsService();
|
||||
let mockedControllerSettingsService = new MockedControllerSettingsService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
|
||||
beforeEach(async() => {
|
||||
@ -45,8 +45,8 @@ describe('QemuPreferencesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerSettingsService, useValue: mockedServerSettingsService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: ControllerSettingsService, useValue: mockedControllerSettingsService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
],
|
||||
declarations: [QemuPreferencesComponent],
|
||||
@ -65,10 +65,10 @@ describe('QemuPreferencesComponent', () => {
|
||||
});
|
||||
|
||||
it('should call update settings when restore defaults chosen', () => {
|
||||
spyOn(mockedServerSettingsService, 'updateSettingsForQemu').and.returnValue(of([]));
|
||||
spyOn(mockedControllerSettingsService, 'updateSettingsForQemu').and.returnValue(of([]));
|
||||
|
||||
component.restoreDefaults();
|
||||
|
||||
expect(mockedServerSettingsService.updateSettingsForQemu).toHaveBeenCalled();
|
||||
expect(mockedControllerSettingsService.updateSettingsForQemu).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ describe('QemuVmTemplateDetailsComponent', () => {
|
||||
let component: QemuVmTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<QemuVmTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedQemuService = new MockedQemuService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -65,7 +65,7 @@ describe('QemuVmTemplateDetailsComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: QemuService, useValue: mockedQemuService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: QemuConfigurationService, useClass: QemuConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('QemuTemplatesComponent', () => {
|
||||
let component: QemuVmTemplatesComponent;
|
||||
let fixture: ComponentFixture<QemuVmTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedQemuService = new MockedQemuService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('QemuTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: QemuService, useValue: mockedQemuService },
|
||||
],
|
||||
declarations: [QemuVmTemplatesComponent],
|
||||
|
@ -35,7 +35,7 @@ describe('AddVirtualBoxTemplateComponent', () => {
|
||||
let component: AddVirtualBoxTemplateComponent;
|
||||
let fixture: ComponentFixture<AddVirtualBoxTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVirtualBoxService = new MockedVirtualBoxService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -57,7 +57,7 @@ describe('AddVirtualBoxTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VirtualBoxService, useValue: mockedVirtualBoxService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
|
@ -17,7 +17,7 @@ describe('VirtualBoxPreferencesComponent', () => {
|
||||
let component: VirtualBoxPreferencesComponent;
|
||||
let fixture: ComponentFixture<VirtualBoxPreferencesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async() => {
|
||||
@ -36,7 +36,7 @@ describe('VirtualBoxPreferencesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
],
|
||||
declarations: [VirtualBoxPreferencesComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
|
@ -36,7 +36,7 @@ describe('VirtualBoxTemplateDetailsComponent', () => {
|
||||
let component: VirtualBoxTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<VirtualBoxTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVirtualBoxService = new MockedVirtualBoxService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -60,7 +60,7 @@ describe('VirtualBoxTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VirtualBoxService, useValue: mockedVirtualBoxService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: VirtualBoxConfigurationService, useClass: VirtualBoxConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('VirtualBoxTemplatesComponent', () => {
|
||||
let component: VirtualBoxTemplatesComponent;
|
||||
let fixture: ComponentFixture<VirtualBoxTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVirtualBoxService = new MockedVirtualBoxService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('VirtualBoxTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VirtualBoxService, useValue: mockedVirtualBoxService },
|
||||
],
|
||||
declarations: [VirtualBoxTemplatesComponent],
|
||||
|
@ -36,7 +36,7 @@ describe('AddVmwareTemplateComponent', () => {
|
||||
let component: AddVmwareTemplateComponent;
|
||||
let fixture: ComponentFixture<AddVmwareTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVmwareService = new MockedVmwareService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -58,7 +58,7 @@ describe('AddVmwareTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VmwareService, useValue: mockedVmwareService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||
|
@ -17,7 +17,7 @@ describe('VmwarePreferencesComponent', () => {
|
||||
let component: VmwarePreferencesComponent;
|
||||
let fixture: ComponentFixture<VmwarePreferencesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async() => {
|
||||
@ -36,7 +36,7 @@ describe('VmwarePreferencesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
],
|
||||
declarations: [VmwarePreferencesComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
|
@ -36,7 +36,7 @@ describe('VmwareTemplateDetailsComponent', () => {
|
||||
let component: VmwareTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<VmwareTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVmwareService = new MockedVmwareService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -60,7 +60,7 @@ describe('VmwareTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VmwareService, useValue: mockedVmwareService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: VmwareConfigurationService, useClass: VmwareConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('VmwareTemplatesComponent', () => {
|
||||
let component: VmwareTemplatesComponent;
|
||||
let fixture: ComponentFixture<VmwareTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVmwareService = new MockedVmwareService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('VmwareTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VmwareService, useValue: mockedVmwareService },
|
||||
],
|
||||
declarations: [VmwareTemplatesComponent],
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')" checked
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setControllerType('local')" checked
|
||||
>Run the VPCS node locally</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
|
@ -38,7 +38,7 @@ describe('AddVpcsTemplateComponent', () => {
|
||||
let component: AddVpcsTemplateComponent;
|
||||
let fixture: ComponentFixture<AddVpcsTemplateComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVpcsService = new MockedVpcsService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -61,7 +61,7 @@ describe('AddVpcsTemplateComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VpcsService, useValue: mockedVpcsService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
|
@ -44,8 +44,8 @@ export class AddVpcsTemplateComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
if (serverType === 'local') {
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ describe('VpcsPreferencesComponent', () => {
|
||||
let component: VpcsPreferencesComponent;
|
||||
let fixture: ComponentFixture<VpcsPreferencesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async() => {
|
||||
@ -36,7 +36,7 @@ describe('VpcsPreferencesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
],
|
||||
declarations: [VpcsPreferencesComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
|
@ -35,7 +35,7 @@ describe('VpcsTemplateDetailsComponent', () => {
|
||||
let component: VpcsTemplateDetailsComponent;
|
||||
let fixture: ComponentFixture<VpcsTemplateDetailsComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVpcsService = new MockedVpcsService();
|
||||
let mockedToasterService = new MockedToasterService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
@ -58,7 +58,7 @@ describe('VpcsTemplateDetailsComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VpcsService, useValue: mockedVpcsService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: VpcsConfigurationService, useClass: VpcsConfigurationService },
|
||||
|
@ -27,7 +27,7 @@ describe('VpcsTemplatesComponent', () => {
|
||||
let component: VpcsTemplatesComponent;
|
||||
let fixture: ComponentFixture<VpcsTemplatesComponent>;
|
||||
|
||||
let mockedServerService = new MockedControllerService();
|
||||
let mockedControllerService = new MockedControllerService();
|
||||
let mockedVpcsService = new MockedVpcsService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
@ -47,7 +47,7 @@ describe('VpcsTemplatesComponent', () => {
|
||||
provide: ActivatedRoute,
|
||||
useValue: activatedRoute,
|
||||
},
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: VpcsService, useValue: mockedVpcsService },
|
||||
],
|
||||
declarations: [VpcsTemplatesComponent],
|
||||
|
@ -18,7 +18,7 @@ describe('ConsoleDeviceActionComponent', () => {
|
||||
let electronService;
|
||||
let controller:Controller ;
|
||||
let settingsService: SettingsService;
|
||||
let mockedServerService: MockedControllerService;
|
||||
let mockedControllerService: MockedControllerService;
|
||||
let mockedToaster: MockedToasterService;
|
||||
let mockedNodeService: MockedNodeService = new MockedNodeService();
|
||||
|
||||
@ -34,7 +34,7 @@ describe('ConsoleDeviceActionComponent', () => {
|
||||
},
|
||||
};
|
||||
|
||||
mockedServerService = new MockedControllerService();
|
||||
mockedControllerService = new MockedControllerService();
|
||||
mockedToaster = new MockedToasterService();
|
||||
|
||||
controller = { host: 'localhost', port: 222 } as Controller ;
|
||||
@ -44,7 +44,7 @@ describe('ConsoleDeviceActionComponent', () => {
|
||||
await TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: ElectronService, useValue: electronService },
|
||||
{ provide: ControllerService, useValue: mockedServerService },
|
||||
{ provide: ControllerService, useValue: mockedControllerService },
|
||||
{ provide: SettingsService },
|
||||
{ provide: ToasterService, useValue: mockedToaster },
|
||||
{ provide: NodeService, useValue: mockedNodeService },
|
||||
@ -100,7 +100,7 @@ describe('ConsoleDeviceActionComponent', () => {
|
||||
name: 'Node 1',
|
||||
project_id: '1111',
|
||||
node_id: '2222',
|
||||
server_url: 'localhost:222',
|
||||
controller_url: 'localhost:222',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class ConsoleDeviceActionComponent implements OnInit {
|
||||
name: node.name,
|
||||
project_id: node.project_id,
|
||||
node_id: node.node_id,
|
||||
server_url: this.controllerService.getServerUrl(this.controller),
|
||||
controller_url: this.controllerService.getControllerUrl(this.controller),
|
||||
};
|
||||
await this.openConsole(consoleRequest);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export class ContextMenuComponent implements OnInit {
|
||||
|
||||
hasTextCapabilities = false;
|
||||
isElectronApp = false;
|
||||
isBundledServer: boolean = false;
|
||||
isBundledController: boolean = false;
|
||||
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
@ -47,7 +47,7 @@ export class ContextMenuComponent implements OnInit {
|
||||
this.setPosition(0, 0);
|
||||
|
||||
this.isElectronApp = this.electronService.isElectronApp;
|
||||
this.isBundledServer = this.controller.location === 'bundled';
|
||||
this.isBundledController = this.controller.location === 'bundled';
|
||||
}
|
||||
|
||||
public setPosition(top: number, left: number) {
|
||||
|
@ -43,7 +43,7 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private nodeSubscription: Subscription;
|
||||
private linkSubscription: Subscription;
|
||||
private drawingSubscription: Subscription;
|
||||
private serverRequestsSubscription: Subscription;
|
||||
private controllerRequestsSubscription: Subscription;
|
||||
private errorSubscription: Subscription;
|
||||
private warningSubscription: Subscription;
|
||||
private infoSubscription: Subscription;
|
||||
@ -119,7 +119,7 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
message: message,
|
||||
});
|
||||
});
|
||||
this.serverRequestsSubscription = this.httpService.requestsNotificationEmitter.subscribe((message) => {
|
||||
this.controllerRequestsSubscription = this.httpService.requestsNotificationEmitter.subscribe((message) => {
|
||||
this.showMessage({
|
||||
type: 'controller request',
|
||||
message: message,
|
||||
@ -153,7 +153,7 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.nodeSubscription.unsubscribe();
|
||||
this.linkSubscription.unsubscribe();
|
||||
this.drawingSubscription.unsubscribe();
|
||||
this.serverRequestsSubscription.unsubscribe();
|
||||
this.controllerRequestsSubscription.unsubscribe();
|
||||
this.errorSubscription.unsubscribe();
|
||||
this.warningSubscription.unsubscribe();
|
||||
this.infoSubscription.unsubscribe();
|
||||
|
@ -308,7 +308,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
setServerType(serverType: string) {
|
||||
setControllerType(controllerType: string) {
|
||||
this.isLocalComputerChosen = true;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ export class NodesMenuComponent {
|
||||
name: node.name,
|
||||
project_id: node.project_id,
|
||||
node_id: node.node_id,
|
||||
server_url: this.controllerService.getServerUrl(this.controller),
|
||||
controller_url: this.controllerService.getControllerUrl(this.controller),
|
||||
};
|
||||
await this.electronService.remote.require('./console-executor.js').openConsole(request);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ export class MockedDrawingService {
|
||||
public drawing = {} as Drawing;
|
||||
constructor() {}
|
||||
|
||||
add(_server:Controller , _project_id: string, _x: number, _y: number, _svg: string) {
|
||||
add(_controller:Controller , _project_id: string, _x: number, _y: number, _svg: string) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
@ -154,23 +154,23 @@ export class MockedDrawingService {
|
||||
return of(drawing);
|
||||
}
|
||||
|
||||
updatePosition(_server:Controller , _project: Project, _drawing: Drawing, _x: number, _y: number) {
|
||||
updatePosition(_controller:Controller , _project: Project, _drawing: Drawing, _x: number, _y: number) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
updateSizeAndPosition(_server:Controller , _drawing: Drawing, _x: number, _y: number, _svg: string) {
|
||||
updateSizeAndPosition(_controller:Controller , _drawing: Drawing, _x: number, _y: number, _svg: string) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
update(_server:Controller , _drawing: Drawing) {
|
||||
update(_controller:Controller , _drawing: Drawing) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
delete(_server:Controller , _drawing: Drawing) {
|
||||
delete(_controller:Controller , _drawing: Drawing) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
updateText(_server:Controller , _drawing: Drawing, _svg: string): Observable<Drawing> {
|
||||
updateText(_controller:Controller , _drawing: Drawing, _svg: string): Observable<Drawing> {
|
||||
return of(this.drawing);
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ export class MockedLinkService {
|
||||
return of({});
|
||||
}
|
||||
|
||||
deleteLink(_server:Controller , link: Link) {
|
||||
deleteLink(_controller:Controller , link: Link) {
|
||||
return of({});
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
maxHeight: '850px',
|
||||
autoFocus: false,
|
||||
disableClose: true,
|
||||
data: {serverDetails:this.controller,projectDetails:this.project},
|
||||
data: {controllerDetails:this.controller,projectDetails:this.project},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((isAddes: boolean) => {});
|
||||
|
@ -6,7 +6,7 @@ import { FileItem, FileUploader, ParsedResponseHeaders } from 'ng2-file-upload';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { Project } from '../../../models/project';
|
||||
import{ Controller } from '../../../models/controller';
|
||||
import { ServerResponse } from '../../../models/serverResponse';
|
||||
import { ControllerResponse } from '../../../models/controllerResponse';
|
||||
import { ProjectService } from '../../../services/project.service';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
import { ProjectNameValidator } from '../models/projectNameValidator';
|
||||
@ -58,8 +58,8 @@ export class ImportProjectDialogComponent implements OnInit {
|
||||
};
|
||||
|
||||
this.uploader.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
let serverResponse: ServerResponse = JSON.parse(response);
|
||||
this.resultMessage = 'An error occured: ' + serverResponse.message;
|
||||
let controllerResponse: ControllerResponse = JSON.parse(response);
|
||||
this.resultMessage = 'An error has occurred: ' + controllerResponse.message;
|
||||
this.isFinishEnabled = true;
|
||||
};
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-select *ngIf="selectedTemplate" placeholder="Choose controller for node" [(value)]="selectedTemplate.compute_id">
|
||||
<mat-option *ngFor="let type of nodeServers" [value]="type">
|
||||
<mat-option *ngFor="let type of nodeControllers" [value]="type">
|
||||
{{ type }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
@ -39,7 +39,7 @@ export class TemplateListDialogComponent implements OnInit {
|
||||
selectedTemplate: Template;
|
||||
searchText: string = '';
|
||||
|
||||
nodeServers: string[] = ['local', 'vm'];
|
||||
nodeControllers: string[] = ['local', 'vm'];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<TemplateListDialogComponent>,
|
||||
|
@ -70,9 +70,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab (click)="toggleTopologyVisibility(false)" label="Controllers">
|
||||
<mat-tab (click)="toggleTopologyVisibility(false)" label="Computes">
|
||||
<div class="tabContent">
|
||||
<div class="summaryContentServers">
|
||||
<div class="summaryContentComputes">
|
||||
<div class="nodeRow" *ngFor="let compute of computes">
|
||||
<div>
|
||||
<svg *ngIf="compute.connected" width="10" height="10">
|
||||
|
@ -61,7 +61,7 @@ mat-tab-group {
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.summaryContentServers {
|
||||
.summaryContentComputes {
|
||||
max-height: 350px;
|
||||
overflow: auto;
|
||||
scrollbar-color: darkgrey #263238;
|
||||
|
@ -21,7 +21,7 @@ class ElectronServiceMock {
|
||||
public isElectronApp: boolean;
|
||||
}
|
||||
|
||||
class MockedServerManagementService {
|
||||
class MockedControllerManagementService {
|
||||
public controllerStatusChanged;
|
||||
public stopAll() {}
|
||||
}
|
||||
@ -30,14 +30,14 @@ describe('DefaultLayoutComponent', () => {
|
||||
let component: DefaultLayoutComponent;
|
||||
let fixture: ComponentFixture<DefaultLayoutComponent>;
|
||||
let electronServiceMock: ElectronServiceMock;
|
||||
let serverManagementService = new MockedServerManagementService();
|
||||
let controllerManagementService = new MockedControllerManagementService();
|
||||
let controllerService: ControllerService;
|
||||
let httpController: HttpController;
|
||||
let errorHandler: ControllerErrorHandler;
|
||||
|
||||
beforeEach(async() => {
|
||||
electronServiceMock = new ElectronServiceMock();
|
||||
serverManagementService.controllerStatusChanged = new Subject<ControllerStateEvent>();
|
||||
controllerManagementService.controllerStatusChanged = new Subject<ControllerStateEvent>();
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [DefaultLayoutComponent, ProgressComponent],
|
||||
@ -49,7 +49,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
},
|
||||
{
|
||||
provide: ControllerManagementService,
|
||||
useValue: serverManagementService,
|
||||
useValue: controllerManagementService,
|
||||
},
|
||||
{
|
||||
provide: ToasterService,
|
||||
@ -95,7 +95,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
|
||||
it('should show error when controller management service throw event', () => {
|
||||
const toaster: MockedToasterService = TestBed.get(ToasterService);
|
||||
serverManagementService.controllerStatusChanged.next({
|
||||
controllerManagementService.controllerStatusChanged.next({
|
||||
status: 'errored',
|
||||
message: 'Message',
|
||||
});
|
||||
@ -105,7 +105,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
it('should not show error when controller management service throw event', () => {
|
||||
component.ngOnDestroy();
|
||||
const toaster: MockedToasterService = TestBed.get(ToasterService);
|
||||
serverManagementService.controllerStatusChanged.next({
|
||||
controllerManagementService.controllerStatusChanged.next({
|
||||
status: 'errored',
|
||||
message: 'Message',
|
||||
});
|
||||
@ -119,13 +119,13 @@ describe('DefaultLayoutComponent', () => {
|
||||
});
|
||||
|
||||
it('should close window with no action when not in electron', async () => {
|
||||
component.shouldStopServersOnClosing = false;
|
||||
component.shouldStopControllersOnClosing = false;
|
||||
const isClosed = await component.onBeforeUnload(event);
|
||||
expect(isClosed).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should stop all controllers and close window', () => {
|
||||
component.shouldStopServersOnClosing = true;
|
||||
component.shouldStopControllersOnClosing = true;
|
||||
const isClosed = component.onBeforeUnload(event);
|
||||
expect(isClosed).toBeTruthy();
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
public routeSubscription;
|
||||
|
||||
controllerStatusSubscription: Subscription;
|
||||
shouldStopServersOnClosing = true;
|
||||
shouldStopControllersOnClosing = true;
|
||||
|
||||
recentlyOpenedcontrollerId: string;
|
||||
recentlyOpenedProjectId: string;
|
||||
@ -66,7 +66,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
// stop controllers only when in Electron
|
||||
this.shouldStopServersOnClosing = this.electronService.isElectronApp;
|
||||
this.shouldStopControllersOnClosing = this.electronService.isElectronApp;
|
||||
}
|
||||
|
||||
goToUserInfo() {
|
||||
@ -113,14 +113,14 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
|
||||
@HostListener('window:beforeunload', ['$event'])
|
||||
async onBeforeUnload($event) {
|
||||
if (!this.shouldStopServersOnClosing) {
|
||||
if (!this.shouldStopControllersOnClosing) {
|
||||
return;
|
||||
}
|
||||
$event.preventDefault();
|
||||
$event.returnValue = false;
|
||||
this.progressService.activate();
|
||||
await this.controllerManagement.stopAll();
|
||||
this.shouldStopServersOnClosing = false;
|
||||
this.shouldStopControllersOnClosing = false;
|
||||
this.progressService.deactivate();
|
||||
window.close();
|
||||
return false;
|
||||
|
@ -1,18 +1,18 @@
|
||||
export type ServerLocation = 'local' | 'remote' | 'bundled';
|
||||
export type ServerStatus = 'stopped' | 'starting' | 'running';
|
||||
export type ServerProtocol = 'http:' | 'https:';
|
||||
export type ControllerLocation = 'local' | 'remote' | 'bundled';
|
||||
export type ControllerStatus = 'stopped' | 'starting' | 'running';
|
||||
export type ControllerProtocol = 'http:' | 'https:';
|
||||
|
||||
export class Controller {
|
||||
authToken: string;
|
||||
id: number;
|
||||
name: string;
|
||||
location: ServerLocation;
|
||||
location: ControllerLocation;
|
||||
host: string;
|
||||
port: number;
|
||||
path: string;
|
||||
ubridge_path: string;
|
||||
status: ServerStatus;
|
||||
protocol: ServerProtocol;
|
||||
status: ControllerStatus;
|
||||
protocol: ControllerProtocol;
|
||||
username: string;
|
||||
password: string;
|
||||
tokenExpired: boolean;
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class ServerResponse {
|
||||
export class ControllerResponse {
|
||||
message: string;
|
||||
status: number;
|
||||
}
|
@ -8,7 +8,7 @@ import { VirtualBox } from './controller-settings-models/virtual-box';
|
||||
import { VMware } from './controller-settings-models/vmware';
|
||||
import { VPCS } from './controller-settings-models/vpcs';
|
||||
|
||||
export class ServerSettings {
|
||||
export class ControllerSettings {
|
||||
Builtin: Builtin;
|
||||
Docker: Docker;
|
||||
Dynamips: Dynamips;
|
@ -32,20 +32,20 @@ export class ControllerManagementService implements OnDestroy {
|
||||
message: '',
|
||||
};
|
||||
this.controllerStatusChanged.next(startingEvent);
|
||||
return await this.electronService.remote.require('./local-server.js').startLocalController(controller);
|
||||
return await this.electronService.remote.require('./local-controller.js').startLocalController(controller);
|
||||
}
|
||||
|
||||
async stop(controller:Controller ) {
|
||||
return await this.electronService.remote.require('./local-server.js').stopLocalController(controller);
|
||||
return await this.electronService.remote.require('./local-controller.js').stopLocalController(controller);
|
||||
}
|
||||
|
||||
async stopAll() {
|
||||
return await this.electronService.remote.require('./local-server.js').stopAllLocalServers();
|
||||
return await this.electronService.remote.require('./local-controller.js').stopAllLocalControllers();
|
||||
}
|
||||
|
||||
getRunningServers() {
|
||||
getRunningControllers() {
|
||||
if (this.electronService.isElectronApp) {
|
||||
return this.electronService.remote.require('./local-server.js').getRunningServers();
|
||||
return this.electronService.remote.require('./local-controller.js').getRunningControllers();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import{ Controller } from '../models/controller';
|
||||
import { ServerSettings } from '../models/serverSettings';
|
||||
import { ControllerSettings } from '../models/controllerSettings';
|
||||
import { QemuSettings } from '../models/settings/qemu-settings';
|
||||
import { HttpController } from './http-controller.service';
|
||||
|
||||
@ -9,11 +9,11 @@ export class ControllerSettingsService {
|
||||
constructor(private httpController: HttpController) {}
|
||||
|
||||
get(controller:Controller ) {
|
||||
return this.httpController.get<ServerSettings>(controller, `/settings`);
|
||||
return this.httpController.get<ControllerSettings>(controller, `/settings`);
|
||||
}
|
||||
|
||||
update(controller:Controller , serverSettings: ServerSettings) {
|
||||
return this.httpController.post<ServerSettings>(controller, `/settings`, serverSettings);
|
||||
update(controller:Controller , controllerSettings: ControllerSettings) {
|
||||
return this.httpController.post<ControllerSettings>(controller, `/settings`, controllerSettings);
|
||||
}
|
||||
|
||||
getSettingsForQemu(controller:Controller ) {
|
||||
|
@ -12,13 +12,13 @@ export class ControllerDatabase {
|
||||
return this.dataChange.value;
|
||||
}
|
||||
|
||||
public addServer(controller:Controller ) {
|
||||
public addController(controller:Controller ) {
|
||||
const controllers = this.data.slice();
|
||||
controllers.push(controller);
|
||||
this.dataChange.next(controllers);
|
||||
}
|
||||
|
||||
public addServers(controllers:Controller []) {
|
||||
public addControllers(controllers:Controller []) {
|
||||
this.dataChange.next(controllers);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class MockedControllerService {
|
||||
});
|
||||
}
|
||||
|
||||
public getServerUrl(controller:Controller ) {
|
||||
public getControllerUrl(controller:Controller) {
|
||||
return `${controller.host}:${controller.port}`;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import {Controller , ServerProtocol } from '../models/controller';
|
||||
import {Controller , ControllerProtocol } from '../models/controller';
|
||||
import { HttpController } from './http-controller.service';
|
||||
|
||||
@Injectable()
|
||||
@ -82,11 +82,11 @@ export class ControllerService {
|
||||
return promise;
|
||||
}
|
||||
|
||||
public getServerUrl(controller:Controller ) {
|
||||
public getControllerUrl(controller:Controller) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/`;
|
||||
}
|
||||
|
||||
public checkServerVersion(controller:Controller ): Observable<any> {
|
||||
public checkControllerVersion(controller:Controller): Observable<any> {
|
||||
return this.httpController.get(controller, '/version');
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ export class ControllerService {
|
||||
if (local) {
|
||||
local.host = host;
|
||||
local.port = port;
|
||||
local.protocol = location.protocol as ServerProtocol;
|
||||
local.protocol = location.protocol as ControllerProtocol;
|
||||
this.update(local).then((updated) => {
|
||||
resolve(updated);
|
||||
}, reject);
|
||||
@ -107,7 +107,7 @@ export class ControllerService {
|
||||
controller.host = host;
|
||||
controller.port = port;
|
||||
controller.location = 'bundled';
|
||||
controller.protocol = location.protocol as ServerProtocol;
|
||||
controller.protocol = location.protocol as ControllerProtocol;
|
||||
this.create(controller).then((created) => {
|
||||
resolve(created);
|
||||
}, reject);
|
||||
|
@ -3,7 +3,7 @@ import { EventEmitter, Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import {Controller , ServerProtocol } from '../models/controller';
|
||||
import {Controller , ControllerProtocol } from '../models/controller';
|
||||
|
||||
/* tslint:disable:interface-over-type-literal */
|
||||
export type JsonOptions = {
|
||||
@ -217,7 +217,7 @@ export class HttpController {
|
||||
private getOptionsForController<T extends HeadersOptions>(controller:Controller , url: string, options: T) {
|
||||
if (controller && controller.host && controller.port) {
|
||||
if (!controller.protocol) {
|
||||
controller.protocol = location.protocol as ServerProtocol;
|
||||
controller.protocol = location.protocol as ControllerProtocol;
|
||||
}
|
||||
url = `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}${url}`;
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ export class InfoService {
|
||||
infoList.push(`Node ${node.name} is ${node.status}.`);
|
||||
}
|
||||
infoList.push(`Running on controller ${controller.name} with port ${controller.port}.`);
|
||||
infoList.push(`Server ID is ${controller.id}.`);
|
||||
infoList.push(`Controller ID is ${controller.id}.`);
|
||||
if (node.console_type !== 'none' && node.console_type !== 'null') {
|
||||
infoList.push(`Console is on port ${node.console} and type is ${node.console_type}.`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user