<div ng-if="ruleData['type']=='custom'" class="control-group required" style="display:block" ng-form="inventoryAttrs">
    <label class="control-label">
        <div class="inline" ng-class="{error:alertEdit.$dirty && inventoryAttrs.$invalid}"><span>SQL query</span></div>
    </label>
    <div class="controls">
        <textarea required ng-readonly="alertData.ruleid" ng-model="ruleData.customConditions.sql" name="customSQL" class="customSQL" ></textarea>
         <span class="help-block">The SQL query must contain <code>hostkey</code> select column.</span>
         <span class="help-block">Example: SELECT  HostKey AS "hostkey",  LastReportTimeStamp AS "Last report time" FROM hosts WHERE LastReportTimeStamp < NOW() - INTERVAL '5 minutes'
         <span class="help-block">The SQL query must not end with ;</span>
          <span class="help-block">The SQL query will be automatically validated when you finish typing.</span>


        <div ng-show="ruleData.customConditions.errors && ruleData.customConditions.errors.length > 0" id="customValidationErrors">
            <div ng-repeat="(key, value) in ruleData.customConditions.errors"> {{value}} </div>
        </div>
        <div ng-show="ruleData.customConditions.errors.length == 0" class="customValidationSuccess">
            <div>SQL query passed validation. </div>
        </div>
    </div>
</div>