<% @pageName = @myView == "resource" ? "Resource" : "Fence Device" %>
<tr id="<%=@myView%>_title_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}><td id="page_header" colspan=3>
<%= @myView == "resource" ? "RESOURCES" : "FENCE DEVICES" %>
    </td>
  </tr>
  <tr id="<%=@myView%>_header_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}>
    <td id="remove_add" class="borderbottom">
      <div class="x sprites"></div><div class=link">&nbsp;
	<% if @myView == "resource" %>
	  <a href="#" onclick='verify_remove_resources(); return false;'>
	<% else %>
	  <a href="#" onclick='verify_remove_fence_devices(); return false;'>
	<% end %>
      Remove</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
  <div class="plus sprites"></div><div class="link">&nbsp;
    <% if @myView == "resource" %>
      <a href="#" onclick="show_add_resource_dialog();return false;">
    <% else %>
      <a href="#" onclick="$('#new_stonith_agent').dialog({title: 'Add Fence Device', modal:true, width: 'auto'});return false;">
    <% end %>
  Add</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
    <% if @myView == "resource" %>
      <div class="plus sprites"></div><div class="link">&nbsp;<a href="#" onclick="create_group();return false;">Create Group</a></div>
    <% else %>
        <div class="configurelight sprites"></div>
        <div class="link"> &nbsp;
          {{#if Pcs.is_sbd_supported}}
            <a href="#" onclick="sbd_status_dialog();return false;">SBD</a>
          {{else}}
            <a href="#" onclick="alert('This cluster is running an old version of PCSD which does not support SBD.'); return false;">SBD</a>
          {{/if}}
        </div>
    <% end %>
    </td>
    <td class="borderbottom">&nbsp;</td>
    <td id="tab_name" width="125">
      <div style="float: left">&nbsp;Edit <%= @pageName%>&nbsp;</div><div class="check sprites"></div>
    </td>
  </tr>
  <tr id="<%=@myView%>_list_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}>
    <td id="<%=@myView%>_list" class="node_list">
      <%= erb :_resource_list %>
    </td>
  <td id="node_info" colspan=2>
    <div id="<%=@myView%>_info_div">
    <% if @myView == "resource" %>
      {{resource-edit resource=Pcs.resourcesContainer.cur_resource page_name="Resource" old_pcsd=Pcs.resourcesContainer.is_version_1 utilization_support=Pcs.nodesController.utilization_support}}
    <% else %>
      {{resource-edit resource=Pcs.resourcesContainer.cur_fence page_name="Fence device" stonith=1 old_pcsd=Pcs.resourcesContainer.is_version_1}}
    <% end %>
    </div>
    </td>
  </tr>
    <% if @myView == "resource" %>
      </div>
    </table>
    <div id="new_resource_agent" style="display: none;">
      <table id="resource_selector" style="clear:left;float:left;margin-top:25px;">
	<tr>
	  <td class="bold">Class/Provider</td>
	  <td>
	    <select id="resource_class_provider_selector">
        <% @resource_agent_structures.map{|a| a[:class_provider]}.uniq.sort.each{|cp| %>
          <option
            <%= "selected" if cp == "ocf:heartbeat" %>
            value="<%=cp%>"
          ><%=cp%></option>
	      <% } %>
	    </select>
	  </td>
	</tr>
	<tr>
	  <td class="bold">Type</td>
	  <td>
	    <select id="all_ra_types" style="display:none;">
        <% @resource_agent_structures.sort_by{|a| a[:full_name].downcase}.each{|a| %>
          <option value="<%=a[:full_name]%>"><%=a[:type]%></option>
	      <% } %>
	    </select>
	    <select id="add_ra_type" onchange="load_resource_form(this.value);">
        <% @resource_agent_structures.each{|a| %>
          <option width=250px value="<%=a[:full_name]%>"><%=a[:type]%></option>
	      <% } %>
	    </select>
	  </td>
	</tr>
      </table>
      {{resource-form
          agent=Pcs.resourcesContainer.new_resource_agent_metadata
          groups=Pcs.resourcesContainer.groups_enum
          table_id_suffix="_new"
      }}
    </div>
    <div id="new_stonith_agent" style="display: none;">
      <table id="stonith_selector" style="clear:left;float:left;margin-top:25px;">
	<tr>
	  <td class="bold">Type</td>
	  <td>
	    <select id="add_stonith_type" onchange="load_resource_form(this.value,true);">
	      <% @stonith_agents.keys.sort_by{|a|a.downcase}.each { |name| %>
		<option width=250px <%= @stonith_agents[name]["type"] == "fence_apc" ? "selected" : "" %> value="stonith:<%=@stonith_agents[name]["type"]%>"><%=@stonith_agents[name]["type"]%></option>
	    <% } %>
	    </select>
	  </td>
	</tr>
      </table>
      {{fence-form
          agent=Pcs.resourcesContainer.new_fence_agent_metadata
          table_id_suffix="_new"
      }}
    </div>
    <% end %>
