Skip to content

Commit

Permalink
Merge pull request #71 from LCOGT/feature/warning
Browse files Browse the repository at this point in the history
Feature/warning
  • Loading branch information
capetillo authored Sep 17, 2024
2 parents 1e31795 + 76ceff0 commit dbd72b4
Show file tree
Hide file tree
Showing 9 changed files with 1,515 additions and 1,905 deletions.
3,326 changes: 1,479 additions & 1,847 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.25.0",
"jsdom": "^25.0.0",
"vite": "^5.4.3",
"vitest": "^2.0.5"
},
"eslintConfig": {
Expand Down
49 changes: 0 additions & 49 deletions src/components/RealTimeInterface/RealTimeGallery.vue

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/RealTimeInterface/SessionImageCapture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ const sendStopCommand = async () => {
}
onMounted(() => {
imagesDone.value = false
fetchTelescopeStatus()
pollingInterval = setInterval(fetchTelescopeStatus, 1000)
anim.value.goToAndPlay(0, true)
})
onUnmounted(() => {
clearInterval(pollingInterval)
imagesDone.value = false
})
const setCameraState = computed(() => ({
Expand Down
27 changes: 23 additions & 4 deletions src/components/RealTimeInterface/SessionStarted.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const fieldOfView = ref(1.0)
const targeterror = ref(false)
const targeterrorMsg = ref('')
const loading = ref(false)
const exposureError = ref('')
const isExposureTimeValid = ref(true)
const currentSession = sessionsStore.currentSession
const siteInfo = sites[currentSession.site]
Expand Down Expand Up @@ -93,10 +95,14 @@ const resetValues = () => {
exposureCount.value = 1
selectedFilter.value = ''
fieldOfView.value = 1.0
loading.value = false
}
const sendGoCommand = async () => {
loading.value = true
exposureError.value = ''
isExposureTimeValid.value = true
const token = sessionsStore.getTokenForCurrentSession
const headers = {
'Content-Type': 'application/json',
Expand All @@ -109,8 +115,6 @@ const sendGoCommand = async () => {
dec: Number(dec.value),
expFilter: exposFilter,
expTime: exposTime,
// expFilter: ['rp'],
// expTime: [30],
name: targetName.value,
ra: Number(ra.value) / 15,
proposalId: sessionsStore.currentSession.proposal,
Expand All @@ -128,7 +132,15 @@ const sendGoCommand = async () => {
body: requestBody,
header: headers,
successCallback: resetValues,
failCallback: (error) => { console.error('API failed with error', error) }
failCallback: (error) => {
loading.value = false
if (error?.errors?.expTime) {
isExposureTimeValid.value = false
exposureError.value = error.errors.expTime[0]
} else {
console.error('API failed with error', error)
}
}
})
}
Expand Down Expand Up @@ -156,10 +168,16 @@ function updateRenderGallery (value) {
}
const incompleteSelection = computed(() => {
return exposureTime.value === '' || exposureCount.value === '' || selectedFilter.value === ''
return exposureTime.value === '' || exposureCount.value === '' || selectedFilter.value === '' || isExposureTimeValid.value === false
})
watch(exposureTime, (newTime) => {
isExposureTimeValid.value = true
exposureError.value = ''
})
onMounted(() => {
loading.value = false
getFilterList()
})
Expand Down Expand Up @@ -250,6 +268,7 @@ onMounted(() => {
<p class="control is-expanded">
<input id="exposureTime" type="number" class="input" v-model="exposureTime" placeholder="Seconds">
</p>
<p class="help is-danger" v-if="!isExposureTimeValid">{{ exposureError }}</p>
</div>
<div class="times">
<FontAwesomeIcon icon="fa-solid fa-xmark" />
Expand Down
1 change: 0 additions & 1 deletion src/components/Views/RealTimeInterfaceView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ onMounted(async () => {
loading.value = true
// initiate the handshake and retrieve a token prior to polling
await sessionsStore.fetchSessionToken()
sessionsStore.startPolling()
countdown()
const checkTimeRemaining = setInterval(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/utils/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export function createTestStores () {
userDataStore.authToken = 'mock-token'
configurationStore.thumbnailArchiveUrl = 'http://mock-api.com/'
configurationStore.observationPortalUrl = 'http://mock-api.com/'
configurationStore.rtiBridgeUrl = 'http://mock-api.com/'
configurationStore.targetNameUrl = 'http://mock-api.com/'
configurationStore.configdbUrl = 'http://mock-api.com/'

return {
pinia,
Expand Down
5 changes: 4 additions & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export default defineConfig({
plugins: [vue()],
test: {
environment: 'jsdom',
globals: true
globals: true,
coverage: {
reporter: ['text', 'json', 'html']
}
},
resolve: {
alias: {
Expand Down
6 changes: 3 additions & 3 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ module.exports = {
css: {
loaderOptions: {
scss: {
additionalData: `@import '~bulma';`
additionalData: '@import \'~bulma\';'
}
}
},
pages: {
index: {
// entry for the page
entry: 'src/main.js',
title: 'Observe @ Photon Ranch',
},
title: 'Observe @ Photon Ranch'
}
}
}

0 comments on commit dbd72b4

Please sign in to comment.