Skip to content

Commit 36611ca

Browse files
committed
pr review
1 parent 20ed5c1 commit 36611ca

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

site/src/modules/resources/PortForwardButton.tsx

+5-14
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,8 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
196196
(port) => port.agent_name === agent.name,
197197
);
198198
// we don't want to show listening ports if it's a shared port
199-
const filteredListeningPorts = (listeningPorts ? listeningPorts : []).filter(
200-
(port) => {
201-
for (let i = 0; i < filteredSharedPorts.length; i++) {
202-
if (filteredSharedPorts[i].port === port.port) {
203-
return false;
204-
}
205-
}
206-
207-
return true;
208-
},
199+
const filteredListeningPorts = (listeningPorts ?? []).filter((port) =>
200+
filteredSharedPorts.every((sharedPort) => sharedPort.port !== port.port),
209201
);
210202
// only disable the form if shared port controls are entitled and the template doesn't allow sharing ports
211203
const canSharePorts =
@@ -253,9 +245,8 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
253245
</Stack>
254246
<Stack direction="column" gap={1}>
255247
<HelpTooltipText css={{ color: theme.palette.text.secondary }}>
256-
{
257-
"The listening ports are exclusively accessible to you. Selecting HTTP/S will change the protocol for all listening ports."
258-
}
248+
The listening ports are exclusively accessible to you. Selecting
249+
HTTP/S will change the protocol for all listening ports.
259250
</HelpTooltipText>
260251
<Stack
261252
direction="row"
@@ -334,7 +325,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
334325
</Stack>
335326
{filteredListeningPorts.length === 0 && (
336327
<HelpTooltipText css={styles.noPortText}>
337-
{"No open ports were detected."}
328+
No open ports were detected.
338329
</HelpTooltipText>
339330
)}
340331
{filteredListeningPorts.map((port) => {

0 commit comments

Comments
 (0)