Skip to content

Commit

Permalink
chore(runtime): make tables sriped, remove whitespaces, change plugin id
Browse files Browse the repository at this point in the history
  • Loading branch information
mmelko committed Sep 19, 2023
1 parent 04607cb commit d58dfa5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
7 changes: 2 additions & 5 deletions packages/hawtio/src/plugins/runtime/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ export const Metrics: React.FunctionComponent = () => {
<GridItem>
<Card>
<CardHeader>
{' '}
<Title headingLevel='h3'>System</Title>
<Title headingLevel='h2'>System</Title>
</CardHeader>
<CardBody>
{' '}
{metrics
.filter(m => m.type === 'System')
.map((metric, index) => {
Expand Down Expand Up @@ -61,8 +59,7 @@ export const Metrics: React.FunctionComponent = () => {
<GridItem>
<Card>
<CardHeader>
{' '}
<Title headingLevel='h3'>JVM</Title>
<Title headingLevel='h2'>JVM</Title>
</CardHeader>

<CardBody>
Expand Down
4 changes: 2 additions & 2 deletions packages/hawtio/src/plugins/runtime/Runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@patternfly/react-core'
import React from 'react'

import { SysProps } from '@hawtiosrc/plugins/runtime/SysProps'
import { SysProps } from './SysProps'
import { Navigate, NavLink, Route, Routes, useLocation } from 'react-router-dom'
import { Metrics } from './Metrics'
import { Threads } from './Threads'
Expand All @@ -37,7 +37,7 @@ export const Runtime: React.FunctionComponent = () => {
</PageSection>
<PageGroup>
<PageNavigation>
<Nav aria-label='Nav' variant='tertiary'>
<Nav aria-label='Runtime Nav' variant='tertiary'>
<NavList>
{navItems.map(navItem => (
<NavItem key={navItem.id} isActive={location.pathname === `/runtime/${navItem.id}`}>
Expand Down
5 changes: 3 additions & 2 deletions packages/hawtio/src/plugins/runtime/SysProps.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen, waitFor, within } from '@testing-library/react'
import { SysProps } from '@hawtiosrc/plugins/runtime/SysProps'
import { SysProps } from '.SysProps'
import { SystemProperty } from './types'
import userEvent from '@testing-library/user-event'

Expand All @@ -11,9 +11,10 @@ function getMockedProperties(): SystemProperty[] {
]
}

jest.mock('@hawtiosrc/plugins/runtime/runtime-service', () => ({
jest.mock('./runtime-service', () => ({
getSystemProperties: jest.fn().mockResolvedValue(getMockedProperties()),
}))

describe('SysProps.tsx', () => {
const renderSysProps = () => {
return render(<SysProps />)
Expand Down
7 changes: 3 additions & 4 deletions packages/hawtio/src/plugins/runtime/SysProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '@patternfly/react-core'
import { TableComposable, Tbody, Td, Th, Thead, ThProps, Tr } from '@patternfly/react-table'
import { SearchIcon } from '@patternfly/react-icons'
import { getSystemProperties } from './runtime-service'
import { loadSystemProperties } from './runtime-service'
import { objectSorter } from '@hawtiosrc/util/objects'
import { SystemProperty } from './types'

Expand All @@ -38,7 +38,7 @@ export const SysProps: React.FunctionComponent = () => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false)

useEffect(() => {
getSystemProperties().then(props => {
loadSystemProperties().then(props => {
setProperties(props)
setFilteredProperties(props)
})
Expand Down Expand Up @@ -151,7 +151,6 @@ export const SysProps: React.FunctionComponent = () => {
}
return (
<Card isFullHeight>
{/*<CardTitle>Browse Messages</CardTitle>*/}
<CardBody>
<Toolbar>
<ToolbarContent>
Expand Down Expand Up @@ -197,7 +196,7 @@ export const SysProps: React.FunctionComponent = () => {

{sortProperties().length > 0 && (
<FormGroup>
<TableComposable aria-label='Message Table' variant='compact' height='80vh'>
<TableComposable aria-label='Message Table' variant='compact' height='80vh' isStriped>
<Thead>
<Tr>
<Th data-testid={'name-header'} sort={getSortParams(0)}>
Expand Down
6 changes: 3 additions & 3 deletions packages/hawtio/src/plugins/runtime/Threads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { TableComposable, Tbody, Td, Th, Thead, ThProps, Tr } from '@patternfly/react-table'
import { SearchIcon } from '@patternfly/react-icons'
import {
getThreads,
loadThreads,
dumpThreads,
enableThreadContentionMonitoring,
isThreadContentionMonitoringEnabled,
Expand Down Expand Up @@ -88,7 +88,7 @@ export const Threads: React.FunctionComponent = () => {
useEffect(() => {
let timeoutHandle: NodeJS.Timeout
const readThreads = async () => {
const threads = await getThreads()
const threads = await loadThreads()
setThreads(threads)
setFilteredThreads(threads)
setThreadConnectionMonitoring(await isThreadContentionMonitoringEnabled())
Expand Down Expand Up @@ -290,7 +290,7 @@ export const Threads: React.FunctionComponent = () => {
</Toolbar>
{sortThreads().length > 0 && (
<FormGroup>
<TableComposable aria-label='Message Table' variant='compact' height='80vh'>
<TableComposable aria-label='Message Table' variant='compact' height='80vh' isStriped>
<Thead>
<Tr>
{tableColumns.map((att, index) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/hawtio/src/plugins/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export const runtime: HawtioPlugin = () => {
component: Runtime,
isActive: async () => workspace.hasMBeans(),
})
helpRegistry.add(pluginId, 'Runtime', help, 15)
helpRegistry.add(pluginId, 'Runtime', help, 16)
}

0 comments on commit d58dfa5

Please sign in to comment.