mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-19 23:33:43 +00:00
Merge branch 'master' into master-3.0
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
<button mat-menu-item (click)="delete()">
|
<button mat-menu-item (click)="confirmDelete()">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
<span>Delete</span>
|
<span>Delete</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
@ -24,7 +25,7 @@ describe('DeleteActionComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [MatIconModule, MatMenuModule, NoopAnimationsModule],
|
imports: [MatIconModule, MatMenuModule, NoopAnimationsModule, MatBottomSheetModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: NodesDataSource, useClass: NodesDataSource },
|
{ provide: NodesDataSource, useClass: NodesDataSource },
|
||||||
{ provide: DrawingsDataSource, useClass: DrawingsDataSource },
|
{ provide: DrawingsDataSource, useClass: DrawingsDataSource },
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { MatBottomSheet } from '@angular/material/bottom-sheet';
|
||||||
|
import { ConfirmationBottomSheetComponent } from 'app/components/projects/confirmation-bottomsheet/confirmation-bottomsheet.component';
|
||||||
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
|
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
|
||||||
import { LinksDataSource } from '../../../../../cartography/datasources/links-datasource';
|
import { LinksDataSource } from '../../../../../cartography/datasources/links-datasource';
|
||||||
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
|
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
|
||||||
@ -26,11 +28,23 @@ export class DeleteActionComponent implements OnInit {
|
|||||||
private linksDataSource: LinksDataSource,
|
private linksDataSource: LinksDataSource,
|
||||||
private nodeService: NodeService,
|
private nodeService: NodeService,
|
||||||
private drawingService: DrawingService,
|
private drawingService: DrawingService,
|
||||||
private linkService: LinkService
|
private linkService: LinkService,
|
||||||
|
private bottomSheet: MatBottomSheet
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
||||||
|
confirmDelete() {
|
||||||
|
this.bottomSheet.open(ConfirmationBottomSheetComponent);
|
||||||
|
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
|
||||||
|
bottomSheetRef.instance.message = 'Do you want to delete all selected objects?';
|
||||||
|
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
this.delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
this.nodes.forEach((node) => {
|
this.nodes.forEach((node) => {
|
||||||
this.nodesDataSource.remove(node);
|
this.nodesDataSource.remove(node);
|
||||||
|
@ -259,6 +259,38 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="list-item-inside" *ngIf="version.images.cdrom_image">
|
||||||
|
<span>
|
||||||
|
{{ version.images.cdrom_image}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span *ngIf="checkImageFromVersion(version.images.cdrom_image)"
|
||||||
|
><mat-icon matTooltip="Ready to install" matTooltipClass="custom-tooltip">check</mat-icon></span
|
||||||
|
>
|
||||||
|
<span *ngIf="!checkImageFromVersion(version.images.cdrom_image)"
|
||||||
|
><mat-icon matTooltip="Missing" matTooltipClass="custom-tooltip">close</mat-icon></span
|
||||||
|
>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
class="non-visible"
|
||||||
|
#file4
|
||||||
|
(change)="importImage($event, version.images.cdrom_image)"
|
||||||
|
ng2FileSelect
|
||||||
|
[uploader]="uploaderImage"
|
||||||
|
/>
|
||||||
|
<button class="button" mat-raised-button (click)="file4.click()">Import</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="downloadImageFromVersion(version.images.cdrom_image)"
|
||||||
|
>
|
||||||
|
Download
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -391,6 +391,16 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
Mousetrap.bind('del', (event: Event) => {
|
Mousetrap.bind('del', (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.deleteItems();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteItems() {
|
||||||
|
this.bottomSheet.open(ConfirmationBottomSheetComponent);
|
||||||
|
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
|
||||||
|
bottomSheetRef.instance.message = 'Do you want to delete all selected objects?';
|
||||||
|
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
|
||||||
|
if (result) {
|
||||||
const selected = this.selectionManager.getSelected();
|
const selected = this.selectionManager.getSelected();
|
||||||
|
|
||||||
selected
|
selected
|
||||||
@ -401,6 +411,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
this.toasterService.success('Node has been deleted');
|
this.toasterService.success('Node has been deleted');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,33 +464,33 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const onLinkContextMenu = this.linkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
const onLinkContextMenu = this.linkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
||||||
const link = this.mapLinkToLink.convert(eventLink.link);
|
const link = this.mapLinkToLink.convert(eventLink.link);
|
||||||
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.pageY, eventLink.event.pageX);
|
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.screenY - 60, eventLink.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onEthernetLinkContextMenu = this.ethernetLinkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
const onEthernetLinkContextMenu = this.ethernetLinkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
||||||
const link = this.mapLinkToLink.convert(eventLink.link);
|
const link = this.mapLinkToLink.convert(eventLink.link);
|
||||||
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.pageY, eventLink.event.pageX);
|
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.screenY - 60, eventLink.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSerialLinkContextMenu = this.serialLinkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
const onSerialLinkContextMenu = this.serialLinkWidget.onContextMenu.subscribe((eventLink: LinkContextMenu) => {
|
||||||
const link = this.mapLinkToLink.convert(eventLink.link);
|
const link = this.mapLinkToLink.convert(eventLink.link);
|
||||||
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.pageY, eventLink.event.pageX);
|
this.contextMenu.openMenuForListOfElements([], [], [], [link], eventLink.event.screenY - 60, eventLink.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onNodeContextMenu = this.nodeWidget.onContextMenu.subscribe((eventNode: NodeContextMenu) => {
|
const onNodeContextMenu = this.nodeWidget.onContextMenu.subscribe((eventNode: NodeContextMenu) => {
|
||||||
const node = this.mapNodeToNode.convert(eventNode.node);
|
const node = this.mapNodeToNode.convert(eventNode.node);
|
||||||
this.contextMenu.openMenuForNode(node, eventNode.event.pageY, eventNode.event.pageX);
|
this.contextMenu.openMenuForNode(node, eventNode.event.screenY - 60, eventNode.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onDrawingContextMenu = this.drawingsWidget.onContextMenu.subscribe((eventDrawing: DrawingContextMenu) => {
|
const onDrawingContextMenu = this.drawingsWidget.onContextMenu.subscribe((eventDrawing: DrawingContextMenu) => {
|
||||||
const drawing = this.mapDrawingToDrawing.convert(eventDrawing.drawing);
|
const drawing = this.mapDrawingToDrawing.convert(eventDrawing.drawing);
|
||||||
this.contextMenu.openMenuForDrawing(drawing, eventDrawing.event.pageY, eventDrawing.event.pageX);
|
this.contextMenu.openMenuForDrawing(drawing, eventDrawing.event.screenY - 60, eventDrawing.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLabelContextMenu = this.labelWidget.onContextMenu.subscribe((eventLabel: LabelContextMenu) => {
|
const onLabelContextMenu = this.labelWidget.onContextMenu.subscribe((eventLabel: LabelContextMenu) => {
|
||||||
const label = this.mapLabelToLabel.convert(eventLabel.label);
|
const label = this.mapLabelToLabel.convert(eventLabel.label);
|
||||||
const node = this.nodes.find((n) => n.node_id === eventLabel.label.nodeId);
|
const node = this.nodes.find((n) => n.node_id === eventLabel.label.nodeId);
|
||||||
this.contextMenu.openMenuForLabel(label, node, eventLabel.event.pageY, eventLabel.event.pageX);
|
this.contextMenu.openMenuForLabel(label, node, eventLabel.event.screenY - 60, eventLabel.event.screenX);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onInterfaceLabelContextMenu = this.interfaceLabelWidget.onContextMenu.subscribe(
|
const onInterfaceLabelContextMenu = this.interfaceLabelWidget.onContextMenu.subscribe(
|
||||||
@ -489,8 +500,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
this.contextMenu.openMenuForInterfaceLabel(
|
this.contextMenu.openMenuForInterfaceLabel(
|
||||||
linkNode,
|
linkNode,
|
||||||
link,
|
link,
|
||||||
eventInterfaceLabel.event.pageY,
|
eventInterfaceLabel.event.screenY - 60,
|
||||||
eventInterfaceLabel.event.pageX
|
eventInterfaceLabel.event.screenX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -535,6 +546,9 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeAddedEvent.x = nodeAddedEvent.x / this.mapScaleService.getScale();
|
||||||
|
nodeAddedEvent.y = nodeAddedEvent.y / this.mapScaleService.getScale();
|
||||||
|
|
||||||
this.progressService.activate();
|
this.progressService.activate();
|
||||||
this.nodeService
|
this.nodeService
|
||||||
.createFromTemplate(
|
.createFromTemplate(
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
.import-button {
|
.import-button {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
width: 160px;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-button {
|
.add-button {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
width: 160px;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,3 +15,7 @@
|
|||||||
margin-left: -470px;
|
margin-left: -470px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button mat-button (click)="onNoClick()" tabindex="-1" color="accent">No Thanks</button>
|
<button mat-button (click)="onNoClick()" tabindex="-1" color="accent">Cancel</button>
|
||||||
<button mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
<button mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -18,6 +18,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button mat-button (click)="onNoClick()" tabindex="-1" color="accent">No Thanks</button>
|
<button mat-button (click)="onNoClick()" tabindex="-1" color="accent">Cancel</button>
|
||||||
<button mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
<button mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user