/* * Deepkit Framework * Copyright (C) 2021 Deepkit UG, Marc J. Schmidt * * This program is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * You should have received a copy of the MIT License along with this program. */ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { InputComponent, TableCellDirective, TableColumnDirective, TableComponent } from '@deepkit/desktop-ui'; import { Route, Workflow } from '@deepkit/framework-debug-api'; import { ControllerClient } from '../../client'; import { WorkflowComponent } from '../../components/workflow.component'; @Component({ template: `

HTTP Workflow

HTTP Routes

{{ row.httpMethods.join(',') }} {{ row.bodyType }} {{ row.groups.join(', ') }} `, styles: [ ` :host { display: flex; flex-direction: column; height: 100%; } .header { display: flex; margin-bottom: 15px; } .header dui-input { margin-left: auto; } `, ], changeDetection: ChangeDetectionStrategy.Eager, imports: [WorkflowComponent, InputComponent, FormsModule, TableComponent, TableColumnDirective, TableCellDirective], }) export class HttpComponent implements OnInit { public routes: Route[] = []; public selected: Route[] = []; public workflow?: Workflow; public filterQuery: string = ''; constructor( private controllerClient: ControllerClient, public cd: ChangeDetectorRef, ) {} get route() { return this.selected[0]; } filter(items: Route[], filter: string): any[] { if (!filter) return items; return items.filter(v => v.path.includes(filter) || v.controller.includes(filter)); } async ngOnInit(): Promise { [this.routes, this.workflow] = await Promise.all([ this.controllerClient.debug.routes(), this.controllerClient.getWorkflow('http'), ]); this.cd.detectChanges(); } }