Skip to content

Commit

Permalink
fix(topology): warning resolver should include adding ssl certs (#1048)…
Browse files Browse the repository at this point in the history
… (#1052)

* fix(topology): warning resolver should include adding ssl certs

Signed-off-by: Thuan Vo <thvo@redhat.com>

* feat(topology): add warning icon next to JVM ID if empty

* fix(topology): fix wordings

---------

Signed-off-by: Thuan Vo <thvo@redhat.com>
(cherry picked from commit 0dd044c)

Co-authored-by: Thuan Vo <thvo@redhat.com>
  • Loading branch information
mergify[bot] and Thuan Vo authored Jun 6, 2023
1 parent 3ef5a2c commit 99ea62d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/SecurityPanel/ImportCertificate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ const Component = () => {

export const ImportCertificate: SecurityCard = {
title: 'Import SSL Certificates',
description: 'Restart is needed to apply changes.',
description: 'The Cryostat server must be restarted in order to reload the certificate store.',
content: Component,
};
25 changes: 22 additions & 3 deletions src/app/Topology/Shared/Entity/EntityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ import {
Tab,
Tabs,
TabTitleText,
Text,
Tooltip,
} from '@patternfly/react-core';
import { WarningTriangleIcon } from '@patternfly/react-icons';
import { ExclamationTriangleIcon, WarningTriangleIcon } from '@patternfly/react-icons';
import { css } from '@patternfly/react-styles';
import { ExpandableRowContent, TableComposable, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
import { GraphElement, NodeStatus } from '@patternfly/react-topology';
Expand Down Expand Up @@ -203,8 +204,26 @@ export const TargetDetails: React.FC<{
},
{
key: 'JVM ID',
title: 'JVM ID',
helperTitle: 'JVM ID',
title: (
<>
<span style={{ marginRight: '0.5em' }}>JVM ID</span>
{!serviceRef.jvmId && (
<Tooltip content={'Failed to compute JVM ID'}>
<ExclamationTriangleIcon color="orange" />
</Tooltip>
)}
</>
),
helperTitle: (
<>
<span style={{ marginRight: '0.5em' }}>JVM ID</span>
{!serviceRef.jvmId && (
<Tooltip content={'Failed to compute JVM ID'}>
<ExclamationTriangleIcon color="orange" />
</Tooltip>
)}
</>
),
helperDescription: constructHelperDescription('The ID of the current JVM.', 'Target', ['jvmId']),
content: serviceRef.jvmId || <EmptyText text="No JVM ID" />,
},
Expand Down
20 changes: 16 additions & 4 deletions src/app/Topology/Shared/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
*/
import { TopologyFilters } from '@app/Shared/Redux/Filters/TopologyFilterSlice';
import { evaluateTargetWithExpr } from '@app/utils/utils';
import { Button } from '@patternfly/react-core';
import { Button, Text, TextVariants } from '@patternfly/react-core';
import { ContextMenuSeparator, GraphElement, NodeStatus } from '@patternfly/react-topology';
import * as React from 'react';
import { BehaviorSubject, debounceTime, Observable, Subscription } from 'rxjs';
import { ContextMenuItem, MenuItemVariant, NodeAction, nodeActions } from '../Actions/NodeActions';
import { WarningResolverAsCredModal } from '../Actions/WarningResolver';
import { WarningResolverAsCredModal, WarningResolverAsLink } from '../Actions/WarningResolver';
import { EnvironmentNode, TargetNode, isTargetNode, NodeType, DEFAULT_EMPTY_UNIVERSE } from '../typings';

export const DiscoveryTreeContext = React.createContext(DEFAULT_EMPTY_UNIVERSE);
Expand Down Expand Up @@ -95,7 +95,7 @@ export const getUniqueTargetId = (target: TargetNode) => {
return `${target.id}`;
};

export type StatusExtra = { title?: string; description?: string; callForAction?: React.ReactNode[] };
export type StatusExtra = { title?: string; description?: React.ReactNode; callForAction?: React.ReactNode[] };

export const getStatusTargetNode = (node: TargetNode | EnvironmentNode): [NodeStatus?, StatusExtra?] => {
if (isTargetNode(node)) {
Expand All @@ -105,13 +105,25 @@ export const getStatusTargetNode = (node: TargetNode | EnvironmentNode): [NodeSt
NodeStatus.warning,
{
title: 'Failed to compute JVM ID',
description: `Target ${node.target.alias} might be missing credentials.`,
description: (
<>
<Text component={TextVariants.p}>
If target has JMX Authentication enabled, add the credential to Cryostat keyring.
</Text>
<Text component={TextVariants.p}>
If the target has SSL enabled over JMX, add its certificate to Cryostat truststore.
</Text>
</>
),
callForAction: [
<WarningResolverAsCredModal key={`${node.target.alias}-resolver-as-credential-modal`}>
<Button variant="link" isSmall style={{ padding: 0 }}>
Add credentials
</Button>
</WarningResolverAsCredModal>,
<WarningResolverAsLink key={`${node.target.alias}-resolver-as-link-to-security`} to="/security">
Add certificates
</WarningResolverAsLink>,
],
},
];
Expand Down

0 comments on commit 99ea62d

Please sign in to comment.