#338-Add-button-to-change-sensor #423

Merged
c24elipe merged 5 commits from #338-Add-button-to-change-sensor into team_2_week_2 2026-04-21 08:29:16 +00:00
Collaborator

Changes

  • Added two buttons to navigate sensors

    • styling from premade buttons will be added later.
    • Changes in TemperatureView.js
  • Population of sensors array

    • useFetchMockupSensors.js file created
    • /service/tempService/Program.cs added app.MapGet("/temperature/sensors", async () => part to get unique sensors
    • Changes in TemperatureView.js
    • its now possible to chage/add sensors in tempSensormockup and get them on the view(If changed you need to remove and add the card a new)

    Known issues

  • The styling of buttons/text

  • When view is created in inspect -> network you can see that the first get request fail as it sends a null value, it only happens 1 time at creation and is not vissible to users but might need a fix in future

  • The view uppdate when changed but dynamic update of view is a seperate issue

### Changes - Added two buttons to navigate sensors - styling from premade buttons will be added later. - Changes in TemperatureView.js - Population of sensors array - useFetchMockupSensors.js file created - /service/tempService/Program.cs added `app.MapGet("/temperature/sensors", async () =>` part to get unique sensors - Changes in TemperatureView.js - its now possible to chage/add sensors in tempSensormockup and get them on the view(If changed you need to remove and add the card a new) ### Known issues - The styling of buttons/text - When view is created in inspect -> network you can see that the first get request fail as it sends a null value, it only happens 1 time at creation and is not vissible to users but might need a fix in future - The view uppdate when changed but dynamic update of view is a seperate issue
The <TemperatureView> is no longer called with a parameter, insted it gets set to one initially and a button is added to navigate between the sensors.
What left:
-to add a button to previus sensor along with the next senssor that exist.
-Buttons need to be styled according to standards.
-Make population of sensor array[] dynamic its hardcoded now
added button to see previous sensor.
Whats left:
-dynamic population of array[].
-fix button style/styles is general to match standards
The TemperatureView now adds the diffrent sensors in the db when the view is created, if new sensors gets added you have to close the view and open a new one (i beleve this is ok)
Left to do:
change styling in general and on buttons to conform with standards
Collaborator

Review on #338

Whats done

Tested on Windows using Firefox

  • App starts
    • Buttons to switch between sensors work as intended, tested cycling through all 4 sensors (temp-sensor-001 to temp-sensor-004) in both directions
    • Temperature and timestamp update correctly when switching sensor
    • No other cards are affected by the changes

Inspected following files

  • frontend/src/features/temperature/TemperatureView.js
    • Indentation/code styling
      • Follows Prettier
    • Naming convention
      • Follows conventions, PascalCase for component, camelCase for variables
    • Comments
      • Comments good
    • General code quality
      • No issues found
  • frontend/src/features/temperature/useFetchMockupSensors.js
    • Indentation/code styling
      • Follows Prettier
    • Naming convention
      • Follows conventions, follows the useServiceName pattern from the wiki
    • Comments
      • No comments, but the file is simple enough that none are needed
    • General code quality
      • Clean
  • frontend/src/components/Card/Card.js
    • Only Prettier reformatting, no code changes
  • frontend/src/components/Dashboard/Dashboard.js
    • Removed hardcoded sensorId prop, correct change since sensors are now dynamic
  • service/tempService/Program.cs
    • New endpoint /temperature/sensors returns distinct sensor IDs from the database
    • Follows existing code style
  • frontend/package.json
    • No new dependencies added

Conclusion

  • Changing sensors works as intended. Buttons cycle through sensors correctly and temperature data updates. Code follows project standards.
# Review on #338 ## Whats done ### Tested on Windows using Firefox + App starts + Buttons to switch between sensors work as intended, tested cycling through all 4 sensors (temp-sensor-001 to temp-sensor-004) in both directions + Temperature and timestamp update correctly when switching sensor + No other cards are affected by the changes ### Inspected following files + frontend/src/features/temperature/TemperatureView.js + Indentation/code styling + Follows Prettier + Naming convention + Follows conventions, PascalCase for component, camelCase for variables + Comments + Comments good + General code quality + No issues found + frontend/src/features/temperature/useFetchMockupSensors.js + Indentation/code styling + Follows Prettier + Naming convention + Follows conventions, follows the useServiceName pattern from the wiki + Comments + No comments, but the file is simple enough that none are needed + General code quality + Clean + frontend/src/components/Card/Card.js + Only Prettier reformatting, no code changes + frontend/src/components/Dashboard/Dashboard.js + Removed hardcoded sensorId prop, correct change since sensors are now dynamic + service/tempService/Program.cs + New endpoint /temperature/sensors returns distinct sensor IDs from the database + Follows existing code style + frontend/package.json + No new dependencies added ## Conclusion + Changing sensors works as intended. Buttons cycle through sensors correctly and temperature data updates. Code follows project standards.
c24carso approved these changes 2026-04-20 08:49:16 +00:00
c24elipe approved these changes 2026-04-20 14:16:08 +00:00
c24elipe left a comment
Collaborator

Looked over the code.
It compiles, and at a glance, seems to work.

Looked over the code. It compiles, and at a glance, seems to work.
c24elipe merged commit 3ea275223a into team_2_week_2 2026-04-21 08:29:16 +00:00
c24elipe deleted branch #338-Add-button-to-change-sensor 2026-04-21 08:29:18 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!423
No description provided.