mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-24 17:15:22 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
7c7e20d95f | |||
e959a947cc | |||
7b633c29dd | |||
c24517d1f0 | |||
9043c5b97c | |||
2227d11932 | |||
2e581c4495 | |||
cddce63e2b | |||
180c65351b | |||
27eb8eb9c3 | |||
ab84d1eea6 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gns3-web-ui",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.2",
|
||||
"author": {
|
||||
"name": "GNS3 Technology Inc.",
|
||||
"email": "developers@gns3.com"
|
||||
|
@ -142,7 +142,7 @@ export class ImportApplianceComponent implements OnInit {
|
||||
}
|
||||
this.template = template;
|
||||
|
||||
const url = this.getUploadPath(this.controller, template.template_type, name);
|
||||
const url = this.getUploadPath(this.controller, name);
|
||||
this.uploader.queue.forEach((elem) => (elem.url = url));
|
||||
const itemToUpload = this.uploader.queue[0];
|
||||
this.uploader.uploadItem(itemToUpload);
|
||||
@ -150,7 +150,7 @@ export class ImportApplianceComponent implements OnInit {
|
||||
fileReader.readAsText(file);
|
||||
}
|
||||
|
||||
private getUploadPath(controller:Controller , emulator: string, filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/${emulator}/images/${filename}`;
|
||||
private getUploadPath(controller:Controller , filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`;
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
if (appliance.iou) emulator = 'iou';
|
||||
if (appliance.qemu) emulator = 'qemu';
|
||||
|
||||
const url = this.applianceService.getUploadPath(this.controller, emulator, fileName);
|
||||
const url = this.applianceService.getUploadPath(this.controller, fileName);
|
||||
this.uploader.queue.forEach((elem) => (elem.url = url));
|
||||
|
||||
const itemToUpload = this.uploader.queue[0];
|
||||
@ -341,8 +341,6 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
dialogRef.componentInstance.appliance = object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
importImage(event, imageName) {
|
||||
this.computeChecksumMd5(event.target.files[0], false).then((output) => {
|
||||
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === imageName)[0];
|
||||
@ -359,22 +357,21 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
The MD5 sum is ${output} and should be ${imageToInstall.md5sum}. Do you want to accept it at your own risks?`;
|
||||
dialogRef.afterClosed().subscribe((answer: boolean) => {
|
||||
if (answer) {
|
||||
this.importImageFile(event);
|
||||
this.importImageFile(event, imageName);
|
||||
this.openSnackBar()
|
||||
} else {
|
||||
this.uploaderImage.clearQueue();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.importImageFile(event);
|
||||
this.importImageFile(event, imageName);
|
||||
this.openSnackBar()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
importImageFile(event) {
|
||||
importImageFile(event, imageName) {
|
||||
let name = event.target.files[0].name.split('-')[0];
|
||||
let fileName = event.target.files[0].name;
|
||||
let file = event.target.files[0];
|
||||
let fileReader: FileReader = new FileReader();
|
||||
let emulator;
|
||||
@ -384,7 +381,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
||||
if (this.applianceToInstall.iou) emulator = 'iou';
|
||||
|
||||
const url = this.applianceService.getUploadPath(this.controller, emulator, fileName);
|
||||
const url = this.applianceService.getUploadPath(this.controller, imageName);
|
||||
this.uploaderImage.queue.forEach((elem) => (elem.url = url));
|
||||
|
||||
const itemToUpload = this.uploaderImage.queue[0];
|
||||
|
@ -21,8 +21,18 @@ export class ReadmeEditorComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe(file => {
|
||||
if (file) this.markdown = file;
|
||||
this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe({
|
||||
next: (file) => {
|
||||
if (file) {
|
||||
this.markdown = file;
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
if (err.status === 404) {
|
||||
// File doesn't exist yet, which is fine
|
||||
this.markdown = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable()
|
||||
export class ProjectNameValidator {
|
||||
get(projectName) {
|
||||
var pattern = new RegExp(/[~`!#$%\^&*+=\[\]\\';,/{}|\\":<>\?]/);
|
||||
var pattern = new RegExp(/[~`!#$%\^&*+=\[\]\\';,/{}|\\"<>\?]/);
|
||||
|
||||
if (!pattern.test(projectName.value)) {
|
||||
return null;
|
||||
|
@ -11,6 +11,7 @@
|
||||
* Author: Sylvain MATHIEU, Elise LEBEAU
|
||||
*/
|
||||
import {Component, OnInit, QueryList, ViewChild, ViewChildren} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Controller} from "@models/controller";
|
||||
import {MatSort} from "@angular/material/sort";
|
||||
@ -49,7 +50,8 @@ export class UserManagementComponent implements OnInit {
|
||||
private progressService: ProgressService,
|
||||
private controllerService: ControllerService,
|
||||
public dialog: MatDialog,
|
||||
private toasterService: ToasterService) { }
|
||||
private toasterService: ToasterService,
|
||||
private location: Location) { }
|
||||
|
||||
ngOnInit() {
|
||||
const controllerId = this.route.parent.snapshot.paramMap.get('controller_id');
|
||||
@ -88,6 +90,8 @@ export class UserManagementComponent implements OnInit {
|
||||
},
|
||||
(error) => {
|
||||
this.progressService.setError(error);
|
||||
this.toasterService.error(`Cannot open the user management page`);
|
||||
this.location.back();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ export class ApplianceService {
|
||||
return this.httpController.get<Appliance>(controller, url) as Observable<Appliance>;
|
||||
}
|
||||
|
||||
getUploadPath(controller:Controller , emulator: string, filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}?allow_raw_image=true`;
|
||||
getUploadPath(controller:Controller, filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
updateAppliances(controller:Controller ): Observable<Appliance[]> {
|
||||
|
@ -14,10 +14,6 @@ export class ComputeService {
|
||||
return this.httpController.get<Compute[]>(controller, '/computes') as Observable<Compute[]>;
|
||||
}
|
||||
|
||||
getUploadPath(controller:Controller , emulator: string, filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/${emulator}/images/${filename}`;
|
||||
}
|
||||
|
||||
getStatistics(controller:Controller ): Observable<ComputeStatistics[]> {
|
||||
return this.httpController.get(controller, `/statistics`);
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ export class ImageManagerService {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${image_path}?install_appliances=${install_appliance}`;
|
||||
}
|
||||
|
||||
getUploadPath(controller:Controller , emulator: string, filename: string) {
|
||||
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
uploadedImage(controller :Controller, install_appliance, image_path, flie){
|
||||
return this.httpController.post<Image[]>(controller, `/images/upload/${image_path}?install_appliances=${install_appliance}`,flie) as Observable<Image[]>;
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ export class MapSettingsService {
|
||||
} else {
|
||||
localStorage.setItem('openReadme', 'false');
|
||||
}
|
||||
|
||||
if (localStorage.getItem('showInterfaceLabels')) {
|
||||
this.showInterfaceLabels = localStorage.getItem('showInterfaceLabels') === 'true' ? true : false;
|
||||
} else {
|
||||
localStorage.setItem('showInterfaceLabels', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
public getSymbolScaling(): boolean {
|
||||
@ -78,6 +84,12 @@ export class MapSettingsService {
|
||||
|
||||
toggleShowInterfaceLabels(value: boolean) {
|
||||
this.showInterfaceLabels = value;
|
||||
localStorage.removeItem('showInterfaceLabels');
|
||||
if (value) {
|
||||
localStorage.setItem('showInterfaceLabels', 'true');
|
||||
} else {
|
||||
localStorage.setItem('showInterfaceLabels', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
toggleIntegrateInterfaceLabels(value: boolean) {
|
||||
|
Reference in New Issue
Block a user