<!--/*
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 class="wrapper">
    <mat-expansion-panel hideToggle [expanded]="true">
      <mat-expansion-panel-header class="metadata-inspector-header">
        <mat-panel-title>METADATA INSPECTOR</mat-panel-title>
      </mat-expansion-panel-header>
      <section>
        <mat-expansion-panel hideToggle [expanded]="true">
          <mat-expansion-panel-header class="header-dataverse">
            <mat-panel-title class="title">DATAVERSES</mat-panel-title>
          </mat-expansion-panel-header>
          <section class="section">
            <li *ngFor="let dataverse of dataverses; index as i">
              <mat-checkbox [labelPosition]="'after'" class="margin" (change)="generateFilter(dataverse.DataverseName, $event, i)" [(ngModel)]="dataverse.active">{{dataverse.DataverseName}}</mat-checkbox>
            </li>
            <div class="refresh">
              <button mat-button class="refresh-button" (click)="refreshMetadata()" matTooltip="Click to refresh changes in AsterixDB"><mat-icon class="list-icon">cached</mat-icon>REFRESH</button>
            </div>
          </section>
        </mat-expansion-panel>
        <mat-expansion-panel hideToggle [expanded]="panelOpenState">
          <mat-expansion-panel-header #datasetsPanel class="header">
            <mat-panel-title class="title">DATASETS</mat-panel-title>
            <mat-panel-description></mat-panel-description>
          </mat-expansion-panel-header>
          <section class="section">
            <li *ngFor="let dataset of datasetsFiltered" (click)="openMetadataInspectorDialog(dataset, 'dataset')">
              {{dataset.DatasetName}}</li>
          </section>
        </mat-expansion-panel>
        <mat-expansion-panel hideToggle [expanded]="panelOpenState">
          <mat-expansion-panel-header class="header">
            <mat-panel-title class="title">DATATYPES</mat-panel-title>
            <mat-panel-description></mat-panel-description>
          </mat-expansion-panel-header>
          <section class="section">
            <li *ngFor="let datatype of datatypesFiltered" (click)="openMetadataInspectorDialog(datatype, 'datatype')">
              {{datatype.DatatypeName}}</li>
          </section>
        </mat-expansion-panel>
        <mat-expansion-panel hideToggle [expanded]="panelOpenState">
          <mat-expansion-panel-header class="header">
            <mat-panel-title class="title">INDEX</mat-panel-title>
            <mat-panel-description></mat-panel-description>
          </mat-expansion-panel-header>
          <section class="section">
            <li *ngFor="let index of indexesFiltered" (click)="openMetadataInspectorDialog(index, 'index')">
              {{index.IndexName}}</li>
          </section>
        </mat-expansion-panel>
        <mat-expansion-panel hideToggle [expanded]="panelOpenState">
          <mat-expansion-panel-header class="header">
            <mat-panel-title class="title">USER DEFINED FUNCTIONS</mat-panel-title>
            <mat-panel-description></mat-panel-description>
          </mat-expansion-panel-header>
          <section class="section">
            <li *ngFor="let function of functionsFiltered" (click)="openMetadataInspectorDialog(function, 'function')">
              {{function.Name}}
            </li>
          </section>
        </mat-expansion-panel>
      </section>
    </mat-expansion-panel>
</div>
