Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update status on re-run image processing #318

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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