Skip to content

Commit

Permalink
refactor(camel-plugin) Refactor CamelContent to use PageSection tabs …
Browse files Browse the repository at this point in the history
…type

stretch height of the main content and use overflow
  • Loading branch information
mmelko authored and tadayosi committed Apr 23, 2024
1 parent 950f9a2 commit 278b284
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
4 changes: 3 additions & 1 deletion packages/hawtio/src/plugins/camel/CamelContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#camel-content-main .pf-c-page__main {
overflow-x: auto;
}

#camel-content {
height: 100%;
}
#camel-content-header > #camel-contexts-toolbar {
float: right;
padding-top: 0;
Expand Down
35 changes: 23 additions & 12 deletions packages/hawtio/src/plugins/camel/CamelContent.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { eventService } from '@hawtiosrc/core'
import { AttributeValues, Attributes, Chart, JmxContentMBeans, MBeanNode, Operations } from '@hawtiosrc/plugins/shared'
import {
Divider,
EmptyState,
EmptyStateIcon,
EmptyStateVariant,
Nav,
NavItem,
NavList,
PageGroup,
PageNavigation,
PageSection,
PageSectionVariants,
Text,
Expand Down Expand Up @@ -159,17 +159,28 @@ export const CamelContent: React.FunctionComponent = () => {
const camelNavRoutes = navItems.map(nav => <Route key={nav.id} path={nav.id} element={nav.component} />)

return (
<React.Fragment>
<PageGroup>
<PageSection id='camel-content-header' variant={PageSectionVariants.light}>
{camelService.isContext(selectedNode) && <CamelContentContextToolbar />}
<Title headingLevel='h1'>{selectedNode.name}</Title>
{selectedNode.objectName && <Text component='small'>{selectedNode.objectName}</Text>}
<PageGroup id='camel-content'>
<PageSection id='camel-content-header' variant={PageSectionVariants.light}>
{camelService.isContext(selectedNode) && <CamelContentContextToolbar />}
<Title headingLevel='h1'>{selectedNode.name}</Title>
{selectedNode.objectName && <Text component='small'>{selectedNode.objectName}</Text>}
</PageSection>
<Divider />
{navItems.length > 1 && (
<PageSection type={'tabs'} variant={PageSectionVariants.light} hasShadowBottom>
{camelNav}
</PageSection>
{navItems.length > 1 && <PageNavigation>{camelNav}</PageNavigation>}
</PageGroup>

<PageSection id='camel-content-main'>
)}
<Divider />
<PageSection
id='camel-content-main'
variant={
pathname.includes('chart') || pathname.includes('properties')
? PageSectionVariants.default
: PageSectionVariants.light
}
hasOverflowScroll
>
{navItems.length > 0 && (
<Routes>
{camelNavRoutes}
Expand All @@ -178,7 +189,7 @@ export const CamelContent: React.FunctionComponent = () => {
)}
{navItems.length === 0 && !selectedNode.objectName && <JmxContentMBeans />}
</PageSection>
</React.Fragment>
</PageGroup>
)
}

Expand Down

0 comments on commit 278b284

Please sign in to comment.