Skip to content

Commit

Permalink
formatting to replace stuff in the strings
Browse files Browse the repository at this point in the history
  • Loading branch information
travjenkins committed Dec 2, 2024
1 parent 5575941 commit fbd6fa3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/tables/DataPlanes/Rows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useIntl } from 'react-intl';
import {
formatDataPlaneName,
formatDataPlaneOption,
formatSshSubnets,
} from 'utils/dataPlane-utils';

interface RowsProps {
Expand Down Expand Up @@ -44,7 +45,9 @@ function Row({ row }: RowProps) {

<TableCell>
{row.ssh_subnets ? (
<SingleLineCode value={row.ssh_subnets.join(', ')} />
<SingleLineCode
value={row.ssh_subnets.map(formatSshSubnets).join(', ')}
/>
) : (
intl.formatMessage({
id: 'admin.dataPlanes.table.columns.ips.missing',
Expand Down
3 changes: 2 additions & 1 deletion src/forms/renderers/Informational/SshEndpoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AlertBox from 'components/shared/AlertBox';
import { useMemo } from 'react';
import { useIntl } from 'react-intl';
import { useDetailsFormStore } from 'stores/DetailsForm/Store';
import { formatSshSubnets } from 'utils/dataPlane-utils';

function SshEndpointInfo() {
const intl = useIntl();
Expand All @@ -15,7 +16,7 @@ function SshEndpointInfo() {
const ipList = useMemo(() => {
// Check if private data plane has IPs and use 'em
if (sshSubnets && sshSubnets.length > 0) {
return sshSubnets.join(', ');
return sshSubnets.map(formatSshSubnets).join(', ');
}

return intl.formatMessage({
Expand Down
4 changes: 4 additions & 0 deletions src/utils/dataPlane-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,7 @@ export const isHttp = (ep: Endpoint): boolean => {
export const formatHttpUrl = (fullHostName: string): string => {
return `https://${fullHostName}/`;
};

export const formatSshSubnets = (subnet: string) => {
return subnet.replaceAll('/32', '').replaceAll('/64', '');
};

0 comments on commit fbd6fa3

Please sign in to comment.