-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(springboot-plugin): Create empty plugin with Health,Loggers,Info…
…,Trace pages
- Loading branch information
Showing
11 changed files
with
157 additions
and
0 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
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,27 @@ | ||
import React from 'react' | ||
import { Card, CardBody, CardHeader, Grid, GridItem, PageSection, Title } from '@patternfly/react-core' | ||
import { loadHealth } from '@hawtiosrc/plugins/springboot/springboot-service' | ||
|
||
export const Health: React.FunctionComponent = () => { | ||
loadHealth() | ||
return ( | ||
<PageSection variant='light'> | ||
<Grid hasGutter span={12}> | ||
<GridItem> | ||
<Card> | ||
<CardHeader> | ||
<Title headingLevel='h2'>System</Title> | ||
</CardHeader> | ||
<CardBody></CardBody> | ||
</Card> | ||
<Card> | ||
<CardHeader> | ||
<Title headingLevel='h2'>System</Title> | ||
</CardHeader> | ||
<CardBody></CardBody> | ||
</Card> | ||
</GridItem> | ||
</Grid> | ||
</PageSection> | ||
) | ||
} |
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,8 @@ | ||
import React from "react" | ||
import {PageSection} from "@patternfly/react-core" | ||
|
||
export const Info:React.FunctionComponent = () => ( | ||
<PageSection variant='light'> | ||
Info - TO BE DONE | ||
</PageSection> | ||
) |
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,4 @@ | ||
import React from 'react' | ||
import { PageSection } from '@patternfly/react-core' | ||
|
||
export const Loggers: React.FunctionComponent = () => <PageSection variant='light'>Loggers - TO BE DONE</PageSection> |
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,54 @@ | ||
import { Nav, NavItem, NavList, PageGroup, PageNavigation, PageSection, Title } from '@patternfly/react-core' | ||
import React from 'react' | ||
|
||
import { Navigate, NavLink, Route, Routes, useLocation } from 'react-router-dom' | ||
import {Health} from "@hawtiosrc/plugins/springboot/Health" | ||
import {Info} from "@hawtiosrc/plugins/springboot/Info" | ||
import {Loggers} from "@hawtiosrc/plugins/springboot/Loggers" | ||
import {Trace} from "@hawtiosrc/plugins/springboot/Trace" | ||
|
||
|
||
type NavItem = { | ||
id: string | ||
title: string | ||
component: JSX.Element | ||
} | ||
export const Springboot: React.FunctionComponent = () => { | ||
const location = useLocation() | ||
|
||
const navItems: NavItem[] = [ | ||
{ id: 'health', title: 'Health', component: <Health /> }, | ||
{ id: 'info', title: 'Info', component: <Info /> }, | ||
{ id: 'loggers', title: 'Loggers', component: <Loggers /> }, | ||
{ id: 'trace', title: 'Trace', component: <Trace /> }, | ||
] | ||
|
||
return ( | ||
<React.Fragment> | ||
<PageSection variant='light'> | ||
<Title headingLevel='h1'>Springboot</Title> | ||
</PageSection> | ||
<PageGroup> | ||
<PageNavigation> | ||
<Nav aria-label='Spring-boot Nav' variant='tertiary'> | ||
<NavList> | ||
{navItems.map(navItem => ( | ||
<NavItem key={navItem.id} isActive={location.pathname === `/springboot/${navItem.id}`}> | ||
<NavLink to={navItem.id}>{navItem.title}</NavLink> | ||
</NavItem> | ||
))} | ||
</NavList> | ||
</Nav> | ||
</PageNavigation> | ||
</PageGroup> | ||
<PageSection> | ||
<Routes> | ||
{navItems.map(navItem => ( | ||
<Route key={navItem.id} path={navItem.id} element={navItem.component} /> | ||
))} | ||
<Route path='/' element={<Navigate to='health' />} /> | ||
</Routes> | ||
</PageSection> | ||
</React.Fragment> | ||
) | ||
} |
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,8 @@ | ||
import React from "react" | ||
import {PageSection} from "@patternfly/react-core" | ||
|
||
export const Trace:React.FunctionComponent = () => ( | ||
<PageSection variant='light'> | ||
Trace - TO BE DONE | ||
</PageSection> | ||
) |
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,6 @@ | ||
import { Logger } from '@hawtiosrc/core/logging' | ||
|
||
export const pluginId = 'springboot' | ||
export const pluginName = 'hawtio-springboot' | ||
export const pluginPath = '/springboot' | ||
export const log = Logger.get(pluginName) |
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,19 @@ | ||
## Spring Boot | ||
|
||
The Spring Boot plugin provides the capability interact with [actuator](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html) endpoints exposed by an application. | ||
|
||
### Health | ||
|
||
Displays the current health status of the application together with details returned from any Spring Boot health checks. | ||
|
||
### Info | ||
|
||
Displays relevant information regarding the Spring boot application. It is the output of the Info actuator endpoint. | ||
|
||
### Loggers | ||
|
||
Lists all the available loggers in the application. You can modify the level of a logger and the changes will take effect immediately. | ||
|
||
### Trace | ||
|
||
Lists any HTTP traces for your application and lets you view information about the request / response such as headers, time taken etc. |
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,18 @@ | ||
import { hawtio, HawtioPlugin } from '@hawtiosrc/core' | ||
|
||
import { pluginId, pluginPath } from './globals' | ||
import { workspace } from '@hawtiosrc/plugins' | ||
import { helpRegistry } from '@hawtiosrc/help' | ||
import help from './help.md' | ||
import {Springboot} from "@hawtiosrc/plugins/springboot/Springboot" | ||
|
||
export const springboot: HawtioPlugin = () => { | ||
hawtio.addPlugin({ | ||
id: pluginId, | ||
title: 'Springboot', | ||
path: pluginPath, | ||
component: Springboot, | ||
isActive: async () => workspace.hasMBeans(), | ||
}) | ||
helpRegistry.add(pluginId, 'Runtime', help, 16) | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/hawtio/src/plugins/springboot/springboot-service.ts
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,11 @@ | ||
import { SystemProperty } from '@hawtiosrc/plugins/runtime/types' | ||
import { jolokiaService } from '@hawtiosrc/plugins' | ||
|
||
export async function loadHealth() { | ||
const attr = await jolokiaService.execute('org.springframework.boot:type=Endpoint,name=Health', 'health') | ||
console.log(attr) | ||
// for (const [k, v] of Object.entries(attr as object)) { | ||
// systemProperties.push({ key: k, value: v }) | ||
// } | ||
//return systemProperties | ||
} |
Empty file.