-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global code review #9
base: reviewed
Are you sure you want to change the base?
Conversation
* feat: bring interface from another repo * feat: bring code for the ESP32 * feat: add graph in the readme * feat: recreate database * feat: bring user login from another repo
* feat: display averages for the last two months, refactor the way data is retrieved and placed in the pie chart * feat: token added to link for API data, change to display of month element * feat: link login element with login backend * feat: link login element with login backend * feat: the token in sampleContext takes the value from the user who logged in * feat: store the token in localstorage * fix: fix small errors to launch npm run build * feat: added login functionality, created a function to get tokens from localstorage * style: change input form design * feat: redirect the user on login if the token is wrong * feat: create a function that checks for 401 errors * refactor: the method of collecting data and putting it into the monthly chart * feat: add log out button
* feat: group docker compose together * feat: move docker compose to root * fix: rename secret example file the name it had before made esphome think it was an esp32 config file * refactor: rename login_login to login login_login is a pleonasme, it's useless to say login twice * feat: Launch php login backend with the docker * refactor: move sql file to root it's the only required file for the database, therefore it doesn't need to be in another directory * refactor: rewrite Readme.md * feat: launch react build with the web server * feat: isolate the sub domain from the domain before if you were making a request to anything.domain.com, the domain would be domain.com. Now the domain will be anything.domain.com it means that now everything starting with login.memoires-info.com will be run as php code instead of being ignored the reason it worked before was because the uri contained "login." * feat: access everythign from the same web server * feat: update readme * feat: change web server port to be the default one User now don't need to specify the port when accessing the web server * refactor: move sql script to it's own directory now postgres data won't apear in root * refactor: rename assets folder to be hidden * refactor: move postgrest config in another file * feat: add a way to get postgrest error in php login * fix: update api test file * refactor: shorten gitignore file * feat: automatically create the db * feat: implement login (#5) * feat: display averages for the last two months, refactor the way data is retrieved and placed in the pie chart * feat: token added to link for API data, change to display of month element * feat: link login element with login backend * feat: link login element with login backend * feat: the token in sampleContext takes the value from the user who logged in * feat: store the token in localstorage * fix: fix small errors to launch npm run build * feat: added login functionality, created a function to get tokens from localstorage * style: change input form design * feat: redirect the user on login if the token is wrong * feat: create a function that checks for 401 errors * refactor: the method of collecting data and putting it into the monthly chart * feat: add log out button * fix: add link to esphome github page --------- Co-authored-by: jordyBSK <[email protected]>
fix: fix 404 when trying to access router path fix: rename ngnix conf file fix: add font back in esp32 config fix: post request of type json now get decoded feat: get esp jwt token from the php fix: "sequence user_id_seq not exist" when creating database fix: give nginx it's real name back I'll probably write it wrong next time I have to write it ^^" fix: add lockfile to ensure plugin's hash match feat: make production docker compose fix: take pg password from .env fix: put interface in the right directory and remove adminer fix: rename add-esp.php to esp.php cause ngnix fail with the - refactor: change docker images to take images from last feature version at this date fix: copy .env in the php container fix: handle web socker for esphome esphome needs web sockets to work, without them it just freezes right before the compilation dev: script to reset the state of the mounted volumes\n\n this script is ignored by the gitignore feat: specify default user in readme refactor: change the url to use Subdirectory instead of subdomain fix: repare sed at build of prod fix: postgrest subdirectory now redirect to postg-rest container fix: restore php and postgrest url call fix: 404 when sending data from esp to database refactor: group all .env file in a single one fix: update readme fix: update readme fix: make readme easier to understand fix: remove hard coded env variable from Dockerfile.Postgres
* feat: add new plan card * feat: differentiate the different ip's in the database * feat: add a new room in database * feat: dislay name of room in api * feat: sorted all data by ip * feat: put the data in cardPlanElement * feat:change button for selected month, change function add room, change plan style * feat: add floor plan elements with sensors * feat: add a circle to the svg with the esp coordinates in the database
const submit = async (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
await fetch(`${SampleContext.urlLogin}/login.php?username=${username}&password=${password}`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either use:
try {
response = await fetch(...);
} catch(...) {...}
or .then .catch without await
if (reponse.token) { | ||
localStorage.setItem('token', reponse.token); | ||
localStorage.setItem('username', username); | ||
window.location.replace("http://localhost:5173/dashboard"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't hardcode protocol, host and port. localhost:5173 is probably wrong.
A relative path would be better.
…function (#21) * !feat: get ip in the sql average function ouput * feat: get count of entries in average function output now that data are separated from the other, some may accidentaly be more important than other ones when trying to get the global average, with the count as an information it is possible to weight the outputs to ensure none of them are more important
feat: initialize sqitch feat: create schema and roles for the postgrest api feat: create roles to distinguish users esp & login feat: Add table to store data feat: add a table to store user and passwords fix: test migrations refactor: remove old useless stuff feat: launch migration on docker start fix: ensure container wait enougth before starting
refactor: change docker image versions style: use latex instead of html to display color\n\nhtml isn't properly render on github while latex is\nthis line is here to show the user what the line with the ip address looks like on the esphone, the color matches the ones on esphome fix: ask to change the ip in secret.yaml refactor: use post request to send data to backend with curl dev: make gitignore more precise
refactor: rename login/ -> php/\n\ncalling the folder php is more representative of what there is inside refactor: move files from public folder to private refactor: move Dockerfile in their own folder
feat: install php stan to lint code fix: class NoReturn not exist fix: no value in iterrable array dev: set paths in phpstan config file Before you had to set it by hand every time you wanted to lint the code
* revert: remove interface * feat: change interface with nextjs
* feat: get lastdata from database * fix: function if in data.ts
README.md
Outdated
```bash | ||
cp .env.example .env | ||
cp esp32/config/secrets.yaml.example esp32/config/secrets.yaml | ||
cp Interface/src/contexts/SampleContext.example.tsx Interface/src/contexts/SampleContext.tsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the file SampleContext.example.tsx does not exist.
Can you update this?
docker-compose.yml
Outdated
migration: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.Sqitch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file has been moved to Dockerfile/ folder
Do we really need 2 docker-compose files?
maybe we can reduce duplication with https://docs.docker.com/compose/multiple-compose-files/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right I forgot to change the path there but the docker-compose.yml is supposed to be the one for development is a bit outdated, the production one is docker-compose.prod.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked at the link you provide and for debugging it is better for us to have the docker-compose.yml while for production we want to have the smallest and fastest program so we use the docker-compose.prod.yml wich automatically install dependencies and build the project in a way that only the build files will be keep inside the docker image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with differenciating prod/dev environments.
The problem is that we have redundant code in both docker-compose yml files. And then, the risk of forgetting to update one is big. So we could "include" things that are common to both files.
docker-compose.yml
Outdated
ports: | ||
- "80:80" | ||
volumes: | ||
- ./Interface/dist:/var/www/memoires-info/html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Interface folder does not exist.
nextjs-interface/README.md
Outdated
First, run the development server: | ||
|
||
```bash | ||
npm run dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I run "npm run dev", I get
> [email protected] dev
> next dev
sh: 1: next: not found
npm install
is required first
Dockerfile/Dockerfile.Nginx
Outdated
@@ -0,0 +1,19 @@ | |||
# node 20, build the application | |||
FROM node:20.12.2-alpine3.19 | |||
COPY ../Interface . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have the Interface folder. Where does it come from?
is it nextjs-interface ?
Dockerfile/Dockerfile.Nginx
Outdated
# nginx 1.26 on port 80, keep the build output, nginx config | ||
FROM nginx:1.26-alpine-otel | ||
EXPOSE 80 | ||
COPY --from=0 ../dist /var/www/memoires-info/html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
../dist does not exist...
is it nextjs-interface/.next ?
* feat: create table esp * feat: revert table esp * feat: verify table esp
* feat: avgData interface * feat: change type of data in data.ts * feat: change ip adress in EspLinksElement.tsx * feat: implement data in room chart * feat: change date format in chart * feat: add ip parameter in api ur * feat: implement sort data in page with esp ip
* feat: add ip parameter in useLastData * refactor: refactor code with prettier * refactor: change esp ip in Plan.tsx * feat: add espMap.tsx components * feat: display last data on map point in plan * refactor: create AddPointElement.tsx to create new point in map * refactor: refactor code with prettier
* feat: added dynamic data in dashboard and esp pages * fix: fixed function in map
* feat: retrieves and displays date in datepicker * refactor: refactor and remove unused import * feart: set the default date to the current month * feat: add date parameter in useFetchData function * feat: implement date range * refactor: refactor code
…p dynamically (#97) * chore: removed console.log * refactor: removed window.location.reload and added dynamically new esp in sidebar * refactor: remade logic to only use one map * refactor: fix warning exception caught locally * style: reformated file
* refactor: added verification of ip in js * style: reformated file * refactor: simplified regex (shorter) * style: reformated file * refactor: compacted regex
Co-authored-by: Alex-zReeZ <[email protected]>
* refactor: removed console log * refactor: added hour in graph xAxis
* fix: set timezon UTC+02:00 and removed seconde on timestamp * style: reformated file * fix: fix date possibly having no value * chore: showing returned error in auth thest * chore: added debugging * test: do only the curl to see if it works * refactor: merge docker and test in one run * refactor: added a waiting time for the server to be ready * refactor: changed method of waiting service to POST * refactor: moved sleep just before the curl * refactor: readded token content again
* feat: added zooming interface in plan closes: #115 * style: reformated code * style: reformated code
* feat: show the day when clicking on it closes: #116 * style: format
* feat: correct espId link when clicking on the day, for each esp * style: reformat
* feat: show variance between days with two esp * feat: show variance between days with two esp * style: reformat code * refactor: reformat code * refactor: reformat code * style: responsive esp page, dashboard * refactor: reformat code * style: remove comment
refactor(database): changed sqitch dockerfile to only docker compose No more need of the dedicated docker file. Migrations mounted in the container directly from docker compose. Closes: #127
…#135) Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.7 to 4.0.8. - [Release notes](https://github.com/micromatch/micromatch/releases) - [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md) - [Commits](micromatch/micromatch@4.0.7...4.0.8) --- updated-dependencies: - dependency-name: micromatch dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.3.3 to 18.3.4. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@radix-ui/react-popover](https://github.com/radix-ui/primitives) from 1.0.7 to 1.1.1. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-popover" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@radix-ui/react-label](https://github.com/radix-ui/primitives) from 2.0.2 to 2.1.0. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-label" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@radix-ui/react-slot](https://github.com/radix-ui/primitives) from 1.0.2 to 1.1.0. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-slot" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.5.4 to 5.6.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](microsoft/TypeScript@v5.5.4...v5.6.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@radix-ui/react-select](https://github.com/radix-ui/primitives) from 2.0.0 to 2.1.2. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-select" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) Bumps [next](https://github.com/vercel/next.js) from 14.2.3 to 14.2.10. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](vercel/next.js@v14.2.3...v14.2.10) --- updated-dependencies: - dependency-name: next dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@hookform/resolvers](https://github.com/react-hook-form/resolvers) from 3.6.0 to 3.9.0. - [Release notes](https://github.com/react-hook-form/resolvers/releases) - [Commits](react-hook-form/resolvers@v3.6.0...v3.9.0) --- updated-dependencies: - dependency-name: "@hookform/resolvers" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bastien Nicoud <[email protected]>
Bumps [@radix-ui/react-tooltip](https://github.com/radix-ui/primitives) from 1.0.7 to 1.1.3. - [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md) - [Commits](https://github.com/radix-ui/primitives/commits) --- updated-dependencies: - dependency-name: "@radix-ui/react-tooltip" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I am using this pull request to write down my review started on 4.6.2024.