Skip to content

Commit c254e0d

Browse files
Merge pull request #37 from KonsumGandalf/sim-35
Feat: Improve coloring, mobility view and integrate last run for list view
2 parents 597f681 + 74faf43 commit c254e0d

File tree

224 files changed

+6893
-1258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+6893
-1258
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ yarn-error.log
1818
# Ignore Docker-specific files
1919
.dockerignore
2020
docker-compose.yml
21+
22+
# Ignore Json files
23+
./src/assets/leaflet/region-map.json
24+
./src/assets/leaflet/street-map.json

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ SIMRA_API_URL=localhost:8081/api
22

33
MAPILLARY_URL="https://graph.mapillary.com"
44
MAPILLARY_ACCESS_TOKEN="YOUR TOKEN"
5+
6+
MAP_TILER_TOKEN="YOUR TOKEN"

.github/workflows/docker.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
build-args: |
3636
MAPILLARY_URL=${{ vars.MAPILLARY_URL }}
3737
secrets: |
38-
"simra_api_url=${{ secrets.SIMRA_API_URL }}"
39-
"mapillary_access_token=${{ secrets.MAPILLARY_ACCESS_TOKEN }}"
40-
38+
simra_api_url=${{ secrets.SIMRA_API_URL }}
39+
mapillary_access_token=${{ secrets.MAPILLARY_ACCESS_TOKEN }}
40+
map_tiler_token=${{ secrets.MAP_TILER_TOKEN }}
41+
4142

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ WORKDIR /usr/src/app
55
ARG SIMRA_API_URL
66
ARG MAPILLARY_URL
77
ARG MAPILLARY_ACCESS_TOKEN
8+
ARG MAP_TILER_TOKEN
89

910
ENV SIMRA_API_URL=$SIMRA_API_URL
1011
ENV MAPILLARY_URL=$MAPILLARY_URL
1112
ENV MAPILLARY_ACCESS_TOKEN=$MAPILLARY_ACCESS_TOKEN
13+
ENV MAP_TILER_TOKEN=$MAP_TILER_TOKEN
1214
ENV NX_DAEMON=false
1315

1416
COPY package*.json ./
@@ -37,8 +39,10 @@ COPY . .
3739

3840
RUN --mount=type=secret,id=simra_api_url \
3941
--mount=type=secret,id=mapillary_access_token \
42+
--mount=type=secret,id=map_tiler_token \
4043
export SIMRA_API_URL=$(cat /run/secrets/simra_api_url) && \
4144
export MAPILLARY_ACCESS_TOKEN=$(cat /run/secrets/mapillary_access_token) && \
45+
export MAP_TILER_TOKEN=$(cat /run/secrets/map_tiler_token) && \
4246
nx build --skip-nx-cache
4347

4448
FROM nginx:stable-alpine AS local_production
@@ -54,3 +58,26 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf
5458
COPY --from=github_builder /usr/src/app/dist/simra/browser /usr/share/nginx/html
5559

5660
EXPOSE 80
61+
62+
FROM node:23-alpine AS local_test
63+
64+
ARG SIMRA_API_URL
65+
ARG MAPILLARY_URL
66+
ARG MAPILLARY_ACCESS_TOKEN
67+
ARG MAP_TILER_TOKEN
68+
69+
ENV SIMRA_API_URL=$SIMRA_API_URL
70+
ENV MAPILLARY_URL=$MAPILLARY_URL
71+
ENV MAPILLARY_ACCESS_TOKEN=$MAPILLARY_ACCESS_TOKEN
72+
ENV MAP_TILER_TOKEN=$MAP_TILER_TOKEN
73+
ENV NX_DAEMON=false
74+
75+
COPY package*.json ./
76+
77+
RUN npm ci --ignore-scripts
78+
RUN npm install -g nx
79+
80+
COPY . .
81+
82+
RUN nx serve
83+
EXPOSE 4200

docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ services:
1313
SIMRA_API_URL: ${SIMRA_API_URL}
1414
MAPILLARY_URL: ${MAPILLARY_URL}
1515
MAPILLARY_ACCESS_TOKEN: ${MAPILLARY_ACCESS_TOKEN}
16+
MAP_TILER_TOKEN: ${MAP_TILER_TOKEN}
1617
ports:
17-
- "4200:80"
18+
- "4200:4200"
1819
env_file:
1920
- .env

k6s/backend-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import http from 'k6/http';
2+
import { sleep, check } from 'k6';
3+
4+
export const options = {
5+
vus: 5,
6+
duration: '40s',
7+
};
8+
9+
export default function () {
10+
let res = http.get('http://konsumpi:8081/api/streets/grid?lat=52.523232122212534&lng=13.47329869&zoom=9&year=2024');
11+
res = http.get('http://konsumpi:8081/api/safety-metrics/simra-regions/Berlin-Potsdam');
12+
res = http.get('http://konsumpi:8081/api/safety-metrics/streets?size=20&minNumberOfRides=2&page=0&weekDay=ALL_WEEK&trafficTime=ALL_DAY&year=2000&sort=dangerousScore,DESC');
13+
// res = http.get('http://konsumpi:8081/api/safety-metrics/regions?size=20&minNumberOfRides=100&page=0&weekDay=ALL_WEEK&trafficTime=ALL_DAY&year=2000&sort=dangerousScore,DESC');
14+
15+
check(res, {
16+
'Status ist 200': (r) => r.status === 200,
17+
'Antwortzeit < 300': (r) => r.timings.duration < 300,
18+
});
19+
}

k6s/frontend-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import http from 'k6/http';
2+
import { sleep, check } from 'k6';
3+
4+
export const options = {
5+
vus: 10,
6+
duration: '30s',
7+
};
8+
9+
export default function () {
10+
const res = http.get('https://konsumpi:8081/streets/map?lat=52.522&lng=13.413&zoom=14');
11+
12+
check(res, {
13+
'Status ist 200': (r) => r.status === 200,
14+
'Antwortzeit < 500ms': (r) => r.timings.duration < 500,
15+
});
16+
17+
sleep(1);
18+
}

libs/common/models/src/lib/enums/year.enum.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export enum EYear {
22
ALL = '2000',
3-
Y2018 = '2018',
43
Y2019 = '2019',
54
Y2020 = '2020',
65
Y2021 = '2021',

libs/common/models/src/lib/interfaces/app-environment.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ export interface AppEnvironmentInterface extends Environment {
66
apiUrl: string;
77
mapillaryUrl: string;
88
mapillaryAccessToken: string;
9+
mapTilerToken: string;
910
}

libs/common/models/src/lib/interfaces/map-position.interface.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ export interface IMapPosition extends CoordinateInterface {
1010
* ID of the street
1111
*/
1212
osm_id?: number;
13+
14+
/**
15+
* Indicates if a jump or fly is performed
16+
*/
17+
isNavigated?: boolean;
1318
}

0 commit comments

Comments
 (0)