-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feat: tree list query limit by time #412
Conversation
dashboard/src/pages/treeConstants.ts
Outdated
@@ -0,0 +1,2 @@ | |||
export const DEBOUNCE_INTERVAL = 666; |
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 don't think there is any specific reason for this to be a global costat, maybe it could be the default debounce interval for the text input if the user didn't specify any
dashboard/src/hooks/use-toast.ts
Outdated
const [state, setState] = React.useState<State>(memoryState); | ||
|
||
React.useEffect(() => { | ||
listeners.push(setState); |
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.
wow this is so hacky, I know it is from shadcn, lets keep this as is since it is working
}): JSX.Element => { | ||
const className = useMemo( | ||
() => | ||
`border-${fieldError ? 'red' : 'gray'} mx-[10px] flex w-[100px] flex-1 rounded border`, |
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.
border-${fieldError ? 'red' : 'gray'}
will bug the tailwind compiler, remember that it interprets the test value not the javascript
https://tailwindcss.com/docs/content-configuration#dynamic-class-names
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.
use the cn
utils for it
1fd2256
to
fbc7ebe
Compare
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.
Looks good to me
debouncedSideEffect, | ||
startingValue = '', | ||
onChange, |
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 think this is a leftover, you are not using in the TreeListingPage and it feels weird since we have the debouncedSideEffect
function validateString(val: string): boolean { | ||
const convertedNumber = parseInt(val); | ||
return !Number.isNaN(convertedNumber) && convertedNumber > 0; | ||
} | ||
|
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.
since this is a pure function you can leave outside of the component so we don't have to worry about memoization or keeping an stable reference
dashboard/src/components/ui/form.tsx
Outdated
@@ -0,0 +1,176 @@ | |||
import * as React from "react" |
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 think you never used this file, you can delete it
@@ -0,0 +1,24 @@ | |||
import * as React from "react" |
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.
since you are not using form, you can delete the label component also
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.
it is working really nice, just some few pointers to go
time = int(request.GET.get('time', '7')) | ||
timedata = {"days": time} |
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 think we should receive it in a more standard way such as a unix timestamp or a ISO 8601
@@ -1,3 +1,6 @@ | |||
# If you want to see headers, add -p H to the http call: | |||
# http -p H 'http://localhost:8000/api/tree/' origin==maestro | |||
http 'http://localhost:8000/api/tree-fast/' origin==maestro | |||
|
|||
# If you want to provide another limit to query: | |||
# http 'http://localhost:8000/api/tree-fast/' origin==maestro value==8 |
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.
is this value
right? shouldn't it be time
?
fbc7ebe
to
ac14c78
Compare
ac14c78
to
5327c13
Compare
Add an input to allow the user to provide a time parameter in the tree listing page.
How to test:
#88