src/app/tasks/task-definition/graph/task-graph.component.ts
Component that shows the graph of a Task Definition
selector | app-task-graph |
templateUrl | task-graph.component.html |
Properties |
|
Methods |
constructor(route: ActivatedRoute, tasksService: TasksService, metamodelService: MetamodelService, renderService: RenderService)
|
||||||||||||||||||||
Constructor
Parameters :
|
ngOnDestroy |
ngOnDestroy()
|
Will cleanup any {@link Subscription}s to prevent memory leaks.
Returns :
void
|
ngOnInit |
ngOnInit()
|
Initialize
Returns :
void
|
Public metamodelService |
metamodelService:
|
Type : MetamodelService
|
Public renderService |
renderService:
|
Type : RenderService
|
taskDefinition$ |
taskDefinition$:
|
Type : Observable<TaskDefinition>
|
Stream name |
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { mergeMap } from 'rxjs/operators';
import { RenderService } from '../../components/flo/render.service';
import { MetamodelService } from '../../components/flo/metamodel.service';
import { TasksService } from '../../tasks.service';
import { Observable } from 'rxjs';
import { TaskDefinition } from '../../model/task-definition';
/**
* Component that shows the graph of a Task Definition
*
* @author Damien Vitrac
*/
@Component({
selector: 'app-task-graph',
templateUrl: 'task-graph.component.html'
})
export class TaskGraphComponent implements OnInit, OnDestroy {
/**
* Stream name
*/
taskDefinition$: Observable<TaskDefinition>;
/**
* Constructor
*
* @param {ActivatedRoute} route
* @param {TasksService} tasksService
* @param {MetamodelService} metamodelService
* @param {RenderService} renderService
*/
constructor(private route: ActivatedRoute,
private tasksService: TasksService,
public metamodelService: MetamodelService,
public renderService: RenderService) {
}
/**
* Initialize
*/
ngOnInit() {
this.taskDefinition$ = this.route.parent.params
.pipe(mergeMap(val => this.tasksService.getDefinition(val.id)));
}
/**
* Will cleanup any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
this.metamodelService.clearCachedData();
}
}
<div *ngIf="taskDefinition$ | async as taskDefinition; else loading" dataflowLayoutType type="full">
<app-graph-view [dsl]="taskDefinition.dslText" [paperPadding]="20" class="composed-task-details"
[metamodel]="metamodelService" [renderer]="renderService">
</app-graph-view>
</div>
<ng-template #loading>
<app-loader></app-loader>
</ng-template>