mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 13:33:06 +00:00
renamed [server] = "server" => [controller]="controller"
This commit is contained in:
parent
4b0499e373
commit
974e17395b
@ -27,13 +27,10 @@ describe('BundledControllerFinderComponent', () => {
|
||||
|
||||
|
||||
controllerServiceMock = jasmine.createSpyObj<ControllerService>([
|
||||
"getLocalServer"
|
||||
"getLocalController"
|
||||
]);
|
||||
|
||||
|
||||
// serverService = new MockedControllerService();
|
||||
// spyOn(serverService, 'getLocalServer').and.returnValue(Promise.resolve(server));
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: Router, useValue: router },
|
||||
@ -52,14 +49,14 @@ describe('BundledControllerFinderComponent', () => {
|
||||
it('should create and redirect to controller', fakeAsync(() => {
|
||||
const controller = new Controller ();
|
||||
controller.id = 99;
|
||||
controllerServiceMock.getLocalServer.and.returnValue(
|
||||
controllerServiceMock.getLocalController.and.returnValue(
|
||||
Promise.resolve(controller)
|
||||
);
|
||||
expect(component).toBeTruthy();
|
||||
tick(101)
|
||||
fixture.detectChanges()
|
||||
fixture.whenStable().then(() => {
|
||||
expect(controllerServiceMock.getLocalServer).toHaveBeenCalledWith('vps3.gns3.net',3000);
|
||||
expect(controllerServiceMock.getLocalController).toHaveBeenCalledWith('vps3.gns3.net',3000);
|
||||
expect(router.navigate).toHaveBeenCalledWith(['/controller', 99, 'projects']);
|
||||
})
|
||||
service = TestBed.inject(ControllerService);
|
||||
|
@ -31,7 +31,7 @@ export class BundledControllerFinderComponent implements OnInit {
|
||||
port = 80;
|
||||
}
|
||||
|
||||
this.serverService.getLocalServer(this.document.location.hostname, port).then((controller:Controller ) => {
|
||||
this.serverService.getLocalController(this.document.location.hostname, port).then((controller:Controller ) => {
|
||||
this.router.navigate(['/controller', controller.id, 'projects']);
|
||||
this.progressService.deactivate();
|
||||
});
|
||||
|
@ -55,9 +55,9 @@ export class AddControllerDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
async numberOfLocalServers() {
|
||||
const servers = await this.serverService.findAll();
|
||||
const controllers = await this.serverService.findAll();
|
||||
|
||||
return servers.filter((controller) => controller.location === 'local').length;
|
||||
return controllers.filter((controller) => controller.location === 'local').length;
|
||||
}
|
||||
|
||||
getDefaultHost() {
|
||||
|
@ -15,16 +15,16 @@ xdescribe('ControllerDiscoveryComponent', () => {
|
||||
let component: ControllerDiscoveryComponent;
|
||||
let fixture: ComponentFixture<ControllerDiscoveryComponent>;
|
||||
let mockedVersionService: MockedVersionService;
|
||||
let mockedServerService: MockedControllerService;
|
||||
let mockedControllerService: MockedControllerService;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockedServerService = new MockedControllerService();
|
||||
mockedControllerService = new MockedControllerService();
|
||||
mockedVersionService = new MockedVersionService();
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [MatCardModule, MatDividerModule],
|
||||
providers: [
|
||||
{ provide: VersionService, useFactory: () => mockedVersionService },
|
||||
{ provide: ControllerService, useFactory: () => mockedServerService },
|
||||
{ provide: ControllerService, useFactory: () => mockedControllerService },
|
||||
ControllerDatabase,
|
||||
],
|
||||
declarations: [ControllerDiscoveryComponent],
|
||||
@ -89,7 +89,7 @@ describe('isAvailable', () => {
|
||||
});
|
||||
|
||||
describe('discovery', () => {
|
||||
it('should discovery all servers available', (done) => {
|
||||
it('should discovery all controllers available', (done) => {
|
||||
const version = new Version();
|
||||
version.version = '2.1.8';
|
||||
|
||||
@ -132,7 +132,7 @@ describe('discoverFirstAvailableServer', () => {
|
||||
}));
|
||||
|
||||
it('should get first controller from discovered and with already added', fakeAsync(() => {
|
||||
mockedServerService.servers.push(controller);
|
||||
mockedControllerService.controllers.push(controller);
|
||||
|
||||
expect(component.discoveredServer).toBeUndefined();
|
||||
component.discoverFirstAvailableServer();
|
||||
@ -154,9 +154,9 @@ describe('accepting and ignoring found controller', () => {
|
||||
component.accept(controller);
|
||||
tick();
|
||||
expect(component.discoveredServer).toBeNull();
|
||||
expect(mockedServerService.servers[0].host).toEqual('199.111.111.1');
|
||||
expect(mockedServerService.servers[0].name).toEqual('199.111.111.1');
|
||||
expect(mockedServerService.servers[0].location).toEqual('remote');
|
||||
expect(mockedControllerService.controllers[0].host).toEqual('199.111.111.1');
|
||||
expect(mockedControllerService.controllers[0].name).toEqual('199.111.111.1');
|
||||
expect(mockedControllerService.controllers[0].location).toEqual('remote');
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -22,14 +22,14 @@ import { AddControllerDialogComponent } from './add-controller-dialog/add-contro
|
||||
export class ControllersComponent implements OnInit, OnDestroy {
|
||||
dataSource: ServerDataSource;
|
||||
displayedColumns = ['id', 'name', 'ip', 'port', 'actions'];
|
||||
serverStatusSubscription: Subscription;
|
||||
controllerStatusSubscription: Subscription;
|
||||
isElectronApp: boolean = false;
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private serverService: ControllerService,
|
||||
private serverDatabase: ControllerDatabase,
|
||||
private serverManagement: ControllerManagementService,
|
||||
private controllerManagement: ControllerManagementService,
|
||||
private changeDetector: ChangeDetectorRef,
|
||||
private electronService: ElectronService,
|
||||
private childProcessService: ChildProcessService,
|
||||
@ -39,7 +39,7 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
) { }
|
||||
|
||||
getControllers() {
|
||||
const runningServersNames = this.serverManagement.getRunningServers();
|
||||
const runningServersNames = this.controllerManagement.getRunningServers();
|
||||
|
||||
this.serverService.findAll().then((controllers:Controller []) => {
|
||||
controllers.forEach((controller) => {
|
||||
@ -78,7 +78,7 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.dataSource = new ServerDataSource(this.serverDatabase);
|
||||
|
||||
this.serverStatusSubscription = this.serverManagement.controllerStatusChanged.subscribe((serverStatus) => {
|
||||
this.controllerStatusSubscription = this.controllerManagement.controllerStatusChanged.subscribe((serverStatus) => {
|
||||
const controller = this.serverDatabase.find(serverStatus.serverName);
|
||||
if (!controller) {
|
||||
return;
|
||||
@ -101,7 +101,7 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.serverStatusSubscription.unsubscribe();
|
||||
this.controllerStatusSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
startLocalController() {
|
||||
@ -152,11 +152,11 @@ export class ControllersComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
async startServer(controller:Controller ) {
|
||||
await this.serverManagement.start(controller);
|
||||
await this.controllerManagement.start(controller);
|
||||
}
|
||||
|
||||
async stopServer(controller:Controller ) {
|
||||
await this.serverManagement.stop(controller);
|
||||
await this.controllerManagement.stop(controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ export class DeleteAllImageFilesDialogComponent implements OnInit {
|
||||
deleteFile() {
|
||||
const calls = [];
|
||||
this.deleteData.deleteFilesPaths.forEach(pathElement => {
|
||||
calls.push(this.imageService.deleteFile(this.deleteData.server, pathElement.filename).pipe(catchError(error => of(error))))
|
||||
calls.push(this.imageService.deleteFile(this.deleteData.controller, pathElement.filename).pipe(catchError(error => of(error))))
|
||||
});
|
||||
Observable.forkJoin(calls).subscribe(responses => {
|
||||
this.deleteFliesDetails = responses.filter(x => x !== null)
|
||||
|
@ -181,7 +181,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && cloudNodeTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="cloudNodeTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -65,7 +65,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && ethernetHubTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="ethernetHubTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -78,7 +78,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && ethernetSwitchTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="ethernetSwitchTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -143,7 +143,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && dockerTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="dockerTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -282,7 +282,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && iosTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="iosTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -150,7 +150,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && iouTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="iouTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -68,7 +68,7 @@ describe('PreferencesComponent', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should save correct server id', () => {
|
||||
it('should save correct controller id', () => {
|
||||
expect(component.controllerId).toBe('1');
|
||||
});
|
||||
});
|
||||
|
@ -298,7 +298,7 @@
|
||||
></app-custom-adapters>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && qemuTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="qemuTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -176,7 +176,7 @@
|
||||
></app-custom-adapters>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && virtualBoxTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="virtualBoxTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -138,7 +138,7 @@
|
||||
></app-custom-adapters>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && vmwareTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="vmwareTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -73,7 +73,7 @@
|
||||
</div>
|
||||
<app-symbols-menu
|
||||
*ngIf="isSymbolSelectionOpened && vpcsTemplate"
|
||||
[server]="server"
|
||||
[controller]="controller"
|
||||
[symbol]="vpcsTemplate.symbol"
|
||||
(symbolChangedEmitter)="symbolChanged($event)"
|
||||
></app-symbols-menu>
|
||||
|
@ -1,19 +1,17 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import{ Controller } from '../../../../../models/server';
|
||||
import { Controller } from '../../../../../models/controller';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { LinkService } from '../../../../../services/link.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reset-link-action',
|
||||
templateUrl: './reset-link-action.component.html'
|
||||
templateUrl: './reset-link-action.component.html',
|
||||
})
|
||||
export class ResetLinkActionComponent {
|
||||
@Input() controller:Controller ;
|
||||
@Input() controller: Controller;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService
|
||||
) {}
|
||||
constructor(private linkService: LinkService) {}
|
||||
|
||||
resetLink() {
|
||||
this.linkService.resetLink(this.controller, this.link).subscribe(() => {});
|
||||
|
@ -9,7 +9,7 @@
|
||||
<button (click)="applyFilter('warnings')" mat-menu-item>warnings</button>
|
||||
<button (click)="applyFilter('info')" mat-menu-item>info</button>
|
||||
<button (click)="applyFilter('map updates')" mat-menu-item>map updates</button>
|
||||
<button (click)="applyFilter('server requests')" mat-menu-item>server requests</button>
|
||||
<button (click)="applyFilter('controller requests')" mat-menu-item>controller requests</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button class="radio-button" value="1" (click)="setAction('install')" checked
|
||||
>Install new appliance from the GNS server</mat-radio-button
|
||||
>Install new appliance from the GNS controller</mat-radio-button
|
||||
><br />
|
||||
<mat-radio-button class="radio-button" value="2" (click)="setAction('import')"
|
||||
>Import an appliance file</mat-radio-button
|
||||
|
@ -17,7 +17,7 @@
|
||||
%s: path of the serial connection<br />
|
||||
%d: title of the console<br />
|
||||
%i: Project UUID<br />
|
||||
%c: server URL (http://user:password@controller:port)
|
||||
%c: controller URL (http://user:password@controller:port)
|
||||
</div>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
@ -5,7 +5,7 @@
|
||||
class="top-button"
|
||||
color="accent"
|
||||
(click)="onNoClick()"
|
||||
routerLink="/controller/{{ server?.id }}/preferences"
|
||||
routerLink="/controller/{{ controller?.id }}/preferences"
|
||||
>
|
||||
Go to template preferences
|
||||
</button>
|
||||
@ -55,7 +55,7 @@
|
||||
/>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-select *ngIf="selectedTemplate" placeholder="Choose server 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">
|
||||
{{ type }}
|
||||
</mat-option>
|
||||
|
@ -87,7 +87,7 @@
|
||||
{{ compute.host }}
|
||||
</div>
|
||||
<div>
|
||||
{{ server.location }}
|
||||
{{ controller.location }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,16 +23,16 @@ export class HttpRequestsInterceptor implements HttpInterceptor {
|
||||
async call() {
|
||||
let getCurrentUser = JSON.parse(localStorage.getItem(`isRememberMe`)) ?? null;
|
||||
const controller_id = this.loginService.controller_id;
|
||||
let server = await this.serverService.get(parseInt(controller_id, 10));
|
||||
server.tokenExpired = true;
|
||||
await this.serverService.update(server);
|
||||
let controller = await this.serverService.get(parseInt(controller_id, 10));
|
||||
controller.tokenExpired = true;
|
||||
await this.serverService.update(controller);
|
||||
try {
|
||||
if (getCurrentUser && getCurrentUser.isRememberMe) {
|
||||
let response = await this.loginService.getLoggedUserRefToken(server, getCurrentUser);
|
||||
server.authToken = response.access_token;
|
||||
server.tokenExpired = false;
|
||||
await this.serverService.update(server);
|
||||
await this.loginService.getLoggedUser(server);
|
||||
let response = await this.loginService.getLoggedUserRefToken(controller, getCurrentUser);
|
||||
controller.authToken = response.access_token;
|
||||
controller.tokenExpired = false;
|
||||
await this.serverService.update(controller);
|
||||
await this.loginService.getLoggedUser(controller);
|
||||
this.reloadCurrentRoute();
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -93,7 +93,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
expect(component.isInstalledSoftwareAvailable).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should show error when server management service throw event', () => {
|
||||
it('should show error when controller management service throw event', () => {
|
||||
const toaster: MockedToasterService = TestBed.get(ToasterService);
|
||||
serverManagementService.controllerStatusChanged.next({
|
||||
status: 'errored',
|
||||
@ -102,7 +102,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
expect(toaster.errors).toEqual(['Message']);
|
||||
});
|
||||
|
||||
it('should not show error when server management service throw event', () => {
|
||||
it('should not show error when controller management service throw event', () => {
|
||||
component.ngOnDestroy();
|
||||
const toaster: MockedToasterService = TestBed.get(ToasterService);
|
||||
serverManagementService.controllerStatusChanged.next({
|
||||
@ -112,7 +112,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
expect(toaster.errors).toEqual([]);
|
||||
});
|
||||
|
||||
describe('auto stopping servers', () => {
|
||||
describe('auto stopping controllers', () => {
|
||||
let event;
|
||||
beforeEach(() => {
|
||||
event = new Event('onbeforeunload');
|
||||
@ -124,7 +124,7 @@ describe('DefaultLayoutComponent', () => {
|
||||
expect(isClosed).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should stop all servers and close window', () => {
|
||||
it('should stop all controllers and close window', () => {
|
||||
component.shouldStopServersOnClosing = true;
|
||||
const isClosed = component.onBeforeUnload(event);
|
||||
expect(isClosed).toBeTruthy();
|
||||
|
@ -23,7 +23,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
public isLoginPage = false;
|
||||
public routeSubscription;
|
||||
|
||||
serverStatusSubscription: Subscription;
|
||||
controllerStatusSubscription: Subscription;
|
||||
shouldStopServersOnClosing = true;
|
||||
|
||||
recentlyOpenedcontrollerId: string;
|
||||
@ -33,7 +33,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private electronService: ElectronService,
|
||||
private recentlyOpenedProjectService: RecentlyOpenedProjectService,
|
||||
private serverManagement: ControllerManagementService,
|
||||
private controllerManagement: ControllerManagementService,
|
||||
private toasterService: ToasterService,
|
||||
private progressService: ProgressService,
|
||||
public router: Router,
|
||||
@ -53,8 +53,8 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.isInstalledSoftwareAvailable = this.electronService.isElectronApp;
|
||||
|
||||
// attach to notification stream when any of running local servers experienced issues
|
||||
this.serverStatusSubscription = this.serverManagement.controllerStatusChanged.subscribe((serverStatus) => {
|
||||
// attach to notification stream when any of running local controllers experienced issues
|
||||
this.controllerStatusSubscription = this.controllerManagement.controllerStatusChanged.subscribe((serverStatus) => {
|
||||
if (serverStatus.status === 'errored') {
|
||||
console.error(serverStatus.message);
|
||||
this.toasterService.error(serverStatus.message);
|
||||
@ -65,7 +65,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
|
||||
// stop servers only when in Electron
|
||||
// stop controllers only when in Electron
|
||||
this.shouldStopServersOnClosing = this.electronService.isElectronApp;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
$event.preventDefault();
|
||||
$event.returnValue = false;
|
||||
this.progressService.activate();
|
||||
await this.serverManagement.stopAll();
|
||||
await this.controllerManagement.stopAll();
|
||||
this.shouldStopServersOnClosing = false;
|
||||
this.progressService.deactivate();
|
||||
window.close();
|
||||
@ -127,7 +127,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.serverStatusSubscription.unsubscribe();
|
||||
this.controllerStatusSubscription.unsubscribe();
|
||||
this.routeSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ export class Link {
|
||||
suspend: boolean;
|
||||
link_style?: LinkStyle;
|
||||
|
||||
distance: number; // this is not from server
|
||||
length: number; // this is not from server
|
||||
source: Node; // this is not from server
|
||||
target: Node; // this is not from server
|
||||
distance: number; // this is not from controller
|
||||
length: number; // this is not from controller
|
||||
source: Node; // this is not from controller
|
||||
target: Node; // this is not from controller
|
||||
|
||||
x: number; // this is not from server
|
||||
y: number; // this is not from server
|
||||
x: number; // this is not from controller
|
||||
y: number; // this is not from controller
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { Builtin } from './server-settings-models/builtin';
|
||||
import { Docker } from './server-settings-models/docker';
|
||||
import { Dynamips } from './server-settings-models/dynamips';
|
||||
import { GraphicsView } from './server-settings-models/graphics-view';
|
||||
import { IOU } from './server-settings-models/iou';
|
||||
import { Qemu } from './server-settings-models/qemu';
|
||||
import { VirtualBox } from './server-settings-models/virtual-box';
|
||||
import { VMware } from './server-settings-models/vmware';
|
||||
import { VPCS } from './server-settings-models/vpcs';
|
||||
import { Builtin } from './controller-settings-models/builtin';
|
||||
import { Docker } from './controller-settings-models/docker';
|
||||
import { Dynamips } from './controller-settings-models/dynamips';
|
||||
import { GraphicsView } from './controller-settings-models/graphics-view';
|
||||
import { IOU } from './controller-settings-models/iou';
|
||||
import { Qemu } from './controller-settings-models/qemu';
|
||||
import { VirtualBox } from './controller-settings-models/virtual-box';
|
||||
import { VMware } from './controller-settings-models/vmware';
|
||||
import { VPCS } from './controller-settings-models/vpcs';
|
||||
|
||||
export class ServerSettings {
|
||||
Builtin: Builtin;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import{ Controller } from '../models/controller';
|
||||
|
||||
export class MockedControllerService {
|
||||
public servers:Controller [] = [];
|
||||
public controllers:Controller [] = [];
|
||||
|
||||
public create(controller:Controller ) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.servers.push(controller);
|
||||
this.controllers.push(controller);
|
||||
resolve(controller);
|
||||
});
|
||||
}
|
||||
@ -16,7 +16,7 @@ export class MockedControllerService {
|
||||
return Promise.resolve(controller);
|
||||
}
|
||||
|
||||
public getLocalServer(hostname: string, port: number) {
|
||||
public getLocalController(hostname: string, port: number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const controller = new Controller ();
|
||||
controller.id = 99;
|
||||
@ -26,7 +26,7 @@ export class MockedControllerService {
|
||||
|
||||
public findAll() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(this.servers);
|
||||
resolve(this.controllers);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ export class ControllerService {
|
||||
|
||||
public findAll() {
|
||||
let promise = new Promise<Controller[]>((resolve) => {
|
||||
let servers:Controller [] = [];
|
||||
let controllers:Controller [] = [];
|
||||
this.controllerIds.forEach((n) => {
|
||||
let controller:Controller = JSON.parse(localStorage.getItem(n));
|
||||
servers.push(controller);
|
||||
controllers.push(controller);
|
||||
});
|
||||
resolve(servers);
|
||||
resolve(controllers);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
@ -90,10 +90,10 @@ export class ControllerService {
|
||||
return this.httpServer.get(controller, '/version');
|
||||
}
|
||||
|
||||
public getLocalServer(host: string, port: number) {
|
||||
public getLocalController(host: string, port: number) {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
this.findAll().then((servers:Controller []) => {
|
||||
const local = servers.find((controller) => controller.location === 'bundled');
|
||||
this.findAll().then((controllers:Controller []) => {
|
||||
const local = controllers.find((controller) => controller.location === 'bundled');
|
||||
if (local) {
|
||||
local.host = host;
|
||||
local.port = port;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import{ Controller } from '../models/controller';
|
||||
|
||||
export function getTestServer():Controller {
|
||||
const server = new Controller ();
|
||||
server.host = '127.0.0.1';
|
||||
server.port = 3080;
|
||||
server.protocol = 'http:';
|
||||
return server;
|
||||
const controller = new Controller ();
|
||||
controller.host = '127.0.0.1';
|
||||
controller.port = 3080;
|
||||
controller.protocol = 'http:';
|
||||
return controller;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user