KPMP 6704 add icon to metaspace links#320
Conversation
WalkthroughThe PR updates the dataset table's external link button in ChangesSpatial Viewer Dataset List Button
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fbe9fa12-d9c7-43fc-9324-e9c659193512
📒 Files selected for processing (1)
src/components/SpatialViewer/ImageDatasetList.js
|
|
||
| }else { | ||
| return <button onClick={() => setSelectedImageDataset(row)} type='button' data-toggle="tooltip" data-placement="top" title="View dataset" className='table-column btn btn-link text-start p-0 text-decoration-none'>{row["spectracksampleid"]}</button> | ||
| return <button onClick={() => setSelectedImageDataset(row)} type='button' data-toggle="tooltip" data-placement="top" title="Open in Metaspace" className='table-column btn btn-link text-start p-0 text-decoration-none'>{row["spectracksampleid"]} <FontAwesomeIcon icon={faArrowUpRightFromSquare} /></button> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Locate ImageDatasetListContainer.js =="
ls -R src/components/SpatialViewer | head
echo "== Search for window.open in SpatialViewer =="
rg -n "window\.open\(" src/components/SpatialViewer || true
echo "== Show ImageDatasetListContainer.js (around window.open call if present) =="
FILE="src/components/SpatialViewer/ImageDatasetListContainer.js"
if [ -f "$FILE" ]; then
nl -ba "$FILE" | sed -n '1,220p' | sed -n '1,220p'
fi
echo "== Inspect ImageDatasetList.js around line ~115 =="
FILE2="src/components/SpatialViewer/ImageDatasetList.js"
if [ -f "$FILE2" ]; then
nl -ba "$FILE2" | sed -n '80,160p'
fi
echo "== Search for externallink usage wiring =="
rg -n "externallink" src/components/SpatialViewer/ImageDatasetList*.js || trueRepository: KPMP/hubble-web
Length of output: 656
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="src/components/SpatialViewer/ImageDatasetListContainer.js"
echo "== Dump ImageDatasetListContainer.js (lines 1-120) =="
if [ -f "$FILE" ]; then
awk 'NR>=1 && NR<=120 {printf "%5d\t%s\n", NR, $0}' "$FILE"
fi
FILE2="src/components/SpatialViewer/ImageDatasetList.js"
echo "== Dump ImageDatasetList.js (lines 80-160) =="
if [ -f "$FILE2" ]; then
awk 'NR>=80 && NR<=160 {printf "%5d\t%s\n", NR, $0}' "$FILE2"
fi
echo "== Search externallink wiring across SpatialViewer subcomponents =="
rg -n "externallink" src/components/SpatialViewer/ImageDatasetList*.jsRepository: KPMP/hubble-web
Length of output: 6571
Harden external-link window.open against reverse-tabnabbing
For configtype === 'external_link', setSelectedImageDataset calls window.open(selectedImageDataset['externallink'], '_blank') without noopener/noreferrer, leaving a reverse-tabnabbing surface from the opened page. Add safe window features in src/components/SpatialViewer/ImageDatasetListContainer.js.
🔧 Proposed fix
- window.open(selectedImageDataset['externallink'], '_blank')
+ window.open(selectedImageDataset['externallink'], '_blank', 'noopener,noreferrer')
Summary by CodeRabbit