<div class="searchBar" @fade>
  <app-search-select [(value)]="companyNo" [label]="'selectCompany' | translate" optL="companyName"
                     [data]="companys" optV="companyNo"></app-search-select>
  <div class="btnLine">
    <button nz-button class="searchBtn" [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch()"><span>{{'search' | translate}}</span></button>
    <button nz-button class="searchBtn" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span></button>
    <button nz-button class="searchBtn" [nzLoading]="isLoading" (click)="add()"><span>{{'add' | translate}}</span></button>
  </div>
</div>
<div class="tableBar" @fade>
  <nz-table #nzTable
            [nzData]="data"
            [nzLoading]="isLoading">
    <thead nz-thead>
    <tr>
      <th nz-th><span>{{'num' | translate}}</span></th>
      <th nz-th><span>{{'databaseName' | translate}}</span></th>
      <th nz-th><span>{{'dbPolicy' | translate}}</span></th>
      <th nz-th><span>{{'duration' | translate}}</span></th>
      <th nz-th><span>{{'shardDuration' | translate}}</span></th>
      <th nz-th><span>{{'remark' | translate}}</span></th>
      <th nz-th><span>{{'belongCompany' | translate}}</span></th>
      <th nz-th><span>{{'oper' | translate}}</span></th>
    </tr>
    </thead>
    <tbody nz-tbody>
    <tr *ngFor="let one of nzTable.data,let i = index">
      <td nz-td>{{i + 1}}</td>
      <td nz-td>{{one.databaseName}}</td>
      <td nz-td>{{one.retentionPolicyName}}</td>
      <td nz-td>{{one.duration}}</td>
      <td nz-td>{{one.shardDuration}}</td>
      <td nz-td>{{one.remark}}</td>
      <td nz-td>{{one.companyName}}</td>
      <td nz-td>
        <span class="editSpan" (click)="onPolicyMgr(one)">{{'retentionPolicyMgr' | translate}}</span>
        <nz-divider nzType="vertical" *ngIf="0 == one.defaultDatabase"></nz-divider>
        <span class="editSpan" *ngIf="0 == one.defaultDatabase" (click)="edit(one)" >{{'edit' | translate}}</span>
        <nz-divider nzType="vertical" *ngIf="0 == one.defaultDatabase"></nz-divider>
        <span class="deleteFontColor" *ngIf="0 == one.defaultDatabase"
              (click)="deleteConfirm(one)">{{'delete' | translate}}</span>
      </td>
    </tr>
    </tbody>
  </nz-table>
</div>

<nz-modal [(nzVisible)]="isVisible" [nzTitle]="(isUpdate ? 'editInfluxDB' : 'addInfluxDB') | translate" [nzContent]="modalContent" nzWidth="500"
          [nzFooter]="modalFooter" (nzOnCancel)="cancel()" nzMaskClosable="false">
  <ng-template #modalContent>
    <app-search-item isMust="true" inModal="true" [readonly]="isUpdate"
                     [(value)]="req.databaseName" [label]="'databaseName' | translate" ></app-search-item>
    <!--<app-search-select isMust="true" [(value)]="req.companyNo" [label]="'selectCompany' | translate" optL="companyName"-->
                       <!--[data]="companys" inModal="true" optV="companyNo"></app-search-select>-->
    <app-search-item [(value)]="req.remark" [label]="'remark' | translate" inModal="true"></app-search-item>
  </ng-template>
  <ng-template #modalFooter>
    <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span></button>
    <button nz-button class="searchBtn" nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
  </ng-template>
</nz-modal>
