<button (click)="createResource()" class="wayne-button primary" *ngIf="authService.currentAppPermission.ingress.create || authService.currentUser.admin">
  创建 Ingress
</button>
<create-edit-ingress (create)="onResourceCreatedEvent($event)"></create-edit-ingress>

<div *ngIf="resourceId && resources?.length>0">
  <wayne-tabs>
    <wayne-tab (click)="onResourceCreatedEvent(resource.id)"
               [id]="resource.id"
               *ngFor="let resource of resources"
               [active]="resource.id==resourceId"
               [description]="resource.description">
      {{resource.name}}
    </wayne-tab>
  </wayne-tabs>
  <div class="table-search">
    <div class="table-search-left">
      <button (click)="createTemplate()" class="wayne-button normal"
              *ngIf="template?.length <= 0 && (authService.currentAppPermission.ingress.create || authService.currentUser.admin)">
        创建 ingress 模版
      </button>
      <button (click)="editResource()" class="wayne-button normal"
              *ngIf="authService.currentAppPermission.ingress.update || authService.currentUser.admin">
        编辑 ingress
      </button>
      <button (click)="listPublishHistory()" class="wayne-button normal"
              *ngIf="authService.currentAppPermission.ingress.read || authService.currentUser.admin">
        发布历史
      </button>
      <button (click)="deleteResource('删除 Ingress','是否确定删除 Ingress','已上线 Ingress 禁止直接删除！')" class="wayne-button normal" *ngIf="authService.currentAppPermission.ingress.offline || authService.currentUser.admin">
        删除 ingress
      </button>
      <button class="wayne-button normal" (click)="onShowDiffEvent()">{{'BUTTON.COMPARE_TEMPLATES' | translate}}</button>
      <wayne-filter-box (confirm)="onConfirmClick()" (cancel)="onCancelClick()">
        <wayne-checkbox-group [(ngModel)]="showList">
          <wayne-checkbox>创建时间</wayne-checkbox>
          <wayne-checkbox>上线机房</wayne-checkbox>
          <wayne-checkbox>发布说明</wayne-checkbox>
          <wayne-checkbox>创建者</wayne-checkbox>
          <wayne-checkbox>操作</wayne-checkbox>
        </wayne-checkbox-group>
      </wayne-filter-box>
    </div>
    <div class="table-search-right">
      <div class="toggle-switch">
        <input type="checkbox" id="toggle_1" [(ngModel)]="isOnline" (change)="onTemplateListChanged()">
        <label for="toggle_1">只显示上线模板</label>
      </div>
    </div>
  </div>
  <list-ingress
    [resources]="resources"
    [templates]="templates"
    [appId]="appId"
    [resourceId] = "resourceId"
    [showState]="showState"
    [page]="pageState.page"
    (paginate)="retrieveTemplates($event)"
    (cloneTemplate)="cloneTemplate($event)"
  ></list-ingress>
</div>
