<% if @query.errors.any? %>
<%= @query.errors.full_messages.first %>
<% end %> <%= form_for @query, url: (@query.persisted? ? query_path(@query, variable_params) : queries_path(variable_params)), html: {class: "the_form", autocomplete: "off"} do |f| %>
<%= f.hidden_field :statement %>
<%= @query.statement %>
<%= link_to "Back", :back %> <% if Blazer.data_sources.size == 1 %> Use {start_time} and {end_time} for time ranges <% end %>
<%= f.select :data_source, Blazer.data_sources.values.map { |ds| [ds.name, ds.id] }, {}, class: ("hide" if Blazer.data_sources.size == 1), style: "width: 140px;" %>
<%= render partial: "tables" %>
<%= link_to "Run", "#", class: "btn btn-info", id: "run", style: "vertical-align: top;" %>
<%= f.label :name %> <%= f.text_field :name, class: "form-control" %>
<%= f.label :description %> <%= f.text_area :description, placeholder: "Optional", style: "height: 80px;", class: "form-control" %>
<% if @query.persisted? %> <%= link_to "Delete", query_path(@query), method: :delete, "data-confirm" => "Are you sure?", class: "btn btn-danger" %> <% end %> <%= f.submit "Save", class: "btn btn-success" %>
<% end %>