Skip to content

Commit

Permalink
Merge pull request #162 from kbss-cvut/create-mock-of-statistics
Browse files Browse the repository at this point in the history
[New] Create mock statistics for example deployments
  • Loading branch information
blcham authored May 8, 2024
2 parents d46c5ef + 7be8300 commit e354745
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 8 deletions.
7 changes: 3 additions & 4 deletions deploy/internal-auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ services:
- record-manager-server
- s-pipes-engine
- db-server
- ava-analytics-ui
environment:
NGINX_ENVSUBST_OUTPUT_DIR: /etc/nginx
APP_ORIGIN: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}"
APP_ROOT_PATH: "${APP_ROOT_PATH:-}"
RECORD_MANAGER_PATH: "${RECORD_MANAGER_PATH:-/record-manager}"
ANALYTICS_PATH: "${ANALYTICS_PATH:-/statistics}"
volumes:
- ./nginx/nginx.conf:/etc/nginx/templates/nginx.conf.template:ro
- ../shared/nginx/error.html:/usr/share/nginx/html/error.html:ro
- ./nginx/index.html:/usr/share/nginx/html/index.html:ro
- ../shared/nginx/images:/usr/share/nginx/html/images:ro
- ../shared/nginx/statistics.html:/usr/share/nginx/html/statistics.html:ro

record-manager:
image: ghcr.io/kbss-cvut/record-manager-ui:latest
Expand All @@ -52,6 +53,7 @@ services:
LANGUAGE: "${LANGUAGE:-en}"
NAVIGATOR_LANGUAGE: "false"
BASENAME: "${APP_ROOT_PATH:-}${RECORD_MANAGER_PATH:-/record-manager}"
ANALYTICS_URL: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${APP_ROOT_PATH:-}${ANALYTICS_PATH:-/statistics}"
EXTENSIONS: "${RECORD_MANAGER_EXTENSIONS:-supplier}"

record-manager-server:
Expand Down Expand Up @@ -98,8 +100,5 @@ services:
- ../shared/db-server/import:/root/graphdb-import:ro
- db-server:/opt/graphdb/home

ava-analytics-ui:
image: ghcr.io/kbss-cvut/ava-analytics-ui:latest

volumes:
db-server:
5 changes: 5 additions & 0 deletions deploy/internal-auth/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ http {
proxy_pass http://s-pipes-engine:8080/; # keep the trailing slash to cut off matched prefix
}

location ${ANALYTICS_PATH} {
try_files /statistics.html =404;
root /usr/share/nginx/html;
}

location /health-check {
return 200;
access_log off;
Expand Down
7 changes: 3 additions & 4 deletions deploy/keycloak-auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ services:
- record-manager-server
- s-pipes-engine
- db-server
- ava-analytics-ui
environment:
NGINX_ENVSUBST_OUTPUT_DIR: /etc/nginx
APP_ORIGIN: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}"
APP_ROOT_PATH: "${APP_ROOT_PATH:-}"
RECORD_MANAGER_PATH: "${RECORD_MANAGER_PATH:-/record-manager}"
ANALYTICS_PATH: "${ANALYTICS_PATH:-/statistics}"
volumes:
- ./nginx/nginx.conf:/etc/nginx/templates/nginx.conf.template:ro
- ../shared/nginx/error.html:/usr/share/nginx/html/error.html:ro
- ../shared/nginx/statistics.html:/usr/share/nginx/html/statistics.html:ro

record-manager:
image: ghcr.io/kbss-cvut/kbss-cvut/record-manager-ui:latest
Expand All @@ -53,6 +54,7 @@ services:
AUTHENTICATION: "oidc"
AUTH_SERVER_URL: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${APP_ROOT_PATH:-}/services/auth/realms/record-manager"
AUTH_CLIENT_ID: "record-manager"
ANALYTICS_URL: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${APP_ROOT_PATH:-}${ANALYTICS_PATH:-/statistics}"
EXTENSIONS: "${RECORD_MANAGER_EXTENSIONS:-supplier}"

record-manager-server:
Expand Down Expand Up @@ -150,9 +152,6 @@ services:
depends_on:
- auth-server-db

ava-analytics-ui:
image: ghcr.io/kbss-cvut/ava-analytics-ui:latest

volumes:
db-server:
auth-server:
Expand Down
5 changes: 5 additions & 0 deletions deploy/keycloak-auth/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ http {
proxy_busy_buffers_size 256k;
}

location ${ANALYTICS_PATH} {
try_files /statistics.html =404;
root /usr/share/nginx/html;
}

location /health-check {
return 200;
access_log off;
Expand Down
130 changes: 130 additions & 0 deletions deploy/shared/nginx/statistics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" />
<title>Record Manager Statistics</title>
<style>
body {
font-family: "Open Sans", Helvetica, Arial, sans-serif;
color: #ededed;
margin: 0;
padding: 0;
background-image: url("./images/background.jpg");
background-size: cover;
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

h1 {
font-size: 3em;
margin-bottom: 30px;
text-align: center;
}

.statistics-container {
background: rgba(255, 255, 255, 0.13);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10.5px);
-webkit-backdrop-filter: blur(10.5px);
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 20px;
margin-top: 20px;
max-width: 800px;
}

.statistics-heading {
font-size: 2em;
margin-bottom: 20px;
text-align: center;
}

.statistics-list {
list-style-type: none;
padding: 0;
text-align: center;
}

.statistics-item {
margin-bottom: 10px;
}

table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

th,
td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {
background-color: #333;
color: #fff;
}
</style>
</head>
<body>
<div class="statistics-container">
<h1>Record Manager Statistics</h1>

<div class="statistics-heading">General Statistics</div>
<ul class="statistics-list">
<li class="statistics-item">Number of Entry Clerks: <strong>10</strong></li>
<li class="statistics-item">Number of Participating Institutions: <strong>5</strong></li>
<li class="statistics-item">Number of Completed Records: <strong>500</strong></li>
<li class="statistics-item">Number of Invalid Records: <strong>20</strong></li>
<li class="statistics-item">Number of Rejected Records: <strong>50</strong></li>
<li class="statistics-item">Number of Confirmed Records: <strong>430</strong></li>
<li class="statistics-item">Period of Record Entries: <strong>01/01/2024 - 03/01/2024</strong></li>
</ul>

<div class="statistics-heading">Record Statistics</div>
<table>
<thead>
<tr>
<th>Date</th>
<th>Number of Records Completed</th>
<th>Number of Invalid Records</th>
<th>Number of Rejected Records</th>
<th>Number of Confirmed Records</th>
</tr>
</thead>
<tbody>
<tr>
<td>01/01/2024</td>
<td>50</td>
<td>2</td>
<td>5</td>
<td>43</td>
</tr>
<tr>
<td>01/02/2024</td>
<td>60</td>
<td>3</td>
<td>6</td>
<td>51</td>
</tr>
<tr>
<td>01/03/2024</td>
<td>70</td>
<td>4</td>
<td>7</td>
<td>59</td>
</tr>
<!-- Additional rows can be added similarly -->
</tbody>
</table>
</div>
</body>
</html>

0 comments on commit e354745

Please sign in to comment.