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

This is the base version of the charts, it is incomplete and still requires fine tuning #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alymasani
Copy link

This current version,
Linechart and Mapchart can plot from existing data and subscribe for new changes, Rocketchart still needs tweaking

Copy link
Collaborator

@EtSubas EtSubas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also Connel has a big refactor change that is changing most of the packetbase subscribes (making it easier to use), so could you rebase your branch on his pr.

there will hopefully be not too many merge conflicts on your new file changes just maybe a couple where you modified older files.

RocketControlUnitGUI/src/data.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont commit this


console.log(ADMIN_EMAIL);

const pb = new PocketBase('http://127.0.0.1:8090');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to change back to the PI IP

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will do!

Comment on lines 9 to 15
<!-- <div style="display: flex; flex-direction: column; align-items: center;">
<LineChart collection="Rcupressure" />
<LineChart collection="RcuTemperature" />
<LineChart collection="Imu" />
</div> -->
<!--
<MapChart /> -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be commented out?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, need to tweak that page cause I need to use divs for css, so that everything looks in its proper place

RocketControlUnitGUI/static/Pegasus_XL.glb Outdated Show resolved Hide resolved


// Function to authenticate the admin user
export async function authenticate() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authentication as well as subscribing is handled in usePocketbase hook (which may need some additions) in master so refactor to use that. Also, when using the hook we should make sure to pass around a global instance so that we are not opening duplicate pb connections like in this file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to refactor my code to incorporate the usePocketbase hook now will I will be implementing soon!

export type AllData = { [collectionName: string]: RecordData[] };

// Fetch paginated data with existing logic
export async function fetchPaginatedData(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be extracted into its own hook that depends on Return<typeof usePocketbase>. Perhaps make a chart hook that encapsulates chart related logic to avoid global state for the chart system (this is not a big deal though, it would just be cleaner).

let hasMoreData = true;

try {
await authenticate(); // Authenticate once before fetching data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we only need to authenticate once, not every time we want to read/write to/from pocketbase.

</style>

<!-- Map container -->
<div id="map"></div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using Ids in components, instead use a class. Svelte automatically applies a data tag to components so we can have scoped styles even with same class name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants