Skip to content

Commit

Permalink
Merge pull request #318 from hotosm/feat/image-processing-failed
Browse files Browse the repository at this point in the history
feat: update status on re-run image processing
  • Loading branch information
nrjadkry authored Oct 30, 2024
2 parents ba94feb + 65f1025 commit ef2219c
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ import {
useGetTaskAssetsInfo,
useGetTaskWaypointQuery,
} from '@Api/tasks';
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { postProcessImagery } from '@Services/tasks';
import { formatString } from '@Utils/index';
import { Button } from '@Components/RadixComponents/Button';
import { Label } from '@Components/common/FormUI';
import SwitchTab from '@Components/common/SwitchTab';
import { setUploadedImagesType } from '@Store/actions/droneOperatorTask';
import { useTypedSelector } from '@Store/hooks';
import { postTaskStatus } from '@Services/project';
import DescriptionBoxComponent from './DescriptionComponent';
import QuestionBox from '../QuestionBox';
import UploadsInformation from '../UploadsInformation';
import UploadsBox from '../UploadsBox';

const DescriptionBox = () => {
const dispatch = useDispatch();
const queryClient = useQueryClient();
const [flyable, setFlyable] = useState('yes');
const { taskId, projectId } = useParams();
const uploadedImageType = useTypedSelector(
Expand All @@ -40,9 +42,22 @@ const DescriptionBox = () => {
const { data: taskAssetsInformation }: Record<string, any> =
useGetTaskAssetsInfo(projectId as string, taskId as string);

const { mutate: updateStatus } = useMutation<any, any, any, unknown>({
mutationFn: postTaskStatus,
onError: (err: any) => {
toast.error(err.message);
},
});

const { mutate: reStartImageryProcess } = useMutation({
mutationFn: () => postProcessImagery(projectId as string, taskId as string),
onSuccess: () => {
updateStatus({
projectId,
taskId,
data: { event: 'image_upload', updated_at: new Date().toISOString() },
});
queryClient.invalidateQueries(['task-assets-info']);
toast.success('Image processing re-started');
},
});
Expand Down

0 comments on commit ef2219c

Please sign in to comment.