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