diff --git a/src/common/DeleteDialog.jsx b/src/common/DeleteDialog.jsx index 5e5cd812..76d004bf 100644 --- a/src/common/DeleteDialog.jsx +++ b/src/common/DeleteDialog.jsx @@ -101,6 +101,7 @@ const DeleteDialog = ({ Cancel + + + + ); +}; + +export default TaskReopenDialog; diff --git a/src/common/index.js b/src/common/index.js index af83e45c..d5f60ac6 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -11,6 +11,7 @@ import CreateVideoDialog from "./CreateVideoDialog"; import CustomMenuComponent from "./CustomMenuComponent"; import CustomSwitchDarkBackground from "./CustomSwitchDarkBackground"; import DeleteDialog from "./DeleteDialog"; +import TaskReopenDialog from "./TaskReopenDialog"; import DeleteMemberErrorDialog from "./DeleteMemberErrorDialog"; import ExportAllDialog from "./ExportAllDialog"; import ExportDialog from "./ExportDialog"; @@ -58,6 +59,7 @@ export { CustomMenuComponent, CustomSwitchDarkBackground, DeleteDialog, + TaskReopenDialog, DeleteMemberErrorDialog, ExportAllDialog, ExportDialog, diff --git a/src/config/tableColumns.js b/src/config/tableColumns.js index 8fe867cd..2b763130 100644 --- a/src/config/tableColumns.js +++ b/src/config/tableColumns.js @@ -500,14 +500,14 @@ export const taskQueueStatusColumns = [ ]; export const failInfoColumns = [ - { - name: "index", - label: "Id", - }, { name: "page_number", label: "Page Number", }, + { + name: "index", + label: "Id", + }, { name: "start_time", label: "Start Time", @@ -524,17 +524,21 @@ export const failInfoColumns = [ name: "target_text", label: "Target Text", }, + { + name: "issue_type", + label: "Issue Type", + }, ]; export const failTranscriptionInfoColumns = [ - { - name: "index", - label: "Id", - }, { name: "page_number", label: "Page Number", }, + { + name: "index", + label: "Id", + }, { name: "start_time", label: "Start Time", @@ -550,14 +554,14 @@ export const failTranscriptionInfoColumns = [ ]; export const voiceoverFailInfoColumns = [ - { - name: "index", - label: "Id", - }, { name: "page_number", label: "Page Number", }, + { + name: "index", + label: "Id", + }, { name: "reason", label: "Reason", diff --git a/src/containers/Organization/Project/TaskList.jsx b/src/containers/Organization/Project/TaskList.jsx index a2afadd5..d6deebe9 100644 --- a/src/containers/Organization/Project/TaskList.jsx +++ b/src/containers/Organization/Project/TaskList.jsx @@ -46,6 +46,7 @@ import { UpdateBulkTaskDialog, UploadFormatDialog, ViewTaskDialog, + TaskReopenDialog, } from "common"; //Icons @@ -117,6 +118,10 @@ const TaskList = () => { const [uploadLoading, setUploadLoading] = useState([]); const [deleteMsg, setDeleteMsg] = useState(""); const [deleteResponse, setDeleteResponse] = useState([]); + + const [taskReopenMsg, setTaskReopenMsg] = useState(""); + const [taskReopenResponse, setTaskReopenResponse] = useState([]); + const [isSubmit, setIsSubmit] = useState(false); const [currentTaskDetails, setCurrentTaskDetails] = useState(); @@ -133,6 +138,7 @@ const TaskList = () => { uploadDialog: false, speakerInfoDialog: false, tableDialog: false, + TaskReopenDialog: false, }); const [tableDialogMessage, setTableDialogMessage] = useState(""); const [tableDialogResponse, setTableDialogResponse] = useState([]); @@ -177,51 +183,6 @@ const TaskList = () => { (state) => state.getPreviewData?.data ); - const reopenActionColumn = { - name: "Action", - label: "Actions", - options: { - filter: false, - sort: false, - align: "center", - setCellHeaderProps: () => ({ - className: tableClasses.cellHeaderProps, - }), - customBodyRender: (_value, tableMeta) => { - const { tableData: data, rowIndex } = tableMeta; - const selectedTask = data[rowIndex]; - - return ( - - - - ); - }, - }, - }; - useEffect(() => { const { progress, success, apiType, data } = apiStatus; if (!progress) { @@ -237,6 +198,11 @@ const TaskList = () => { fetchTaskList(); break; + case "REOPEN_TASK": + handleDialogClose("TaskReopenDialog"); + fetchTaskList(); + break; + case "GENERATE_TRANSLATION_OUTPUT": navigate(`/task/${currentTaskDetails?.id}/translate`); break; @@ -295,10 +261,9 @@ const TaskList = () => { if (apiType === "REOPEN_TASK" && data.response) { dispatch(setSnackBar({ open: false })); - handleDialogOpen("tableDialog"); - setTableDialogColumn([...reopenTableColumns,reopenActionColumn]); - setTableDialogMessage(data.message); - setTableDialogResponse(data.response); + handleDialogOpen("TaskReopenDialog"); + setTaskReopenMsg(data.message); + setTaskReopenResponse(data.response); } } } @@ -592,6 +557,14 @@ const TaskList = () => { handleDialogClose("deleteDialog"); }; + const handleTaskReopen = async () => { + setLoading(true); + + const reopenObj = new ReopenTaskAPI(reOpenTaskId,true); + dispatch(APITransport(reopenObj)); + handleDialogClose("TaskReopenDialog"); + }; + const handlePreviewTask = async (videoId, taskType, targetlanguage) => { handleDialogOpen("previewDialog"); @@ -1105,6 +1078,17 @@ const TaskList = () => { /> )} + {openDialogs.TaskReopenDialog && ( + handleDialogClose("TaskReopenDialog")} + submit={() => handleTaskReopen()} + loading={apiStatus.loading} + message={taskReopenMsg} + taskReopenResponse={taskReopenResponse} + /> + )} + {openDialogs.editTaskDialog && ( { const { taskId } = useParams(); const classes = VideoLandingStyle(); @@ -110,23 +114,59 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { const [complete, setComplete] = useState(false); const [autoSave, setAutoSave] = useState(false); + const [openInfoDialog, setOpenInfoDialog] = useState(false); + const [tableDialogMessage, setTableDialogMessage] = useState(""); + const [tableDialogResponse, setTableDialogResponse] = useState([]); + const [tableDialogColumn, setTableDialogColumn] = useState([]); + useEffect(() => { - const { progress, success, apiType } = apiStatus; + const { progress, success, apiType, data } = apiStatus; + + if (!progress) { + if (success) { + switch (apiType) { + case "SAVE_TRANSCRIPT": + if (!autoSave) { + setTimeout(() => { + dispatch(setSnackBar({ open: false })); + }, 1000); + } + if (complete) { + setTimeout(() => { + navigate( + `/my-organization/${assignedOrgId}/project/${taskData?.project}` + ); + setComplete(false); + }, 2000); + } + break; - if (!progress && success && apiType === "SAVE_TRANSCRIPT") { - if (!autoSave) { - setTimeout(() => { - dispatch(setSnackBar({ open: false })); - }, 1000); - } + case "GET_TASK_FAIL_INFO": + setOpenInfoDialog(true); + setTableDialogColumn(failInfoColumns.filter((col)=>col.name!='target_text')); + setTableDialogMessage(data.message); + setTableDialogResponse(data.data); + break; - if (complete) { - setTimeout(() => { - navigate( - `/my-organization/${assignedOrgId}/project/${taskData?.project}` - ); - setComplete(false); - }, 2000); + default: + break; + } + } else { + switch (apiType) { + case "SAVE_TRANSCRIPT": + setOpenConfirmDialog(false); + + if (complete) { + setOpenInfoDialog(true); + setTableDialogColumn(failInfoColumns.filter((col)=>col.name!='target_text')); + setTableDialogMessage(data.message); + setTableDialogResponse(data.data); + } + break; + + default: + break; + } } } @@ -278,6 +318,11 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { } }; + const handleInfoButtonClick = async () => { + const apiObj = new FetchTaskFailInfoAPI(taskId); + dispatch(APITransport(apiObj)); + }; + const onMergeClick = useCallback( (index) => { const selectionStart = getSelectionStart(index); @@ -571,6 +616,7 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { handleSuperscript={handleSuperscript} showPopOver={showPopOver} showSplit={true} + handleInfoButtonClick={handleInfoButtonClick} /> @@ -765,6 +811,16 @@ const RightPanel = ({ currentIndex, setCurrentIndex }) => { /> )} + {openInfoDialog && ( + setOpenInfoDialog(false)} + message={tableDialogMessage} + response={tableDialogResponse} + columns={tableDialogColumn} + /> + )} + {Boolean(tagSuggestionsAnchorEl) && (