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