Skip to content

Commit

Permalink
Bump to SkyPortal b1588301cc36702234dbbc50db502fed870098ae
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPeloton committed Mar 29, 2024
1 parent f5d7e0d commit 502f293
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 17 deletions.
4 changes: 4 additions & 0 deletions extensions/skyportal/config.yaml.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions extensions/skyportal/skyportal/app_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
ObservationPlanFieldsHandler,
ObservationPlanManualRequestHandler,
PhotometryHandler,
PhotometryValidationHandler,
PhotStatHandler,
PhotStatUpdateHandler,
BulkDeletePhotometryHandler,
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions extensions/skyportal/skyportal/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
72 changes: 56 additions & 16 deletions extensions/skyportal/static/js/components/RecentSources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -187,6 +178,8 @@ export const useSourceListStyles = makeStyles((theme) => ({

const defaultPrefs = {
maxNumSources: "5",
includeSitewideSources: false,
displayTNS: true,
};

function containsSpecialCharacters(str) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -457,7 +455,7 @@ const RecentSourcesList = ({ sources, styles, search = false }) => {
</div>
{source.resaved && <span>(Source was re-saved)</span>}
</div>
<div className={styles.quickViewContainer}>
<div className={styles.bottomContainer}>
<span style={{ textAlign: "right" }}>
{dayjs().to(dayjs.utc(`${source.created_at}Z`))}
</span>
Expand All @@ -479,6 +477,38 @@ const RecentSourcesList = ({ sources, styles, search = false }) => {
className={styles.quickViewButton}
/>
</div>
{displayTNS && source?.tns_name?.length > 0 && (
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "flex-end",
}}
>
<Chip
label={source.tns_name}
color={
source.tns_name.includes("SN")
? "primary"
: "default"
}
size="small"
style={{
fontWeight: "bold",
}}
onClick={() => {
window.open(
`https://www.wis-tns.org/object/${
source.tns_name.trim().includes(" ")
? source.tns_name.split(" ")[1]
: source.tns_name
}`,
"_blank",
);
}}
/>
</div>
)}
</div>
</div>
</div>
Expand Down Expand Up @@ -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 }) => {
Expand All @@ -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 (
<Paper elevation={1} className={classes.widgetPaperFillSpace}>
<div className={classes.widgetPaperDiv}>
Expand All @@ -560,7 +596,11 @@ const RecentSources = ({ classes }) => {
/>
</div>
</div>
<RecentSourcesList sources={recentSources} styles={styles} />
<RecentSourcesList
sources={recentSources}
styles={styles}
displayTNS={recentSourcesPrefs?.displayTNS !== false}
/>
</div>
</Paper>
);
Expand Down
2 changes: 1 addition & 1 deletion skyportal
Submodule skyportal updated 39 files
+41 −0 alembic/versions/430a8a5f3c18_tns_photometry_options.py
+73 −0 alembic/versions/af970c6b6b3c_photometry_validation.py
+1 −1 baselayer
+4 −0 config.yaml.defaults
+49 −18 services/tns_retrieval_queue/tns_retrieval_queue.py
+280 −113 services/tns_submission_queue/tns_submission_queue.py
+2 −0 skyportal/app_server.py
+1 −0 skyportal/handlers/api/__init__.py
+2 −0 skyportal/handlers/api/config_handler.py
+28 −6 skyportal/handlers/api/internal/recent_sources.py
+1 −0 skyportal/handlers/api/internal/source_views.py
+43 −0 skyportal/handlers/api/photometry.py
+332 −0 skyportal/handlers/api/photometry_validation.py
+6 −0 skyportal/handlers/api/recurring_api.py
+9 −0 skyportal/handlers/api/source.py
+62 −0 skyportal/handlers/api/tns.py
+1 −0 skyportal/models/__init__.py
+7 −0 skyportal/models/photometry.py
+60 −0 skyportal/models/photometry_validation.py
+17 −4 skyportal/models/tns.py
+7 −0 skyportal/models/user_token.py
+126 −0 skyportal/tests/api/candidates_sources_events/test_photometry.py
+17 −3 skyportal/tests/api/test_recurring_api.py
+1 −20 skyportal/tests/frontend/sources_and_observingruns_etc/test_recent_sources.py
+0 −32 skyportal/tests/frontend/test_plotly_plots_frontend.py
+108 −15 skyportal/utils/tns.py
+5 −1 static/js/components/PhotometryPlot.jsx
+176 −42 static/js/components/PhotometryTable.jsx
+364 −0 static/js/components/PhotometryValidation.jsx
+57 −30 static/js/components/RecentSources.jsx
+195 −139 static/js/components/RecurringAPIPage.jsx
+1 −5 static/js/components/Source.jsx
+46 −7 static/js/components/SpectraPlot.jsx
+116 −24 static/js/components/TNSATForm.jsx
+11 −0 static/js/components/TNSRobotSubmissionsPage.jsx
+75 −9 static/js/components/TNSRobotsPage.jsx
+52 −33 static/js/components/TopSources.jsx
+1 −0 static/js/ducks/photometry.js
+24 −0 static/js/ducks/photometry_validation.js

0 comments on commit 502f293

Please sign in to comment.