mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-07 19:18:40 +00:00
Duplicate action added
This commit is contained in:
parent
031291612f
commit
c0ef682e9c
@ -40,6 +40,9 @@
|
|||||||
<button mat-icon-button matTooltip="Delete project" (click)="delete(row)" *ngIf="row.status == 'closed'">
|
<button mat-icon-button matTooltip="Delete project" (click)="delete(row)" *ngIf="row.status == 'closed'">
|
||||||
<mat-icon aria-label="Delete project">delete</mat-icon>
|
<mat-icon aria-label="Delete project">delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<button mat-icon-button matTooltip="Duplicate project" (click)="duplicate(row)">
|
||||||
|
<mat-icon aria-label="Duplicate project">filter_2</mat-icon>
|
||||||
|
</button>
|
||||||
<button mat-icon-button matTooltip="Open project" (click)="open(row)" *ngIf="row.status == 'closed'">
|
<button mat-icon-button matTooltip="Open project" (click)="open(row)" *ngIf="row.status == 'closed'">
|
||||||
<mat-icon aria-label="Open project">play_arrow</mat-icon>
|
<mat-icon aria-label="Open project">play_arrow</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
@ -107,6 +107,12 @@ export class ProjectsComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicate(project: Project) {
|
||||||
|
this.projectService.duplicate(this.server, project.project_id, project.name).subscribe(() => {
|
||||||
|
this.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
addBlankProject() {
|
addBlankProject() {
|
||||||
const dialogRef = this.dialog.open(AddBlankProjectDialogComponent, {
|
const dialogRef = this.dialog.open(AddBlankProjectDialogComponent, {
|
||||||
width: '400px',
|
width: '400px',
|
||||||
|
@ -132,6 +132,13 @@ describe('ProjectService', () => {
|
|||||||
expect(req.request.method).toEqual('DELETE');
|
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/v2/projects/projectId/duplicate');
|
||||||
|
expect(req.request.method).toEqual('POST');
|
||||||
|
});
|
||||||
|
|
||||||
it('should get notifications path of project', () => {
|
it('should get notifications path of project', () => {
|
||||||
const path = service.notificationsPath(server, 'myproject');
|
const path = service.notificationsPath(server, 'myproject');
|
||||||
expect(path).toEqual('ws://127.0.0.1:3080/v2/projects/myproject/notifications/ws');
|
expect(path).toEqual('ws://127.0.0.1:3080/v2/projects/myproject/notifications/ws');
|
||||||
|
@ -49,6 +49,10 @@ export class ProjectService {
|
|||||||
return this.httpServer.delete(server, `/projects/${project_id}`);
|
return this.httpServer.delete(server, `/projects/${project_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicate(server: Server, project_id: string, project_name): Observable<any> {
|
||||||
|
return this.httpServer.post(server, `/projects/${project_id}/duplicate`, { name: project_name });
|
||||||
|
}
|
||||||
|
|
||||||
notificationsPath(server: Server, project_id: string): string {
|
notificationsPath(server: Server, project_id: string): string {
|
||||||
return `ws://${server.host}:${server.port}/v2/projects/${project_id}/notifications/ws`;
|
return `ws://${server.host}:${server.port}/v2/projects/${project_id}/notifications/ws`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user