Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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