mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-30 09:48:53 +00:00
commit
36482c7a96
@ -1,4 +1,5 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../../../../models/server';
|
||||
import { Symbol } from '../../../../models/symbol';
|
||||
import { SymbolService } from '../../../../services/symbol.service';
|
||||
@ -77,6 +78,6 @@ export class SymbolsComponent implements OnInit {
|
||||
}
|
||||
|
||||
getImageSourceForTemplate(symbol: string) {
|
||||
return `${this.server.protocol}//${this.server.host}:${this.server.port}/v3/symbols/${symbol}/raw`;
|
||||
return `${this.server.protocol}//${this.server.host}:${this.server.port}/${environment.current_version}/symbols/${symbol}/raw`;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { FileItem, FileUploader, ParsedResponseHeaders } from 'ng2-file-upload';
|
||||
import { Project } from '../../../models/project';
|
||||
import { Server } from '../../../models/server';
|
||||
@ -149,6 +150,6 @@ export class ImportApplianceComponent implements OnInit {
|
||||
}
|
||||
|
||||
private getUploadPath(server: Server, emulator: string, filename: string) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/${emulator}/images/${filename}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/${emulator}/images/${filename}`;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import { ToasterService } from '../../../services/toaster.service';
|
||||
import { ApplianceInfoDialogComponent } from './appliance-info-dialog/appliance-info-dialog.component';
|
||||
import { TemplateNameDialogComponent } from './template-name-dialog/template-name-dialog.component';
|
||||
import { UploadServiceService } from '../../../common/uploading-processbar/upload-service.service';
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-template-dialog',
|
||||
@ -246,7 +247,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
getAppliance(url: string) {
|
||||
let str = url.split('/v3');
|
||||
let str = url.split(`/${environment.current_version}`);
|
||||
let appliancePath = str[str.length - 1];
|
||||
this.applianceService.getAppliance(this.server, appliancePath).subscribe((appliance: Appliance) => {
|
||||
this.applianceToInstall = appliance;
|
||||
|
@ -3,6 +3,7 @@ import { MatBottomSheet } from '@angular/material/bottom-sheet';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||
import { environment } from 'environments/environment';
|
||||
import * as Mousetrap from 'mousetrap';
|
||||
import { from, Observable, Subscription } from 'rxjs';
|
||||
import { map, mergeMap, takeUntil } from 'rxjs/operators';
|
||||
@ -260,7 +261,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
this.nodesDataSource.changes.subscribe((nodes: Node[]) => {
|
||||
if (!this.server) return;
|
||||
nodes.forEach(async (node: Node) => {
|
||||
node.symbol_url = `${this.server.protocol}//${this.server.host}:${this.server.port}/v3/symbols/${node.symbol}/raw`;
|
||||
node.symbol_url = `${this.server.protocol}//${this.server.host}:${this.server.port}/${environment.current_version}/symbols/${node.symbol}/raw`;
|
||||
|
||||
if (node.width == 0 && node.height == 0) {
|
||||
let symbolDimensions = await this.symbolService.getDimensions(this.server, node.symbol).toPromise();
|
||||
|
@ -11,6 +11,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { FileItem, FileSelectDirective, FileUploadModule } from 'ng2-file-upload';
|
||||
import { of } from 'rxjs/internal/observable/of';
|
||||
import { Project } from '../../../models/project';
|
||||
@ -47,11 +48,11 @@ export class MockedProjectService {
|
||||
}
|
||||
|
||||
getUploadPath(server: Server, uuid: string, project_name: string) {
|
||||
return `http://${server.host}:${server.port}/v3/projects/${uuid}/import?name=${project_name}`;
|
||||
return `http://${server.host}:${server.port}/${environment.current_version}/projects/${uuid}/import?name=${project_name}`;
|
||||
}
|
||||
|
||||
getExportPath(server: Server, project: Project) {
|
||||
return `http://${server.host}:${server.port}/v3/projects/${project.project_id}/export`;
|
||||
return `http://${server.host}:${server.port}/${environment.current_version}/projects/${project.project_id}/export`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,19 +3,20 @@ import { Console } from 'console';
|
||||
import { Server } from '../models/server';
|
||||
import { HttpServer } from '../services/http-server.service';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
@Pipe({
|
||||
name: 'authImage'
|
||||
})
|
||||
export class AuthImageFilter implements PipeTransform {
|
||||
|
||||
|
||||
constructor(
|
||||
private httpServer: HttpServer,
|
||||
private domSanitizer: DomSanitizer
|
||||
) {}
|
||||
|
||||
) { }
|
||||
|
||||
async transform(src: string, server: Server) {
|
||||
let url = src.split('v3')[1];
|
||||
let url = src.split(`${environment.current_version}`)[1];
|
||||
const imageBlob: Blob = await this.httpServer.getBlob(server, url).toPromise();
|
||||
const reader = new FileReader();
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { CloudTemplate } from '../models/templates/cloud-template';
|
||||
import { EthernetHubTemplate } from '../models/templates/ethernet-hub-template';
|
||||
@ -51,7 +52,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.saveTemplate(server, cloudtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/1`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(cloudtemplate);
|
||||
}));
|
||||
@ -71,7 +72,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.saveTemplate(server, ethernethubtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/2');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/2`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(ethernethubtemplate);
|
||||
}));
|
||||
@ -91,7 +92,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.saveTemplate(server, ethernetswitchtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/3');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/3`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(ethernetswitchtemplate);
|
||||
}));
|
||||
@ -112,7 +113,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.addTemplate(server, cloudtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`)
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(cloudtemplate);
|
||||
}));
|
||||
@ -132,7 +133,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.addTemplate(server, ethernethubtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`)
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(ethernethubtemplate);
|
||||
}));
|
||||
@ -152,7 +153,7 @@ describe('BuiltInTemplatesService', () => {
|
||||
|
||||
service.addTemplate(server, ethernetswitchtemplate).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`)
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(ethernetswitchtemplate);
|
||||
}));
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Compute } from '../models/compute';
|
||||
import { ComputeStatistics } from '../models/computeStatistics';
|
||||
@ -14,7 +15,7 @@ export class ComputeService {
|
||||
}
|
||||
|
||||
getUploadPath(server: Server, emulator: string, filename: string) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/${emulator}/images/${filename}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/${emulator}/images/${filename}`;
|
||||
}
|
||||
|
||||
getStatistics(server: Server): Observable<ComputeStatistics[]> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { SvgToDrawingConverter } from '../cartography/helpers/svg-to-drawing-converter';
|
||||
import { Drawing } from '../cartography/models/drawing';
|
||||
import { Project } from '../models/project';
|
||||
@ -44,7 +45,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.updatePosition(server, project, drawing, 10, 20).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -59,7 +60,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.updatePosition(server, project, drawing, 10.1, 20.6).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -75,7 +76,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.updateSizeAndPosition(server, drawing, 100, 100, svgSample).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 100,
|
||||
@ -94,7 +95,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.updateSizeAndPosition(server, drawing, 100.1, 100.6, svgSample).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 100,
|
||||
@ -117,7 +118,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.update(server, drawing).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -136,7 +137,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.delete(server, drawing).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings/id`);
|
||||
expect(req.request.method).toEqual('DELETE');
|
||||
}));
|
||||
|
||||
@ -153,7 +154,7 @@ describe('DrawingService', () => {
|
||||
|
||||
service.duplicate(server, drawing.project_id, drawing).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/v3/projects/${drawing.project_id}/drawings`);
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/${drawing.project_id}/drawings`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({
|
||||
svg: drawing.svg,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
import { HttpServer, ServerError, ServerErrorHandler } from './http-server.service';
|
||||
@ -76,7 +77,7 @@ describe('HttpServer', () => {
|
||||
it('should make GET query for get method', () => {
|
||||
service.get(server, '/test').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -89,7 +90,7 @@ describe('HttpServer', () => {
|
||||
expect(data).toEqual(testData);
|
||||
});
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
|
||||
@ -115,7 +116,7 @@ describe('HttpServer', () => {
|
||||
it('should make GET query for getText method', () => {
|
||||
service.getText(server, '/test').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
expect(req.request.responseType).toEqual('text');
|
||||
});
|
||||
@ -130,7 +131,7 @@ describe('HttpServer', () => {
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
expect(req.request.responseType).toEqual('text');
|
||||
});
|
||||
@ -138,7 +139,7 @@ describe('HttpServer', () => {
|
||||
it('should make POST query for post method', () => {
|
||||
service.post(server, '/test', { test: '1' }).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -146,7 +147,7 @@ describe('HttpServer', () => {
|
||||
it('should make PUT query for put method', () => {
|
||||
service.put(server, '/test', { test: '1' }).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -154,7 +155,7 @@ describe('HttpServer', () => {
|
||||
it('should make DELETE query for delete method', () => {
|
||||
service.delete(server, '/test').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('DELETE');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -162,7 +163,7 @@ describe('HttpServer', () => {
|
||||
it('should make PATCH query for patch method', () => {
|
||||
service.patch(server, '/test', { test: '1' }).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('PATCH');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -170,7 +171,7 @@ describe('HttpServer', () => {
|
||||
it('should make HEAD query for head method', () => {
|
||||
service.head(server, '/test').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('HEAD');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -178,7 +179,7 @@ describe('HttpServer', () => {
|
||||
it('should make OPTIONS query for options method', () => {
|
||||
service.options(server, '/test').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/test`);
|
||||
expect(req.request.method).toEqual('OPTIONS');
|
||||
expect(req.request.responseType).toEqual('json');
|
||||
});
|
||||
@ -195,7 +196,7 @@ describe('HttpServer', () => {
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('/v3/test');
|
||||
expect(req.request.url).toBe('/v3/test');
|
||||
const req = httpTestingController.expectOne(`/${environment.current_version}/test`);
|
||||
expect(req.request.url).toBe(`/${environment.current_version}/test`);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { EventEmitter, Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Server, ServerProtocol } from '../models/server';
|
||||
@ -218,9 +219,9 @@ export class HttpServer {
|
||||
if (!server.protocol) {
|
||||
server.protocol = location.protocol as ServerProtocol;
|
||||
}
|
||||
url = `${server.protocol}//${server.host}:${server.port}/v3${url}`;
|
||||
url = `${server.protocol}//${server.host}:${server.port}/${environment.current_version}${url}`;
|
||||
} else {
|
||||
url = `/v3${url}`;
|
||||
url = `/${environment.current_version}${url}`;
|
||||
}
|
||||
|
||||
if (!options.headers) {
|
||||
|
@ -3,6 +3,7 @@ import { Server } from '../models/server';
|
||||
import { HttpServer } from './http-server.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Image } from "../models/images";
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -16,11 +17,11 @@ export class ImageManagerService {
|
||||
}
|
||||
|
||||
getImagePath(server:Server, install_appliance, image_path){
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${image_path}?install_appliances=${install_appliance}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/images/upload/${image_path}?install_appliances=${install_appliance}`;
|
||||
}
|
||||
|
||||
getUploadPath(server: Server, emulator: string, filename: string) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${filename}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
uploadedImage(server:Server, install_appliance, image_path, flie){
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Node } from '../cartography/models/node';
|
||||
import { Port } from '../models/port';
|
||||
import { Server } from '../models/server';
|
||||
@ -53,7 +54,7 @@ describe('LinkService', () => {
|
||||
|
||||
service.createLink(server, sourceNode, sourcePort, targetNode, targetPort, 0, 0, 10, 10).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/links');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/links`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({
|
||||
nodes: [
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Label } from '../cartography/models/label';
|
||||
import { Node } from '../cartography/models/node';
|
||||
import { Project } from '../models/project';
|
||||
@ -49,7 +50,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.start(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/start');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id/start`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -61,7 +62,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.stop(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/stop');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id/stop`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -73,7 +74,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.suspend(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/suspend');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id/suspend`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -85,7 +86,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.reload(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/reload');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id/reload`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -97,7 +98,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.startAll(server, project).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/start');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/1/nodes/start`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -109,7 +110,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.stopAll(server, project).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/stop');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/1/nodes/stop`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -121,7 +122,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.suspendAll(server, project).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/suspend');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/1/nodes/suspend`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -133,7 +134,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.reloadAll(server, project).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/reload');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/1/nodes/reload`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
}));
|
||||
@ -146,7 +147,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.createFromTemplate(server, project, template, 10, 20, 'compute').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/templates/mytemplate');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/templates/mytemplate`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -165,7 +166,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.updatePosition(server, project, node, 10, 20).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -183,7 +184,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.updatePosition(server, project, node, 10.1, 20.6).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -205,7 +206,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.updateLabel(server, node, label).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
label: {
|
||||
@ -228,7 +229,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.update(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual({
|
||||
x: 10,
|
||||
@ -244,7 +245,7 @@ describe('NodeService', () => {
|
||||
|
||||
service.delete(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes/id`);
|
||||
expect(req.request.method).toEqual('DELETE');
|
||||
}));
|
||||
|
||||
@ -256,7 +257,7 @@ describe('NodeService', () => {
|
||||
service.duplicate(server, node).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne(
|
||||
`http://127.0.0.1:3080/v3/projects/${node.project_id}/nodes/${node.node_id}/duplicate`
|
||||
`http://127.0.0.1:3080/${environment.current_version}/projects/${node.project_id}/nodes/${node.node_id}/duplicate`
|
||||
);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
}));
|
||||
|
@ -6,6 +6,7 @@ import { Router } from '@angular/router';
|
||||
import { ToasterService } from './toaster.service';
|
||||
import { MapSettingsService } from './mapsettings.service';
|
||||
import { node } from 'prop-types';
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
@Injectable()
|
||||
export class NodeConsoleService {
|
||||
@ -71,7 +72,7 @@ export class NodeConsoleService {
|
||||
protocol = "wss"
|
||||
}
|
||||
|
||||
return `${protocol}://${server.host}:${server.port}/v3/projects/${node.project_id}/nodes/${node.node_id}/console/ws`
|
||||
return `${protocol}://${server.host}:${server.port}/${environment.current_version}/projects/${node.project_id}/nodes/${node.node_id}/console/ws`
|
||||
}
|
||||
|
||||
openConsolesForAllNodesInWidget(nodes: Node[]) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
|
||||
@Injectable()
|
||||
@ -9,7 +10,7 @@ export class NotificationService {
|
||||
protocol = "wss"
|
||||
}
|
||||
|
||||
return `${protocol}://${server.host}:${server.port}/v3/notifications/ws?token=${server.authToken}`;
|
||||
return `${protocol}://${server.host}:${server.port}/${environment.current_version}/notifications/ws?token=${server.authToken}`;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +20,6 @@ export class NotificationService {
|
||||
protocol = "wss"
|
||||
}
|
||||
|
||||
return `${protocol}://${server.host}:${server.port}/v3/projects/${project_id}/notifications/ws?token=${server.authToken}`;
|
||||
return `${protocol}://${server.host}:${server.port}/${environment.current_version}/projects/${project_id}/notifications/ws?token=${server.authToken}`;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { of } from 'rxjs';
|
||||
import { Project } from '../models/project';
|
||||
import { Server } from '../models/server';
|
||||
@ -89,14 +90,14 @@ describe('ProjectService', () => {
|
||||
it('should get the project', () => {
|
||||
service.get(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
});
|
||||
|
||||
it('should open the project', () => {
|
||||
service.open(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/open');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/open`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
});
|
||||
@ -104,7 +105,7 @@ describe('ProjectService', () => {
|
||||
it('should close the project', () => {
|
||||
service.close(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/close');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/close`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({});
|
||||
});
|
||||
@ -112,42 +113,42 @@ describe('ProjectService', () => {
|
||||
it('should list projects', () => {
|
||||
service.list(server).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
});
|
||||
|
||||
it('should get nodes of project', () => {
|
||||
service.nodes(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/nodes`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
});
|
||||
|
||||
it('should get links of project', () => {
|
||||
service.links(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/links');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/links`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
});
|
||||
|
||||
it('should get drawings of project', () => {
|
||||
service.drawings(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/drawings`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
});
|
||||
|
||||
it('should delete the project', () => {
|
||||
service.delete(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject`);
|
||||
expect(req.request.method).toEqual('DELETE');
|
||||
});
|
||||
|
||||
it('should duplicate the project', () => {
|
||||
service.duplicate(server, 'projectId', 'projectName').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/projectId/duplicate');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/projectId/duplicate`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { Drawing } from '../cartography/models/drawing';
|
||||
import { Node } from '../cartography/models/node';
|
||||
@ -83,11 +84,11 @@ export class ProjectService {
|
||||
}
|
||||
|
||||
getUploadPath(server: Server, uuid: string, project_name: string) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/projects/${uuid}/import?name=${project_name}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/projects/${uuid}/import?name=${project_name}`;
|
||||
}
|
||||
|
||||
getExportPath(server: Server, project: Project) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/projects/${project.project_id}/export`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/projects/${project.project_id}/export`;
|
||||
}
|
||||
|
||||
export(server: Server, project_id: string): Observable<any> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { QemuTemplate } from '../models/templates/qemu-template';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -81,7 +82,7 @@ describe('QemuService', () => {
|
||||
|
||||
service.saveTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/1`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -133,7 +134,7 @@ describe('QemuService', () => {
|
||||
|
||||
service.addTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { Snapshot } from '../models/snapshot';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -40,7 +41,7 @@ describe('SnapshotService', () => {
|
||||
const snapshot = new Snapshot();
|
||||
service.create(server, 'myproject', snapshot).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/snapshots');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/snapshots`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(snapshot);
|
||||
}));
|
||||
@ -48,7 +49,7 @@ describe('SnapshotService', () => {
|
||||
it('should list snapshots', inject([SnapshotService], (service: SnapshotService) => {
|
||||
service.list(server, 'myproject').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/snapshots');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/projects/myproject/snapshots`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { of } from 'rxjs';
|
||||
import { Server } from '../models/server';
|
||||
import { Symbol } from '../models/symbol';
|
||||
@ -38,14 +39,14 @@ describe('SymbolService', () => {
|
||||
it('should list symbols', inject([SymbolService], (service: SymbolService) => {
|
||||
service.list(server).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/symbols');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/symbols`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
|
||||
it('should get raw symbol', inject([SymbolService], (service: SymbolService) => {
|
||||
service.raw(server, ':my/tested.png').subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/symbols/:my/tested.png/raw');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/symbols/:my/tested.png/raw`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import { Node } from '../cartography/models/node';
|
||||
import { Server } from '../models/server';
|
||||
import { Symbol } from '../models/symbol';
|
||||
import { HttpServer } from './http-server.service';
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
const CACHE_SIZE = 1;
|
||||
|
||||
@ -65,7 +66,7 @@ export class SymbolService {
|
||||
}
|
||||
|
||||
getSymbolFromTemplate(server: Server, template: Template) {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/symbols/${template.symbol}/raw`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/${environment.current_version}/symbols/${template.symbol}/raw`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
import { HttpServer } from './http-server.service';
|
||||
@ -33,7 +34,7 @@ describe('TemplateService', () => {
|
||||
|
||||
service.list(server).subscribe(() => {});
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
expect(req.request.url).toBe('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
expect(req.request.url).toBe(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { Server } from '../models/server';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -47,7 +48,7 @@ describe('VersionService', () => {
|
||||
it('should get version', inject([VersionService], (service: VersionService) => {
|
||||
service.get(server).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/version');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/version`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { VirtualBoxTemplate } from '../models/templates/virtualbox-template';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -63,7 +64,7 @@ describe('VirtualBoxService', () => {
|
||||
|
||||
service.saveTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/1`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -97,7 +98,7 @@ describe('VirtualBoxService', () => {
|
||||
|
||||
service.addTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -105,7 +106,7 @@ describe('VirtualBoxService', () => {
|
||||
it('should get available virtual machines', inject([VirtualBoxService], (service: VirtualBoxService) => {
|
||||
service.getVirtualMachines(server).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/compute/virtualbox/vms');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/compute/virtualbox/vms`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { VmwareTemplate } from '../models/templates/vmware-template';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -62,7 +63,7 @@ describe('VmwareService', () => {
|
||||
|
||||
service.saveTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/1`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -95,7 +96,7 @@ describe('VmwareService', () => {
|
||||
|
||||
service.addTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -103,7 +104,7 @@ describe('VmwareService', () => {
|
||||
it('should get available virtual machines', inject([VmwareService], (service: VmwareService) => {
|
||||
service.getVirtualMachines(server).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/compute/vmware/vms');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/compute/vmware/vms`);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
}));
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Server } from '../models/server';
|
||||
import { VpcsTemplate } from '../models/templates/vpcs-template';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
@ -51,7 +52,7 @@ describe('VpcsService', () => {
|
||||
|
||||
service.saveTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates/1`);
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
@ -73,7 +74,7 @@ describe('VpcsService', () => {
|
||||
|
||||
service.addTemplate(server, template).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
|
||||
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/${environment.current_version}/templates`);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual(template);
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user