<div ng-controller="Kubernetes.ReplicationControllers">
  <script type="text/ng-template" id="currentReplicasTemplate.html">
    <div class="ngCellText" title="Number of running pods for this controller">
      <a ng-show="row.entity.podsLink" href="{{row.entity.podsLink}}">
        <span class="badge {{row.entity.status.replicas > 0 ? 'badge-success' : 'badge-warning'}}">{{row.entity.status.replicas}}</span>
      </a>
      <span ng-hide="row.entity.podsLink" class="badge">{{row.entity.status.replicas}}</span>
    </div>
  </script>
  <script type="text/ng-template" id="desiredReplicas.html">
    <div class="ngCellText">
      <a href="" class="badge badge-info" 
         ng-click="$parent.$parent.resizeDialog.open(row.entity)" 
         title="Edit the number of replicas of this controller">{{row.entity.spec.replicas || 0}}</a>
    </div>
  </script>

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

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

  <div class="row filter-header">
    <div class="col-md-12" >
      <span ng-show="!id">
        <hawtio-filter ng-model="tableConfig.filterOptions.filterText"
                       css-class="input-xxlarge"
                       placeholder="通过数据标签筛选相应的oracle服务..."
                       save-as="kubernetes-replication-controllers-text-filter"></hawtio-filter>
      </span>
      <button ng-show="model.fetched"
              class="btn btn-danger pull-right"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              ng-click="deletePrompt(id || tableConfig.selectedItems)">
        <i class="fa fa-remove"></i> 删除
      </button>
      <span class="pull-right">&nbsp;</span>

      <button ng-show="model.fetched"
              class="btn btn-danger pull-right"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              ng-click="stopPrompt(id || tableConfig.selectedItems)">
        <i class="fa fa-remove"></i> 停止
      </button>
      <span class="pull-right">&nbsp;</span>

      <button ng-show="model.fetched"
              class="btn btn-primary pull-right"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              ng-click="reStartPrompt(id || tableConfig.selectedItems)">
        <i class="fa fa-plus"></i> 启动
      </button>
      <span class="pull-right">&nbsp;</span>

      <!--<button ng-show="id"
              class="btn btn-primary pull-right"
              ng-click="id = undefined"><i class="fa fa-list"></i></button>
      <span ng-show="id" class="pull-right">&nbsp;</span>
      <a class="btn btn-default pull-right"
         title="Create a new replication controller"
         ng-click="createRCs()"><i class="fa fa-plus"></i> 创建汇总数据库</a>
      <span class="pull-right">&nbsp;</span>-->
      <button ng-show="model.fetched"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              class="btn btn-success pull-right"
              ng-click="extractData.open(id || tableConfig.selectedItems)">
        <i class="fa fa-play-circle"></i> 汇总
      </button>
      <!--<span ng-include="'runButton.html'"></span>-->
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <div ng-hide="model.fetched">
        <div class="align-center">
          <i class="fa fa-spinner fa-spin"></i>
        </div>
      </div>
      <div ng-show="model.fetched">
        <div ng-hide="model.replicationControllers.length" class="align-center">
          <p class="alert alert-info">当前没有正在运行的oracle服务.</p>
        </div>
        <div ng-show="model.replicationControllers.length">
          <table class="table table-bordered table-striped"
                 hawtio-simple-table="tableConfig"></table>
        </div>
      </div>
    </div>
  </div>
  <ng-include src="'resizeDialog.html'"/>

  <div modal="extractData.dialog.show">
    <form name="createNamespaceForm" class="" ng-submit="extractData.onOk()">
      <div class="modal-header"><h4>数据汇总</h4></div>
      <div class="modal-body">

        <div class="form-group" ng-class="{'has-error': createNamespaceForm.$invalid}">
          <label class="col-sm-3 control-label" for="selectedItem">
            数据库名称
            <a tabindex="0" role="button" data-toggle="popover" data-trigger="focus" data-html="true" title=""
               data-content="name of the new project" data-placement="top" data-original-title="">
              <span class="fa fa-info-circle"></span>
            </a>
          </label>

          <div class="col-sm-9">
            <select ng-model="extractData.selectedItem"  class="form-control"
                    title="name of the new namespace"
                    id ="selectedItem"
                    ng-options="x.$oracleName for x in filterReplicationControllers">

            </select>

              <span class="help-block" ng-show="filterReplicationControllers.length == 0">
                当前没有汇总数据库可以选择，请先创建，可以点击创建汇总数据库按钮进行创建或从汇总页面中的服务器数据列表中启动已创建的汇总数据库！
              </span>
          </div>
        </div>

        <hr/>

        <div class="form-group">
          <div class="col-sm-12">
                <span class="help-block" ng-show="extractData.selectedItem">
                   <br>
                   您所选择的数据库数据将会被抽取到汇总数据库:
                   <font color="Red"><strong>{{extractData.selectedItem.$oracleName}}</strong></font> 中，是否继续请确认！
                </span>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <input class="btn btn-primary" type="submit"
               ng-disabled="filterReplicationControllers.length == 0"
               value="确定">

        <button class="btn btn-warning cancel" type="button" ng-click="extractData.close()">取消</button>
      </div>
    </form>
  </div>
</div>
