diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx
index cdee7365..cfef8088 100644
--- a/src/frontend/src/App.tsx
+++ b/src/frontend/src/App.tsx
@@ -84,7 +84,7 @@ export default function App() {
{
- // const secondPageStates = useTypedSelector(state => state.droneOperatorTask);
const [flyable, setFlyable] = useState('yes');
- // const { secondPage } = secondPageStates;
const { taskId, projectId } = useParams();
const { data: taskWayPoints }: any = useGetTaskWaypointQuery(
@@ -98,6 +97,32 @@ const DescriptionBox = () => {
},
});
+ const handleDownloadResult = () => {
+ if (!taskAssetsInformation?.assets_url) return;
+
+ fetch(`${taskAssetsInformation?.assets_url}`, { method: 'GET' })
+ .then(response => {
+ if (!response.ok) {
+ throw new Error(`Network response was ${response.statusText}`);
+ }
+ return response.blob();
+ })
+ .then(blob => {
+ const url = window.URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = 'assets.zip';
+ document.body.appendChild(link);
+ link.click();
+ link.remove();
+ window.URL.revokeObjectURL(url);
+ })
+ .catch(error =>
+ toast.error(`There wan an error while downloading file
+ ${error}`),
+ );
+ };
+
return (
<>
@@ -109,12 +134,13 @@ const DescriptionBox = () => {
/>
))}
- {/* {!secondPage &&
} */}
-
+ {taskAssetsInformation?.image_count === 0 && (
+
+ )}
{taskAssetsInformation?.image_count > 0 && (
@@ -130,6 +156,18 @@ const DescriptionBox = () => {
},
]}
/>
+
+
+
)}
>
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/LoadingBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/LoadingBox/index.tsx
index 017905be..3911014a 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/LoadingBox/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/LoadingBox/index.tsx
@@ -1,5 +1,6 @@
import Icon from '@Components/common/Icon';
import { toggleModal } from '@Store/actions/common';
+import { useQueryClient } from '@tanstack/react-query';
import { useDispatch } from 'react-redux';
interface IFilesUploadingPopOverProps {
@@ -16,12 +17,12 @@ const FilesUploadingPopOver = ({
uploadedFiles,
}: IFilesUploadingPopOverProps) => {
const dispatch = useDispatch();
- // const navigate = useNavigate();
+ const queryClient = useQueryClient();
- // function to close modal
+ // function to close modal and refetch task assets to update the UI
function closeModal() {
+ queryClient.invalidateQueries(['task-assets-info']);
setTimeout(() => {
- // navigate('/dashboard');
dispatch(toggleModal());
}, 2000);
return null;
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsInformation/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsInformation/index.tsx
index 0a86a0e5..8773b675 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsInformation/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsInformation/index.tsx
@@ -1,8 +1,8 @@
const UploadsInformation = ({ data }: { data: Record
[] }) => {
return (
<>
-
-
+
+
Upload Information
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/index.tsx
index f49d37d3..9151f63d 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/index.tsx
@@ -96,7 +96,6 @@ const DroneOperatorDescriptionBox = () => {
.then(blob => {
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
- // link.setAttribute('download', '');
link.href = url;
link.download = 'flight_plan.kmz';
document.body.appendChild(link);