Skip to content

Commit

Permalink
Feature/mock reports (#15)
Browse files Browse the repository at this point in the history
* 0.9.0 enable JDK21

Signed-off-by: Andres LeonRangel <[email protected]>

* JDK21 settings buttons documentation markdown

- improves settings with JDK21
- badges for README file with links to project

Signed-off-by: Andres LeonRangel <[email protected]>

* local development upgrade

- clean function can receive argument to clean particular version.
useful in case of app upgrade to clean up local environment

- docker compose prep for integration testing

Signed-off-by: Andres LeonRangel <[email protected]>

* Mocked Reports

- primefaces extension
- basic HTML reporting

Signed-off-by: Andres LeonRangel <[email protected]>

* class to control the org chart PF extensions

Signed-off-by: Andres LeonRangel <[email protected]>

---------

Signed-off-by: Andres LeonRangel <[email protected]>
  • Loading branch information
aleon1220 authored May 12, 2024
1 parent b4130f5 commit 04d80cd
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .env.tpl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# https://developer.1password.com/docs/cli/secrets-config-files/
LDAP_ADMIN_PASS="op://Professional-IT Projects/multi-cloud-WebApp-Attendance/password"
export LDAP_ADMIN_PASS="op://Professional-IT Projects/multi-cloud-WebApp-Attendance/password"
export APP_WAR_FILE_VERSION=$(gradle getAppVersion --quiet) || true
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile.wildfly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://quay.io/repository/wildfly/wildfly?tab=tags
FROM quay.io/wildfly/wildfly:29.0.0.Final-jdk20
FROM quay.io/wildfly/wildfly:32.0.0.Final-1-jdk21

ARG APP_WAR_FILE_VERSION
ENV APP_WAR_FILE_VERSION=$APP_WAR_FILE_VERSION
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Project Status: Active](https://img.shields.io/badge/Project%20Status-Active-brightgreen.svg)](https://github.com/aleon1220/multi-cloud-WebApp-Attendance/projects)
[![Automation engineers wanted](https://img.shields.io/badge/Automation%20engineers%20wanted-Yes-brightgreen.svg)](https://github.com/my-org/my-project/issues/new)
[![Feedback welcome](https://img.shields.io/badge/Feedback%20welcome-Yes-brightgreen.svg)](https://github.com/aleon1220/multi-cloud-WebApp-Attendance/issues/new)

- [Attendance WebApp](#attendance-webapp)
- [Introduction](#introduction)
- [GitHub Reports](#github-reports)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.net.InetAddress

group = "soa.nz.aut"
version = "0.8.0"
version = "0.9.0"
description = "Student Attendance WebApp"
val warDeploymentName = "AttendanceTrak"
// java.sourceCompatibility = JavaVersion.VERSION_17
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ services:
image: aleon1220/soa:latest
env_file: .env
ports:
- 8080:8080
- 8080:8080
24 changes: 15 additions & 9 deletions runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ set -e
# Array avoids word splitting issues
COMMANDS=(help build clean run_smoke_test run_stack test_stack)
export APP_WAR_FILE_VERSION=$(gradle getAppVersion --quiet) || true
# build
version="$APP_WAR_FILE_VERSION"
command=$1

print_usage() {
printf "Usage: %s <command> [options] Available commands: \n\n" $0
printf "Usage: %s <command> [options] Available commands: \n\n" "$0"
printf "\t %s " "${COMMANDS[@]}"
printf "\n\n Script tested in Linux Bash 5.1.16 \n\n"
printf "This OS bash version is: \n\n"
Expand All @@ -16,22 +18,19 @@ print_usage() {

# Function to handle invalid command
invalid_command() {
printf "Invalid command: %s \n\n" $1
printf "Invalid command: %s \n\n" "$1"
print_usage
exit 1
}

# build
export APP_WAR_FILE_VERSION=$(gradle getAppVersion --quiet) || true
version="$APP_WAR_FILE_VERSION"

build() {
gradle clean assemble war --warn || true
docker build --build-arg APP_WAR_FILE_VERSION=$version --tag aleon1220/attendance-webapp:$version --file Dockerfile.wildfly . || true
# gradle clean assemble war --warn || true
gradle clean war --warn || true
docker build --build-arg APP_WAR_FILE_VERSION="$version" --tag aleon1220/attendance-webapp:"$version" --file Dockerfile.wildfly . || true
}

run_smoke_test() {
clean
clean "$version"
build
printf "Executing webapp Locally \n\n" || true
docker run --interactive --tty --detach --publish 8080:8080 --name $version aleon1220/attendance-webapp:$version || true
Expand All @@ -43,6 +42,13 @@ run_smoke_test() {
}

clean() {
# Check if a version argument is provided
if [ -z "$2" ]; then
version="$version"
else
# Version provided, use it directly
version="$2"
fi
printf "Executing local CLEAN-UP \n\n"
docker kill $version
docker rm $version
Expand Down
64 changes: 64 additions & 0 deletions src/main/java/bean/OrgchartController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package bean;

import java.io.Serializable;
import jakarta.inject.Named;
//https://jakarta.ee/specifications/platform/9/apidocs/jakarta/faces/bean/viewscoped
import jakarta.faces.view.ViewScoped;
import org.primefaces.extensions.component.orgchart.OrgChartNode;
import org.primefaces.extensions.component.orgchart.DefaultOrgChartNode;
import org.primefaces.extensions.event.OrgChartClickEvent;
import org.primefaces.extensions.event.OrgChartDropEvent;

@Named
@ViewScoped
public class OrgchartController implements Serializable {

private static final long serialVersionUID = 1648477595853984820L;

private OrgChartNode orgChartNode;

private String direction = "t2b";

public OrgchartController() {
super();
init();
}

public void init() {
orgChartNode = new DefaultOrgChartNode("id1", "Cohort March 2023", "2023-03-20");
orgChartNode.addChild(new DefaultOrgChartNode("id2", "Cloud Basics", "Content2"));
orgChartNode.addChild(new DefaultOrgChartNode("id3", "Programming Java", "Content3"));
orgChartNode.addChild(new DefaultOrgChartNode("id4", "Programming Python", "Content3"));
final OrgChartNode node = new DefaultOrgChartNode("id5", "Iac", "Infra as Code");
orgChartNode.addChild(node);
node.addChild(new DefaultOrgChartNode("id6", "pulumi", "with java programming language"));
node.addChild(new DefaultOrgChartNode("id7", "terraform", "HCL Hashicorp config language"));
}

public static void onClick(final OrgChartClickEvent event) {
System.out.println("clicked ID: " + event.getId());
System.out.println("hierarchy: " + event.getHierarchy().toString());
}

public static void onDropOver(final OrgChartDropEvent event) {
System.out.println("hierarchy: " + event.getHierarchy().toString());
System.out.println("dragged node id " + event.getDraggedNodeId());
System.out.println("dropped node id " + event.getDroppedZoneId());
}

public OrgChartNode getOrgChartNode() {
return orgChartNode;
}

public void setOrgChartNode(final OrgChartNode orgChartNode) {
this.orgChartNode = orgChartNode;
}

public String getDirection() {
return direction;
}

public void setDirection(final String direction) {
this.direction = direction;
}
}
18 changes: 8 additions & 10 deletions src/main/webapp/02-attendance.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<p:menuitem value="Settings" url="home.xhtml" />
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About webapp" url="about.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down Expand Up @@ -52,16 +52,14 @@
<pe:timer timeout="35" singleRun="true" listener="#{attendance.onTimeout}"/>
</div>
<p:inputText id="attendanceCode" value="#{attendanceBean.attendanceCode}" required="true" />
<div>
<p:button icon="pi pi-clock" value="Confirm Attendance" action="#{attendanceBean.button1Action}" />
</div>

<p:panel>
<f:facet name="footer">
<p:linkButton icon="pi pi-arrow-left" outcome="home" value="Go Back"/>
<p:button icon="pi pi-sign-in" outcome="03-attendanceOK" value="Confirm Attendance"/>
</f:facet>
</p:panel>
</h:form>
<p:panel>
<f:facet name="footer">
<p:linkButton icon="pi pi-arrow-left" outcome="home" value="Go Back"/>
<p:button icon="pi pi-sign-in" outcome="03-attendanceOK" value="Confirm Attendance"/>
</f:facet>
</p:panel>
</div>
</h:body>
</html>
1 change: 1 addition & 0 deletions src/main/webapp/04-lecturerHome.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Admin Settings" url="05-adminStaff.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/05-adminStaff.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Teacher" url="04-lecturerHome.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down
90 changes: 69 additions & 21 deletions src/main/webapp/06-Reports.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">

<h:head>
<title>Reporting AttendanceTrak</title>
<title>Reporting AttendTrak</title>
<link rel="stylesheet" type="text/css" href="attendance.css"/>
</h:head>
<h:body>
Expand All @@ -19,6 +20,7 @@
<p:menuitem value="Settings" url="home.xhtml" />
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand All @@ -27,32 +29,78 @@
<div id="rightBlockDiv">
<h2>Reports Attendance Tracking</h2>
<p>
<i>Info: </i> example primefaces panel signup to the attendance web App
<i>Info: </i> Reports for admin staff
</p>
<h:form id="SignForm">
<div>
<!-- https://www.primefaces.org/showcase-ext/sections/orgchart/basicUsage.jsf -->
<pe:orgchart id="orgChart"
widgetVar="orgChartViewWidget"
value="#{orgchartController.orgChartNode}"
draggable="false"
exportButton="false"
pan="true"
parentNodeSymbol="oci-leader"
zoom="true"
exportFileextension="pdf"
direction="#{orgchartController.direction}"
toggleSiblingsResp="true"
style="height:300px">
</pe:orgchart>
</div>
<p:panel>
<f:facet name="header">Sign Up</f:facet>
<p>Attendance System Sign Up</p>
<f:facet name="header">Absence Report</f:facet>
<p>AttendTrak Absent Report. use https://www.primefaces.org/showcase/ui/chartjs/pie.xhtml</p>
<div class="dialog">
<p:button icon="pi pi-sign-in" value="Attendance Session DATE SESSION_NAME"/>
<h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
<h:outputLabel for="username">Username</h:outputLabel>
<h:inputText id="username" value="#{userBean.username}"/>
<h:outputLabel for="password">Password</h:outputLabel>
<h:inputSecret id="password" value="#{userBean.password}"/>
<h:outputLabel for="confirmPassword">Confirm Password</h:outputLabel>
<h:inputSecret id="confirmPassword" value="#{userBean.password}"/>
<h:outputLabel for="email">email</h:outputLabel>
<h:inputText id="email" value="#{userBean.email}"/>
<h:outputLabel for="absent">Total absence</h:outputLabel>
<h:outputLabel id="absent">2 students</h:outputLabel>
<h:outputLabel for="trainee01">student 01</h:outputLabel>
<h:outputLabel id="trainee01">john.doe</h:outputLabel>
<h:outputLabel for="trainee02">student 02</h:outputLabel>
<h:outputLabel id="trainee02">juana.marquez</h:outputLabel>
</h:panelGrid>
</div>

<div class="actionButtons">
<center>
<h:outputLabel>submit changes</h:outputLabel>
</center>
</div>
</p:panel>
</h:form>
<h3>Class Attendance Summary Report</h3>
<p>Provides an overview of attendance for a specific class within a chosen timeframe.</p>
<ul>
<li>Total enrolled students: 150</li>
<li>Average attendance percentage: 85%</li>
<li>Attendance breakdown:</li>
<ul>
<li>Present: 120 students</li>
<li>Absent: 20 students</li>
<li>Late: 10 students</li>
</ul>
<li>Total attendance percentage: 90%</li>
<li>Average attendance: 27 students per class</li>
<li>Trends:</li>
<ul>
<li>Weekly spikes after holidays</li>
<li>Monthly drops during exam weeks</li>
</ul>
</ul>

<h3>Comparative Attendance Report</h3>
<p>Compares attendance data across multiple classes or cohorts.</p>
<ul>
<li>Class A: 80% average attendance</li>
<li>Class B: 95% average attendance</li>
<li>Class C: 70% average attendance</li>
<li>Assessment of teaching methods:</li>
<ul>
<li>Class B shows the highest attendance; consider sharing their practices with other classes.</li>
</ul>
</ul>

<h3>Absence Reason Report</h3>
<p>Categorizes absences by reason.</p>
<ul>
<li>Illness: 40%</li>
<li>Family emergency: 40%</li>
<li>Approved absence: 20%</li>
</ul>
</div>
</h:body>
</html>
1 change: 1 addition & 0 deletions src/main/webapp/07-StudentManagement.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Admin Settings" url="05-adminStaff.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/08-ClassManagement.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Admin Settings" url="05-adminStaff.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/09-UserManagement.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Admin Settings" url="05-adminStaff.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand Down
3 changes: 1 addition & 2 deletions src/main/webapp/support.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<p:menuitem value="Settings" url="05-adminStaff.xhtml" />
<p:menuitem value="Reports" url="06-Reports.xhtml" />
<p:menuitem value="Support" url="support.xhtml" />
<p:menuitem value="About webapp" url="about.xhtml" />
<p:menuitem value="About app" url="about.xhtml" />
</p:submenu>
</p:menu>
</h:form>
Expand All @@ -37,5 +37,4 @@
<p>For detailed documentation, visit the <a href="https://www.primefaces.org/showcase/support.xhtml">PrimeFaces Showcase Support</a> page.</p>
</div>
</h:body>

</html>

0 comments on commit 04d80cd

Please sign in to comment.