Skip to content

Commit

Permalink
web/satellite: close upload pop-up
Browse files Browse the repository at this point in the history
This change closes that upload pop up when a different project or bucket is entered into, since clicking on objects in the pop-up that don't belong to the current project/bucket will result in an error.

Change-Id: I6a929566f0cee97fcf2e230e5a0453b4ebf29a4a
  • Loading branch information
wilfred-asomanii authored and Storj Robot committed Dec 18, 2023
1 parent cf98c13 commit bb4c19f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import { useNotify } from '@/utils/hooks';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
import { useConfigStore } from '@/store/modules/configStore';
import { MODALS } from '@/utils/constants/appStatePopUps';
import { useProjectsStore } from '@/store/modules/projectsStore';
import { useBucketsStore } from '@/store/modules/bucketsStore';
import UploadItem from '@/components/modals/objectUpload/UploadItem.vue';
Expand All @@ -57,7 +59,9 @@ import FailedIcon from '@/../static/images/modals/objectUpload/failed.svg';
const obStore = useObjectBrowserStore();
const appStore = useAppStore();
const bucketsStore = useBucketsStore();
const notify = useNotify();
const projectsStore = useProjectsStore();
const config = useConfigStore();
const isExpanded = ref<boolean>(false);
Expand Down Expand Up @@ -230,6 +234,20 @@ function startInterval(): void {
interval.value = int;
}
watch(() => projectsStore.state.selectedProject, (value, oldValue) => {
if (value.id === oldValue.id || !appStore.state.isUploadingModal) {
return;
}
closeModal();
});
watch(() => bucketsStore.state.fileComponentBucketName, (value, oldValue) => {
if (value === oldValue || !appStore.state.isUploadingModal) {
return;
}
closeModal();
});
watch(() => objectsInProgress.value.length, () => {
if (!interval.value) {
startDate.value = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<v-expansion-panel-title color="">
<span>{{ statusLabel }}</span>
<template v-if="isClosable" #actions>
<v-icon icon="mdi-close" @click="v1AppStore.setUploadingModal(false)" />
<v-icon icon="mdi-close" @click="closeDialog" />
</template>
</v-expansion-panel-title>
<v-progress-linear
Expand Down Expand Up @@ -268,13 +268,32 @@ function startInterval(): void {
interval.value = int;
}
function closeDialog(): void {
obStore.clearUploading();
v1AppStore.setUploadingModal(false);
}
watch(() => objectsInProgress.value.length, () => {
if (!interval.value) {
startDate.value = Date.now();
startInterval();
}
});
watch(() => projectsStore.state.selectedProject, (value, oldValue) => {
if (value.id === oldValue.id || !isObjectsUploadModal.value) {
return;
}
closeDialog();
});
watch(bucketName, (value, oldValue) => {
if (value === oldValue || !isObjectsUploadModal.value) {
return;
}
closeDialog();
});
onMounted(() => {
startInterval();
});
Expand Down

0 comments on commit bb4c19f

Please sign in to comment.