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

custon Dns txt target add #499

Merged
merged 2 commits into from
Jan 17, 2025
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
1 change: 1 addition & 0 deletions src/components/ResourceInstance/Connectivity/CustomDNS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ const CustomDNS: FC<EndpointProps> = (props) => {
aRecordTarget={customDNSData?.aRecordTarget}
cnameTarget={customDNSData?.cnameTarget}
domainName={customDNSData?.dnsName}
resourceInstanceId={accessQueryParams.resourceInstanceId}
/>
)}
<FieldContainer marginTop={0} sx={{ maxWidth: "1000px" }}>
Expand Down
43 changes: 37 additions & 6 deletions src/components/ResourceInstance/Connectivity/CustomDNSDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type CustomDNSDetailsProps = {
aRecordTarget?: string;
cnameTarget?: string;
domainName: string;
resourceInstanceId?: string;
};

const RecordContainer = styled(Box)({
Expand All @@ -16,17 +17,21 @@ const RecordContainer = styled(Box)({
width: "100%",
padding: "24px",
border: "1px solid #EAECF0",
marginBottom: "16px",
marginBottom: "24px",
boxShadow: "0px 1px 2px 0px rgba(16, 24, 40, 0.05)",
});

const RecordRowContainer = styled(Box)({
const RecordRowContainer = styled(Box)<{
marginBottom?: string;
marginTop?: string;
}>(({ marginBottom, marginTop }) => ({
display: "flex",
flexDirection: "row",
alignItems: "center",
width: "100%",
marginBottom: "16px",
});
marginBottom: marginBottom ? marginBottom : "8px",
marginTop: marginTop,
}));
const RecordColumn = styled(Box)<{ hasBorder?: boolean }>(({ hasBorder }) => ({
display: "flex",
alignItems: "center",
Expand All @@ -43,6 +48,7 @@ const CustomDNSDetails: React.FC<CustomDNSDetailsProps> = ({
aRecordTarget,
cnameTarget,
domainName,
resourceInstanceId,
}) => {
const records = [];
if (aRecordTarget) {
Expand All @@ -60,15 +66,21 @@ const CustomDNSDetails: React.FC<CustomDNSDetailsProps> = ({
recordValue: cnameTarget,
});
}
records.push({
recordLabel: "TXT",
domainValue: domainName,
recordValue: `target-${domainName}=${resourceInstanceId}`,
recordValueDetails: `The TXT record is a name-value pair, where the name must start with the prefix "target-", and the value should is the instance ID.`,
});

return (
<RecordContainer>
{records.map((record, index) => (
<Box key={index} width="100%">
<Box key={index} width="100%" marginBottom={"16px"}>
<RecordRowContainer>
<RecordColumn>
<Text size="small" weight="medium" color="rgba(52, 64, 84, 1)">
Record Name
{`${record.recordLabel} Record`}
</Text>
</RecordColumn>

Expand Down Expand Up @@ -166,6 +178,25 @@ const CustomDNSDetails: React.FC<CustomDNSDetailsProps> = ({
</Box>
</RecordColumn>
</RecordRowContainer>
{record?.recordValueDetails && (
<RecordRowContainer marginTop="-4px">
{/* @ts-ignore */}
<RecordColumn />
{/* @ts-ignore */}
<Box px="8px" />
<RecordColumn>
<Box paddingLeft="15px">
<Text
size="small"
weight="regular"
color="rgba(52, 64, 84, 1)"
>
{record?.recordValueDetails}
</Text>
</Box>
</RecordColumn>
</RecordRowContainer>
)}
</Box>
))}
</RecordContainer>
Expand Down
Loading