Skip to content
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

Add a Public Endpoint to Display API State Using Jinja2 Templates #107

Open
6 tasks
0x1026 opened this issue Nov 21, 2024 · 0 comments
Open
6 tasks

Add a Public Endpoint to Display API State Using Jinja2 Templates #107

0x1026 opened this issue Nov 21, 2024 · 0 comments
Assignees
Labels
area/api Categorizes issue or PR as related to api. milestone/current Indicates an issue or PR that is being worked on at the current milestone. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@0x1026
Copy link
Member

0x1026 commented Nov 21, 2024

The microservice will include a public endpoint to display the current state of the sensors through a web page. This web page will use Jinja2 templates to render sensor data in an organized and user-friendly format. The microservice will serve this page directly, using FastAPI to handle the backend logic and template rendering.

Tasks

  • Design the Screen Layout
    • Plan the structure of the web page to display:
      • Sensor names or IDs.
      • Current sensor states (e.g., active/inactive, temperature, or other metrics).
      • Additional metadata or information, if required.
  • Add the Public Endpoint
    • Implement an endpoint in the microservice (e.g., /sensors) to serve the web page.
    • Ensure the endpoint is accessible and handles requests efficiently.
  • Fetch Data from the API
    • Use the microservice to retrieve and process sensor data for the template.
    • Handle errors gracefully if the API fails or returns incomplete data.
  • Implement Jinja2 Template
    • Create a responsive and visually appealing template to display sensor data.
    • Include elements like tables, charts, or status indicators to improve data visualization.
    • Add error messages or loading indicators for better user experience.
  • Integrate with Backend Logic
    • Query the sensor API, process the response, and pass the data to the Jinja2 template for rendering.
    • Optimize performance for real-time data updates, if applicable.
  • Test the Endpoint and Screen
    • Verify the endpoint serves the page correctly under various conditions:
      • Normal operation with all sensors online.
      • Scenarios where sensors are offline or returning errors.
      • Cases where the API itself is unavailable.
    • Test the screen’s responsiveness on different devices and browsers.

Considerations

  • Ensure the endpoint and page comply with best practices for security and performance.
  • Use responsive design principles to make the page accessible across devices.
  • Provide visual indicators for sensor states (e.g., green for active, red for inactive).
  • Document the endpoint and its purpose for future maintainability.
@0x1026 0x1026 added triage/accepted Indicates an issue or PR is ready to be actively worked on. milestone/current Indicates an issue or PR that is being worked on at the current milestone. labels Nov 21, 2024
@0x1026 0x1026 added this to the Sprint 3 - Prototype milestone Nov 21, 2024
@0x1026 0x1026 added the area/api Categorizes issue or PR as related to api. label Nov 26, 2024
@0x1026 0x1026 changed the title With jinja2 templates, create a screen to see the API state. Create a Screen to Display API State Using Jinja2 Templates Nov 26, 2024
@0x1026 0x1026 changed the title Create a Screen to Display API State Using Jinja2 Templates Add a Public Endpoint to Display API State Using Jinja2 Templates Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Categorizes issue or PR as related to api. milestone/current Indicates an issue or PR that is being worked on at the current milestone. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Pendent
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants