<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 sj_fluid" >
      <span ng-show="!id">
        <hawtio-filter ng-model="tableConfig.filterOptions.filterText"
                       css-class="input-xxlarge sj_txt_box"
                       placeholder="通过数据标签筛选相应的oracle服务..."
                       save-as="kubernetes-replication-controllers-text-filter"></hawtio-filter>
      </span>
      <button ng-show="model.fetched"
              class="btn btn-danger pull-right sj_btn_grey "
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              ng-click="deletePrompt(id || tableConfig.selectedItems)">
        <i class="glyphicon glyphicon-trash"></i> 删除
      </button>
      <span class="pull-right">&nbsp;</span>

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

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

      <button ng-show="model.fetched"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              class="btn btn-success pull-right sj_btn_grey"
              ng-click="extractClick.open(id || tableConfig.selectedItems)">
        <i class="glyphicon glyphicon-cloud-download"></i> 汇总
      </button>
      <span class="pull-right">&nbsp;</span>
      
      <button ng-show="model.fetched"
              ng-disabled="!id && tableConfig.selectedItems.length == 0"
              class="btn btn-success pull-right sj_btn_grey"
              ng-click="extractOracle(id || tableConfig.selectedItems)">
        <i class="glyphicon glyphicon-cloud-download"></i> 抽取
      </button>      
    </div>
  </div>
  <div class="row">
    <div class="col-md-12 sj_fluid">
      <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 sj_content_table"
                 hawtio-simple-table="tableConfig" ></table>
        </div>
      </div>
    </div>
  </div>  

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

        <div class="form-group" ng-class="{'has-error': selectOracle.$invalid}">
          <label class="fl control-label sj_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="extractClick.selectedItem"  class="form-control sj_txt_box02"
                    title="name of the new namespace"
                    id ="selectedItem"
                    ng-options="x.name for x in configs.oracleParam">
            </select>
          </div>
        </div>

        <hr/>

        <div class="form-group">
          <div class="col-sm-12 alert alert-warning sj_alert-warning">
            <span class="help-block " ng-show="configs.oracleParam.length >0 && extractClick.selectedItem">
                   <br>
              您所选择的数据库数据将会被抽取到汇总数据库:
              <font color="Red"><strong>{{extractClick.selectedItem.name}}</strong></font> 中,是否继续请确认!
            </span>
            <span class="help-block" ng-show="configs.oracleParam.length == 0">
              当前没有汇总数据库可以选择,请先创建,可以点击创建汇总数据库按钮进行创建或从汇总页面中的服务器数据列表中启动已创建的汇总数据库!
            </span>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <input class="btn btn-primary sj_btn_blue" type="submit"
               ng-disabled="configs.oracleParam.length == 0"
               value="确定">

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