gns3-web-ui/src/app/components/project-map/change-symbol-dialog/change-symbol-dialog.component.ts
2021-04-12 13:46:28 +02:00

37 lines
1.0 KiB
TypeScript

import { Component, Input, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../cartography/models/node';
import { Server } from '../../../models/server';
import { NodeService } from '../../../services/node.service';
@Component({
selector: 'app-change-symbol-dialog',
templateUrl: './change-symbol-dialog.component.html',
styleUrls: ['./change-symbol-dialog.component.scss'],
})
export class ChangeSymbolDialogComponent implements OnInit {
@Input() server: Server;
@Input() node: Node;
symbol: string;
constructor(public dialogRef: MatDialogRef<ChangeSymbolDialogComponent>, private nodeService: NodeService) {}
ngOnInit() {
this.symbol = this.node.symbol;
}
symbolChanged(chosenSymbol: string) {
this.symbol = chosenSymbol;
}
onCloseClick() {
this.dialogRef.close();
}
onSelectClick() {
this.nodeService.updateSymbol(this.server, this.node, this.symbol).subscribe(() => {
this.onCloseClick();
});
}
}