Skip to content

Commit

Permalink
refactor(shared): Replace Card component with the Panel in Attributes…
Browse files Browse the repository at this point in the history
… and Operations components
  • Loading branch information
mmelko committed Apr 22, 2024
1 parent faa1805 commit dae41fd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.attribute-table > tr > th {
max-width: none;
}
#attribute-table-with-panel {
height: 75vh;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PluginNodeSelectionContext } from '@hawtiosrc/plugins/context'
import { JmxContentMBeans } from '@hawtiosrc/plugins/shared/JmxContentMBeans'
import { AttributeValues } from '@hawtiosrc/plugins/shared/jolokia-service'
import { humanizeLabels } from '@hawtiosrc/util/strings'
import { Card } from '@patternfly/react-core'
import { Panel } from '@patternfly/react-core'
import { TableComposable, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table'
import { Response } from 'jolokia.js'
import React, { useContext, useEffect, useState } from 'react'
Expand Down Expand Up @@ -106,7 +106,7 @@ export const AttributeTable: React.FunctionComponent = () => {
const labels = Object.keys(attributesEntries[0] ?? {})

return (
<Card isFullHeight>
<Panel>
<TableComposable aria-label='MBeans' variant='compact'>
<Thead>
<Tr>
Expand All @@ -125,6 +125,6 @@ export const AttributeTable: React.FunctionComponent = () => {
))}
</Tbody>
</TableComposable>
</Card>
</Panel>
)
}
9 changes: 5 additions & 4 deletions packages/hawtio/src/plugins/shared/attributes/Attributes.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { PluginNodeSelectionContext } from '@hawtiosrc/plugins/context'
import { AttributeValues } from '@hawtiosrc/plugins/shared/jolokia-service'
import { isObject, objectSorter } from '@hawtiosrc/util/objects'
import { Card, Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core'
import { Drawer, DrawerContent, DrawerContentBody, Panel } from '@patternfly/react-core'
import { TableComposable, Tbody, Td, Th, Thead, ThProps, Tr } from '@patternfly/react-table'
import React, { useContext, useEffect, useState } from 'react'
import { HawtioEmptyCard } from '../HawtioEmptyCard'
import { HawtioLoadingCard } from '../HawtioLoadingCard'
import { log } from '../globals'
import { AttributeModal } from './AttributeModal'
import { attributeService } from './attribute-service'
import './AttributeTable.css'

export const Attributes: React.FunctionComponent = () => {
const { selectedNode } = useContext(PluginNodeSelectionContext)
Expand Down Expand Up @@ -100,7 +101,7 @@ export const Attributes: React.FunctionComponent = () => {
)

const attributesTable = (
<div style={{ height: '75vh' }}>
<div id='attribute-table-with-panel'>
<TableComposable aria-label='Attributes' variant='compact'>
<Thead>
<Tr>
Expand Down Expand Up @@ -128,13 +129,13 @@ export const Attributes: React.FunctionComponent = () => {
)
return (
<React.Fragment>
<Card isFullHeight>
<Panel>
<Drawer isExpanded={isModalOpen} className={'pf-m-inline-on-2xl'}>
<DrawerContent panelContent={panelContent}>
<DrawerContentBody hasPadding> {attributesTable}</DrawerContentBody>
</DrawerContent>
</Drawer>
</Card>
</Panel>
</React.Fragment>
)
}
18 changes: 10 additions & 8 deletions packages/hawtio/src/plugins/shared/operations/Operations.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PluginNodeSelectionContext } from '@hawtiosrc/plugins/context'
import { isEmpty } from '@hawtiosrc/util/objects'
import { Card, CardBody, DataList, Text } from '@patternfly/react-core'
import { DataList, Panel, PanelHeader, PanelMain, PanelMainBody, Text } from '@patternfly/react-core'
import React, { useContext } from 'react'
import { HawtioEmptyCard } from '../HawtioEmptyCard'
import { OperationForm } from './OperationForm'
Expand Down Expand Up @@ -31,15 +31,17 @@ export const Operations: React.FunctionComponent = () => {
)

return (
<Card isFullHeight>
<CardBody>
<Panel>
<PanelHeader>
<Text component='p'>
This MBean supports the following JMX operations. Expand an item in the list to invoke that operation.
</Text>
</CardBody>
<CardBody>
<OperationList />
</CardBody>
</Card>
</PanelHeader>
<PanelMain>
<PanelMainBody>
<OperationList />
</PanelMainBody>
</PanelMain>
</Panel>
)
}

0 comments on commit dae41fd

Please sign in to comment.