File

src/app/node-details-page/node-details-page.component.ts

Implements

OnInit

Metadata

styleUrls ./node-details-page.component.scss
templateUrl ./node-details-page.component.html

Index

Properties
Methods

Constructor

constructor(route: ActivatedRoute, changeDetector: ChangeDetectorRef, router: Router)
Parameters :
Name Type Optional
route ActivatedRoute No
changeDetector ChangeDetectorRef No
router Router No

Methods

onNodeUpdate
onNodeUpdate(deleted: boolean)
Parameters :
Name Type Optional
deleted boolean No
Returns : void

Properties

nodeId
Type : string
Default value : null
nodeType
Type : NodeDetailsType
Default value : null
projectId
Type : string
Default value : null
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {NodeDetailsType} from '@app/node-details/node-details.component';

@Component({
  templateUrl: './node-details-page.component.html',
  styleUrls: ['./node-details-page.component.scss']
})
export class NodeDetailsPageComponent implements OnInit {
  nodeType: NodeDetailsType = null;
  nodeId: string = null;
  projectId: string = null;

  constructor(private route: ActivatedRoute, private changeDetector: ChangeDetectorRef, private router: Router) {}

  ngOnInit() {
    this.projectId = this.route.snapshot.paramMap.get('id');
    const componentId = this.route.snapshot.paramMap.get('componentId');
    const interfaceId = this.route.snapshot.paramMap.get('interfaceId');

    if (componentId !== null) {
      this.nodeId = componentId;
      this.nodeType = NodeDetailsType.Component;
    } else if (interfaceId !== null) {
      this.nodeId = interfaceId;
      this.nodeType = NodeDetailsType.Interface;
    }
    this.changeDetector.detectChanges();
  }

  onNodeUpdate(deleted: boolean): void {
    if (deleted) {
      this.router.navigate([`/projects/${this.projectId}/graph`]);
    }
  }
}
<ng-container *ngIf="nodeType !== null">
  <app-node-details
    [projectId]="this.projectId"
    [nodeType]="this.nodeType"
    [nodeId]="this.nodeId"
    [callback]="onNodeUpdate"
  ></app-node-details>
</ng-container>

./node-details-page.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""