diff --git a/packages/hawtio/src/plugins/connect/discover/Discover.tsx b/packages/hawtio/src/plugins/connect/discover/Discover.tsx index 7eb2b755d..8c64c98c8 100644 --- a/packages/hawtio/src/plugins/connect/discover/Discover.tsx +++ b/packages/hawtio/src/plugins/connect/discover/Discover.tsx @@ -32,9 +32,6 @@ import React, { useContext, useEffect, useState } from 'react' import { ADD, UPDATE } from '../connections' import { ConnectContext } from '../context' import { log } from '../globals' -import javaLogo from '../img/java-logo.svg' -import jettyLogo from '../img/jetty-logo.svg' -import tomcatLogo from '../img/tomcat-logo.svg' import { Agent, Jvm, discoverService } from './discover-service' export const Discover: React.FunctionComponent = () => { @@ -223,20 +220,10 @@ export const Discover: React.FunctionComponent = () => { ) } -const PRODUCT_LOGO: Record = { - jetty: jettyLogo, - tomcat: tomcatLogo, - generic: javaLogo, -} - export const AgentCard: React.FunctionComponent<{ agent: Agent connect: (conn: Connection) => void }> = ({ agent, connect }) => { - const productLogo = (agent: Agent) => { - return PRODUCT_LOGO[agent.server_product?.toLowerCase() ?? 'generic'] ?? PRODUCT_LOGO.generic - } - const title = discoverService.hasName(agent) ? ( `${agent.server_vendor} ${agent.server_product} ${agent.server_version}` ) : ( @@ -247,16 +234,15 @@ export const AgentCard: React.FunctionComponent<{ - - - ), + actions: , hasNoOffset: false, - className: undefined, }} > - {agent.server_product} + {agent.server_product} {title} @@ -334,16 +320,15 @@ export const JvmCard: React.FunctionComponent<{ - - - ), + actions: , hasNoOffset: false, - className: undefined, }} > - {jvm.alias} + {jvm.alias} {jvm.alias} diff --git a/packages/hawtio/src/plugins/connect/discover/discover-service.ts b/packages/hawtio/src/plugins/connect/discover/discover-service.ts index 493e7de38..368cf35b1 100644 --- a/packages/hawtio/src/plugins/connect/discover/discover-service.ts +++ b/packages/hawtio/src/plugins/connect/discover/discover-service.ts @@ -1,6 +1,10 @@ import { Connection, INITIAL_CONNECTION, connectService, jolokiaService, workspace } from '@hawtiosrc/plugins/shared' import { isBlank } from '@hawtiosrc/util/strings' import { log } from '../globals' +import camelLogo from '../img/camel-logo.svg' +import javaLogo from '../img/java-logo.svg' +import jettyLogo from '../img/jetty-logo.svg' +import tomcatLogo from '../img/tomcat-logo.svg' /** * @see https://jolokia.org/reference/html/manual/jolokia_mbeans.html#mbean-discovery @@ -22,7 +26,7 @@ export type Agent = { } /** - * @see https://github.com/hawtio/hawtio/blob/3.x/plugins/hawtio-local-jvm-mbean/src/main/java/io/hawt/jvm/local/VMDescriptorDTO.java + * @see https://github.com/hawtio/hawtio/blob/4.x/plugins/hawtio-local-jvm-mbean/src/main/java/io/hawt/jvm/local/VMDescriptorDTO.java */ export type Jvm = { id: string @@ -35,6 +39,13 @@ export type Jvm = { path: string | null } +export const PRODUCT_LOGO: Record = { + camel: camelLogo, + jetty: jettyLogo, + tomcat: tomcatLogo, + generic: javaLogo, +} + class DiscoverService { hasDiscoveryMBean(): Promise { return workspace.treeContainsDomainAndProperties('jolokia', { type: 'Discovery' }) @@ -92,6 +103,22 @@ class DiscoverService { return [agent.server_vendor, agent.server_product, agent.server_version].every(s => !isBlank(s)) } + productLogo(agent: Agent): string { + // Special handling for Camel + if (agent.command?.startsWith('main.CamelJBang')) { + return PRODUCT_LOGO.camel! + } + return PRODUCT_LOGO[agent.server_product?.toLowerCase() ?? 'generic'] ?? PRODUCT_LOGO.generic! + } + + productLogoJvm(jvm: Jvm): string { + // Special handling for Camel + if (jvm.displayName.startsWith('main.CamelJBang')) { + return PRODUCT_LOGO.camel! + } + return PRODUCT_LOGO.generic! + } + agentToConnection(agent: Agent): Connection { const conn = { ...INITIAL_CONNECTION, diff --git a/packages/hawtio/src/plugins/connect/img/camel-logo.svg b/packages/hawtio/src/plugins/connect/img/camel-logo.svg new file mode 100644 index 000000000..3dc5f97ff --- /dev/null +++ b/packages/hawtio/src/plugins/connect/img/camel-logo.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file