Action created

This commit is contained in:
Piotr Pekala 2019-08-12 04:05:04 -07:00
parent 031291612f
commit 528842b713
5 changed files with 56 additions and 1 deletions

View File

@ -191,6 +191,7 @@ import { DuplicateActionComponent } from './components/project-map/context-menu/
import { MapSettingService } from './services/mapsettings.service';
import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
import { HelpComponent } from './components/help/help.component';
import { BringToFrontActionComponent } from './components/project-map/context-menu/actions/bring-to-front-action/bring-to-front-action.component';
if (environment.production) {
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
@ -312,7 +313,8 @@ if (environment.production) {
ConsoleComponent,
NodesMenuComponent,
ProjectMapMenuComponent,
HelpComponent
HelpComponent,
BringToFrontActionComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1,4 @@
<button mat-menu-item (click)="bringToFront()">
<mat-icon>vertical_align_top</mat-icon>
<span>Bring to front</span>
</button>

View File

@ -0,0 +1,43 @@
import { Component, OnInit, Input } from '@angular/core';
import { Server } from '../../../../../models/server';
import { Node } from '../../../../../cartography/models/node';
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
import { NodeService } from '../../../../../services/node.service';
import { Drawing } from '../../../../../cartography/models/drawing';
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
import { DrawingService } from '../../../../../services/drawing.service';
@Component({
selector: 'app-bring-to-front-action',
templateUrl: './bring-to-front-action.component.html'
})
export class BringToFrontActionComponent implements OnInit {
@Input() server: Server;
@Input() nodes: Node[];
@Input() drawings: Drawing[];
constructor(
private nodesDataSource: NodesDataSource,
private drawingsDataSource: DrawingsDataSource,
private nodeService: NodeService,
private drawingService: DrawingService
) {}
ngOnInit() {}
bringToFront() {
this.nodes.forEach((node) => {
node.z = 100;
this.nodesDataSource.update(node);
this.nodeService.update(this.server, node).subscribe((node: Node) => {});
});
this.drawings.forEach((drawing) => {
drawing.z = 100;
this.drawingsDataSource.update(drawing);
this.drawingService.update(this.server, drawing).subscribe((drawing: Drawing) => {});
});
}
}

View File

@ -44,6 +44,12 @@
[nodes]="nodes"
[drawings]="drawings"
></app-move-layer-down-action>
<app-bring-to-front-action
*ngIf="!projectService.isReadOnly(project) && (drawings.length || nodes.length) && labels.length===0"
[server]="server"
[nodes]="nodes"
[drawings]="drawings"
></app-bring-to-front-action>
<app-start-capture-action
*ngIf="!projectService.isReadOnly(project) && isBundledServer
&& drawings.length===0 && nodes.length===0 && links.length===1"