import {Component, OnInit, Input, Pipe, PipeTransform} from "@angular/core"; import { InaxTranslatePipe } from '../../../@inax/translate'; import { InaxSqlService } from '../../../@inax/sql'; @Pipe({name: 'keys'}) export class KeysPipe implements PipeTransform { transform(value, args:string[]) : any { let keys = []; for (let key in value) { keys.push({key: key, value: value[key]}); } return keys; } } @Component({ selector: 'sql-viewer', templateUrl: 'app/components/sqlviewer/sqlviewer.component.html', styleUrls: ['app/components/sqlviewer/sqlviewer.component.css'] }) export class SqlViewerComponent implements OnInit { public table: string = "Motions"; public where: string = ""; public orderby: string = ""; public include: string = ""; public groupby: string = ""; public skip: number = 0; public take: number = 50; public result:any[] = []; public queriedData:string = "?"; constructor(private _inaxSql: InaxSqlService) { } public ngOnInit() { } public onExecuteQuery() { try { this.queriedData = "?"; this._inaxSql.query(this.table, this.where, this.orderby, this.include, this.groupby, this.skip, this.take).subscribe((data: any) => { try { if (data != null) { this.queriedData = this.table; this.result = data.Entries; } else { console.warn("no data red!"); } } catch (error) { console.warn("no data red!"); } }); } catch (error) { console.error(error); } } }