<div class="tight-form">
  <ul class="tight-form-list pull-right">
    <li class="tight-form-item small" ng-show="target.datasource">
      <em>{{target.datasource}}</em>
    </li>
    <li class="tight-form-item">
      <div class="dropdown">
        <a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
          <i class="fa fa-bars"></i>
        </a>
        <ul class="dropdown-menu pull-right" role="menu">
          <li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li>
          <li role="menuitem"><a tabindex="1" ng-click="duplicateDataQuery(target)">Duplicate</a></li>
          <li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index-1)">Move up</a></li>
          <li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index+1)">Move down</a></li>
        </ul>
      </div>
    </li>
    <li class="tight-form-item last">
      <a class="pointer" tabindex="1" ng-click="removeDataQuery(target)">
        <i class="fa fa-remove"></i>
      </a>
    </li>
  </ul>

  <ul class="tight-form-list">
    <li class="tight-form-item" style="min-width: 15px; text-align: center">
      {{target.refId}}
    </li>
    <li>
      <a  class="tight-form-item"
          ng-click="target.hide = !target.hide; get_data();"
          role="menuitem">
        <i class="fa fa-eye"></i>
      </a>
    </li>
  </ul>

  <ul class="tight-form-list" role="menu">
    <li class="tight-form-item" style="width: 94px">
      Query
    </li>
    <li>
      <input type="text"
             class="input-xxlarge tight-form-input"
             ng-model="target.expr"
             spellcheck='false'
             placeholder="query expression"
             data-min-length=0 data-items=100
             ng-model-onblur
             ng-change="refreshMetricData()">
    </li>
    <li class="tight-form-item">
      Metric
    </li>
    <li>
      <input type="text"
             class="input-medium tight-form-input"
             ng-model="target.metric"
             spellcheck='false'
             bs-typeahead="suggestMetrics"
             placeholder="metric name"
             data-min-length=0 data-items=100>
    </li>
  </ul>

  <div class="clearfix"></div>
</div>

<div class="tight-form">
  <ul class="tight-form-list" role="menu">
    <li class="tight-form-item tight-form-align" style="width: 94px">
      Legend format
    </li>
    <li>
      <input type="text" class="tight-form-input input-xxlarge" ng-model="target.legendFormat"
             spellcheck='false' placeholder="legend format" data-min-length=0 data-items=1000
             ng-model-onblur ng-change="refreshMetricData()">
      </input>
    </li>
  </ul>

  <div class="clearfix"></div>
</div>

<div class="tight-form">
  <ul class="tight-form-list" role="menu">
    <li class="tight-form-item tight-form-align" style="width: 94px">
      Step
    </li>
    <li>
      <input type="text" class="input-mini tight-form-input" ng-model="target.interval"
             bs-tooltip="'Leave blank for auto handling based on time range and panel width'"
             data-placement="right"
             spellcheck='false'
             placeholder="{{interval}}"
             data-min-length=0 data-items=100
             ng-model-onblur
             ng-change="refreshMetricData()"
             />
      </input>
    </li>

    <li class="tight-form-item">
      Resolution
    </li>
    <li>
      <select ng-model="target.intervalFactor" class="tight-form-input input-mini"
             ng-options="r.factor as r.label for r in resolutions"
             ng-change="refreshMetricData()">
      </select>
    </li>
    <li class="tight-form-item">
      <a href="{{linkToPrometheus()}}" target="_blank" bs-tooltip="'Link to Graph in Prometheus'">
        <i class="fa fa-share-square-o"></i>
      </a>
    </li>
  </ul>

  <div class="clearfix"></div>
</div>
