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(connect): Disable "Connect" button in Discovery when in insecure … #947

Merged
merged 1 commit into from
May 16, 2024
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 packages/hawtio/src/plugins/connect/ConnectionStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ConnectionStatus: React.FunctionComponent = () => {
icon = <UnpluggedIcon color='red' />
break
case 'not-reachable-securely':
icon = <UnpluggedIcon style={{ color: 'var(--pf-global--warning-color--100)' }} />
icon = <PluggedIcon style={{ color: 'var(--pf-global--warning-color--100)' }} />
break
}

Expand Down
18 changes: 17 additions & 1 deletion packages/hawtio/src/plugins/connect/discover/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { formatTimestamp } from '@hawtiosrc/util/dates'
import {
ActionList,
ActionListItem,
Alert,
Button,
Card,
CardActions,
Expand Down Expand Up @@ -270,10 +271,25 @@ export const AgentCard: React.FunctionComponent<{
</DescriptionListDescription>
</DescriptionListGroup>
)}
{!window.isSecureContext && agent.secured ? (
<Alert
variant='danger'
isInline
isPlain
title="Can't connect to secured agent in non-secure browsing context"
/>
) : (
''
)}
</DescriptionList>
</CardBody>
<CardFooter>
<Button variant='primary' onClick={() => connect(discoverService.agentToConnection(agent))} isSmall>
<Button
variant='primary'
onClick={() => connect(discoverService.agentToConnection(agent))}
isSmall
isDisabled={!window.isSecureContext && agent.secured}
>
Connect
</Button>
</CardFooter>
Expand Down
2 changes: 1 addition & 1 deletion packages/hawtio/src/plugins/connect/remote/Remote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const ConnectionItem: React.FunctionComponent<{
icon = <UnpluggedIcon color='red' />
break
case 'not-reachable-securely':
icon = <UnpluggedIcon style={{ color: 'var(--pf-global--warning-color--100)' }} />
icon = <PluggedIcon style={{ color: 'var(--pf-global--warning-color--100)' }} />
break
}

Expand Down
Loading