<div ng-controller="Kubernetes.ReplicationControllerController">

  <div class="row">
    <div hawtio-breadcrumbs></div>
  </div>

  <div class="row">
    <div hawtio-tabs></div>
  </div>

  <div class="row row-header">
    <div class="col-md-12">
      <span ng-show="model.fetched && !rawMode" class="icon-heading">
          <img ng-show="item.$iconUrl" class="icon-selected-app" ng-src="{{item.$iconUrl}}">&nbsp;{{item.metadata.name}}
      </span>

      <button class="btn btn-danger pull-right"
              title="Delete this ReplicationController"
              ng-click="deleteEntity()">
        <i class="fa fa-remove"></i> Delete
      </button>
      <span class="pull-right">&nbsp;</span>

      <a class="btn btn-default pull-right"
         title="Return to table of controllers"
              href="{{baseUri}}/kubernetes/replicationControllers?namespace={{item.metadata.namespace}}"><i class="fa fa-list"></i></a>
      <span class="pull-right">&nbsp;</span>

      <a class="btn btn-default pull-right"
         ng-click="flipRaw()"
         title="{{rawMode ? 'Raw mode' : 'Form mode'}}">{{rawMode ? 'Form' : 'Raw'}}</a>
       <span class="pull-right">&nbsp;</span>

       <a class="btn btn-default pull-right" ng-show="rawMode" ng-click="readOnly = !readOnly" ng-class="!readOnly ? 'btn-primary' : ''">Edit</a>
       <span class="pull-right">&nbsp;</span>

       <a class="btn btn-success pull-right" ng-show="dirty" ng-click="save(rawModel)">Save</a>
       <span class="pull-right">&nbsp;</span>

      <a class="btn btn-default pull-right"
         href="/kubernetes/namespace/{{item.metadata.namespace}}/events?q=kind%3DReplicationController%20name%3D{{item.metadata.name}}"
         title="View the events for this Replication Controller">
        <i class="fa fa-ellipsis-v"></i> Events
      </a>

      <span class="pull-right">&nbsp;&nbsp;&nbsp;</span>

      <a class="btn btn-default pull-right"
              ng-click="resizeDialog.open(item)"
              title="Scale this controller, changing the number of pods you wish to run">
        <i class="fa fa-server"></i> Scale
      </a>

      <span class="pull-right controller-pod-counts" ng-show="item.$podCounters">Pods:
        <a ng-show="item.$podCounters.podsLink" href="{{link(item.$podCounters.podsLink)}}" title="View pods">
          <span ng-show="item.$podCounters.ready" class="badge badge-success">{{item.$podCounters.ready}}</span>
          <span ng-show="item.$podCounters.valid" class="badge badge-info">{{item.$podCounters.valid}}</span>
          <span ng-show="item.$podCounters.waiting" class="badge">{{item.$podCounters.waiting}}</span>
          <span ng-show="item.$podCounters.error" class="badge badge-warning">{{item.$podCounters.error}}</span>
        </a>
      </span>
    </div>
  </div>

  <div ng-hide="model.fetched">
    <div class="row">
      <div class="col-md-12">
        <div class="align-center">
          <i class="fa fa-spinner fa-spin"></i>
        </div>
      </div>
    </div>
  </div>
  <div ng-show="model.fetched && !rawMode">
    <div class="row">
      <div class="col-md-12">
        <div hawtio-object="item" config="itemConfig"></div>
      </div>
    </div>
  </div>

  <div ng-show="model.fetched && rawMode">
    <div class="raw-json-view">
      <div hawtio-editor="rawModel" mode="mode" read-only="readOnly"></div>
    </div>
  </div>

  <ng-include src="'resizeDialog.html'"/>
</div>
