-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Toggle columns from LogSidePanel (#82)
Allow to toggle columns from LogSidePanel <img width="821" alt="Screenshot 2023-11-03 at 10 39 13 PM" src="https://github.com/hyperdxio/hyperdx/assets/20255948/b997cd3d-edf1-4df5-a201-affdbea27cb6"> Co-authored-by: Shorpo <149748269+svc-shorpo@users.noreply.github.com>
- Loading branch information
1 parent
ef0fb17
commit bf8af29
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
'@hyperdx/app': minor | ||
--- | ||
|
||
feat: Toggle columns from LogSidePanel |
This file contains 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 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 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 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 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,16 @@ | ||
import { useState } from 'react'; | ||
|
||
// TODO: Instead of prop drilling additional columns, we can consider using React.Context or Jotai | ||
export const useDisplayedColumns = () => { | ||
const [displayedColumns, setDisplayedColumns] = useState<string[]>([]); | ||
|
||
const toggleColumn = (column: string) => { | ||
if (displayedColumns.includes(column)) { | ||
setDisplayedColumns(displayedColumns.filter(c => c !== column)); | ||
} else { | ||
setDisplayedColumns([...displayedColumns, column]); | ||
} | ||
}; | ||
|
||
return { displayedColumns, setDisplayedColumns, toggleColumn }; | ||
}; |