<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sm_tray_edit.jsp    1.18    03/06/04     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>

<!-- locale stuff -->
<html:html locale="true">
<!-- end locale -->

<!-- Place Java Script Here -->

<!-- HTML -->
 <head>
<%@include file="/layout/page_head_section.jsp"%>
    <title>
        <bean:message  key="storage.mgmt.system.tray.details.title"/>
    </title>
</head>

<%@include file="/layout/bodytag.jsp"%>
<%@include file="/layout/top.jsp"%>
<%@include file="/layout/breadcrumb.jsp"%>
<%@include file="/layout/spacer.jsp"%>
<%@ include file="/layout/user_messages.jsp"%>

<html:form action="root.menu.item0.item0trayedit.do">
<%
   com.sun.netstorage.array.mgmt.cfg.ui.forms.TrayForm form = 
     (com.sun.netstorage.array.mgmt.cfg.ui.forms.TrayForm)session.getAttribute("tray");
%>
<!-- hidden element which specifies the action for this form -->
<input type="hidden" name="request_action" value="<%=request.getAttribute("request_action")%>">

<div class="content-layout">

  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td nowrap>
              <div class="major-category-text">
                <bean:message  key="storage.mgmt.system.tray.details.section"/>                
              </div>
            </td>
            <td valign="bottom" width="99%">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td class="property-separator" valign="bottom"><img alt border="0" height="2" src="/images/general/dot.gif" width="1"></td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td><img alt border="0" height="5" src="/images/general/dot.gif" width="1"></td>
    </tr>
  </table>
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>
        <table border="0" cellspacing="0" cellpadding="0">         
          <tr>
            <td><img alt border="0" src="images/general/dot.gif" width="1" height="5"></td>
          </tr>
          <tr>
            <td nowrap>
              <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="50%">
                <tr>
                  <td>
                    <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%">
                      <tr class="header-row">
                        <td>
                          <div class="table-header-text">
                            <bean:message key="detail.property"/>
                          </div>
                        </td>
                        <td>
                          <div class="table-header-text">
                            <bean:message key="detail.value"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <bean:message key="tray.table.id" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:write name="tray" property="id"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <bean:message key="tray.detail.t4" /> 
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:write name="tray" property="t4Name"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <bean:message key="tray.detail.t4profile" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%
                               String profileName =
                                 ((T4Interface)session.getAttribute(
                                    Constants.HttpSessionFields.CURRENT_T4)).getProfile().getName();
                            %>
                            <bean:message key="<%=profileName%>"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.type" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                <bean:message key='<%=form.getTrayType()%>' />
                            <% }%>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.role" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                <bean:message key='<%=form.getRole()%>' />
                            <% }%>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.state" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                <bean:message key='<%=form.getState()%>' />
                            <% }%>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.status" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                <bean:message key='<%=form.getStatus()%>' />
                            <% }%>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.drivenum" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:write name="tray" property="numberOfDrives"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                           <bean:message key="tray.table.drivecapacity" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                  <%=Convert.bytesStringToGB(form.getDriveCapacity())%>
                                  <bean:message key="size.GB"/>
                            <% }%>
                          </div>
                        </td>
                      </tr>                                           
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="tray.table.alldriveshealthy" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <%                               
                               if(form != null) {                             
                            %>
                                <bean:message key='<%=form.getTrayAllDrivesHealthy()%>' />
                            <% }%>
                          </div>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</div>
<!-- END SECTION:  fixed/static data section -->

<!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="20" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<!-- BEGIN SECTION:  variable length table populated with items contained in major
                     object displayed on this page -->
<!-- OPTIONAL section, dependig on purpose of page -->
<!-- NOTE:  the buttons above the table are optional.  They exist on pages where
            they are required.  If the buttons are not there, then the first column
            with the checkboxes also has to be removed -->
<div class="content-layout">
<!-- only show pools in this tray if there are any -->
<%
 boolean hasPools = false;
 if(form != null && 
    form.getRaidGroups() != null &&
    form.getRaidGroups().size() > 0) {
    hasPools = true;
 }
%>

 <%   
   if(hasPools) {       
 %>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td nowrap>
              <div class="major-category-text">
                <bean:message key="raid.group.section.header" arg0='<%=((com.sun.netstorage.array.mgmt.cfg.ui.forms.TrayForm)session.getAttribute("tray")).getId()%>'/>
                
              </div>
            </td>
            <td valign="bottom" width="99%">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td class="property-separator" valign="bottom"><img alt border="0" height="2" src="/images/general/dot.gif" width="1"></td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>    
    <tr>
      <td><img alt border="0" height="5" src="/images/general/dot.gif" width="1"></td>
    </tr>
  </table>
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>
        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img alt width="1" height="2" border="0" src="images/general/dot.gif"></td>
          </tr>
          
          
          <tr>
             <td>
                    <table border="0" cellpadding="1" cellspacing="0" class="button-link-enabled-text">
                      <tr>
                        <td>
                          <table border="0" cellpadding="0" cellspacing="0" class="button-link-enabled-text">
                            <tr>
                              <td align="center" valign="middle" nowrap>                  
                                  <component:button text="tray.detail.pool.management" href="javascript:document.forms[0].action='root.menu.item0.item2pools.do';document.forms[0].submit();" title="tray.detail.pool.management" isEnabled="true" />                            
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
          </tr>
          
          <tr>
            <td><img alt border="0" src="images/general/dot.gif" width="1" height="5"></td>
          </tr>
          
          <tr>
            <td nowrap>
              <table class="back-table" border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <table class="front-table" border="0" cellspacing="0" cellpadding="0">
                      <tr class="header-row">
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.name" />
                          </div>
                        </td>
                        <td nowrap">
                          <div class="table-header-text">
                            <bean:message key="pools.table.raid" />
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.available" />
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.total" /> 
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.hotspare" /> 
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.status" /> 
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.volumes" /> 
                          </div>
                        </td>
                      </tr>
                                              
                        <logic:iterate id="rg" name="tray" property="raidGroups" type="RaidGroupInterface">                        
                      		<tr>
                      		 <td align="center">   
                      		   <div class="table-normal-text">                      
                                <bean:write name="rg" property="name"/>
                               </div>
                             </td> 
                             <td align="center">                         
                               <div class="table-normal-text">                      
                                <bean:write name="rg" property="raidLevel"/>
                               </div>
                             </td> 
                             <td align="center">                         
                               <div class="table-normal-text">                                    
                                <%
                                  String capacity = nf.format(nf.parse(Convert.bytesToGB(rg.getAvailableCapacity())));
                                %>               
                                <%= capacity %>            
                                <bean:message key="size.GB"/>                    
                               </div>
                             </td> 
                             <td align="center">                         
                               <div class="table-normal-text">                      
                                <%=nf.format(nf.parse(Convert.bytesToGB(rg.getTotalCapacity())))%>
                                <bean:message key="size.GB"/>  
                               </div>
                             </td> 
                             <td align="center">                         
                               <div class="table-normal-text">                      
                                <bean:write name="rg" property="useHotSpare"/>
                               </div>
                             </td> 
                             <td align="center">                         
                               <div class="table-normal-text">                
                                <%
                                 String status = "storage.mgmt.pool.status." + rg.getStatus();                                 
                                %>      
                                <bean:message key="<%=status%>"/>
                               </div>
                             </td> 
                             <%
                               boolean hasVolumes = false;
                               if(rg.getVolumes() != null &&
                                  rg.getVolumes().size() > 0) {
                                  	hasVolumes = true;
                               }
                             %>                             
                             <td align="center">       
                               <% if(hasVolumes) { %>                                                
                                <html:link href="root.menu.item0.item0trayvolumes.do">             
                                <bean:message key="tray.detail.showvolumes"/>
                                </html:link>
                               <% } else { %>
                                <bean:message key="raid.group.table.data.novolumes"/>
                               <% } %>
                             </td>                             
                           </tr>
                        </logic:iterate>                                            
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
<% } else { %>
   <bean:message key="tray.detail.nopoolsmsg"/>
<% } %>
</div>

<!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="20" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>


</html:form></body>

</html:html>
