Skip to content

Commit

Permalink
Separate Facilities
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed Jan 29, 2025
1 parent 6d2d20e commit ef89fe1
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.jlab.jam.presentation.controller.inventory;

import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jlab.jam.business.session.AbstractFacade;
import org.jlab.jam.business.session.FacilityFacade;
import org.jlab.jam.persistence.entity.Facility;

/**
* @author ryans
*/
@WebServlet(
name = "AuthorizersController",
urlPatterns = {"/inventory/authorizers"})
public class AuthorizersController extends HttpServlet {

@EJB FacilityFacade facilityFacade;

/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

List<Facility> facilityList =
facilityFacade.findAll(new AbstractFacade.OrderDirective("weight"));

request.setAttribute("facilityList", facilityList);

request
.getRequestDispatcher("/WEB-INF/views/inventory/authorizers.jsp")
.forward(request, response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.jlab.jam.presentation.controller.inventory;

import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jlab.jam.business.session.AbstractFacade;
import org.jlab.jam.business.session.CreditedControlFacade;
import org.jlab.jam.persistence.entity.CreditedControl;

/**
* @author ryans
*/
@WebServlet(
name = "VerifiersController",
urlPatterns = {"/inventory/verifiers"})
public class VerifiersController extends HttpServlet {

@EJB CreditedControlFacade controlFacade;

/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

List<CreditedControl> controlList =
controlFacade.findAll(new AbstractFacade.OrderDirective("weight"));

request.setAttribute("controlList", controlList);

request
.getRequestDispatcher("/WEB-INF/views/inventory/verifiers.jsp")
.forward(request, response);
}
}
79 changes: 79 additions & 0 deletions src/main/webapp/WEB-INF/views/inventory/authorizers.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="s" uri="http://jlab.org/jsp/smoothness"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<c:set var="title" value="Authorizers"/>
<t:inventory-page title="${title}">
<jsp:attribute name="stylesheets">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/v${initParam.releaseNumber}/css/systems.css"/>
</jsp:attribute>
<jsp:attribute name="scripts">
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/v${initParam.releaseNumber}/js/systems.js"></script>
</jsp:attribute>
<jsp:body>
<section>
<h2 class="page-header-title"><c:out value="${title}"/></h2>
<div class="message-box"><c:out value="${selectionMessage}"/></div>
<div id="chart-wrap" class="chart-wrap-backdrop">
<c:set var="readonly" value="${!pageContext.request.isUserInRole('jaws-admin')}"/>
<c:if test="${not readonly}">
<s:editable-row-table-controls>
</s:editable-row-table-controls>
</c:if>
<table class="data-table stripped-table ${readonly ? '' : 'uniselect-table editable-row-table'}">
<thead>
<tr>
<th>Name</th>
<th>Operations Type</th>
<th>Facility</th>
</tr>
</thead>
<tbody>
<c:forEach items="${facilityList}" var="facility">
<tr data-id="${facility.facilityId}">
<td><c:out value="John Doe (jdoe)"/></td>
<td><c:out value="RF"/></td>
<td><c:out value="${facility.name}"/></td>
</tr>
<tr data-id="${facility.facilityId}">
<td><c:out value="John Doe (jdoe)"/></td>
<td><c:out value="BEAM"/></td>
<td><c:out value="${facility.name}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</section>
<s:editable-row-table-dialog>
<form id="row-form">
<ul class="key-value-list">
<li>
<div class="li-key">
<label for="row-name">Name</label>
</div>
<div class="li-value">
<input type="text" required="required" id="row-name"/>
</div>
</li>
<li>
<div class="li-key">
<label for="row-team">Team</label>
</div>
<div class="li-value">
<select id="row-team" required="required">
<option value="">&nbsp;</option>
<c:forEach items="${teamList}" var="team">
<option value="${team.teamId}">
<c:out value="${team.name}"/></option>
</c:forEach>
</select>
</div>
</li>
</ul>
</form>
</s:editable-row-table-dialog>
</jsp:body>
</t:inventory-page>
2 changes: 2 additions & 0 deletions src/main/webapp/WEB-INF/views/inventory/controls.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<tr>
<th>Name</th>
<th>Description</th>
<th>Verification Team</th>
<th>Verification Frequency</th>
</tr>
</thead>
Expand All @@ -35,6 +36,7 @@
<tr data-id="${control.creditedControlId}">
<td><c:out value="${control.name}"/></td>
<td><c:out value="${control.description}"/></td>
<td><c:out value="${control.group.name}"/></td>
<td><c:out value="${control.verificationFrequency}"/></td>
</tr>
</c:forEach>
Expand Down
74 changes: 74 additions & 0 deletions src/main/webapp/WEB-INF/views/inventory/verifiers.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="s" uri="http://jlab.org/jsp/smoothness"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<c:set var="title" value="Verifiers"/>
<t:inventory-page title="${title}">
<jsp:attribute name="stylesheets">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/v${initParam.releaseNumber}/css/systems.css"/>
</jsp:attribute>
<jsp:attribute name="scripts">
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/v${initParam.releaseNumber}/js/systems.js"></script>
</jsp:attribute>
<jsp:body>
<section>
<h2 class="page-header-title"><c:out value="${title}"/></h2>
<div class="message-box"><c:out value="${selectionMessage}"/></div>
<div id="chart-wrap" class="chart-wrap-backdrop">
<c:set var="readonly" value="${!pageContext.request.isUserInRole('jaws-admin')}"/>
<c:if test="${not readonly}">
<s:editable-row-table-controls>
</s:editable-row-table-controls>
</c:if>
<table class="data-table stripped-table ${readonly ? '' : 'uniselect-table editable-row-table'}">
<thead>
<tr>
<th>Team Name</th>
<th>Members</th>
<th>Credited Control</th>
</tr>
</thead>
<tbody>
<c:forEach items="${controlList}" var="control">
<tr data-id="${control.creditedControlId}">
<td><c:out value="SSG"/></td>
<td><c:out value="John Doe (jdoe), Jane Doe (janed)"/></td>
<td><c:out value="${control.name}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</section>
<s:editable-row-table-dialog>
<form id="row-form">
<ul class="key-value-list">
<li>
<div class="li-key">
<label for="row-name">Name</label>
</div>
<div class="li-value">
<input type="text" required="required" id="row-name"/>
</div>
</li>
<li>
<div class="li-key">
<label for="row-team">Team</label>
</div>
<div class="li-value">
<select id="row-team" required="required">
<option value="">&nbsp;</option>
<c:forEach items="${teamList}" var="team">
<option value="${team.teamId}">
<c:out value="${team.name}"/></option>
</c:forEach>
</select>
</div>
</li>
</ul>
</form>
</s:editable-row-table-dialog>
</jsp:body>
</t:inventory-page>

0 comments on commit ef89fe1

Please sign in to comment.