<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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 *ngIf="isLoading == false" style="margin: 15px; padding: 15px; background-color: white">
  <div align="right">
    <button nz-button id="btn-backHome" nzType="primary" style="margin: 10px 4px 10px 4px" (click)="backHome()">
      <i nz-icon nzType="caret-left"></i>
      {{ 'Back' | translate }}
    </button>
    <button
      nz-button
      id="btn-delTemplate"
      nzType="primary"
      style="margin: 10px 4px 10px 4px"
      nz-popconfirm
      nzPlacement="left"
      nzTitle="{{ 'Are you sure you want to delete?' | translate }}"
      nzCancelText="{{ 'Cancel' | translate }}"
      nzOkText="{{ 'Ok' | translate }}"
      (nzOnConfirm)="deleteTemplate()"
    >
      <i nz-icon nzType="delete"></i>
      {{ 'Delete Template' | translate }}
    </button>
  </div>
  <nz-descriptions nzTitle="Template Info" nzBordered [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
    <nz-descriptions-item nzTitle="{{ 'Template Name' | translate }}">
      {{ templateInfo.experimentTemplateSpec.name }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="{{ 'Framework' | translate }}">
      {{ templateInfo.experimentTemplateSpec.experimentSpec.meta.framework }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="{{ 'Author' | translate }}">
      {{ templateInfo.experimentTemplateSpec.author }}
    </nz-descriptions-item>
    <nz-descriptions-item nzTitle="{{ 'Description' | translate }}">
      {{ templateInfo.experimentTemplateSpec.description }}
    </nz-descriptions-item>
  </nz-descriptions>
  <nz-tabset>
    <nz-tab nzTitle="{{ 'Experiment' | translate }}{{ 'Spec' | translate }}">
      <nz-descriptions nzTitle="{{ 'Experiment Spec' | translate }}" nzBordered [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
        <nz-descriptions-item nzTitle="{{ 'Namespace' | translate }}">
          {{ templateInfo.experimentTemplateSpec.experimentSpec.meta.namespace }}
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="{{ 'Image' | translate }}">
          {{ templateInfo.experimentTemplateSpec.experimentSpec.environment.image }}
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="{{ 'Command' | translate }}">
          {{ templateInfo.experimentTemplateSpec.experimentSpec.meta.cmd }}
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="{{ 'Environment Varibles' | translate }}">
          {{ templateVars }}
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="{{ 'Tags' | translate }}">
          <nz-tag *ngFor="let tag of templateInfo.experimentTemplateSpec.experimentSpec.meta.tags">{{tag}}</nz-tag>
        </nz-descriptions-item>
      </nz-descriptions>
    </nz-tab>
    <nz-tab nzTitle="{{ 'Parameters' | translate }}">
      <nz-table #basicTable [nzData]="templateInfo.experimentTemplateSpec.parameters">
        <thead>
          <tr>
            <th>{{ 'Name' | translate }}</th>
            <th>{{ 'Value' | translate }}</th>
            <th>{{ 'Description' | translate }}</th>
            <th>{{ 'Required' | translate }}</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of basicTable.data">
            <td>{{ data.name }}</td>
            <td>{{ data.value }}</td>
            <td>{{ data.description }}</td>
            <td>
              {{ data.required }}
            </td>
          </tr>
        </tbody>
      </nz-table>
    </nz-tab>
  </nz-tabset>
</div>
