From 502f293c9a705ad727485b50bfcdf7be64a6b8bf Mon Sep 17 00:00:00 2001 From: JulienPeloton Date: Fri, 29 Mar 2024 15:20:11 +0100 Subject: [PATCH] Bump to SkyPortal b1588301cc36702234dbbc50db502fed870098ae --- extensions/skyportal/config.yaml.defaults | 4 ++ extensions/skyportal/skyportal/app_server.py | 2 + .../skyportal/skyportal/models/__init__.py | 1 + .../static/js/components/RecentSources.jsx | 72 ++++++++++++++----- skyportal | 2 +- 5 files changed, 64 insertions(+), 17 deletions(-) diff --git a/extensions/skyportal/config.yaml.defaults b/extensions/skyportal/config.yaml.defaults index 2d55a62..81db86b 100644 --- a/extensions/skyportal/config.yaml.defaults +++ b/extensions/skyportal/config.yaml.defaults @@ -615,6 +615,10 @@ misc: # consider a photometry point as a detection photometry_detection_threshold_nsigma: 3.0 + # whether or not the frontend show photometry validation information + # and if the backend allows adding/editing/deleting it + photometry_validation: True + # The airmass value below which to track hours for when plotting # on an object's observability page hours_below_airmass_threshold: 2.9 diff --git a/extensions/skyportal/skyportal/app_server.py b/extensions/skyportal/skyportal/app_server.py index fe497a4..1715597 100644 --- a/extensions/skyportal/skyportal/app_server.py +++ b/extensions/skyportal/skyportal/app_server.py @@ -105,6 +105,7 @@ ObservationPlanFieldsHandler, ObservationPlanManualRequestHandler, PhotometryHandler, + PhotometryValidationHandler, PhotStatHandler, PhotStatUpdateHandler, BulkDeletePhotometryHandler, @@ -435,6 +436,7 @@ def log_request(self, handler): ), (r'/api/objs(/[0-9A-Za-z-_\.\+]+)', ObjHandler), (r'/api/photometry(/[0-9]+)?', PhotometryHandler), + (r'/api/photometry(/[0-9]+)/validation', PhotometryValidationHandler), (r'/api/photometric_series(/[0-9]+)?', PhotometricSeriesHandler), (r'/api/summary_query', SummaryQueryHandler), (r'/api/sharing', SharingHandler), diff --git a/extensions/skyportal/skyportal/models/__init__.py b/extensions/skyportal/skyportal/models/__init__.py index 42875cb..ad1e9f8 100644 --- a/extensions/skyportal/skyportal/models/__init__.py +++ b/extensions/skyportal/skyportal/models/__init__.py @@ -27,6 +27,7 @@ from .observation_plan import * from .observing_run import * from .photometry import * +from .photometry_validation import * from .photometric_series import * from .phot_stat import * from .recurring_api import * diff --git a/extensions/skyportal/static/js/components/RecentSources.jsx b/extensions/skyportal/static/js/components/RecentSources.jsx index de1a2ab..ee6ba92 100644 --- a/extensions/skyportal/static/js/components/RecentSources.jsx +++ b/extensions/skyportal/static/js/components/RecentSources.jsx @@ -13,11 +13,11 @@ import makeStyles from "@mui/styles/makeStyles"; import DragHandleIcon from "@mui/icons-material/DragHandle"; import CircularProgress from "@mui/material/CircularProgress"; import Chip from "@mui/material/Chip"; - import TextField from "@mui/material/TextField"; import Autocomplete from "@mui/material/Autocomplete"; import SearchIcon from "@mui/icons-material/Search"; import InputAdornment from "@mui/material/InputAdornment"; + import { showNotification } from "baselayer/components/Notifications"; import { ra_to_hours, dec_to_dms } from "../units"; import * as profileActions from "../ducks/profile"; @@ -109,18 +109,13 @@ export const useSourceListStyles = makeStyles((theme) => ({ link: { color: theme.palette.warning.main, }, - quickViewContainer: { + bottomContainer: { display: "flex", flexDirection: "column", - width: "45%", + width: "100%", alignItems: "flex-end", justifyContent: "space-between", }, - quickViewButton: { - visibility: "hidden", - textAlign: "center", - display: "none", - }, sourceItemWithButton: { display: "flex", flexFlow: "column nowrap", @@ -131,10 +126,6 @@ export const useSourceListStyles = makeStyles((theme) => ({ backgroundColor: theme.palette.mode === "light" ? theme.palette.secondary.light : null, }, - "&:hover $quickViewButton": { - visibility: "visible", - display: "block", - }, }, confirmed: { background: "#03c04a!important", @@ -187,6 +178,8 @@ export const useSourceListStyles = makeStyles((theme) => ({ const defaultPrefs = { maxNumSources: "5", + includeSitewideSources: false, + displayTNS: true, }; function containsSpecialCharacters(str) { @@ -285,7 +278,12 @@ const RecentSourcesSearchbar = ({ styles }) => { ); }; -const RecentSourcesList = ({ sources, styles, search = false }) => { +const RecentSourcesList = ({ + sources, + styles, + search = false, + displayTNS = true, +}) => { const [thumbnailIdxs, setThumbnailIdxs] = useState({}); const { taxonomyList } = useSelector((state) => state.taxonomies); @@ -457,7 +455,7 @@ const RecentSourcesList = ({ sources, styles, search = false }) => { {source.resaved && (Source was re-saved)} -
+
{dayjs().to(dayjs.utc(`${source.created_at}Z`))} @@ -479,6 +477,38 @@ const RecentSourcesList = ({ sources, styles, search = false }) => { className={styles.quickViewButton} />
+ {displayTNS && source?.tns_name?.length > 0 && ( +
+ { + window.open( + `https://www.wis-tns.org/object/${ + source.tns_name.trim().includes(" ") + ? source.tns_name.split(" ")[1] + : source.tns_name + }`, + "_blank", + ); + }} + /> +
+ )}
@@ -525,11 +555,13 @@ RecentSourcesList.propTypes = { ), styles: PropTypes.shape(Object).isRequired, search: PropTypes.bool, + displayTNS: PropTypes.bool, }; RecentSourcesList.defaultProps = { sources: undefined, search: false, + displayTNS: true, }; const RecentSources = ({ classes }) => { @@ -539,10 +571,14 @@ const RecentSources = ({ classes }) => { const styles = useSourceListStyles({ invertThumbnails }); const { recentSources } = useSelector((state) => state.recentSources); - const recentSourcesPrefs = + const prefs = useSelector((state) => state.profile.preferences.recentSources) || defaultPrefs; + const recentSourcesPrefs = prefs + ? { ...defaultPrefs, ...prefs } + : defaultPrefs; + return (
@@ -560,7 +596,11 @@ const RecentSources = ({ classes }) => { />
- +
); diff --git a/skyportal b/skyportal index 953dede..b158830 160000 --- a/skyportal +++ b/skyportal @@ -1 +1 @@ -Subproject commit 953dede70f2876259c9aff43ab3d1cab2154d319 +Subproject commit b1588301cc36702234dbbc50db502fed870098ae