-
Notifications
You must be signed in to change notification settings - Fork 610
feat: ratelimit overview v2 #2896
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
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
9e83c8d
feat: add initial overview
ogzhanolguncu e1fa1d8
fix: run formatter
ogzhanolguncu 5c01407
refactor: Add card back
ogzhanolguncu 8323bec
feat: add first draft of barchart
ogzhanolguncu 3ffdd3b
feat: add latency line chart
ogzhanolguncu c14754a
refactor: update timestamp colors
ogzhanolguncu e4372a8
feat: add initial draft of filters for overvioew
ogzhanolguncu 8b6ce2f
feat: add overview filters
ogzhanolguncu 2a33711
fix: round to nearest for latencies
ogzhanolguncu 81f482c
feat: add data fetching for overviews
ogzhanolguncu 0b152ba
fix: add chart states
ogzhanolguncu 4eb831f
fix: add mvs for timeseries latency
ogzhanolguncu a5b07e7
fix: chart colors
ogzhanolguncu 2eea8c7
refactor: organize files
ogzhanolguncu 8d5aaa0
feat: add new optinos to action menu
ogzhanolguncu fcab8df
feat: add override modal
ogzhanolguncu 5209c9e
feat: add new override fields
ogzhanolguncu d2c12ef
feat: extend logs data
ogzhanolguncu 2f6decd
fix: styles
ogzhanolguncu f479630
fix: small ui issues
ogzhanolguncu 580b859
feat: add status to filters for log
ogzhanolguncu c025068
fix: bugs
ogzhanolguncu 2e3e67f
feat: add new sebmenu
ogzhanolguncu b96cec1
feat: add delete and update for quick navbar
ogzhanolguncu 52a57fc
feat: add new quickbar to every ratelimit page
ogzhanolguncu 10efc04
feat: add charts for ratelimit list
ogzhanolguncu f0ae734
feat: add missing search to ratelimit
ogzhanolguncu 499d978
fix: ui issues
ogzhanolguncu 54ba243
fix: ordering issues
ogzhanolguncu b2f7427
feat: add more granular timeseries for logs
ogzhanolguncu 68c0d14
feat: add more granular options for charts
ogzhanolguncu c77360a
feat: add new search for identifiers and paths
ogzhanolguncu bc2ccaa
chore: cleanup
ogzhanolguncu 954324f
fix: typo
ogzhanolguncu 0d074c6
feat: add sorting
ogzhanolguncu 1a78349
chore: remove mvs
ogzhanolguncu 4272fb7
chore: formatter
ogzhanolguncu 65f07de
feat: replace icons and remove latency
ogzhanolguncu 8c408d6
fix: icon
ogzhanolguncu ff96dcb
Merge branch 'main' of github.com:unkeyed/unkey into ratelimit-overvi…
ogzhanolguncu 95c6c15
fix: conflict issue
ogzhanolguncu c38d27b
fix: coderabit issues
ogzhanolguncu 6e1bddc
fix: review comments
ogzhanolguncu 99ecae9
Merge branch 'main' of github.com:unkeyed/unkey into ratelimit-overvi…
ogzhanolguncu b893b39
chore: remove unused icon
ogzhanolguncu f20639c
fix: load issue
ogzhanolguncu 341c340
fix: missing error check
ogzhanolguncu 8d47a24
fix: build issue
ogzhanolguncu 825aecf
Merge branch 'main' of github.com:unkeyed/unkey into ratelimit-overvi…
ogzhanolguncu 4316e95
[autofix.ci] apply automated fixes
autofix-ci[bot] 5ca0947
fix: missing action for logs action menu item
ogzhanolguncu 6259a45
Merge branch 'ratelimit-overview-v2' of github.com:unkeyed/unkey into…
ogzhanolguncu ad19525
fix: ch data fetching
ogzhanolguncu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/dashboard/app/(app)/logs/components/control-cloud/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 27 additions & 69 deletions
96
...rd/app/(app)/logs/components/controls/components/logs-filters/components/paths-filter.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,36 @@ | ||
| import { InputSearch } from "@unkey/icons"; | ||
| import { Button } from "@unkey/ui"; | ||
| import { cn } from "@unkey/ui/src/lib/utils"; | ||
| import { useState } from "react"; | ||
| import { useFilters } from "../../../../../hooks/use-filters"; | ||
| import { logsFilterFieldConfig } from "@/app/(app)/logs/filters.schema"; | ||
| import { useFilters } from "@/app/(app)/logs/hooks/use-filters"; | ||
| import { FilterOperatorInput } from "@/components/logs/filter-operator-input"; | ||
|
|
||
| export const PathsFilter = () => { | ||
| const { filters, updateFilters } = useFilters(); | ||
| const activeFilter = filters.find((f) => f.field === "paths"); | ||
| const [searchText, setSearchText] = useState(activeFilter?.value.toString() ?? ""); | ||
| const [isFocused, setIsFocused] = useState(false); | ||
|
|
||
| const handleSearch = () => { | ||
| const activeFilters = filters.filter((f) => f.field !== "paths"); | ||
| if (searchText.trim()) { | ||
| updateFilters([ | ||
| ...activeFilters, | ||
| { | ||
| field: "paths", | ||
| value: searchText, | ||
| id: crypto.randomUUID(), | ||
| operator: "contains", | ||
| }, | ||
| ]); | ||
| } else { | ||
| updateFilters(activeFilters); | ||
| } | ||
| }; | ||
| const pathOperators = logsFilterFieldConfig.paths.operators; | ||
| const options = pathOperators.map((op) => ({ | ||
| id: op, | ||
| label: op, | ||
| })); | ||
|
|
||
| const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
| if (isFocused) { | ||
| e.stopPropagation(); | ||
| if (e.key === "Enter") { | ||
| handleSearch(); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| const handleFocus = () => { | ||
| setIsFocused(true); | ||
| }; | ||
|
|
||
| const handleBlur = () => { | ||
| setIsFocused(false); | ||
| }; | ||
| const activePathFilter = filters.find((f) => f.field === "paths"); | ||
|
|
||
| return ( | ||
| <div className="flex flex-col p-4 gap-2 w-[300px]"> | ||
| <div className="relative w-full"> | ||
| <div | ||
| className={cn( | ||
| "flex items-center gap-2 px-2 py-1 h-8 rounded-md hover:bg-gray-3 bg-gray-4 transition-all duration-200", | ||
| isFocused && "bg-gray-4", | ||
| )} | ||
| > | ||
| <InputSearch className="w-4 h-4 text-accent-12" /> | ||
| <input | ||
| value={searchText} | ||
| onChange={(e) => setSearchText(e.target.value)} | ||
| onKeyDown={handleKeyDown} | ||
| onFocus={handleFocus} | ||
| onBlur={handleBlur} | ||
| type="text" | ||
| placeholder="Search for path..." | ||
| className="w-full text-[13px] font-medium text-accent-12 bg-transparent border-none outline-none focus:ring-0 focus:outline-none placeholder:text-accent-12" | ||
| /> | ||
| </div> | ||
| </div> | ||
| <Button | ||
| variant="primary" | ||
| className="font-sans mt-2 w-full h-9 rounded-md" | ||
| onClick={handleSearch} | ||
| > | ||
| Search | ||
| </Button> | ||
| </div> | ||
| <FilterOperatorInput | ||
| label="Path" | ||
| options={options} | ||
| defaultOption={activePathFilter?.operator} | ||
| defaultText={activePathFilter?.value as string} | ||
| onApply={(id, text) => { | ||
| const activeFiltersWithoutPaths = filters.filter((f) => f.field !== "paths"); | ||
| updateFilters([ | ||
| ...activeFiltersWithoutPaths, | ||
| { | ||
| field: "paths", | ||
| id: crypto.randomUUID(), | ||
| operator: id, | ||
| value: text, | ||
| }, | ||
| ]); | ||
| }} | ||
| /> | ||
| ); | ||
| }; |
2 changes: 1 addition & 1 deletion
2
apps/dashboard/app/(app)/logs/components/controls/components/logs-live-switch.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_components/form-field.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { Label } from "@/components/ui/label"; | ||
| import { CircleInfo } from "@unkey/icons"; | ||
| import type { ReactNode } from "react"; | ||
| import { InputTooltip } from "../_overview/components/table/components/logs-actions/components/input-tooltip"; | ||
|
|
||
| type FormFieldProps = { | ||
| label: string; | ||
| tooltip?: string; | ||
| error?: string; | ||
| children: ReactNode; | ||
| }; | ||
|
|
||
| export const FormField = ({ label, tooltip, error, children }: FormFieldProps) => ( | ||
| // biome-ignore lint/a11y/useKeyWithClickEvents: no need for button | ||
| <div className="flex flex-col gap-1" onClick={(e) => e.stopPropagation()}> | ||
| <Label | ||
| className="text-gray-11 text-[13px] flex items-center" | ||
| onClick={(e) => e.preventDefault()} | ||
| > | ||
| {label} | ||
| {tooltip && ( | ||
| <InputTooltip desc={tooltip}> | ||
| <CircleInfo size="md-regular" className="text-accent-8 ml-[10px]" /> | ||
| </InputTooltip> | ||
| )} | ||
| </Label> | ||
| {children} | ||
| {error && <span className="text-error-10 text-[13px] font-medium">{error}</span>} | ||
| </div> | ||
| ); | ||
ogzhanolguncu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.