<!DOCTYPE html>
<html>
<head>
    {{ template "inc/select2" . }}
    <link rel="stylesheet" type="text/css" href="/css/strategy.css">
</head>
<body>
    {{ template "inc/nav" . }}

<div class='container middle_vertical' style='margin-top:100px'>
  <div class='col-md-3'>
  </div>
  <div class='col-md-6'>
    <div role='form' class='form-horizontal'>
      <div class='form-group'>
         <label for='TargetNeedToMonitor'>启用(Enable)</label>
            <select class='form-control' id="enable">
              <option value ="1">启用 true</option>
              <option value ="0">禁用 false</option>
            </select>
        </div>
        <div class='form-group'>
         <label for='TargetNeedToMonitor'>Method</label>
            <select class='form-control' id="method">
              <option value ="get">GET</option>
              <option value ="post">POST</option>
              <option value ="put">PUT</option>
            </select>
        </div>
      <div class='form-group'>
        <label class='control-label' for='TargetNeedToMonitor'>API(必填)</label>
        <div class="input-group">
          <textarea type="text" class="form-control target" id="url" placeholder="http://blog.x2know.org 可以填多个，每行一个"
          /></textarea>
        </div>
      </div>
      <div class='form-group'>
        <label for='TargetNeedToMonitor'>期望返回状态码(status code)</label>
        <div class='controls'>
          <input class='form-control' type='text' placeholder='(4 表示4** 2个数字40 表示40*  3个数字403)' id='expect_code'/>
        </div>
      </div>
          <div class='form-group'>
              <label for='TargetNeedToMonitor'>Timeout(ms)</label>
              <input class='form-control' type='timeout' placeholder='单位：毫秒，默认 3000ms' id='timeout'></input>
          </div>

          <div class='form-group'>
            <label for='TargetNeedToMonitor'>Remark</label>
            <div class='controls'>
              <input class='form-control' type='text' placeholder='备注信息' id='note'></input>
            </div>
          </div>
 
          <div class='form-group'>
            <label for='TargetNeedToMonitor'>Region</label>
            <select class='form-control' id="idc">
              {{range .Regions}}
                <option value ="{{.}}">{{.}}</option>
              {{end}}
            </select>
          </div>

          <div class='form-group' style="">
            <label for='TargetNeedToMonitor'>告警设置(Alarm Stra)</label>
            <table>
            <thead>
            <tr>
              <th><div style="width:50px;">all</div></th>
              <th><input class='form-control' type="text" style="width:40px;margin-right:10px" value="3"  id='times'></th>
              <th><div style="width:105px;">fault,&nbsp;&nbsp;send to</div></th>
              <th><input class='form-control' type="text" style="width:150px;margin-right:10px" id='teams'></th>
              <th><div style="width:80px;">send times</div></th>
              <th><input class='form-control' type="text" style="width:100px" id='max_step'></th>
            </tr>
          </thead>
        </table>
          </div>
          <div class="form-group">
          <h4 class="panel-title">
            <a data-toggle="collapse" href="#collapse1">高级选项(Advanced)</a>
          </h4>
        </div>
        <div id="collapse1" class="panel-collapse collapse">
          <div class='form-group'>
            <label for='TargetNeedToMonitor'>Keywords</label>
            <div class='controls'>
              <input class='form-control' type='text' placeholder='check page keywords' id='keywords'></input>
            </div>
          </div>
          
        <div class='form-group'>
          <label for='TargetNeedToMonitor'>Header</label>
          <textarea class='form-control' type='text' placeholder='Host:127.0.0.1
Cookie:adfaldsfjaldjfalj
每行一个key:value
' id='header'></textarea>
        </div>
        <div class='form-group'>
          <label for='TargetNeedToMonitor'>Post Data</label>
          <textarea  class='form-control' type='text' placeholder='set to post body' id='post_data'></textarea>
        </div>
          <div class='form-group'>
          <label for='TargetNeedToMonitor'>IP</label>
            <input class='form-control' type='text' placeholder='指定域名对应的ip,多个用逗号隔开(set the IP pointed to by the domain)' id='ip'></input>
          </div>

          <div class='form-group'>
            <label for='TargetNeedToMonitor'>endpoint</label>
            <div class='controls'>
              <input class='form-control' type='text' placeholder='自定义发往open-falcon的endpoint' id='endpoint'></input>
            </div>
          </div>

          <div class='form-group'>
            <label for='TargetNeedToMonitor'>tags</label>
            <textarea type="text" class="form-control " id="tags" value="" placeholder="向falcon推送数据时使用, 形式为 a=b 每行一个"/></textarea>
          </div>

        </div>
          <div class='container' style="margin-top:10px">
            <button class='btn btn-defaultr btn-lg btn-primary' id='submit' onclick='add_strategy()'>Submit</button>
          </div>
        </div>
        <!-- end of the form -->
      </div>
      <!-- end of the col-md-8 -->
    </div>
  </div>

<script type="text/javascript">
$(function() {
    $("#teams").select2({
        placeholder: "报警接收组",
        allowClear: true,
        multiple: true,
        quietMillis: 100,
        minimumInputLength: 1,
        id: function(obj){return obj.id;},
        ajax: {
            url: "/teams/query",
            dataType: 'json',
            data: function(term, page) {
                return {
                    query: term,
                    limit: 20
                };
            },
            results: function(json, page) {
                return {results: json.data.teams};
            }
        },
        formatResult: function(obj) {return obj.name},
        formatSelection: function(obj) {return obj.name},
    });

});
</script>
{{ template "inc/footer" . }}
</body>
</html>


    