-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(logs-viewer): api integration (logs fetching, filtering) (#263)
* feat(logs): create logs-viewer page and basic ui components: select, multiselect, drawer * refactor(logs): refactor/restyle logs components; refactor style login page; add json viewer * feat(logs): add date-time picker * feat(logs-viewer): api implementation * refactor(logs-viewer): remove parallel route for drawer; update logs queries * refactor(logs-viewer): update folder structure, add logs filters, improve drawer ui * Update LogsFiltersPanel.tsx --------- Co-authored-by: Konstantinos Kopanidis <[email protected]>
- Loading branch information
1 parent
ce89db8
commit 8eb5c8a
Showing
20 changed files
with
21,220 additions
and
577 deletions.
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 |
---|---|---|
@@ -1,60 +1,14 @@ | ||
'use client'; | ||
import { Sidebar } from '@/components/navigation/sidebar'; | ||
import { SidebarItem } from '@/components/navigation/sidebarItem'; | ||
import { SidebarItemWithSub } from '@/components/navigation/sidebarItemWithSub'; | ||
import { navList } from '@/app/(dashboard)/navList'; | ||
import { usePathname } from 'next/navigation'; | ||
|
||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
const pathname = usePathname(); | ||
const isActive = (href: string) => pathname === href; | ||
const isSubActive = (href: string) => pathname.includes(href); | ||
import SidebarList from '@/components/navigation/sidebarList'; | ||
|
||
export default async function Layout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<div className={'flex'}> | ||
<Sidebar> | ||
{navList.map(item => { | ||
if (item.children) { | ||
return ( | ||
<SidebarItemWithSub | ||
key={item.href} | ||
active={isActive(item.href) || isSubActive(item.href)} | ||
> | ||
<SidebarItem href={item.href} key={item.href}> | ||
{item.icon} | ||
{item.name} | ||
</SidebarItem> | ||
{item.children.map(child => ( | ||
<SidebarItem | ||
href={child.href} | ||
active={ | ||
isActive(child.href) || | ||
(child.href !== item.href && isSubActive(child.href)) | ||
} | ||
key={child.href} | ||
> | ||
{child.icon} | ||
{child.name} | ||
</SidebarItem> | ||
))} | ||
</SidebarItemWithSub> | ||
); | ||
} | ||
return ( | ||
<SidebarItem | ||
href={item.href} | ||
active={isActive(item.href)} | ||
key={item.href} | ||
> | ||
{item.icon} | ||
{item.name} | ||
</SidebarItem> | ||
); | ||
})} | ||
</Sidebar> | ||
<div className="relative flex-grow h-screen overflow-auto main-scrollbar"> | ||
{children} | ||
</div> | ||
<SidebarList /> | ||
<div className="relative flex-grow h-screen">{children}</div> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,7 +1,36 @@ | ||
import LogsViewer from '@/components/logs-viewer/LogsViewer'; | ||
import { getModules } from '@/lib/api/modules'; | ||
import { getLogsLevels, getLogsQueryRange } from '@/lib/api/logs-viewer'; | ||
import { knownModuleNames } from '@/lib/models/logs-viewer/constants'; | ||
|
||
export default async function LogsViewerPage() { | ||
const modules = await getModules(); | ||
return <LogsViewer modules={modules} />; | ||
const levelsData = await getLogsLevels(); | ||
|
||
const logsData = await getLogsQueryRange({ | ||
modules: knownModuleNames, | ||
limit: '100', | ||
}); | ||
|
||
const refreshLogs = async (data: { | ||
modules: string[]; | ||
levels: string[]; | ||
startDate: number | undefined; | ||
endDate: number | undefined; | ||
limit: string | undefined; | ||
}) => { | ||
'use server'; | ||
const logs = await getLogsQueryRange({ | ||
...data, | ||
modules: data.modules ? data.modules : knownModuleNames, | ||
limit: data.limit ? data.limit : '100', | ||
}); | ||
return logs; | ||
}; | ||
|
||
return ( | ||
<LogsViewer | ||
levelsData={levelsData} | ||
logsData={logsData} | ||
refreshLogs={refreshLogs} | ||
/> | ||
); | ||
} |
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
Oops, something went wrong.