feat: create nginx on docker compose | close #305
This commit is contained in:
parent
f8cb6e600f
commit
99508c5f16
|
|
@ -58,7 +58,7 @@ user@user-laptop:~$ cd oktopus/deploy/compose
|
||||||
user@user-laptop:~/oktopus/deploy/compose$ COMPOSE_PROFILES=nats,controller,cwmp,mqtt,stomp,ws,adapter,frontend,portainer docker compose up -d
|
user@user-laptop:~/oktopus/deploy/compose$ COMPOSE_PROFILES=nats,controller,cwmp,mqtt,stomp,ws,adapter,frontend,portainer docker compose up -d
|
||||||
</pre>
|
</pre>
|
||||||
Oktopus deployment in <u><b>Kubernetes</b></u> still is in beta phase: <a href="https://github.com/OktopUSP/oktopus/blob/main/deploy/kubernetes/README.md"> Instructions for Kubernetes deployment</a><p></p>
|
Oktopus deployment in <u><b>Kubernetes</b></u> still is in beta phase: <a href="https://github.com/OktopUSP/oktopus/blob/main/deploy/kubernetes/README.md"> Instructions for Kubernetes deployment</a><p></p>
|
||||||
UI will open at port 3000:
|
UI will open at port 80:
|
||||||
<img src="https://github.com/OktopUSP/oktopus/assets/83298718/65f7c5b9-c08d-479a-8a13-fdfc634b5ca2"/><br/><br/>
|
<img src="https://github.com/OktopUSP/oktopus/assets/83298718/65f7c5b9-c08d-479a-8a13-fdfc634b5ca2"/><br/><br/>
|
||||||
<h1>Agent</h1>
|
<h1>Agent</h1>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
# ----------------------------- Local Environment ---------------------------- #
|
|
||||||
|
|
||||||
NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api"
|
|
||||||
NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
|
|
||||||
# ---------------------------------------------------------------------------- #
|
|
||||||
|
|
||||||
# -------------------------- Production Environment -------------------------- #
|
|
||||||
|
|
||||||
#NEXT_PUBLIC_REST_ENPOINT="https://demo.oktopus.app.br/api"
|
|
||||||
#NEXT_PUBLIC_WS_ENPOINT="https://demo.oktopus.app.br/"
|
|
||||||
# ---------------------------------------------------------------------------- #
|
|
||||||
|
|
||||||
# ---------------------------- Mocked Environment ---------------------------- #
|
|
||||||
|
|
||||||
#NEXT_PUBLIC_REST_ENPOINT="https://d9962fd9-2464-4a30-9a86-a15a04b57ad0.mock.pstmn.io"
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------- #
|
|
||||||
|
|
@ -151,10 +151,8 @@ services:
|
||||||
|
|
||||||
#/* -------------------------------- Frontend -------------------------------- */
|
#/* -------------------------------- Frontend -------------------------------- */
|
||||||
frontend:
|
frontend:
|
||||||
image: 'oktopusp/frontend'
|
image: 'oktopusp/frontend-ce'
|
||||||
container_name: frontend
|
container_name: frontend
|
||||||
env_file:
|
|
||||||
- .env.frontend
|
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|
@ -188,6 +186,21 @@ services:
|
||||||
ipv4_address: 172.16.235.16
|
ipv4_address: 172.16.235.16
|
||||||
profiles: [cwmp]
|
profiles: [cwmp]
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
depends_on:
|
||||||
|
- frontend
|
||||||
|
- controller
|
||||||
|
- socketio
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
networks:
|
||||||
|
usp_network:
|
||||||
|
ipv4_address: 172.16.235.17
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
usp_network:
|
usp_network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
|
||||||
41
deploy/compose/nginx.conf
Normal file
41
deploy/compose/nginx.conf
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
include /etc/nginx/default.d/*.conf;
|
||||||
|
|
||||||
|
error_page 404 /404.html;
|
||||||
|
location = /404.html {
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://frontend:3000;
|
||||||
|
proxy_read_timeout 60;
|
||||||
|
proxy_connect_timeout 60;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
location /api {
|
||||||
|
proxy_pass http://controller:8000;
|
||||||
|
proxy_read_timeout 60;
|
||||||
|
proxy_connect_timeout 60;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
location /socket.io {
|
||||||
|
proxy_pass http://socketio:5000;
|
||||||
|
proxy_read_timeout 60;
|
||||||
|
proxy_connect_timeout 60;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
}
|
||||||
|
}
|
||||||
1
deploy/compose/run.sh
Normal file
1
deploy/compose/run.sh
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
COMPOSE_PROFILES=nats,controller,cwmp,mqtt,stomp,ws,adapter,frontend,portainer docker compose up -d
|
||||||
1
deploy/compose/stop.sh
Normal file
1
deploy/compose/stop.sh
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
COMPOSE_PROFILES=nats,controller,cwmp,mqtt,stomp,ws,adapter,frontend,portainer docker compose down
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
# ----------------------------- Local Environment ---------------------------- #
|
# ----------------------------- Local Environment ---------------------------- #
|
||||||
|
|
||||||
NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api"
|
NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000"
|
||||||
NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
|
NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
|
||||||
NEXT_PUBLIC_ENTERPRISE_VERSION="false"
|
NEXT_PUBLIC_ENTERPRISE_VERSION="false"
|
||||||
|
NEXT_PUBLIC_GOOGLE_MAPS_KEY=""
|
||||||
# ---------------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------------- #
|
||||||
|
|
||||||
# -------------------------- Production Environment -------------------------- #
|
# -------------------------- Production Environment -------------------------- #
|
||||||
|
|
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
.next/
|
../.next/
|
||||||
|
../node_modules/
|
||||||
|
../.env
|
||||||
|
../.env.local
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
FROM node:18.17.0-alpine as builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY ../ ./
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
RUN NEXT_PUBLIC_REST_ENDPOINT=REST_API_URL NEXT_PUBLIC_WS_ENDPOINT=WS_URL NEXT_PUBLIC_ENTERPRISE_VERSION=ENTERPRISE_VERSION npm run build
|
|
||||||
|
|
||||||
RUN ls -la && echo "Listing directory contents done"
|
|
||||||
|
|
||||||
FROM node:18.17.0-alpine as runner
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=builder /app/.next ./.next
|
|
||||||
COPY --from=builder /app/package.json ./package.json
|
|
||||||
COPY --from=builder /app/build/entrypoint.sh ./entrypoint.sh
|
|
||||||
COPY --from=builder /app/public ./public
|
|
||||||
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
RUN chmod 755 entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
||||||
|
|
||||||
CMD [ "npm", "run", "start" ]
|
|
||||||
22
frontend/build/Dockerfile.ce
Normal file
22
frontend/build/Dockerfile.ce
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
FROM node:18.18.0-alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ../ ./
|
||||||
|
RUN rm .env && rm .env.local || true
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
RUN NEXT_PUBLIC_ENTERPRISE_VERSION="false" npm run build
|
||||||
|
|
||||||
|
FROM node:18.18.0-alpine as runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
CMD [ "npm", "run", "start" ]
|
||||||
22
frontend/build/Dockerfile.ee
Normal file
22
frontend/build/Dockerfile.ee
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
FROM node:18.18.0-alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ../ ./
|
||||||
|
RUN rm .env && rm .env.local || true
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
RUN NEXT_PUBLIC_ENTERPRISE_VERSION="true" npm run build
|
||||||
|
|
||||||
|
FROM node:18.18.0-alpine as runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
CMD [ "npm", "run", "start" ]
|
||||||
|
|
@ -18,48 +18,16 @@ help:
|
||||||
@echo "Makefile commands:"
|
@echo "Makefile commands:"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "build - docker image build"
|
@echo "build - docker image build"
|
||||||
@echo "push - push docker image to registry"
|
|
||||||
@echo "run - create and start docker container with the image"
|
|
||||||
@echo "start - start existent docker container with the image"
|
|
||||||
@echo "stop - stop docker container running the image"
|
|
||||||
@echo "remove - remove docker container running the image"
|
|
||||||
@echo "delete - delete docker image"
|
|
||||||
@echo "logs - show logs of docker container"
|
|
||||||
@echo "bash - access container shell"
|
|
||||||
@echo "release - tag image as latest and push to registry"
|
@echo "release - tag image as latest and push to registry"
|
||||||
@echo "tag - tag image as latest"
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@docker build -t ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG} -f Dockerfile ../
|
@docker build -t ${DOCKER_USER}/${DOCKER_APP}-ce:${DOCKER_TAG} -f Dockerfile.ce ../
|
||||||
|
@docker build -t ${DOCKER_USER}/${DOCKER_APP}-ee:${DOCKER_TAG} -f Dockerfile.ee ../
|
||||||
run:
|
|
||||||
@docker run -d --name ${DOCKER_USER}-${DOCKER_APP} ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG}
|
|
||||||
|
|
||||||
stop:
|
|
||||||
@docker stop ${DOCKER_USER}-${DOCKER_APP}
|
|
||||||
|
|
||||||
remove: stop
|
|
||||||
@docker rm ${DOCKER_USER}-${DOCKER_APP}
|
|
||||||
|
|
||||||
delete:
|
|
||||||
@docker rmi ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG}
|
|
||||||
|
|
||||||
start:
|
|
||||||
@docker start ${DOCKER_USER}-${DOCKER_APP}
|
|
||||||
|
|
||||||
push:
|
|
||||||
@docker push ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG}
|
|
||||||
|
|
||||||
logs:
|
|
||||||
@docker logs -f ${DOCKER_USER}-${DOCKER_APP}
|
|
||||||
|
|
||||||
bash:
|
|
||||||
@docker exec -it ${DOCKER_USER}-${DOCKER_APP} ${CONTAINER_SHELL}
|
|
||||||
|
|
||||||
release: build
|
release: build
|
||||||
@docker push ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG}
|
@docker push ${DOCKER_USER}/${DOCKER_APP}-ce:${DOCKER_TAG}
|
||||||
@docker tag ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG} ${DOCKER_USER}/${DOCKER_APP}:latest
|
@docker push ${DOCKER_USER}/${DOCKER_APP}-ee:${DOCKER_TAG}
|
||||||
@docker push ${DOCKER_USER}/${DOCKER_APP}:latest
|
@docker tag ${DOCKER_USER}/${DOCKER_APP}-ce:${DOCKER_TAG} ${DOCKER_USER}/${DOCKER_APP}-ce:latest
|
||||||
|
@docker tag ${DOCKER_USER}/${DOCKER_APP}-ee:${DOCKER_TAG} ${DOCKER_USER}/${DOCKER_APP}-ee:latest
|
||||||
tag:
|
@docker push ${DOCKER_USER}/${DOCKER_APP}-ce:latest
|
||||||
docker tag ${DOCKER_USER}/${DOCKER_APP}:${DOCKER_TAG} ${DOCKER_USER}/${DOCKER_APP}:latest
|
@docker push ${DOCKER_USER}/${DOCKER_APP}-ee:latest
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
set -Ex
|
|
||||||
|
|
||||||
function apply_path {
|
|
||||||
|
|
||||||
echo "Check that we have NEXT_PUBLIC_REST_ENDPOINT vars"
|
|
||||||
test -n "$NEXT_PUBLIC_REST_ENDPOINT"
|
|
||||||
|
|
||||||
echo "Check that we have NEXT_PUBLIC_WS_ENDPOINT vars"
|
|
||||||
test -n "$NEXT_PUBLIC_WS_ENDPOINT"
|
|
||||||
|
|
||||||
echo "Check that we have NEXT_PUBLIC_ENTERPRISE_VERSION vars"
|
|
||||||
test -n "$NEXT_PUBLIC_ENTERPRISE_VERSION"
|
|
||||||
|
|
||||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENDPOINT#g"
|
|
||||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$NEXT_PUBLIC_WS_ENDPOINT#g"
|
|
||||||
find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#ENTERPRISE_VERSION#$NEXT_PUBLIC_ENTERPRISE_VERSION#g"
|
|
||||||
}
|
|
||||||
|
|
||||||
apply_path
|
|
||||||
echo "Starting Nextjs"
|
|
||||||
exec "$@"
|
|
||||||
143
frontend/package-lock.json
generated
143
frontend/package-lock.json
generated
|
|
@ -17,6 +17,7 @@
|
||||||
"@mui/material": "5.11.10",
|
"@mui/material": "5.11.10",
|
||||||
"@mui/system": "5.11.9",
|
"@mui/system": "5.11.9",
|
||||||
"@mui/x-date-pickers": "5.0.19",
|
"@mui/x-date-pickers": "5.0.19",
|
||||||
|
"@react-google-maps/api": "^2.19.3",
|
||||||
"apexcharts": "3.37.0",
|
"apexcharts": "3.37.0",
|
||||||
"date-fns": "2.29.3",
|
"date-fns": "2.29.3",
|
||||||
"formik": "2.2.9",
|
"formik": "2.2.9",
|
||||||
|
|
@ -499,6 +500,23 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@googlemaps/js-api-loader": {
|
||||||
|
"version": "1.16.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.16.2.tgz",
|
||||||
|
"integrity": "sha512-psGw5u0QM6humao48Hn4lrChOM2/rA43ZCm3tKK9qQsEj1/VzqkCqnvGfEOshDbBQflydfaRovbKwZMF4AyqbA==",
|
||||||
|
"dependencies": {
|
||||||
|
"fast-deep-equal": "^3.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@googlemaps/markerclusterer": {
|
||||||
|
"version": "2.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@googlemaps/markerclusterer/-/markerclusterer-2.5.3.tgz",
|
||||||
|
"integrity": "sha512-x7lX0R5yYOoiNectr10wLgCBasNcXFHiADIBdmn7jQllF2B5ENQw5XtZK+hIw4xnV0Df0xhN4LN98XqA5jaiOw==",
|
||||||
|
"dependencies": {
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"supercluster": "^8.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@heroicons/react": {
|
"node_modules/@heroicons/react": {
|
||||||
"version": "2.0.16",
|
"version": "2.0.16",
|
||||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.16.tgz",
|
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.16.tgz",
|
||||||
|
|
@ -1215,6 +1233,33 @@
|
||||||
"url": "https://opencollective.com/popperjs"
|
"url": "https://opencollective.com/popperjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-google-maps/api": {
|
||||||
|
"version": "2.19.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/api/-/api-2.19.3.tgz",
|
||||||
|
"integrity": "sha512-jiLqvuOt5lOowkLeq7d077AByTyJp+s6hZVlLhlq7SBacBD37aUNpXBz2OsazfeR6Aw4a+9RRhAEjEFvrR1f5A==",
|
||||||
|
"dependencies": {
|
||||||
|
"@googlemaps/js-api-loader": "1.16.2",
|
||||||
|
"@googlemaps/markerclusterer": "2.5.3",
|
||||||
|
"@react-google-maps/infobox": "2.19.2",
|
||||||
|
"@react-google-maps/marker-clusterer": "2.19.2",
|
||||||
|
"@types/google.maps": "3.55.2",
|
||||||
|
"invariant": "2.2.4"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8 || ^17 || ^18",
|
||||||
|
"react-dom": "^16.8 || ^17 || ^18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@react-google-maps/infobox": {
|
||||||
|
"version": "2.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/infobox/-/infobox-2.19.2.tgz",
|
||||||
|
"integrity": "sha512-6wvBqeJsQ/eFSvoxg+9VoncQvNoVCdmxzxRpLvmjPD+nNC6mHM0vJH1xSqaKijkMrfLJT0nfkTGpovrF896jwg=="
|
||||||
|
},
|
||||||
|
"node_modules/@react-google-maps/marker-clusterer": {
|
||||||
|
"version": "2.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/marker-clusterer/-/marker-clusterer-2.19.2.tgz",
|
||||||
|
"integrity": "sha512-x9ibmsP0ZVqzyCo1Pitbw+4b6iEXRw/r1TCy3vOUR3eKrzWLnHYZMR325BkZW2r8fnuWE/V3Fp4QZOP9qYORCw=="
|
||||||
|
},
|
||||||
"node_modules/@rushstack/eslint-patch": {
|
"node_modules/@rushstack/eslint-patch": {
|
||||||
"version": "1.10.3",
|
"version": "1.10.3",
|
||||||
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.3.tgz",
|
||||||
|
|
@ -1245,6 +1290,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
|
||||||
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="
|
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/google.maps": {
|
||||||
|
"version": "3.55.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/google.maps/-/google.maps-3.55.2.tgz",
|
||||||
|
"integrity": "sha512-JcTwzkxskR8DN/nnX96Pie3gGN3WHiPpuxzuQ9z3516o1bB243d8w8DHUJ8BohuzoT1o3HUFta2ns/mkZC8KRw=="
|
||||||
|
},
|
||||||
"node_modules/@types/json5": {
|
"node_modules/@types/json5": {
|
||||||
"version": "0.0.29",
|
"version": "0.0.29",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
|
|
@ -2981,8 +3031,7 @@
|
||||||
"node_modules/fast-deep-equal": {
|
"node_modules/fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/fast-glob": {
|
"node_modules/fast-glob": {
|
||||||
"version": "3.3.2",
|
"version": "3.3.2",
|
||||||
|
|
@ -3529,6 +3578,14 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/invariant": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
|
||||||
|
"dependencies": {
|
||||||
|
"loose-envify": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-array-buffer": {
|
"node_modules/is-array-buffer": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz",
|
||||||
|
|
@ -4018,6 +4075,11 @@
|
||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/kdbush": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA=="
|
||||||
|
},
|
||||||
"node_modules/keyv": {
|
"node_modules/keyv": {
|
||||||
"version": "4.5.4",
|
"version": "4.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
||||||
|
|
@ -5445,6 +5507,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",
|
||||||
"integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA=="
|
"integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/supercluster": {
|
||||||
|
"version": "8.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz",
|
||||||
|
"integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"kdbush": "^4.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/supports-color": {
|
"node_modules/supports-color": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||||
|
|
@ -6440,6 +6510,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@googlemaps/js-api-loader": {
|
||||||
|
"version": "1.16.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.16.2.tgz",
|
||||||
|
"integrity": "sha512-psGw5u0QM6humao48Hn4lrChOM2/rA43ZCm3tKK9qQsEj1/VzqkCqnvGfEOshDbBQflydfaRovbKwZMF4AyqbA==",
|
||||||
|
"requires": {
|
||||||
|
"fast-deep-equal": "^3.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@googlemaps/markerclusterer": {
|
||||||
|
"version": "2.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@googlemaps/markerclusterer/-/markerclusterer-2.5.3.tgz",
|
||||||
|
"integrity": "sha512-x7lX0R5yYOoiNectr10wLgCBasNcXFHiADIBdmn7jQllF2B5ENQw5XtZK+hIw4xnV0Df0xhN4LN98XqA5jaiOw==",
|
||||||
|
"requires": {
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"supercluster": "^8.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@heroicons/react": {
|
"@heroicons/react": {
|
||||||
"version": "2.0.16",
|
"version": "2.0.16",
|
||||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.16.tgz",
|
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.16.tgz",
|
||||||
|
|
@ -6818,6 +6905,29 @@
|
||||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||||
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A=="
|
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A=="
|
||||||
},
|
},
|
||||||
|
"@react-google-maps/api": {
|
||||||
|
"version": "2.19.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/api/-/api-2.19.3.tgz",
|
||||||
|
"integrity": "sha512-jiLqvuOt5lOowkLeq7d077AByTyJp+s6hZVlLhlq7SBacBD37aUNpXBz2OsazfeR6Aw4a+9RRhAEjEFvrR1f5A==",
|
||||||
|
"requires": {
|
||||||
|
"@googlemaps/js-api-loader": "1.16.2",
|
||||||
|
"@googlemaps/markerclusterer": "2.5.3",
|
||||||
|
"@react-google-maps/infobox": "2.19.2",
|
||||||
|
"@react-google-maps/marker-clusterer": "2.19.2",
|
||||||
|
"@types/google.maps": "3.55.2",
|
||||||
|
"invariant": "2.2.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@react-google-maps/infobox": {
|
||||||
|
"version": "2.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/infobox/-/infobox-2.19.2.tgz",
|
||||||
|
"integrity": "sha512-6wvBqeJsQ/eFSvoxg+9VoncQvNoVCdmxzxRpLvmjPD+nNC6mHM0vJH1xSqaKijkMrfLJT0nfkTGpovrF896jwg=="
|
||||||
|
},
|
||||||
|
"@react-google-maps/marker-clusterer": {
|
||||||
|
"version": "2.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-google-maps/marker-clusterer/-/marker-clusterer-2.19.2.tgz",
|
||||||
|
"integrity": "sha512-x9ibmsP0ZVqzyCo1Pitbw+4b6iEXRw/r1TCy3vOUR3eKrzWLnHYZMR325BkZW2r8fnuWE/V3Fp4QZOP9qYORCw=="
|
||||||
|
},
|
||||||
"@rushstack/eslint-patch": {
|
"@rushstack/eslint-patch": {
|
||||||
"version": "1.10.3",
|
"version": "1.10.3",
|
||||||
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.3.tgz",
|
||||||
|
|
@ -6850,6 +6960,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/google.maps": {
|
||||||
|
"version": "3.55.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/google.maps/-/google.maps-3.55.2.tgz",
|
||||||
|
"integrity": "sha512-JcTwzkxskR8DN/nnX96Pie3gGN3WHiPpuxzuQ9z3516o1bB243d8w8DHUJ8BohuzoT1o3HUFta2ns/mkZC8KRw=="
|
||||||
|
},
|
||||||
"@types/json5": {
|
"@types/json5": {
|
||||||
"version": "0.0.29",
|
"version": "0.0.29",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
|
|
@ -8149,8 +8264,7 @@
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"fast-glob": {
|
"fast-glob": {
|
||||||
"version": "3.3.2",
|
"version": "3.3.2",
|
||||||
|
|
@ -8547,6 +8661,14 @@
|
||||||
"side-channel": "^1.0.4"
|
"side-channel": "^1.0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"invariant": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
|
||||||
|
"requires": {
|
||||||
|
"loose-envify": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"is-array-buffer": {
|
"is-array-buffer": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz",
|
||||||
|
|
@ -8874,6 +8996,11 @@
|
||||||
"object.values": "^1.1.6"
|
"object.values": "^1.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"kdbush": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA=="
|
||||||
|
},
|
||||||
"keyv": {
|
"keyv": {
|
||||||
"version": "4.5.4",
|
"version": "4.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
||||||
|
|
@ -9849,6 +9976,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",
|
||||||
"integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA=="
|
"integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA=="
|
||||||
},
|
},
|
||||||
|
"supercluster": {
|
||||||
|
"version": "8.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz",
|
||||||
|
"integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==",
|
||||||
|
"requires": {
|
||||||
|
"kdbush": "^4.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
"@mui/material": "5.11.10",
|
"@mui/material": "5.11.10",
|
||||||
"@mui/system": "5.11.9",
|
"@mui/system": "5.11.9",
|
||||||
"@mui/x-date-pickers": "5.0.19",
|
"@mui/x-date-pickers": "5.0.19",
|
||||||
|
"@react-google-maps/api": "^2.19.3",
|
||||||
"apexcharts": "3.37.0",
|
"apexcharts": "3.37.0",
|
||||||
"date-fns": "2.29.3",
|
"date-fns": "2.29.3",
|
||||||
"formik": "2.2.9",
|
"formik": "2.2.9",
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ export const AuthProvider = (props) => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+"/auth/login", requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/auth/login`, requestOptions)
|
||||||
|
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
throw new Error('Please check your email and password');
|
throw new Error('Please check your email and password');
|
||||||
|
|
@ -199,7 +199,7 @@ export const AuthProvider = (props) => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+"/auth/admin/register", requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/auth/admin/register`, requestOptions)
|
||||||
|
|
||||||
if (result.status == 200) {
|
if (result.status == 200) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export const items = [
|
||||||
// <SvgIcon fontSize="small">
|
// <SvgIcon fontSize="small">
|
||||||
// <MapIcon/>
|
// <MapIcon/>
|
||||||
// </SvgIcon>
|
// </SvgIcon>
|
||||||
// )
|
// ),
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: 'Credentials',
|
title: 'Credentials',
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,11 @@ export const Layout = withAuthGuard((props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TopNav onNavOpen={() => setOpenNav(true)} />
|
{pathname != "/map" && <TopNav onNavOpen={() => setOpenNav(true)} />}
|
||||||
<SideNav
|
<SideNav
|
||||||
onClose={() => setOpenNav(false)}
|
onClose={() => setOpenNav(false)}
|
||||||
open={openNav}
|
open={openNav}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LayoutRoot>
|
<LayoutRoot>
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const Page = () => {
|
||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/auth/admin/exists`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/auth/admin/exists`, requestOptions))
|
||||||
let content = await result.json()
|
let content = await result.json()
|
||||||
console.log("content: ", content)
|
console.log("content: ", content)
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/users`,requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/users`,requestOptions)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
// let teste = JSON.stringify(JSON.parse(result), null, 2)
|
// let teste = JSON.stringify(JSON.parse(result), null, 2)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT + '/device/auth?id='+id, requestOptions)
|
return fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/auth?id=${id}`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -81,7 +81,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+"/device/auth", requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/auth`, requestOptions)
|
||||||
|
|
||||||
if (result.status == 200) {
|
if (result.status == 200) {
|
||||||
console.log("user created: deu boa raça !!")
|
console.log("user created: deu boa raça !!")
|
||||||
|
|
@ -134,7 +134,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = process.env.NEXT_PUBLIC_REST_ENDPOINT + '/device/auth'
|
let url = `${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/auth`
|
||||||
if (id !== undefined && id !== "") {
|
if (id !== undefined && id !== "") {
|
||||||
url += "?id="+id
|
url += "?id="+id
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +224,7 @@ const Page = () => {
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
defaultValue=""
|
defaultValue=""
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Search customer"
|
placeholder="Search credentials by username"
|
||||||
onKeyDownCapture={(e) => {
|
onKeyDownCapture={(e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
console.log("Fetch credentials per username: ", e.target.value)
|
console.log("Fetch credentials per username: ", e.target.value)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+'/device', requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401)
|
if (response.status === 401)
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -86,7 +86,7 @@ const Page = () => {
|
||||||
p = p - 1
|
p = p - 1
|
||||||
p = p.toString()
|
p = p.toString()
|
||||||
|
|
||||||
fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+'/device?page_number='+p, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device?page_number=+${p}`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401)
|
if (response.status === 401)
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -116,7 +116,7 @@ const Page = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == ""){
|
if (id == ""){
|
||||||
return fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+'/device', requestOptions)
|
return fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401)
|
if (response.status === 401)
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -134,7 +134,7 @@ const Page = () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = await fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+'/device?id='+id, requestOptions)
|
let response = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device?id=${id}`, requestOptions)
|
||||||
if (response.status === 401)
|
if (response.status === 401)
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
let json = await response.json()
|
let json = await response.json()
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const Page = () => {
|
||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/info/general`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/info/general`, requestOptions))
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
}else if (result.status != 200){
|
}else if (result.status != 200){
|
||||||
|
|
|
||||||
86
frontend/src/pages/map.js
Normal file
86
frontend/src/pages/map.js
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
import Head from 'next/head';
|
||||||
|
import { GoogleMap, useLoadScript } from "@react-google-maps/api"
|
||||||
|
import { Layout as DashboardLayout } from 'src/layouts/dashboard/layout';
|
||||||
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
import mapStyles from '../utils/mapStyles.json';
|
||||||
|
|
||||||
|
const Page = () => {
|
||||||
|
|
||||||
|
const libraries = useMemo(() => ['places'], []);
|
||||||
|
|
||||||
|
const [mapCenter, setMapCenter] = useState(null);
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
// Check if geolocation is supported by the browser
|
||||||
|
if ("geolocation" in navigator) {
|
||||||
|
// Prompt user for permission to access their location
|
||||||
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
// Get the user's latitude and longitude coordinates
|
||||||
|
// Success callback function
|
||||||
|
function(position) {
|
||||||
|
// Update the map with the user's new location
|
||||||
|
setMapCenter({
|
||||||
|
lat: position.coords.latitude,
|
||||||
|
lng: position.coords.longitude,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// Error callback function
|
||||||
|
function(error) {
|
||||||
|
// Handle errors, e.g. user denied location sharing permissions
|
||||||
|
console.error("Error getting user location:", error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Geolocation is not supported by the browser
|
||||||
|
console.error("Geolocation is not supported by this browser.");
|
||||||
|
}
|
||||||
|
},[])
|
||||||
|
|
||||||
|
const mapOptions = useMemo(
|
||||||
|
() => ({
|
||||||
|
disableDefaultUI: false,
|
||||||
|
clickableIcons: true,
|
||||||
|
zoomControl: true,
|
||||||
|
controlSize: 23,
|
||||||
|
styles: mapStyles,
|
||||||
|
mapTypeControlOptions: {
|
||||||
|
mapTypeIds: ['roadmap', 'satellite'],
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const { isLoaded } = useLoadScript({
|
||||||
|
googleMapsApiKey: process.env.NEXT_PUBLIC_GOOGLE_MAPS_KEY,
|
||||||
|
libraries: libraries,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isLoaded) {
|
||||||
|
return <p>Loading...</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( mapCenter &&
|
||||||
|
<>
|
||||||
|
<Head>
|
||||||
|
<title>
|
||||||
|
Maps | Oktopus
|
||||||
|
</title>
|
||||||
|
</Head>
|
||||||
|
<GoogleMap
|
||||||
|
options={mapOptions}
|
||||||
|
zoom={14}
|
||||||
|
center={mapCenter}
|
||||||
|
mapContainerStyle={{ width: '100%', height: '100%' }}
|
||||||
|
onLoad={() => console.log('Map Component Loaded...')}
|
||||||
|
clickableIcons={false}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)};
|
||||||
|
|
||||||
|
Page.getLayout = (page) => (
|
||||||
|
<DashboardLayout>
|
||||||
|
{page}
|
||||||
|
</DashboardLayout>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default Page;
|
||||||
|
|
@ -8,7 +8,7 @@ const Page = () => (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>
|
<title>
|
||||||
Settings | Devias Kit
|
Settings | Oktopus
|
||||||
</title>
|
</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Box
|
<Box
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT + '/auth/delete/' + id, requestOptions)
|
return fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/auth/delete/${id}`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -82,7 +82,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT + '/users', requestOptions)
|
return fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/users`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -142,7 +142,7 @@ const Page = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await fetch(process.env.NEXT_PUBLIC_REST_ENDPOINT+"/auth/register", requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/auth/register`, requestOptions)
|
||||||
|
|
||||||
if (result.status == 200) {
|
if (result.status == 200) {
|
||||||
console.log("user created: deu boa raça !!")
|
console.log("user created: deu boa raça !!")
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export const ConnectedDevices = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/connecteddevices`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/connecteddevices`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ export const DevicesDiagnostic = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/ping`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/ping`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -95,7 +95,7 @@ export const DevicesDiagnostic = () => {
|
||||||
body: JSON.stringify(content)
|
body: JSON.stringify(content)
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/ping`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/ping`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ const handleOpen = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/cwmp/${router.query.id[0]}/${method}`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/cwmp/${router.query.id[0]}/${method}`, requestOptions)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export const DevicesWiFi = () => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/wifi`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/wifi`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -197,7 +197,7 @@ export const DevicesWiFi = () => {
|
||||||
body: data,
|
body: data,
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/wifi`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/wifi`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ export const SiteSurvey = (props) => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/sitesurvey`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/sitesurvey`, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ const addDeviceObj = async(obj, setShowLoading, router, updateDeviceParameters)
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
setShowLoading(true)
|
setShowLoading(true)
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/add`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/add`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -131,7 +131,7 @@ const deleteDeviceObj = async(obj, setShowLoading, router, updateDeviceParameter
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
setShowLoading(true)
|
setShowLoading(true)
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/del`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/del`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -481,7 +481,7 @@ const getDeviceParameters = async (raw) =>{
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/parameters`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/parameters`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -505,7 +505,7 @@ const getDeviceParameterInstances = async (raw) =>{
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/instances`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/instances`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
throw new Error('Please check your email and password');
|
throw new Error('Please check your email and password');
|
||||||
}else if (result.status === 401){
|
}else if (result.status === 401){
|
||||||
|
|
@ -779,7 +779,7 @@ const getDeviceParameterInstances = async (raw) =>{
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/get`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/get`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -1029,7 +1029,7 @@ const getDeviceParameterInstances = async (raw) =>{
|
||||||
|
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
setShowLoading(true)
|
setShowLoading(true)
|
||||||
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/set`, requestOptions))
|
let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/set`, requestOptions))
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -1172,7 +1172,7 @@ const getDeviceParameterInstances = async (raw) =>{
|
||||||
body: raw
|
body: raw
|
||||||
};
|
};
|
||||||
setShowLoading(true)
|
setShowLoading(true)
|
||||||
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/operate`, requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/operate`, requestOptions)
|
||||||
let content = await result.json()
|
let content = await result.json()
|
||||||
if (result.status != 200) {
|
if (result.status != 200) {
|
||||||
setShowLoading(false)
|
setShowLoading(false)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ const handleOpen = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/${router.query.id[0]}/any/${method}`, requestOptions)
|
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/any/${method}`, requestOptions)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ export const OverviewLatestOrders = (props) => {
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT}/device/alias?id=${sn}`, requestOptions)
|
let result = await fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/alias?id=${sn}`, requestOptions)
|
||||||
console.log("result:", result)
|
console.log("result:", result)
|
||||||
if (result.status === 401){
|
if (result.status === 401){
|
||||||
router.push("/auth/login")
|
router.push("/auth/login")
|
||||||
|
|
@ -199,13 +199,6 @@ export const OverviewLatestOrders = (props) => {
|
||||||
setDeviceAlias(order.Alias)
|
setDeviceAlias(order.Alias)
|
||||||
setShowSetDeviceAlias(true)
|
setShowSetDeviceAlias(true)
|
||||||
}}
|
}}
|
||||||
onKeyDown={e => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
setDeviceToBeChanged(index)
|
|
||||||
setDeviceAlias(order.Alias)
|
|
||||||
setShowSetDeviceAlias(true)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<SvgIcon
|
<SvgIcon
|
||||||
fontSize="small"
|
fontSize="small"
|
||||||
|
|
@ -239,10 +232,16 @@ export const OverviewLatestOrders = (props) => {
|
||||||
</Button>
|
</Button>
|
||||||
</CardActions>*/}
|
</CardActions>*/}
|
||||||
</Card>
|
</Card>
|
||||||
|
{showSetDeviceAlias&&
|
||||||
<Dialog open={showSetDeviceAlias}>
|
<Dialog open={showSetDeviceAlias}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<InputLabel>Device Alias</InputLabel>
|
<InputLabel>Device Alias</InputLabel>
|
||||||
<Input value={deviceAlias} onChange={(e)=>{setDeviceAlias(e.target.value)}}>
|
<Input value={deviceAlias} onChange={(e)=>{setDeviceAlias(e.target.value)}}
|
||||||
|
onKeyUp={e => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
setNewDeviceAlias(deviceAlias, orders[deviceToBeChanged].SN)
|
||||||
|
}
|
||||||
|
}}>
|
||||||
</Input>
|
</Input>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|
@ -255,7 +254,7 @@ export const OverviewLatestOrders = (props) => {
|
||||||
setNewDeviceAlias(deviceAlias, orders[deviceToBeChanged].SN)
|
setNewDeviceAlias(deviceAlias, orders[deviceToBeChanged].SN)
|
||||||
}}>Save</Button>
|
}}>Save</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
20
frontend/src/utils/mapStyles.json
Normal file
20
frontend/src/utils/mapStyles.json
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"featureType": "all",
|
||||||
|
"elementType": "labels.text",
|
||||||
|
"stylers": [
|
||||||
|
{
|
||||||
|
"visibility": "on"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"featureType": "poi",
|
||||||
|
"elementType": "labels.icon",
|
||||||
|
"stylers": [
|
||||||
|
{
|
||||||
|
"visibility": "off"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue
Block a user