{{!--
  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.
--}}

{{breadcrumb-bar breadcrumbs=breadcrumbs}}

<div class="col-md-12 container-fluid">
  <div class="row">

    {{node-menu-panel path="yarn-node" nodeId=model.rmNode.id
                      nodeAddr=model.node.id nmGpuInfo=model.nmGpuInfo}}

    <div class="col-md-10 container-fluid">

      <div class="row">
        <div class="col-md-12 container-fluid">
          <div class="panel panel-default">
            <div class="panel-heading">Node
              Information: {{model.rmNode.id}}</div>
            <table class="table">
              <tbody>
              <tr>
                <td>Total Vmem allocated for Containers</td>
                <td>{{divide num=model.node.totalVmemAllocatedContainersMB
                             den=1024}} GB
                </td>
              </tr>
              <tr>
                <td>Vmem enforcement enabled</td>
                <td>{{model.node.vmemCheckEnabled}}</td>
              </tr>
              <tr>
                <td>Total Pmem allocated for Containers</td>
                <td>{{divide num=model.node.totalPmemAllocatedContainersMB
                             den=1024}} GB
                </td>
              </tr>
              <tr>
                <td>Pmem enforcement enabled</td>
                <td>{{model.node.pmemCheckEnabled}}</td>
              </tr>
              <tr>
                <td>Total VCores allocated for Containers</td>
                <td>{{model.node.totalVCoresAllocatedContainers}}</td>
              </tr>
              <tr>
                <td>Node Healthy Status</td>
                <td>{{model.node.nodeHealthy}}</td>
              </tr>
              <tr>
                <td>Last Node Health Report Time</td>
                <td>{{model.node.lastNodeUpdateTime}}</td>
              </tr>
              <tr>
                <td>Node Health Report</td>
                <td>{{model.node.healthReport}}</td>
              </tr>
              {{#if model.node.nmStartupTime}}
                <tr>
                  <td>Node Manager Start Time</td>
                  <td>{{model.node.nmStartupTime}}</td>
                </tr>
              {{/if}}
              <tr>
                <td>Node Manager Version</td>
                <td>{{model.node.nodeManagerBuildVersion}}</td>
              </tr>
              <tr>
                <td>Hadoop Version</td>
                <td>{{model.node.hadoopBuildVersion}}</td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-lg-6 container-fluid">
          <div class="panel panel-default">
            <div class="panel-heading">
              Resource - Memory
            </div>
            <div class="container-fluid" id="mem-donut-chart">
              {{donut-chart data=model.rmNode.getMemoryDataForDonutChart
                            showLabels=true
                            parentId="mem-donut-chart"
                            ratio=0.6
                            type="memory"
                            colorTargets="good"
                            colorTargetReverse=true
                            maxHeight=350}}
            </div>
          </div>
        </div>

        <div class="col-lg-6 container-fluid">
          <div class="panel panel-default">
            <div class="panel-heading">
              Resource - VCores
            </div>
            <div class="container-fluid" id="vcore-donut-chart">
              {{donut-chart data=model.rmNode.getVCoreDataForDonutChart
                            showLabels=true
                            parentId="vcore-donut-chart"
                            ratio=0.6
                            colorTargets="good"
                            colorTargetReverse=true
                            maxHeight=350}}
            </div>
          </div>
        </div>
      </div>

      {{#if model.nmGpuInfo}}
        <div class="row">
          <div class="col-lg-6 container-fluid">
            <div class="panel panel-default">
              <div class="panel-heading">
                <li>
                  Resources - yarn.io/gpu
                </li>
              </div>
              <div class="container-fluid" id="gpu-donut-chart">
                {{donut-chart data=model.rmNode.getGpuDataForDonutChart
                              showLabels=true
                              parentId="gpu-donut-chart"
                              ratio=0.6
                              colorTargets="good"
                              colorTargetReverse=true
                              maxHeight=350}}
              </div>
            </div>
          </div>
        </div>
      {{/if}}
    </div>
  </div>
</div>
{{outlet}}
