From 36c5db90fb47a8ee480509aac8b3640910051ab1 Mon Sep 17 00:00:00 2001 From: Lloyd Dakin Date: Wed, 2 Oct 2024 20:23:02 -0700 Subject: [PATCH 1/2] use attribute operation_progress due to name change in backend hackathon feedback PR --- src/components/DataSession/OperationPipeline.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/DataSession/OperationPipeline.vue b/src/components/DataSession/OperationPipeline.vue index 79959ec..55ec348 100644 --- a/src/components/DataSession/OperationPipeline.vue +++ b/src/components/DataSession/OperationPipeline.vue @@ -45,14 +45,11 @@ async function pollOperationCompletion(operationID) { // Success Callback for checking operation status const updateOperationStatus = (response) => { if(response){ - const operationStatus = response.status - const percentCompletion = response.percent_completion - - switch(operationStatus){ + switch(response.status){ case 'PENDING': break case 'IN_PROGRESS': - operationPercentages.value[operationID] = percentCompletion * DEC_TO_PERCENT + operationPercentages.value[operationID] = response.operation_progress * DEC_TO_PERCENT break case 'COMPLETED': operationPercentages.value[operationID] = COMPLETE_PERCENT @@ -66,7 +63,7 @@ async function pollOperationCompletion(operationID) { clearPolling(operationID) break default: - console.error('Unknown Operation Status:', operationStatus) + console.error('Unknown Operation Status:', response.status) } } else{ From cd4ba9ded9f8fa68faccfe329594098b17568b5a Mon Sep 17 00:00:00 2001 From: Lloyd Dakin Date: Thu, 3 Oct 2024 09:39:32 -0700 Subject: [PATCH 2/2] add alert time stamp and watch for alerts --- src/components/Global/AlertToast.vue | 2 +- src/stores/alerts.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Global/AlertToast.vue b/src/components/Global/AlertToast.vue index 6bf438a..c7a8682 100644 --- a/src/components/Global/AlertToast.vue +++ b/src/components/Global/AlertToast.vue @@ -5,7 +5,7 @@ import { useAlertsStore } from '../../stores/alerts' const alertStore = useAlertsStore() const showAlert = ref(false) -watch(() => alertStore.alertText, () => { +watch(() => alertStore.alertTimeStamp, () => { showAlert.value = true setTimeout(() => { showAlert.value = false diff --git a/src/stores/alerts.js b/src/stores/alerts.js index da0c60c..ebf7020 100644 --- a/src/stores/alerts.js +++ b/src/stores/alerts.js @@ -8,16 +8,16 @@ import { defineStore } from 'pinia' export const useAlertsStore = defineStore('alerts', { state() { return{ - // The type of alert to display ('success', 'error', 'warning', 'info') - alertType: 'warning', - // The text to display in the alert - alertText: 'default alert text', + alertType: 'default', // alert type to display ('success', 'error', 'warning', 'info', 'loading') + alertText: 'default alert text', // text displayed in alert + alertTimeStamp: '0' // timestamp of the last alert, used for watching in AlertToast.vue } }, actions: { setAlert(type, text, prefix = '') { this.alertType = type this.alertText = prefix ? prefix + ' ' + text : text + this.alertTimeStamp = Date.now() } } })