<!--
Copyright 2017 The Kubernetes Authors.

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.
-->

<kd-graph-metrics [metrics]="node?.metrics"></kd-graph-metrics>

<kd-object-meta [initialized]="isInitialized"
                [objectMeta]="node?.objectMeta"></kd-object-meta>

<kd-card [initialized]="isInitialized">
  <div title
       i18n>Resource information</div>
  <div content
       *ngIf="isInitialized"
       fxLayout="row wrap">
    <kd-property *ngIf="node?.phase">
      <div key
           i18n>Phase</div>
      <div value>{{node?.phase}}</div>
    </kd-property>
    <kd-property *ngIf="node?.podCIDR">
      <div key
           i18n>Pod CIDR</div>
      <div value>{{node?.podCIDR}}</div>
    </kd-property>
    <kd-property *ngIf="node?.providerID">
      <div key
           i18n>Provider ID</div>
      <div value>{{node?.providerID}}</div>
    </kd-property>
    <kd-property *ngIf="node?.unschedulable">
      <div key
           i18n>Unschedulable</div>
      <div value>{{node?.unschedulable}}</div>
    </kd-property>
    <kd-property *ngIf="node?.addresses"
                 fxFlex="100">
      <div key
           i18n>Addresses</div>
      <div value>
        <kd-chips [map]="getAddresses()"></kd-chips>
      </div>
    </kd-property>
    <kd-property *ngIf="node?.taints"
                 fxFlex="100">
      <div key
           i18n>Taints</div>
      <div value>
        <kd-chips [map]="getTaints()"></kd-chips>
      </div>
    </kd-property>
  </div>
</kd-card>

<kd-card [initialized]="isInitialized">
  <div title
       i18n>System information</div>
  <div content
       *ngIf="isInitialized"
       fxLayout="row wrap">
    <kd-property *ngIf="node?.nodeInfo.machineID">
      <div key
           i18n>Machine ID</div>
      <div value>{{node?.nodeInfo.machineID}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.systemUUID">
      <div key
           i18n>System UUID</div>
      <div value>{{node?.nodeInfo.systemUUID}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.bootID">
      <div key
           i18n>Boot ID</div>
      <div value>{{node?.nodeInfo.bootID}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.kernelVersion">
      <div key
           i18n>Kernel version</div>
      <div value>{{node?.nodeInfo.kernelVersion}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.osImage">
      <div key
           i18n>OS Image</div>
      <div value>{{node?.nodeInfo.osImage}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.containerRuntimeVersion">
      <div key
           i18n>Container runtime version</div>
      <div value>{{node?.nodeInfo.containerRuntimeVersion}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.kubeletVersion">
      <div key
           i18n>kubelet version</div>
      <div value>{{node?.nodeInfo.kubeletVersion}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.kubeProxyVersion">
      <div key
           i18n>kube-proxy version</div>
      <div value>{{node?.nodeInfo.kubeProxyVersion}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.operatingSystem">
      <div key
           i18n>Operating system</div>
      <div value>{{node?.nodeInfo.operatingSystem}}</div>
    </kd-property>
    <kd-property *ngIf="node?.nodeInfo.architecture">
      <div key
           i18n>Architecture</div>
      <div value>{{node?.nodeInfo.architecture}}</div>
    </kd-property>
  </div>
</kd-card>

<kd-card [initialized]="isInitialized">
  <div title
       i18n>Allocation</div>
  <div content
       *ngIf="isInitialized">
    <div class="kd-allocated-resources">
      <div fxLayoutAlign="center center"
           fxLayout="column"
           fxFlex>
        <div class="kd-h1"
             i18n>CPU</div>
        <ngx-charts-pie-grid [results]="cpuAllocation"
                             [designatedTotal]="cpuCapacity"
                             [customColors]="customColors"
                             [animations]="false"
                             [view]="[500,250]"
                             [label]="cpuLabel">
        </ngx-charts-pie-grid>
      </div>
      <div fxLayoutAlign="center center"
           fxLayout="column"
           fxFlex>
        <div class="kd-h1"
             i18n>Memory</div>
        <ngx-charts-pie-grid [results]="memoryAllocation"
                             [designatedTotal]="memoryCapacity"
                             [customColors]="customColors"
                             [animations]="false"
                             [view]="[500,250]"
                             [label]="memoryLabel">
        </ngx-charts-pie-grid>
      </div>
      <div fxLayoutAlign="center center"
           fxLayout="column"
           fxFlex>
        <div class="kd-h1"
             i18n>Pods</div>
        <ngx-charts-pie-grid [results]="podsAllocation"
                             [designatedTotal]="node?.allocatedResources.podCapacity"
                             [customColors]="customColors"
                             [animations]="false"
                             [view]="[250,250]"
                             label="Pods">
        </ngx-charts-pie-grid>
      </div>
    </div>
  </div>
</kd-card>

<kd-condition-list [conditions]="node?.conditions"
                   [initialized]="isInitialized"></kd-condition-list>

<kd-pod-list [endpoint]="podListEndpoint"></kd-pod-list>

<kd-event-list [endpoint]="eventListEndpoint"></kd-event-list>
