Skip to content

Commit

Permalink
Add frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
berrydenhartog committed Jun 26, 2024
1 parent 987fdf2 commit 07167dc
Show file tree
Hide file tree
Showing 27 changed files with 3,486 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
# AI-act-beslisboom

Repository voor de beslisboom op basis van de AI Act

De beslisboom bestaat uit meerdere json files: een hoofdbestand en meerdere sub-trees die in aparte files staan zodat ze geïnclude kunnen worden.
Er wordt een naming-convention gebruikt om onderscheid te maken: wanneer de naam van een json bestand eindigt in -compressed.json, dan bevat het referenties naar andere json bestanden (sub-trees). Wanneer het niet eindigt op -compressed.json (maar gewoon .json) dan staan er geen referenties in.

Door middel van de aanwezige bashscripts kan de volledige beslisboom worden gegenereerd (decision-tree.json)

## frontend

For the frontend we created a minimal vuejs application.

### Project Setup

Go into the frontend folder and execute the following commands.

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```
15 changes: 15 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
8 changes: 8 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
16 changes: 16 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20-alpine as build

WORKDIR /app
COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

FROM nginx:1.27.0
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY nginx.default.conf /etc/nginx/conf.d/default.conf
COPY nginx.htpasswd /etc/nginx/.htpasswd
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
6 changes: 6 additions & 0 deletions frontend/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
web:
build: .
image: ghcr.io/minbzk/beslisboom:main
ports:
- '9090:80'
1 change: 1 addition & 0 deletions frontend/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
16 changes: 16 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Beslisboom</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>

</html>
40 changes: 40 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

server_tokens off; # Hide nginx version

add_header X-Frame-Options "SAMEORIGIN"; # Clickjacking protection
#add_header X-Content-Type-Options "nosniff"; # Don't allow the browser to perform MIME-type guessing
add_header X-XSS-Protection "1; mode=block"; # Cross-site scripting (XSS) filter

# Enable HSTS (HTTP Strict Transport Security) to enforce secure (HTTP over SSL/TLS) connections to the server
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

include /etc/nginx/conf.d/*.conf;
}
36 changes: 36 additions & 0 deletions frontend/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html;

# Password protect the content
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;

}

# Allow access to JS and CSS files
location ~* \.(js|css)$ {
root /usr/share/nginx/html;
expires -1;
log_not_found off;

auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ /\.ht {
deny all;
}
}
1 change: 1 addition & 0 deletions frontend/nginx.htpasswd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruth:$apr1$V6Ei6xCR$.tfy/6fU8NP1P9Y.dbvg01
Loading

0 comments on commit 07167dc

Please sign in to comment.