Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import styled, { CSSProp, useTheme } from 'styled-components'

import { useCreateClusterContext } from '../CreateClusterWizard'
import { sanitizeConsoleUrl } from 'components/overview/clusters/all/AllClustersTableCols'

export function AuthenticationStep() {
const theme = useTheme()
Expand Down Expand Up @@ -54,7 +55,7 @@ export function AuthenticationStep() {
</span>
<Button
as="a"
href={`https://${consoleUrl}`}
href={sanitizeConsoleUrl(consoleUrl)}
target="_blank"
margin={`${theme.spacing.medium}px 0`}
endIcon={<ArrowTopRightIcon />}
Expand Down
6 changes: 4 additions & 2 deletions www/src/components/overview/clusters/SelfHostedTableCols.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { A, Div } from 'honorable'
import { Link } from 'react-router-dom'
import styled, { useTheme } from 'styled-components'

import { ClusterFragment, Source } from '../../../generated/graphql'
import { Source } from '../../../generated/graphql'
import { ProviderIcon } from '../../utils/ProviderIcon'

import ClusterHealth from './ClusterHealth'
import ClusterOwner from './ClusterOwner'
import { sanitizeConsoleUrl } from './all/AllClustersTableCols'
import { ClusterListElement } from './clusterListUtils'

const clusterExists = (row: ClusterListElement): boolean =>
Expand Down Expand Up @@ -143,9 +144,10 @@ export const ColActions = columnHelper.accessor((row) => row.consoleUrl, {
secondary
startIcon={<ConsoleIcon color={theme.colors['icon-default']} />}
as="a"
href={`${row.consoleUrl}`}
href={sanitizeConsoleUrl(row.consoleUrl)}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
Go to Console
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ const ColActions = columnHelper.accessor((instance) => instance, {
small
startIcon={<ConsoleIcon color={theme.colors['icon-default']} />}
as={Link}
to={`https://${instance.consoleUrl}`}
to={sanitizeConsoleUrl(instance.consoleUrl)}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
Go to Console
</Button>
Expand All @@ -144,3 +145,6 @@ export const allClustersCols = [
ColOwner,
ColActions,
]

export const sanitizeConsoleUrl = (url: Nullable<string>) =>
url ? `https://${url.replace(/^https?:\/\//, '')}` : ''
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useTheme } from 'styled-components'

import { CellCaption, CellWrap } from '../SelfHostedTableCols'
import { Link } from 'react-router-dom'
import { sanitizeConsoleUrl } from '../all/AllClustersTableCols'

const columnHelper = createColumnHelper<ConsoleInstanceFragment>()

Expand Down Expand Up @@ -172,9 +173,10 @@ const ColActions = columnHelper.accessor((instance) => instance, {
small
startIcon={<ConsoleIcon color={theme.colors['icon-default']} />}
as={Link}
to={`https://${instance.url}`}
to={sanitizeConsoleUrl(instance.url)}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
Go to Console
</Button>
Expand Down
Loading