-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: push production ready version to main (#52)
fix: change dockerfile to work with next js refactor: added new Ip adresse, rounded data, moved getColor file and changed build output dir (#45) refactor: added new Ip adresse refactor: removed output and added distdir to out refactor: reformated file refactor: rounded data to two decimals refactor: changed test Ip to add new one refactor: removed function param to use react-router params refactor: moved file to lib folder refactor: Rounded data (#42) refactor: moved file position fix: fixed import errors refactor: rounded data to two decimal refactor: reformated files refactor: translated comment in english --------- Co-authored-by: jordyBSK <125542402+jordyBSK@users.noreply.github.com> fix: tofixed temperature in espmap feat: added Workflow to check the format and lint (#46) refactor: added new Ip adresse refactor: removed output and added distdir to out refactor: reformated file feat: created workflow file to check if the code is correctly formated refactor: resolve conflit feat: serve interface using a nodejs server (#48) fix: allow program to compile by fixing syntaxe error feat: build the interface on docker start feat: start nodejs server feat: serve node server through ngnix fix: logout redirection (#49) refactor: reformat code fix: redirects the user to the login from any page if there is no token refactor: changed workflow execution type (#47) refactor: added new Ip adresse refactor: removed output and added distdir to out refactor: reformated file feat: created workflow file to check if the code is correctly formated refactor: moved .github directory to root fix: added change directory to interface fix: changed on which branch in execute name refactor: added execution of workflow for new change in commit (test purpose) fix: remove useless ip adress fix: remove github action from next interface folder --------- Co-authored-by: jordyBSK <125542402+jordyBSK@users.noreply.github.com> style: properly format code fix: fix bugs to prepare for release (#50) --------- Co-authored-by: Alex-zReeZ <145986307+Alex-zReeZ@users.noreply.github.com> Co-authored-by: Nils Hofstetter <119439839+Rignchen@users.noreply.github.com>
- Loading branch information
1 parent
8ec2912
commit 366d14c
Showing
20 changed files
with
197 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Check formatting of project files with Prettier | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, edited, synchronize ] | ||
branches: | ||
- Dev | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
- name: Go to interface | ||
run: cd nextjs-interface | ||
- name: Install dependencies | ||
run: npm install -D | ||
- name: Check code style with Prettier | ||
run: npm run format | ||
|
||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
- name: Go to interface | ||
run: cd nextjs-interface | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Lint code with Eslint | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:20.12.2-alpine3.19 as base | ||
|
||
# node 20, build the application | ||
FROM base | ||
WORKDIR /app | ||
COPY ../nextjs-interface . | ||
COPY ../.env . | ||
RUN npm install | ||
RUN node_modules/.bin/next build | ||
|
||
# serve the application | ||
FROM base | ||
WORKDIR /var/www/memoires-info/html | ||
COPY --from=1 /app/out ./out | ||
COPY --from=1 /app/node_modules/ ./node_modules/ | ||
COPY --from=1 /app/next.config.mjs . | ||
CMD ["node_modules/.bin/next", "start"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
distDir: "out", | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,24 @@ | ||
"use client"; | ||
|
||
// import hooks | ||
import { useState, useEffect } from "react"; | ||
|
||
// import components | ||
import DataCircle from "@/app/ui/dashboard/DataCircle"; | ||
|
||
// import functions | ||
import { useRouter } from "next/navigation"; | ||
|
||
|
||
const ESPList = [ | ||
{ name: "ESP N°1", ip:"172.16.5.178" }, | ||
{ name: "ESP N°2" ,ip:"172.16.4.100"}, | ||
{ name: "ESP N°3" ,ip:"172.16.5.178"}, | ||
{ name: "ESP N°4", ip:"172.16.4.100" }, | ||
{ name: "ESP N°5", ip:"172.16.5.178" }, | ||
{ name: "ESP N°6", ip:"172.16.4.100"}, | ||
{ name: "ESP N°1", ip: "172.16.5.178" }, | ||
{ name: "ESP N°2", ip: "172.16.4.100" }, | ||
{ name: "ESP N°3", ip: "172.16.5.178" }, | ||
{ name: "ESP N°4", ip: "172.16.4.100" }, | ||
{ name: "ESP N°5", ip: "172.16.5.178" }, | ||
{ name: "ESP N°6", ip: "172.16.4.100" }, | ||
]; | ||
|
||
export default function Page() { | ||
const [token, setToken] = useState<string | null>(null); | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
const storedToken = window.localStorage.getItem("token"); | ||
if (!storedToken) { | ||
router.push("/login"); | ||
} else { | ||
setToken(storedToken); | ||
router.push("/dashboard"); | ||
} | ||
}, [router]); | ||
|
||
return ( | ||
<> | ||
<div className="px-auto grid h-fit w-full min-w-[500px] grid-cols-1 gap-10 xl:grid-cols-2 2xl:grid-cols-3"> | ||
{ESPList.map((esp, index) => ( | ||
<DataCircle key={index} esp={esp} /> | ||
|
||
))} | ||
</div> | ||
</> | ||
<> | ||
<div className="px-auto grid h-fit w-full min-w-[500px] grid-cols-1 gap-10 xl:grid-cols-2 2xl:grid-cols-3"> | ||
{ESPList.map((esp, index) => ( | ||
<DataCircle key={index} esp={esp} /> | ||
))} | ||
</div> | ||
</> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import {useLastData} from "@/lib/data"; | ||
import {PieChartTemperature} from "@/app/ui/dashboard/PieChartTemperature"; | ||
import {PieChartHumidity} from "@/app/ui/dashboard/PieChartHumidity"; | ||
import { useLastData } from "@/lib/data"; | ||
import { PieChartTemperature } from "@/app/ui/dashboard/PieChartTemperature"; | ||
import { PieChartHumidity } from "@/app/ui/dashboard/PieChartHumidity"; | ||
|
||
export default function DataCircle({ esp }: { esp: any }) { | ||
const ip = esp.ip; | ||
const temperature = useLastData("temperature", ip); | ||
const humidity = useLastData("humidity", ip); | ||
const ip = esp.ip; | ||
const temperature = useLastData("temperature", ip); | ||
const humidity = useLastData("humidity", ip); | ||
|
||
return ( | ||
<div className="flex h-full flex-col items-center rounded-2xl border-2 text-center"> | ||
<h2 className="w-full border-b-2 pb-5 pt-5 text-center text-gray-800"> | ||
{esp.name} | ||
</h2> | ||
<div className="sm:py-auto flex h-full w-full flex-row py-14"> | ||
<PieChartTemperature data={temperature} /> | ||
<PieChartHumidity data={humidity} /> | ||
</div> | ||
</div> | ||
); | ||
return ( | ||
<div className="flex h-full flex-col items-center rounded-2xl border-2 text-center"> | ||
<h2 className="w-full border-b-2 pb-5 pt-5 text-center text-gray-800"> | ||
{esp.name} | ||
</h2> | ||
<div className="sm:py-auto flex h-full w-full flex-row py-14"> | ||
<PieChartTemperature data={temperature} /> | ||
<PieChartHumidity data={humidity} /> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.