From a979f3eba383c3893ce8754054739b9d224edd21 Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Thu, 5 Oct 2023 20:26:47 +0200 Subject: [PATCH 01/23] Break OWM Report into its own component and place it on home and enclosure tabs TODO: Still need to cache the value in the vuex store for an hour max, and fetch it if it exists. Also conditionally render OWM report on home tab based on whether user is admin --- .../InstrumentControls/Enclosure.vue | 42 ++------------ src/components/sitepages/SiteHome.vue | 9 ++- src/components/status/OWMReport.vue | 58 +++++++++++++++++++ 3 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 src/components/status/OWMReport.vue diff --git a/src/components/InstrumentControls/Enclosure.vue b/src/components/InstrumentControls/Enclosure.vue index ba586ec6..10e59e57 100644 --- a/src/components/InstrumentControls/Enclosure.vue +++ b/src/components/InstrumentControls/Enclosure.vue @@ -379,17 +379,7 @@
-
- OWM Report -
{{ owm_report }}
-
- -
- (alternate method) show OWM Status -
- -
{{ owm_report }}
-
+
{ - this.owm_report = JSON.parse(response.data.status.owm_report) - }).catch(() => { - this.owm_report = 'OWM report unavailable' - }) - }, - showOwmStatus () { - this.owmModalVisible = true - } }, computed: { diff --git a/src/components/sitepages/SiteHome.vue b/src/components/sitepages/SiteHome.vue index 36a4c5a8..2bf4a115 100644 --- a/src/components/sitepages/SiteHome.vue +++ b/src/components/sitepages/SiteHome.vue @@ -52,6 +52,9 @@
+ + +
@@ -60,14 +63,16 @@ import { mapGetters } from 'vuex' import { commands_mixin } from '../../mixins/commands_mixin' import { user_mixin } from '../../mixins/user_mixin' import SiteEventsModal from '@/components/SiteEventsModal' +import OWMReport from '@/components/status/OWMReport' export default { name: 'SiteHome', props: ['sitecode'], mixins: [commands_mixin, user_mixin], components: { - SiteEventsModal - }, + SiteEventsModal, + OWMReport +}, computed: { ...mapGetters('site_config', [ 'site_latitude', diff --git a/src/components/status/OWMReport.vue b/src/components/status/OWMReport.vue new file mode 100644 index 00000000..54c95a96 --- /dev/null +++ b/src/components/status/OWMReport.vue @@ -0,0 +1,58 @@ + + + From 9104c80cb2945e1b15868cb97147605900612823 Mon Sep 17 00:00:00 2001 From: Tim Beccue Date: Fri, 6 Oct 2023 22:10:08 -0400 Subject: [PATCH 02/23] Add mutation to fix minor vuex bug --- src/store/modules/images.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/modules/images.js b/src/store/modules/images.js index 9bd3001e..83cbe81b 100644 --- a/src/store/modules/images.js +++ b/src/store/modules/images.js @@ -200,11 +200,10 @@ const actions = { // Reassigning value of current_image to new_image // If a user takes smart stack photos and they select the image as it's updating, // then the selected image (i.e. the thumbnail with the surrounding yellow border) keeps the yellow border - let current_image = state.current_image - const current_image_SMARTSTK = current_image.header && current_image.header.SMARTSTK + const current_image_SMARTSTK = state.current_image.header && state.current_image.header.SMARTSTK const new_image_SMARTSTK = new_image.header && new_image.header.SMARTSTK if (current_image_SMARTSTK && current_image_SMARTSTK !== 'no' && current_image_SMARTSTK === new_image_SMARTSTK) { - current_image = new_image + commit('setCurrentImage', new_image) } // We don't have a toggle implemented yet. From eadd47fb12c22bf3728cfeb688f237e2686ac6a0 Mon Sep 17 00:00:00 2001 From: Carolina Capetillo Date: Mon, 9 Oct 2023 16:22:34 -0700 Subject: [PATCH 03/23] changed b-input to b-numberinput under the projects tab > exposures so that we can add a min-step of 0.001 and keep the step of 0.1 or 1. Also added styling --- src/components/projects/CreateProjectForm.vue | 86 ++++++++++++------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/src/components/projects/CreateProjectForm.vue b/src/components/projects/CreateProjectForm.vue index 14cd5f66..94ea17da 100644 --- a/src/components/projects/CreateProjectForm.vue +++ b/src/components/projects/CreateProjectForm.vue @@ -365,10 +365,10 @@ - - -
@@ -874,6 +880,7 @@ export default { maxHeightDegrees: 4.5, degreesToArcminutes: 60, conditionalStep: 0.1, + keyDownTime: null, site: this.sitecode, warn: { project_name: false, @@ -1337,33 +1344,54 @@ export default { gap: 1em; margin-bottom: 1em; } +.b-numberinput { + position: relative; +} .degree-input::after { - content: '°'; - position: absolute; - top: 50%; - left: 40%; - transform: translateY(-50%); - pointer-events: none; - color: white; + content: "°"; + position: absolute; + right: 35%; + top: 50%; + transform: translateY(-50%); + pointer-events: none; + z-index: 1; } - .arcmin-input::after { - content: "'"; - position: absolute; - top: 50%; - left: 40%; - transform: translateY(-50%); - pointer-events: none; - color: white; + content: "'"; + position: absolute; + right: 35%; + top: 50%; + transform: translateY(-50%); + pointer-events: none; + z-index: 1; } - .angle-input::after { content: '°'; position: absolute; top: 50%; - left: 40%; + left: 63%; transform: translateY(-50%); pointer-events: none; color: white; + z-index: 1; +} + + + From fda68870113a5c32c7d71e66d949fe698e76574c Mon Sep 17 00:00:00 2001 From: Carolina Capetillo Date: Tue, 10 Oct 2023 09:03:45 -0700 Subject: [PATCH 04/23] removed @input from width, height, and angle mosaic fields and instead it's now being binded by :v-model --- src/components/projects/CreateProjectForm.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/projects/CreateProjectForm.vue b/src/components/projects/CreateProjectForm.vue index 94ea17da..67ea64ff 100644 --- a/src/components/projects/CreateProjectForm.vue +++ b/src/components/projects/CreateProjectForm.vue @@ -368,6 +368,7 @@ style="width: 150px;" >
From 0079062402b91b294a19ddceb0a2ffac0e8e33d6 Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Tue, 10 Oct 2023 09:55:10 -0700 Subject: [PATCH 05/23] Not working - check in initial attempted fix for site navigation The intention here is to use the vuex store to fetch the list of available sites and check that the sitecode url param is valid before allowing navigation to that page. This isn't currently working, however, as the store getter is returning undefined. --- src/router.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/router.js b/src/router.js index 0fbdc978..197cebae 100644 --- a/src/router.js +++ b/src/router.js @@ -2,6 +2,7 @@ import Vue from 'vue' import VueRouter from 'vue-router' +import store from '@/store/index' import Home from './views/Home.vue' import Profile from './views/Profile.vue' @@ -21,6 +22,8 @@ import UserData from './views/UserData.vue' import NotFound from './views/NotFound' import Remotehq from './views/Remotehq' +import _ from 'lodash' + Vue.use(VueRouter) const router = new VueRouter({ @@ -47,6 +50,11 @@ const router = new VueRouter({ { path: '/cr/:sitecode', name: 'controlroom', + beforeEnter: (to, from, next) => { + if (!_.includes(store.getters['site_config/available_sites'], to.params.sitecode)) { + return next('/') + } + }, component: ControlRoom, props: route => { return { @@ -57,6 +65,11 @@ const router = new VueRouter({ { path: '/site/:sitecode/:subpage', name: 'site', + beforeEnter: (to, from, next) => { + if (!_.includes(store.getters['site_config/available_sites'], to.params.sitecode)) { + return next('/') + } + }, component: Site, props: route => { return { From 5fd71e31e7ce7aa03cee8e53d04beb475ee328ff Mon Sep 17 00:00:00 2001 From: Carolina Capetillo Date: Tue, 10 Oct 2023 11:57:00 -0700 Subject: [PATCH 06/23] reroutes to home when user enters a nonexistent site --- src/router.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/router.js b/src/router.js index 197cebae..b4928dad 100644 --- a/src/router.js +++ b/src/router.js @@ -54,6 +54,7 @@ const router = new VueRouter({ if (!_.includes(store.getters['site_config/available_sites'], to.params.sitecode)) { return next('/') } + next() }, component: ControlRoom, props: route => { @@ -69,6 +70,7 @@ const router = new VueRouter({ if (!_.includes(store.getters['site_config/available_sites'], to.params.sitecode)) { return next('/') } + next() }, component: Site, props: route => { From 3931c98f1235c0d433f8043e280bc75b8138118f Mon Sep 17 00:00:00 2001 From: Lloyd Dakin Date: Thu, 12 Oct 2023 13:07:52 -0700 Subject: [PATCH 07/23] add userIsAdmin check for OWM on Homepage --- src/components/sitepages/SiteHome.vue | 7 +++++-- src/components/status/OWMReport.vue | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/sitepages/SiteHome.vue b/src/components/sitepages/SiteHome.vue index 2bf4a115..971d00ac 100644 --- a/src/components/sitepages/SiteHome.vue +++ b/src/components/sitepages/SiteHome.vue @@ -53,7 +53,7 @@
- +
@@ -78,7 +78,10 @@ export default { 'site_latitude', 'site_longitude', 'site_name' - ]) + ]), + userIsAdmin () { + return this.$store.state.user_data.userIsAdmin + } } } diff --git a/src/components/status/OWMReport.vue b/src/components/status/OWMReport.vue index 54c95a96..65d057c8 100644 --- a/src/components/status/OWMReport.vue +++ b/src/components/status/OWMReport.vue @@ -43,8 +43,15 @@ export default { methods: { // TODO: Need to cache this getOwmReport () { + // call to cache to check if we have the report already + + // load report from store if we do + + // call the api if we don't const endpoint = this.$store.state.api_endpoints.status_endpoint + '/' + this.wema_name + '/owm_report' axios.get(endpoint).then(response => { + // cache the report in store for only 1 hour + this.owmReport = JSON.parse(response.data.status.owm_report) }).catch(() => { this.owmReport = 'OWM report unavailable' From 69ee63520d24185af06942f5cb6b4aa32e398fd8 Mon Sep 17 00:00:00 2001 From: Lloyd Dakin Date: Fri, 13 Oct 2023 15:52:53 -0700 Subject: [PATCH 08/23] Moved api call to store --- src/components/status/OWMReport.vue | 19 ++++--------------- src/store/modules/sitestatus/index.js | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/components/status/OWMReport.vue b/src/components/status/OWMReport.vue index 65d057c8..57bcd845 100644 --- a/src/components/status/OWMReport.vue +++ b/src/components/status/OWMReport.vue @@ -15,8 +15,8 @@ + diff --git a/src/components/ImageDisplay/ImageInfoBar.vue b/src/components/ImageDisplay/ImageInfoBar.vue index f3e7c392..f089f9a2 100644 --- a/src/components/ImageDisplay/ImageInfoBar.vue +++ b/src/components/ImageDisplay/ImageInfoBar.vue @@ -1,39 +1,46 @@ @@ -63,11 +67,51 @@ export default { required: true } }, + data () { + return { + fwhm: '', + sepsky: '', + smartstackLength: 1, // Total number of images for this smartstack + smartstackNumber: 0 // Value of n for "this image is the nth smartstack image", 0-indexed + } + }, - methods: { + filters: { dateToReadable (date) { return moment.utc(date).format('YYYY-MM-DD HH:mm UTC') - }, + } + }, + + watch: { + current_image () { + // Get header for extra infobar values + this.$store.dispatch('images/loadCurrentImageFitsHeader').then(header => { + // Round appropriately + if ('FWHMASEC' in header) { + this.fwhm = Number(header.FWHMASEC).toFixed(2) + } else { + this.fwhm = 'n/a' + } + if ('SEPSKY' in header) { + this.sepsky = parseInt(header.SEPSKY) + } else { + this.sepsky = 'n/a' + } + if ('SSTKLEN' in header) { + this.smartstackLength = parseInt(header.SSTKLEN) + } else { + this.smartstackLength = 1 + } + if ('SSTKNUM' in header) { + this.smartstackNumber = parseInt(header.SSTKNUM) + } else { + this.smartstackNumber = 0 + } + }) + } + }, + + methods: { dateToUnix (date) { return (new Date(date).getTime() / 1000).toFixed(0) }, @@ -80,64 +124,6 @@ export default { }, computed: { - site () { - return this.current_image.site - }, - exposure () { - // Account for the cumulative exposure time represented in a smartstack by multiplying the - // single frame exposure time by the number of frames being represented. - // - // If the image is not part of a smartstack, it is treated like a smartstack with size 1, so the math still works. - const frameExposureTime = Number(this.current_image.exposure_time) - const framesInSmartstack = this.smartstackNumber - const cumulativeExposure = (framesInSmartstack + 1) * frameExposureTime - return cumulativeExposure - }, - filter () { - return this.current_image.filter_used - }, - airmass () { - return this.current_image.airmass - }, - altitude () { - return this.truncateDecimalString(this.current_image.altitude, 4) - }, - obstime () { - return this.dateToReadable(this.current_image.capture_date) - }, - filename () { - return this.current_image.base_filename - }, - fwhm () { - if (this.current_image.header && 'FWHMASEC' in this.current_image.header) { - return Number(this.current_image.header.FWHMASEC).toFixed(2) - } else { - return 'n/a' - } - }, - sepsky () { - if (this.current_image.header && 'SEPSKY' in this.current_image.header) { - return parseInt(this.current_image.header.SEPSKY) - } else { - return 'n/a' - } - }, - // Total number of images for this smartstack - smartstackLength () { - if (this.current_image.header && 'SSTKLEN' in this.current_image.header) { - return parseInt(this.current_image.header.SSTKLEN) - } else { - return 1 - } - }, - // Value of n for "this image is the nth smartstack image", 0-indexed - smartstackNumber () { - if (this.current_image.header && 'SSTKNUM' in this.current_image.header) { - return parseInt(this.current_image.header.SSTKNUM) - } else { - return 0 - } - }, smartstackProgress () { if (this.smartstackLength == 1) { return 'n/a' @@ -169,12 +155,11 @@ export default { color: #aaa; background-color: #1e2223; display: grid; - grid-template-rows: 1fr 1fr 1fr 1fr; - grid-template-columns: 1fr 1.5fr 1fr 1fr; - grid-template-areas: 'site exptime ra dec' - 'filter-used obstime airmass altitude' - 'smartstack fwhm sepsky .' - 'filename filename filename filename'; + grid-template-rows: 1fr 1fr 1fr; + grid-template-columns: 1fr 2fr 0.5fr 1fr 1fr; + grid-template-areas: 'site exptime . ra dec' + 'filter-used obstime . airmass altitude' + 'smartstack filename filename fwhm sepsky'; grid-column-gap: 10px; padding: 1px 3px; font-size: 9pt; @@ -186,8 +171,8 @@ export default { .filter-used { grid-area: filter-used; } .smartstack { grid-area: smartstack; } .exptime { grid-area: exptime; } - .ra { grid-area: ra; display: flex; } - .dec { grid-area: dec; display: flex } + .ra { grid-area: ra; } + .dec { grid-area: dec; } .airmass { grid-area: airmass; } .altitude { grid-area: altitude; } .obstime { grid-area: obstime; } diff --git a/src/components/sitepages/SiteData.vue b/src/components/sitepages/SiteData.vue index 002a7905..0f1d9fb7 100644 --- a/src/components/sitepages/SiteData.vue +++ b/src/components/sitepages/SiteData.vue @@ -505,7 +505,7 @@ $tabs-toggle-link-border-width: 10px; @import "@/style/_variables.scss"; $site-data-wrapper-padding: 1em; -$infobar-height: 80px; +$infobar-height: 70px; $thumbnails-height: 100px; $controls-height: 55px; @@ -570,7 +570,7 @@ $visible-content-height: calc(100vh - #{$top-bottom-height + #{(2 * $site-data-w grid-area: image; width: 100%; //display: grid; // for some reason this breaks the layout when loading lots of images - grid-template-rows: auto auto auto 1fr; + grid-template-rows: $infobar-height auto auto auto 1fr; grid-template-columns: auto; overflow: hidden; From 42e8b8a5a3b8e169756dfdc66401dcdbe77bf9e0 Mon Sep 17 00:00:00 2001 From: Carolina Capetillo Date: Mon, 23 Oct 2023 12:29:14 -0700 Subject: [PATCH 23/23] changed mosaic field values of maxheightdegrees and maxwidthdegrees --- src/components/projects/CreateProjectForm.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/projects/CreateProjectForm.vue b/src/components/projects/CreateProjectForm.vue index a06c62df..c72e9019 100644 --- a/src/components/projects/CreateProjectForm.vue +++ b/src/components/projects/CreateProjectForm.vue @@ -875,9 +875,9 @@ export default { 'Small sq.', '71%', '50%', '35%', '25%', '18%', '12.5%', '9%', '6%' ], minWidthDegrees: 0.0, - maxWidthDegrees: 4.5, + maxWidthDegrees: 12.0, minHeightDegrees: 0.0, - maxHeightDegrees: 4.5, + maxHeightDegrees: 12.0, degreesToArcminutes: 60, conditionalStep: 0.1, site: this.sitecode,