<!--/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ -->
<div id='top' *ngIf='treeData' class='tree-card'>
    <mat-expansion-panel hideToggle [expanded]="true">
        <mat-expansion-panel-header class='header header-centered-v'>
            <mat-panel-title>OUTPUT DATA</mat-panel-title>
            <mat-icon>format_list_numbered_rtl</mat-icon>
        </mat-expansion-panel-header>
        <mat-panel-description class='content'>
            <div class='panel'>
                <span class='summary' >Items: {{metrics.resultCount}} Size: {{metrics.resultSizeKb}} Kb</span>
                <mat-paginator [showFirstLastButtons]="true" [length]='metrics.resultCount' [pageSize]='pagedefaults.pageSize' [pageSizeOptions]='pageSizeOptions' (page)='showResults($event, false)'>
                    </mat-paginator>
                <span class='options'>
                    <button mat-button class='button' (click)='dataExpand()' matTooltip="Expand Data"><mat-icon>add_circle</mat-icon></button>
                    <button mat-button class='button' (click)='dataCollapse()' matTooltip="Collapse Data"><mat-icon>remove_circle_outline</mat-icon></button>
                    <button mat-button class='button button-json' (click)='showTable()' matTooltip="Show Table View">TABLE</button>
                    <button mat-button class='button button-json' (click)='showTree()' matTooltip="Show Tree View">TREE</button>
                    <button mat-button class='button button-json' (click)='showJSON()' matTooltip="Show JSON View">JSON</button>
                    <button id='export' mat-button class='button' (click)='exportToText()' matTooltip="Export JSON file to Computer">EXPORT</button>
                </span>
            </div>
            <div *ngIf='treeVisible' class='navi-data' class='navi-data'>
                <mat-icon class='navi-path'>link</mat-icon>
                <span class='navi-path'>{{jsonPath_}}</span>
            </div>
            <div class='divider'>
                <div *ngIf='tableVisible'>
                    <table mat-table [dataSource]="dataSource" class='items-table'>
                        <ng-container matColumnDef="{{col}}" *ngFor="let col of displayedColumns">
                            <th mat-header-cell *matHeaderCellDef class='cell'>{{col}}</th>
                            <td mat-cell *matCellDef="let element"class='cell' >{{element[col]}}</td>
                        </ng-container>
                        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
                        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
                    </table>
                </div>
                <div *ngIf='treeVisible'>
                    <tree-node (jsonPath)='changeJsonPathValue($event)' [node]='treeData_'></tree-node>
                </div>
                <div *ngIf='jsonVisible' class='json'>
                    <pre>{{jsonData}}</pre>
                </div>
                <div id='bottom'></div>
            </div>
            <button *ngIf='showGoTop' mat-fab color='warn' class='button back-button' (click)='gotoTop()'>
                <mat-icon>keyboard_arrow_up</mat-icon>
            </button>
        </mat-panel-description>
    </mat-expansion-panel>
</div>
