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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ WORKDIR /app

COPY . .

ARG VITE_SERVICE_URL
ARG VITE_APP_NAME
ARG VITE_APP_TITLE
ARG VITE_AUTH_ENABLED
ARG VITE_LOGIN_SERVICE
ARG VITE_LOGOUT_SERVICE
ARG VITE_CROSSMATCH_ENABLED

RUN npm install && npm run build

FROM nginxinc/nginx-unprivileged:stable-alpine

COPY --from=build /app/dist/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf


EXPOSE 8080

USER 1001
2 changes: 1 addition & 1 deletion docs/cross-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Lists other **unmatched** sources within 2.0 arcminutes. Click an ID to open tha

Your browser searches SIMBAD for objects within 2.0 arcminutes of the source. It returns up to 10 objects, ordered by how often each is cited in the literature, most-cited first. The time of the search is shown above the list. Each match shows:

- its identifier, which opens the object in the CDS portal in a new tab,
- its identifier, which opens the object in SIMBAD in a new tab, on whichever SIMBAD server (CDS, or the Harvard mirror) answered the search,
- its object type, and
- its distance from the source in arcminutes.

Expand Down
16 changes: 8 additions & 8 deletions docs/search-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Enter a **Source ID** to go straight to that source's page. If no source has tha

## Search by catalog via SIMBAD

Enter the name of an astronomical object, for example `M 31`, `3C 273` or `Sgr A*`, to find it on the [all-sky map](sky-explorer.md). The name is looked up in [SIMBAD](https://simbad.cds.unistra.fr/simbad/) through the CDS [Sesame](https://cds.unistra.fr/cgi-bin/Sesame) name resolver, so any identifier SIMBAD recognizes will work. Spacing and capitalization are flexible, e.g. `M31` and `m 31` find the same object.
Enter the name of an astronomical object, for example `M 31`, `3C 273` or `Sgr A*`, to find it on the [all-sky map](sky-explorer.md). The name is looked up in [SIMBAD](https://simbad.cds.unistra.fr/simbad/) through the CDS [Sesame](https://cds.unistra.fr/cgi-bin/Sesame) name resolver, falling back to a mirror at Harvard if CDS doesn't respond, so any identifier SIMBAD recognizes will work. Spacing and capitalization are flexible, e.g. `M31` and `m 31` find the same object.

While the search runs, the search button shows a spinner. If you search from another page, LightView returns to the home page.

Expand All @@ -105,16 +105,16 @@ The sources table below the map narrows to the sources in the new field of view,

The popup shows:

| Item | Description |
| --------------------------- | ---------------------------------------------------------------------------------------------- |
| **Name** | The object's main identifier in SIMBAD, which may differ from what you typed (`m31` → `M 31`). |
| **RA** | Right ascension in degrees (ICRS), rounded to three decimal places. |
| **Dec** | Declination in degrees (ICRS), rounded to three decimal places. |
| **SIMBAD cone search (5′)** | Opens SIMBAD in a new tab, listing every object within 5 arcminutes of the position. |
| Item | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | The object's main identifier in SIMBAD, which may differ from what you typed (`m31` → `M 31`). |
| **RA** | Right ascension in degrees (ICRS), rounded to three decimal places. |
| **Dec** | Declination in degrees (ICRS), rounded to three decimal places. |
| **SIMBAD cone search (5′)** | Opens SIMBAD in a new tab, listing every object within 5 arcminutes of the position. It uses the same SIMBAD server, CDS or the Harvard mirror, that answered the search. |

The ring and popup stay attached to the object as you pan and zoom. They're hidden while the object is out of view and reappear when you pan back. Close the popup with its close button (✕). A new search replaces it.

If the [all-sky map couldn't load](sky-explorer.md#when-the-map-is-unavailable), a successful search has nothing to show the object on, so nothing visible happens. Instead, run a [cone search](#if-the-sky-map-is-unavailable) on the object's coordinates. SIMBAD runs on the same CDS servers as the map, so it may be unavailable at the same time.
If the [all-sky map couldn't load](sky-explorer.md#when-the-map-is-unavailable), a successful search has nothing to show the object on, so nothing visible happens. Instead, run a [cone search](#if-the-sky-map-is-unavailable) on the object's coordinates.

### Errors

Expand Down
6 changes: 4 additions & 2 deletions docs/sky-explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ To jump to a named object such as `M 31`, use [Search by catalog via SIMBAD](sea

### When the map is unavailable

Aladin Lite is loaded from the CDS servers, so the map depends on them being up. While it loads, the map area shows _Loading sky map..._. If it hasn't loaded after 15 seconds, or fails to load, the map area shrinks to a short message:
Aladin Lite is served with the app, so the map and its sources don't depend on the CDS servers. The background sky imagery comes from the CDS survey servers, or from ESA's mirror of them if CDS doesn't answer within a few seconds of the map loading. If neither is available, the background may be blank even though the sources are plotted. When that happens, a small notice at the top of the map says the survey server isn't responding (or, while a survey is still loading after 10 seconds, that it's still waiting on it). The notice can be dismissed, and clears itself once the server responds again.

> The sky map couldn't be loaded. The Aladin sky atlas service may be temporarily unavailable.
While Aladin loads, the map area shows _Loading sky map..._. If it hasn't loaded after 15 seconds, or fails to load (for example because the browser doesn't support WebGL2), the map area shrinks to a short message:

> The sky map couldn't be loaded. Check your connection, and that your browser supports WebGL2.

Click **Reload page** to try again.

Expand Down
2 changes: 1 addition & 1 deletion docs/source-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Switch the toggle back to **Unbinned** to return to individual measurements.

## Cross-matches

Lists catalog objects that have been matched to this source. Each name opens that object in the [CDS portal](https://portal.cds.unistra.fr/) in a new tab. If the source has no cross-matches, the section shows _No results_.
Lists catalog objects that have been matched to this source. Each name opens that object in [SIMBAD](https://simbad.cds.unistra.fr/simbad/) in a new tab. If a SIMBAD search earlier in the session had to fall back to the [Harvard mirror](https://simbad.cfa.harvard.edu/simbad/) because CDS didn't respond, the links go to the mirror instead. If the source has no cross-matches, the section shows _No results_.

## Nearby sources

Expand Down
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@tanstack/react-table": "^8.21.2",
"aladin-lite": "3.9.0-beta",
"form-data": "^4.0.6",
"plotly.js-dist-min": "^3.0.1",
"react": "^19.0.0",
Expand Down
14 changes: 12 additions & 2 deletions src/components/AladinViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useEffect, useRef, useState } from 'react';
import { SourceResponse } from '../types';
import { SOURCE_ALADIN_SURVEY } from '../configs/cds';
import {
releaseAladinWebGLContext,
useWebGLContextRecovery,
} from '../hooks/useWebGLContextRecovery';
import { WebGLContextLostOverlay } from './WebGLContextLostOverlay';
import { SkyMapStatusOverlay } from './SkyMapStatusOverlay';
import { SurveyStatusNotice } from './SurveyStatusNotice';
import { useSurveyStatus } from '../hooks/useSurveyStatus';
import { AladinLoadStatus, initAladin } from '../utils/initAladin';

type AladinViewerProps = {
Expand All @@ -18,6 +21,11 @@ export function AladinViewer({ source, nearbySources }: AladinViewerProps) {
const aladinInstanceRef = useRef<Aladin | null>(null);
// Bumped each time a viewer is (re)created, so the effects below re-apply to the new instance
const [viewerGeneration, setViewerGeneration] = useState(0);
const surveyStatus = useSurveyStatus(
aladinContainerRef,
aladinInstanceRef,
viewerGeneration
);
const [loadStatus, setLoadStatus] = useState<AladinLoadStatus>('loading');
// Aladin can't be torn down, so rather than rebuilding on our own after a lost context, show an
// overlay and let the user choose when to rebuild (see WebGLContextLostOverlay)
Expand Down Expand Up @@ -45,12 +53,13 @@ export function AladinViewer({ source, nearbySources }: AladinViewerProps) {
if (!el) return;

const stopInit = initAladin(
(A) => {
SOURCE_ALADIN_SURVEY,
(A, surveyUrl) => {
// Clear out the previous viewer's DOM when rebuilding after a lost context
el.replaceChildren();

aladinInstanceRef.current = A.aladin(el, {
survey: 'P/2MASS/color',
survey: surveyUrl,
fov: 5 / 60,
cooFrame: 'ICRSd',
projection: 'ZEA',
Expand Down Expand Up @@ -124,6 +133,7 @@ export function AladinViewer({ source, nearbySources }: AladinViewerProps) {
<div className="webgl-context-lost-host aladin-viewer-host">
<div ref={aladinContainerRef} className="aladin-viewer-container" />
<SkyMapStatusOverlay status={loadStatus} />
{loadStatus === 'ready' && <SurveyStatusNotice status={surveyStatus} />}
{isContextLost && <WebGLContextLostOverlay onReload={recover} />}
</div>
);
Expand Down
13 changes: 12 additions & 1 deletion src/components/AllSkyMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ import {
SO_FALLBACK_COLOR,
frequencyKey,
} from '../configs/socolors';
import { ALL_SKY_ALADIN_SURVEY } from '../configs/cds';
import { SkyExplorerProps } from './SkyExplorer';
import { SkySource } from '../types';
import { useWebGLContextRecovery } from '../hooks/useWebGLContextRecovery';
import { WebGLContextLostOverlay } from './WebGLContextLostOverlay';
import { SkyMapStatusOverlay } from './SkyMapStatusOverlay';
import { SurveyStatusNotice } from './SurveyStatusNotice';
import { useSurveyStatus } from '../hooks/useSurveyStatus';
import { AladinLoadStatus, initAladin } from '../utils/initAladin';
import { SkyTarget, useSkyTarget } from '../contexts/SkyTargetContext';
import { prefersReducedMotion } from '../utils/prefersReducedMotion';
Expand Down Expand Up @@ -163,6 +166,11 @@ function AllSkyMap({
}, [loadStatus, onLoadStatusChange]);
// Bumped each time a viewer is (re)created, so the catalog effects below re-apply to it
const [viewerGeneration, setViewerGeneration] = useState(0);
const surveyStatus = useSurveyStatus(
containerRef,
aladinInstanceRef,
viewerGeneration
);
// Aladin can't be torn down, so rather than rebuilding on our own after a lost context, show an
// overlay and let the user choose when to rebuild (see WebGLContextLostOverlay)
const {
Expand Down Expand Up @@ -320,7 +328,8 @@ function AllSkyMap({
if (!el) return;

const stopInit = initAladin(
(A) => {
ALL_SKY_ALADIN_SURVEY,
(A, surveyUrl) => {
// Clear out the previous viewer's DOM and any state tied to it when rebuilding after a
// lost context. Aladin Lite has no teardown API, so the old instance itself can't be freed.
el.replaceChildren();
Expand All @@ -332,6 +341,7 @@ function AllSkyMap({
? 360 / (window.innerWidth / height)
: 360 * (window.innerWidth / height);
const aladin = A.aladin(el, {
survey: surveyUrl,
fov,
cooFrame: 'equatorial',
projection: 'MOL',
Expand Down Expand Up @@ -705,6 +715,7 @@ function AllSkyMap({
}}
/>
<SkyMapStatusOverlay status={loadStatus} />
{loadStatus === 'ready' && <SurveyStatusNotice status={surveyStatus} />}
{isContextLost && <WebGLContextLostOverlay onReload={handleReload} />}
</div>
{hoveredSource && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/CrossMatchSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SIMBAD_BASE_LINK_OUT_URL } from '../configs/constants';
import { Link } from 'react-router';
import { buildSimbadObjectUrl } from '../utils/simbad';

type CrossMatchSectionProps = {
crossMatches?: { name: string }[];
Expand All @@ -16,7 +16,7 @@ export function CrossMatchSection({ crossMatches }: CrossMatchSectionProps) {
<Link
target="_blank"
className="link-outs"
to={SIMBAD_BASE_LINK_OUT_URL + m.name}
to={buildSimbadObjectUrl(m.name)}
>
{m.name}
</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/components/SkyMapStatusOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export function SkyMapStatusOverlay({ status }: SkyMapStatusOverlayProps) {
return (
<div className="webgl-context-lost-overlay" role="alert">
<p>
The sky map couldn't be loaded. The Aladin sky atlas service may be
temporarily unavailable.
The sky map couldn't be loaded. Check your connection, and that your
browser supports WebGL2.
</p>
<button
type="button"
Expand Down
39 changes: 39 additions & 0 deletions src/components/SurveyStatusNotice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useState } from 'react';
import { SurveyStatus } from '../hooks/useSurveyStatus';
import './styles/webgl-context-lost.css';

type SurveyStatusNoticeProps = {
status: SurveyStatus;
};

/** A small, dismissable notice over a sky map whose background survey is slow or unavailable (see
* useSurveyStatus). Unlike SkyMapStatusOverlay, it leaves the map usable, since our sources still
* plot without the background. Must be rendered inside the map's positioned host, like
* SkyMapStatusOverlay. */
export function SurveyStatusNotice({ status }: SurveyStatusNoticeProps) {
const [dismissedKind, setDismissedKind] = useState<
SurveyStatus['kind'] | null
>(null);
// Once the survey recovers, forget the dismissal so a later problem is shown again
if (status.kind === 'ok' && dismissedKind !== null) setDismissedKind(null);

if (status.kind === 'ok' || status.kind === dismissedKind) return null;

return (
<div className="sky-survey-notice" role="status">
<p>
{status.kind === 'slow'
? 'Still waiting on the sky survey server, so the background imagery may not appear. Sources are still shown.'
: `Background imagery isn't available because the sky survey server (${status.host}) isn't responding. Sources are still shown.`}
</p>
<button
type="button"
className="sky-survey-notice-dismiss"
aria-label="Dismiss"
onClick={() => setDismissedKind(status.kind)}
>
×
</button>
</div>
);
}
16 changes: 13 additions & 3 deletions src/components/UnassignedAladinMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import {
} from '../hooks/useWebGLContextRecovery';
import { WebGLContextLostOverlay } from './WebGLContextLostOverlay';
import { SkyMapStatusOverlay } from './SkyMapStatusOverlay';
import { SurveyStatusNotice } from './SurveyStatusNotice';
import { useSurveyStatus } from '../hooks/useSurveyStatus';
import { AladinSurvey } from '../configs/cds';
import { AladinLoadStatus, initAladin } from '../utils/initAladin';

type SkyPoint = { ra: number; dec: number };

type UnassignedAladinMapProps = {
sourceRa: number;
sourceDec: number;
survey: string;
survey: AladinSurvey;
beamRadiusArcmin: number;
measurements: SkyPoint[];
nearby: SkyPoint[];
Expand Down Expand Up @@ -63,6 +66,11 @@ export function UnassignedAladinMap({
const aladinInstanceRef = useRef<Aladin | null>(null);
// Bumped each time a viewer is (re)created, so the catalog-rebuild effect re-applies to it
const [viewerGeneration, setViewerGeneration] = useState(0);
const surveyStatus = useSurveyStatus(
containerRef,
aladinInstanceRef,
viewerGeneration
);
// Aladin can't be torn down, so rather than rebuilding on our own after a lost context, show an
// overlay and let the user choose when to rebuild (see WebGLContextLostOverlay)
const {
Expand Down Expand Up @@ -92,12 +100,13 @@ export function UnassignedAladinMap({
if (!el) return;

const stopInit = initAladin(
(A) => {
survey,
(A, surveyUrl) => {
// Clear out the previous viewer's DOM when rebuilding after a lost context; Aladin Lite
// has no teardown API, so the old instance itself can't be freed
el.replaceChildren();
const fov = Math.max((beamRadiusArcmin * 8) / 60, MIN_FOV_DEGREES);
const aladin = A.aladin(el, { survey, fov });
const aladin = A.aladin(el, { survey: surveyUrl, fov });
aladin.gotoRaDec(sourceRa, sourceDec);
aladinInstanceRef.current = aladin;
setLoadStatus('ready');
Expand Down Expand Up @@ -201,6 +210,7 @@ export function UnassignedAladinMap({
aria-label="Aladin-Lite sky map"
/>
<SkyMapStatusOverlay status={loadStatus} />
{loadStatus === 'ready' && <SurveyStatusNotice status={surveyStatus} />}
{isContextLost && <WebGLContextLostOverlay onReload={recover} />}
</div>
);
Expand Down
Loading
Loading