-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
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.
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.
1404d68
to
ef7f835
Compare
f049f2a
to
3937286
Compare
database/pocketbase.exe
Outdated
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.
dont commit this
|
||
console.log(ADMIN_EMAIL); | ||
|
||
const pb = new PocketBase('http://127.0.0.1:8090'); |
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 needs to change back to the PI IP
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.
Okay, will do!
<!-- <div style="display: flex; flex-direction: column; align-items: center;"> | ||
<LineChart collection="Rcupressure" /> | ||
<LineChart collection="RcuTemperature" /> | ||
<LineChart collection="Imu" /> | ||
</div> --> | ||
<!-- | ||
<MapChart /> --> |
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.
should this be commented out?
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.
yeah, need to tweak that page cause I need to use divs for css, so that everything looks in its proper place
|
||
|
||
// Function to authenticate the admin user | ||
export async function authenticate() { |
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.
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.
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 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( |
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 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 |
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 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> |
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.
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.
This current version,
Linechart and Mapchart can plot from existing data and subscribe for new changes, Rocketchart still needs tweaking