Skip to content

Commit

Permalink
UI/UX overhaul (#14)
Browse files Browse the repository at this point in the history
* version 0.7.9

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

* top left menu buttons inside panel

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

* attendance UI java functionality

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

* upgrades to Primefaces14 RC2

* Visual UI HTML working fine for committed pages
* adds PF extensions Jakarta RC2
* cleans up gradle function to list .xhtmls
* cleans up old PF8 refernces in xhtmls

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

* gradle Java upgrade JakartaEE

1. tests pass and get executed
2. making beans reachable
3. enables gradle dependency for JakartaEE

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

* UI working 04-lecturerHome

1. PrimeFaces Extension enabled
2. streamlined HTML

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

* UI make it work with no errors

1. prep set up to make UI UX work rendering from server
2. final goal is to have a docker-compose stack

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

* gitpod development v1

1. make UIs with static content run
2. define runme.sh with run_stack command
3. added test_stack function

* version 0.8.0 JDK21

1. upgrade to JDK 21

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

* unified functions local test

1. introduces a function to run smoke tests. Simple run the app, make it work
2. the full run_stack function performs a comprehensive system start

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

* Expanded smoke test function

1. added debug statements
2. gets project info via gradle getProjectInfo()

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

* enable IntelliJ community 2024

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

* added menu on the left corresponding screens

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

* UX optimize build shell script

- remove unnecesary commands
- improves gradle lifecycle

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

* UX enable Gradle caching

Gradle Conference https://www.youtube.com/watch?v=30MFtJPjefo

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

* UX updated Variables general file

- file has not been tested with Tomcat

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

* UX upgrade Wildfly JDK20

- still getting warnings as i am using AWS JDK21
- should print the statements nicely with printf or a docker printing function

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

* chage app name optimized variables

- variables are more readables
- war assemble changes to deal with CSS failures

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

* UX CSS left menu right content

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

* UX left menu right block content

- generalized most pages to use left menu right structure
- added mock functionality where appropriate

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

* cleans up UX attendance module

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

* adds login as the landing point

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

* xhtml touches to make UI UX stable

- stable means all pages work
- all pages have mock functionality

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

---------

Signed-off-by: Andres LeonRangel <[email protected]>
  • Loading branch information
aleon1220 authored May 4, 2024
1 parent a9649d9 commit b4130f5
Show file tree
Hide file tree
Showing 30 changed files with 660 additions and 507 deletions.
10 changes: 10 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: gradle build


2 changes: 1 addition & 1 deletion .idea/misc.xml

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

17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ FROM tomcat:jdk17
# FROM tomcat:9.0.85-jdk17-corretto-al2
# FROM tomcat:9.0-jdk17-corretto-al2
# FROM tomcat:8.5.97-jdk17-corretto-al2

# https://hub.docker.com/layers/library/tomcat/7.0.109-jdk8-openjdk/images/sha256-489823486120d076cb576640c5819c6fa54948f470b46c54f02b48f462eb2c23

ARG APP_WAR_FILE_VERSION
ENV APP_WAR_FILE_VERSION=$APP_WAR_FILE_VERSION
ENV APP_WAR_FILE="Attendance"
ENV APP_WAR_FILE_PATH="build/libs/$APP_WAR_FILE-${APP_WAR_FILE_VERSION}"
ENV APP_WAR_FILE_NAME="AttendanceTrak"
ENV APP_WAR_FILE_OUTPUT=$APP_WAR_FILE_NAME-${APP_WAR_FILE_VERSION}
ENV APP_FULL_WAR_FILE_PATH="build/libs/$APP_WAR_FILE_OUTPUT"

LABEL org.nz.itlatinos.image.authors="[email protected]"
LABEL maintainer="andres.nz"
LABEL war.version="$APP_WAR_FILE_VERSION"
LABEL docker.image.build.command="docker build --build-arg APP_WAR_FILE_VERSION=$APP_WAR_FILE_VERSION --tag aleon1220/soa:latest ."

RUN printf "WAR version is $APP_WAR_FILE-$APP_WAR_FILE_VERSION"
RUN printf "Path to war file $APP_WAR_FILE_PATH"
# Tomcat Custom settings
RUN printf "\t\t Docker Engine Build APP_WAR_FILE_VERSION %s" $APP_WAR_FILE_VERSION
RUN printf "\t\t Docker Engine Build APP_WAR_FILE_NAME $APP_WAR_FILE_NAME"
RUN printf "\t\t Docker Engine Build WAR APP_WAR_FILE_OUTPUT $APP_WAR_FILE_OUTPUT"
RUN printf "\t\t Docker Engine Build Path to war file $APP_FULL_WAR_FILE_PATH"

# RUN echo ${PWD} && ls -lR # Debugging
# USER 1000 # considered permissions issue
COPY ${APP_WAR_FILE_PATH}.war /usr/local/tomcat/webapps
COPY ${APP_FULL_WAR_FILE_PATH}.war /usr/local/tomcat/webapps
# COPY build/libs/AttendanceApp-0.7.2 /usr/local/tomcat/webapps/
# https://forums.docker.com/t/docker-build-multistage-failed-to-compute-cache-key/134316/20
16 changes: 10 additions & 6 deletions Dockerfile.wildfly
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# https://quay.io/repository/wildfly/wildfly?tab=tags
FROM quay.io/wildfly/wildfly:27.0.0.Final-jdk17
FROM quay.io/wildfly/wildfly:29.0.0.Final-jdk20

ARG APP_WAR_FILE_VERSION
ENV APP_WAR_FILE_VERSION=$APP_WAR_FILE_VERSION
ENV APP_WAR_FILE="Attendance"
ENV APP_WAR_FILE_PATH="build/libs/$APP_WAR_FILE-${APP_WAR_FILE_VERSION}"
ENV APP_WAR_FILE_NAME="AttendanceTrak"
ENV APP_WAR_FILE_OUTPUT=$APP_WAR_FILE_NAME-${APP_WAR_FILE_VERSION}
ENV APP_FULL_WAR_FILE_PATH="build/libs/$APP_WAR_FILE_OUTPUT.war"

LABEL org.nz.itlatinos.image.authors="[email protected]"
LABEL maintainer="www.andres.nz"
LABEL war.version="$APP_WAR_FILE_VERSION"
LABEL docker.image.build.command="docker build --build-arg APP_WAR_FILE_VERSION=$version --tag aleon1220/attendance-webapp:$version --file Dockerfile.wildfly ."

RUN printf "WAR version is $APP_WAR_FILE-$APP_WAR_FILE_VERSION"
RUN printf "Path to war file $APP_WAR_FILE_PATH"
ADD ${APP_WAR_FILE_PATH}.war /opt/jboss/wildfly/standalone/deployments/
RUN printf "\t\t Docker Engine Build APP_WAR_FILE_VERSION %s" $APP_WAR_FILE_VERSION
RUN printf "\t\t Docker Engine Build APP_WAR_FILE_NAME $APP_WAR_FILE_NAME"
RUN printf "\t\t Docker Engine Build WAR APP_WAR_FILE_OUTPUT $APP_WAR_FILE_OUTPUT"
RUN printf "\t\t Docker Engine Build Path to war file $APP_FULL_WAR_FILE_PATH"

ADD ${APP_FULL_WAR_FILE_PATH} /opt/jboss/wildfly/standalone/deployments/
36 changes: 19 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.net.InetAddress

group = "soa.nz.aut"
version = "0.7.8"
version = "0.8.0"
description = "Student Attendance WebApp"
val warDeploymentName = "AttendanceTrak"
// java.sourceCompatibility = JavaVersion.VERSION_17

plugins {
java
// id ("com.adarshr.test-logger") version "3.0.0"
// https://docs.gradle.org/7.3/dsl/org.gradle.api.tasks.bundling.War.html
// https://docs.gradle.org/current/userguide/war_plugin.html
war
id ("jacoco")
}
Expand All @@ -25,9 +26,9 @@ dependencies {
// https://primefaces.github.io/primefaces
// https://mvnrepository.com/artifact/org.primefaces/primefaces
// implementation("org.primefaces:primefaces:primefaces-14.0.0-RC1")
implementation("org.primefaces:primefaces:14.0.0-RC1:jakarta")
implementation("org.primefaces:primefaces:14.0.0-RC2:jakarta")
// https://mvnrepository.com/artifact/org.primefaces.extensions/primefaces-extensions
// implementation("org.primefaces.extensions:primefaces-extensions:14.0.0-RC1:jakarta")
implementation("org.primefaces.extensions:primefaces-extensions:14.0.0-RC2:jakarta")
// implementation(files("https://repo.maven.apache.org/maven2/org/primefaces/primefaces/14.0.0-RC1/primefaces-14.0.0-RC1-jakarta.jar"))
// implementation(files("https://repo.maven.apache.org/maven2/org/primefaces/extensions/primefaces-extensions/14.0.0-RC1/primefaces-extensions-14.0.0-RC1-jakarta.jar"))
// PrimeFaces Dependencies
Expand All @@ -47,9 +48,11 @@ dependencies {

// Jakarta EE
// https://mvnrepository.com/artifact/jakarta.enterprise/jakarta.enterprise.cdi-api
// implementation("jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1")
implementation("jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1")
// implementation("jakarta.ws.rs:jakarta.ws.rs-api:3.1.0")
implementation("org.apache.httpcomponents:httpclient:4.5.13")
// https://mvnrepository.com/artifact/jakarta.platform/jakartaee-api-parent
implementation("jakarta.platform:jakartaee-api-parent:10.0.0")
// https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api
// https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client
implementation("org.glassfish.jersey.core:jersey-client:3.1.5")
Expand Down Expand Up @@ -100,6 +103,7 @@ fun getAppVersion() {
fun getWarpackageVersion() {
val hostname_local = System.getenv("HOSTNAME") ?: "localhost"
val hostname = InetAddress.getLocalHost().getHostName()
val warDeploymentContextName = "$warDeploymentName-$version"

// Define the page names
val pages = listOf(
Expand All @@ -113,20 +117,18 @@ fun getWarpackageVersion() {
"08-ClassManagement.xhtml",
"09-UserManagement.xhtml",
"home.xhtml",
"404-attendanceError.xhtml",
"404-loginError.xhtml",
"home.xhtml",
"index.xhtml"
)
"index.xhtml",
"404-loginError.xhtml"
)
project.version?.let { version ->
println("WAR Version is $version")
println("Set env variable with")
println("\t\t WAR Version is $version")
println("Kotlin hostname variable value " + hostname_local)
println("export APP_WAR_FILE_VERSION=" + version.toString())
println("http://" + hostname + ":8080/Attendance-"+ version.toString())
println("http://" + hostname + ":8080/$warDeploymentContextName")
}
// Print URLs for each page
pages.forEach { page ->
println("http://$hostname:8080/Attendance-$version/$page")
println("http://$hostname:8080/$warDeploymentContextName/$page")
}
}

Expand All @@ -142,9 +144,9 @@ tasks.register<DefaultTask>("getAppVersion") {


tasks.war {
archiveBaseName.set("Attendance")
webAppDirectory.set(file("src/main/webapp"))
// from("src/rootContent") // adds a file-set to the root of the archive
archiveBaseName.set(warDeploymentName)
// webAppDirectory.set(file("src/main/webapp"))
from("src/main/resources/css") // adds a file-set to the root of the archive
// webInf { from("src/additionalWebInf") } // adds a file-set to the WEB-INF dir.
// classpath(fileTree("additionalLibs")) // adds a file-set to the WEB-INF/lib dir.
// classpath(moreLibs) // adds a configuration to the WEB-INF/lib dir.
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ services:
# https://github.com/osixia/docker-openldap
# https://www.openldap.org
image: osixia/openldap:1.2.4
env_file: .env
environment:
LDAP_ORGANISATION: "IT Latinos NZ"
LDAP_DOMAIN: "latintech.org"
LDAP_ADMIN_PASSWORD: ${LDAP_ADMIN_PASS}
ports:
- 389:389
- 636:636
volumes:
- ./ldap:/var/lib/ldap
- ./ldap:/etc/ldap/slapd.d
# volumes:
# - ./ldap:/var/lib/ldap
# - ./ldap:/etc/ldap/slapd.d
webapp:
image: aleon1220/soa:latest
env_file: .env
ports:
- 8080:8080
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
log4j_version = 1.2.17
jaxb_version = 2.3.1
junit_version = 5.5.1
org.gradle.caching=true
25 changes: 19 additions & 6 deletions runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Array avoids word splitting issues
COMMANDS=(build run clean test help)
COMMANDS=(help build clean run_smoke_test run_stack test_stack)
export APP_WAR_FILE_VERSION=$(gradle getAppVersion --quiet) || true
command=$1

Expand All @@ -26,30 +26,43 @@ export APP_WAR_FILE_VERSION=$(gradle getAppVersion --quiet) || true
version="$APP_WAR_FILE_VERSION"

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

run() {
run_smoke_test() {
clean
build
printf "Executing webapp Locally \n\n" || true
docker run --interactive --tty --detach --publish 8080:8080 --name $version aleon1220/attendance-webapp:$version || true
printf "Executing Java Webapp Attendance version %s\n" $version
source .env
gradle getProjectInfo
printf "\t\tLoaded .env variables file succesfully\n\n"
printf "\t\tExecuting Java Webapp Attendance version %s\n" $APP_WAR_FILE_VERSION || true
printf "\t\tExecuting Java Webapp Attendance version %s\n" $version
}

clean() {
printf "Executing local CLEAN-UP \n\n"
gradle clean || true
docker kill $version
docker rm $version
docker image rm aleon1220/attendance-webapp:$version
printf "docker clean up completed \n\n"
}

test() {
test_stack() {
printf "Executing TESTING \n\n"
gradle test || true
}

run_stack() {
clean
build
test_stack
run
printf "Executing webapp stack Locally \n\n" || true
}

help() {
printf "Help Function Java WebApp Attendance Class \n\n"
print_usage
Expand Down
77 changes: 75 additions & 2 deletions src/main/java/bean/AttendanceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@

package bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class AttendanceBean {
import jakarta.enterprise.context.RequestScoped;

import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Named;

@Named("attendance")
@RequestScoped
public class AttendanceBean implements Serializable{

private String attendanceCode;
private String selectedUser;
private String className;
private List<String> classes;
private String randomCode;
private static final long serialVersionUID = 1L;

public void init() {
// invokes service class to populate classes
Expand All @@ -24,12 +34,26 @@ public void init() {
classes.add("Service Based Design");
classes.add("Cloud Computing");
classes.add("Service Deployment");

// for(int i = 0; i < 10; i++) {
// classes.add("Class " + i);
// }
}

public void button1Action() {
// Implement logic for button 1
System.out.println("Button 1 has been clicked!");
}

public void button2Action() {
// Implement logic for button 2
System.out.println("Button 2 clicked!");
}

public void onTimeout() {
System.out.println("TimingOut Attendance");
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Time is Out. Talk to your trainer!", null));
}

public String getClassName() {
return className;
}
Expand Down Expand Up @@ -69,5 +93,54 @@ public String getRandomCode() {
public void setRandomCode(String randomCode) {
this.randomCode = randomCode;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((attendanceCode == null) ? 0 : attendanceCode.hashCode());
result = prime * result + ((selectedUser == null) ? 0 : selectedUser.hashCode());
result = prime * result + ((className == null) ? 0 : className.hashCode());
result = prime * result + ((classes == null) ? 0 : classes.hashCode());
result = prime * result + ((randomCode == null) ? 0 : randomCode.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AttendanceBean other = (AttendanceBean) obj;
if (attendanceCode == null) {
if (other.attendanceCode != null)
return false;
} else if (!attendanceCode.equals(other.attendanceCode))
return false;
if (selectedUser == null) {
if (other.selectedUser != null)
return false;
} else if (!selectedUser.equals(other.selectedUser))
return false;
if (className == null) {
if (other.className != null)
return false;
} else if (!className.equals(other.className))
return false;
if (classes == null) {
if (other.classes != null)
return false;
} else if (!classes.equals(other.classes))
return false;
if (randomCode == null) {
if (other.randomCode != null)
return false;
} else if (!randomCode.equals(other.randomCode))
return false;
return true;
}
}
// End of AttendanceBean.java
Loading

0 comments on commit b4130f5

Please sign in to comment.