<!--
  ~ 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 nz-row [nzGutter]="24" *ngIf="statistic">
  <div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="12" [nzLg]="12" [nzXl]="12" class="col">
    <nz-card [nzBordered]="false" nzTitle="Available Task Slots" [nzLoading]="!statistic">
      <ng-container *ngIf="statistic">
        <div class="total">{{ statistic['slots-available'] | number: '1.0-0' }}</div>
        <div class="footer">
          <div class="field">
            <span>Total Task Slots</span>
            <span>{{ statistic['slots-total'] | number: '1.0-0' }}</span>
          </div>
          <ng-container *ngIf="statistic['slots-free-and-blocked']">
            <nz-divider nzType="vertical"></nz-divider>
            <div class="field">
              <span>Blocked Free Slots</span>
              <span class="warning">
                {{ statistic['slots-free-and-blocked'] | number: '1.0-0' }}
              </span>
            </div>
          </ng-container>
          <nz-divider nzType="vertical"></nz-divider>
          <div class="field">
            <span>Task Managers</span>
            <span>{{ statistic['taskmanagers'] | number: '1.0-0' }}</span>
          </div>
          <ng-container *ngIf="statistic['taskmanagers-blocked']">
            <nz-divider nzType="vertical"></nz-divider>
            <div class="field">
              <span>Blocked Task Managers</span>
              <span class="warning">
                {{ statistic['taskmanagers-blocked'] | number: '1.0-0' }}
              </span>
            </div>
          </ng-container>
        </div>
      </ng-container>
    </nz-card>
  </div>
  <div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="12" [nzLg]="12" [nzXl]="12" class="col">
    <nz-card [nzBordered]="false" nzTitle="Running Applications" [nzLoading]="!statistic">
      <ng-container *ngIf="statistic">
        <div class="total">{{ statistic['applications-running'] | number: '1.0-0' }}</div>
        <div class="footer">
          <div class="field">
            <span>Finished</span>
            <span>{{ statistic['applications-finished'] | number: '1.0-0' }}</span>
          </div>
          <nz-divider nzType="vertical"></nz-divider>
          <div class="field">
            <span>Canceled</span>
            <span>{{ statistic['applications-cancelled'] | number: '1.0-0' }}</span>
          </div>
          <nz-divider nzType="vertical"></nz-divider>
          <div class="field">
            <span>Failed</span>
            <span>{{ statistic['applications-failed'] | number: '1.0-0' }}</span>
          </div>
        </div>
      </ng-container>
    </nz-card>
  </div>
</div>
