Skip to content

feat: upload queue#203

Closed
greatgitsby wants to merge 51 commits intocommaai:masterfrom
greatgitsby:feat/upload
Closed

feat: upload queue#203
greatgitsby wants to merge 51 commits intocommaai:masterfrom
greatgitsby:feat/upload

Conversation

@greatgitsby
Copy link
Copy Markdown
Contributor

@greatgitsby greatgitsby commented Mar 15, 2025

second part of commaai/connect#51

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 15, 2025

deployed preview: https://203.connect-d5y.pages.dev

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

Mobile

Desktop

@greatgitsby greatgitsby force-pushed the feat/upload branch 3 times, most recently from ee8087a to c538949 Compare March 16, 2025 06:08
@greatgitsby
Copy link
Copy Markdown
Contributor Author

how flexible are the LoC and bundle size numbers? i will do some refactoring but there will be limits.

@incognitojam
Copy link
Copy Markdown
Collaborator

The hard limit is 500 kb, 5000 lines

I see about 200 lines is in the API fetchers, another 100 for types - for now I think you can save a bunch of lines by wrapping the lines less. I'd like to move this out to a separate package later if it's all standard comma API stuff (there is already a comma API package but it doesn't have types)

@greatgitsby
Copy link
Copy Markdown
Contributor Author

thanks!

yea moving api calls and types out will help quite a lot. i'll do some refactors and it should be achievable

@incognitojam
Copy link
Copy Markdown
Collaborator

Need any help finishing this? You could also split the requesting uploads and upload queue into separate PRs

@greatgitsby
Copy link
Copy Markdown
Contributor Author

nope, i've been working on the clip bounty. i'm planning on separating the API contract and calls separately as that is well defined now

@greatgitsby greatgitsby changed the title feat(new-connect): implement file uploads feat: upload queue Mar 22, 2025
@greatgitsby greatgitsby force-pushed the feat/upload branch 4 times, most recently from 091b189 to a3d05b4 Compare March 23, 2025 22:17
@greatgitsby greatgitsby marked this pull request as ready for review March 24, 2025 00:16
@incognitojam
Copy link
Copy Markdown
Collaborator

incognitojam commented Mar 24, 2025

Can you split this up at all? It's pretty difficult to review (e.g. small fixes can be their own PRs, StatisticsBar refactor..)

@greatgitsby
Copy link
Copy Markdown
Contributor Author

let me see what i can do. some refactors were for DRY (like the stats bar, that code was already somewhere else)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2025

This branch is behind commaai/master. The line count diff bot is disabled.

@greatgitsby
Copy link
Copy Markdown
Contributor Author

removed the stats bar component and changes to the progress bar

@incognitojam
Copy link
Copy Markdown
Collaborator

let me see what i can do. some refactors were for DRY (like the stats bar, that code was already somewhere else)

removed the stats bar component and changes to the progress bar

I just meant you could open PRs to fix/cleanup things first, which would be small and easy to merge, if they help make the diff for this PR smaller

@incognitojam incognitojam added the enhancement new feature or request label Mar 24, 2025
@greatgitsby
Copy link
Copy Markdown
Contributor Author

created these which are self-contained:

commaai/connect#235
commaai/connect#236
commaai/connect#237

i'll do some component refactors later today

@greatgitsby greatgitsby marked this pull request as ready for review March 26, 2025 00:51
Comment on lines +20 to +34
{
label: 'Uploading',
value: () =>
queue()
?.items()
.filter((i) => i.status === 'uploading').length,
},
{
label: 'Waiting',
value: () =>
queue()
?.items()
.filter((i) => i.status === 'queued').length,
},
{ label: 'Total', value: () => queue()?.items().length },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this formatting can be more compact but Biome was doing this.

Comment on lines +151 to +162
const sortedItems = createMemo(() => {
const allItems = [...items.offline, ...(offline() ? [] : items.online)]
return allItems.sort((a, b) => {
const statusDiff = getStatusPriority(a.status) - getStatusPriority(b.status)
if (statusDiff !== 0) return statusDiff
const routeDiff = a.route.localeCompare(b.route)
if (routeDiff !== 0) return routeDiff
const segmentDiff = a.segment - b.segment
if (segmentDiff !== 0) return segmentDiff
return a.filename.localeCompare(b.filename)
})
})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i think i will setup a stable sort for the uploader queue on Athena. we might be able to let the device dictate the order (more than just priority) so that the animation is consistent

for now we can at least stable sort it visually

Copy link
Copy Markdown
Collaborator

@incognitojam incognitojam left a comment

Choose a reason for hiding this comment

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

The upload queue looks good and is polished with animations and everything, but I don't think I can review this all at once still. It's just not possible for me to look at how this all works and give good feedback or ask questions...

What does a minimum upload queue look like? Could you make a version of this under 200 lines? Then you can open as many PRs as you like afterwards to add things (if you think these can be split out, just some ideas):

  • animations
  • clearing the queue
  • showing the offline queue

By the way, this is 9% of the lines in the app!

@@ -0,0 +1,52 @@
import { Component, createMemo } from 'solid-js'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would just put all of the components in the same file if they aren't going to be used elsewhere in the app

url: string
}

export interface UploadItem {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this live in an UploadQueue.tsx too?

import QueueItem from './QueueItem'
import clsx from 'clsx'

const animations = (slide: boolean) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Animations look like something which could just be added in a separate PR later, where there is time to test them properly

@greatgitsby
Copy link
Copy Markdown
Contributor Author

hey, thanks for the review. sure, i can pair this down to start..

@greatgitsby
Copy link
Copy Markdown
Contributor Author

breaking these features into separate PRs won't change the lines of code it will introduce into the app. let's forgo them until there is a need, i guess.

@greatgitsby
Copy link
Copy Markdown
Contributor Author

closing in favor of commaai/connect#251, a simplified version of this PR

@greatgitsby greatgitsby deleted the feat/upload branch March 29, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants