diff --git a/FrontEnd/src/actions/ExportList.js b/FrontEnd/src/actions/ExportList.js index abbb6ffe..da206cfd 100644 --- a/FrontEnd/src/actions/ExportList.js +++ b/FrontEnd/src/actions/ExportList.js @@ -21,7 +21,6 @@ export function addToExportList(seriesArray, studiesArray) { export function addStudiesToExportList(studiesArray) { return async function (dispatch) { for (const studyObject of studiesArray) { - console.log(studyObject) try { let seriesInfo = await apis.content.getSeriesDetailsOfStudy(studyObject.StudyOrthancID) let series = seriesInfo.map(series => { diff --git a/FrontEnd/src/components/Admin/Robots/AutoRetrieveRobotDetails.js b/FrontEnd/src/components/Admin/Robots/AutoRetrieveRobotDetails.js index 3e4c2ad9..ebe72881 100644 --- a/FrontEnd/src/components/Admin/Robots/AutoRetrieveRobotDetails.js +++ b/FrontEnd/src/components/Admin/Robots/AutoRetrieveRobotDetails.js @@ -20,6 +20,7 @@ export default ({ robotId }) => { })) ) + if (isLoading) return return ( diff --git a/FrontEnd/src/components/Anonymize/Anonymize/AnonymizePanel.js b/FrontEnd/src/components/Anonymize/Anonymize/AnonymizePanel.js index f9445e8a..12ba7613 100644 --- a/FrontEnd/src/components/Anonymize/Anonymize/AnonymizePanel.js +++ b/FrontEnd/src/components/Anonymize/Anonymize/AnonymizePanel.js @@ -74,7 +74,6 @@ export default () => { try { let answer = await apis.anon.createAnonRobot(listToAnonymize, store.username) //wait for the robot's answer to know what do to next successMessage('Anonymization started') - console.log(answer) } catch (error) { errorMessage(error.statusText) } diff --git a/FrontEnd/src/components/AutoQuery/AutoQueryRoot.js b/FrontEnd/src/components/AutoQuery/AutoQueryRoot.js index 3cdd5f3d..53fbc94b 100644 --- a/FrontEnd/src/components/AutoQuery/AutoQueryRoot.js +++ b/FrontEnd/src/components/AutoQuery/AutoQueryRoot.js @@ -4,6 +4,42 @@ import QueryRoot from './Query/QueryRoot' import ResultsRoot from './Results/ResultsRoot' import MyRobotRoot from './MyRobot/MyRobotRoot' import RobotHistoryRoot from './RobotHistory/RobotHistoryRoot' +import { useSelector } from 'react-redux' +import apis from '../../services/apis' +import Spinner from '../CommonComponents/Spinner' +import { useCustomQuery } from '../../services/ReactQuery/hooks' +import { errorMessage } from '../../tools/toastify' +import { keys } from '../../model/Constant' + + +const MyRobotWrapper = () => { + + const store = useSelector(state => { + return { + username: state.OrthancTools.username, + } + }) + + const { isLoading, data : retrieveId } = useCustomQuery( + [keys.ROBOTS_KEY, store.username, keys.AUTOQUERY_KEY], + () => apis.task.getTaskOfUser(store.username, 'retrieve'), + () => errorMessage('Failed to retrieve robot list'), + (retrieveIds) => { + if (retrieveIds.length > 0) { + return retrieveIds[0] + } else { + return null + } + } + ) + + if (isLoading) return + if (retrieveId == null) return <>> + + return ( + + ) +} export default () => { @@ -19,10 +55,10 @@ export default () => { case TAB_QUERIES: return setCurrentComponent(TAB_RESULTS)} /> case TAB_RESULTS: - return setCurrentComponent(TAB_MYROBOT)}/> + return setCurrentComponent(TAB_MYROBOT)} /> case TAB_MYROBOT: - return - case TAB_ROBOT_HISTORY: + return + case TAB_ROBOT_HISTORY: return default: break @@ -33,11 +69,11 @@ export default () => { - Auto Retrieve + Auto Retrieve - + { +export default ({ robotId }) => { - const store = useSelector(state => { - return { - username: state.OrthancTools.username, - } - }) - const [id, setId] = useState(null) const [projectName, setProjectName] = useState(null) const [creator, setCreator] = useState(null) - const [valid, setValid] = useState(null) - const [approved, setApproved] = useState(null) + const [valid, setValid] = useState(false) + const [approved, setApproved] = useState(false) const [rows, setRows] = useState([]) - const [totalPercentageProgress, setTotalPercentageProgress] = useState(0) const [percentageFailure, setPercentageFailure] = useState(0) @@ -48,11 +42,8 @@ export default () => { }, []) const refreshInfo = async () => { - let retrieveIds = await apis.task.getTaskOfUser(store.username, 'retrieve') - if (retrieveIds.length > 0) { - let response = await apis.task.getTask(retrieveIds[0]); - refreshHandler(response) - } + let response = await apis.task.getTask(robotId); + refreshHandler(response) } const refreshHandler = (response) => { @@ -62,7 +53,6 @@ export default () => { let newPercentageFailure = 0 response.details.items.forEach(item => { - rowsRetrieveList.push({ //Merge Modalities (study level) to modality column Modality: item.ModalitiesInStudy, @@ -92,17 +82,17 @@ export default () => { //SK ICI CHECKER LE ITEMID dans le backend (eviter position et remplacer par un ID (actuelement aswerId mais mauvaise idee car existe qu'une fois executee)) const retryQueryHandler = async (itemId) => { try { - await apis.retrieveRobot.deleteRobotItem(robotId, itemId) + await apis.retrieveRobot.retryRobotItem(robotId, itemId) } catch (error) { - errorMessage(error?.data?.errorMessage ?? 'Delete Failed') + errorMessage(error?.data?.errorMessage ?? 'Retry Failed') } } const deleteQueryHandler = async (itemId) => { try { - await apis.retrieveRobot.retryRobotItem(robotId, itemId) + await apis.retrieveRobot.deleteRobotItem(robotId, itemId) } catch (error) { - errorMessage(error?.data?.errorMessage ?? 'Retry Failed') + errorMessage(error?.data?.errorMessage ?? 'Delete Failed') } } @@ -117,30 +107,43 @@ export default () => { return ( - Robot for user {creator}, project : {projectName} - - - {/* Foreground path */} - + + Robot for user {creator} + Project : {projectName} + Valid : {valid.toString()} + Approved : {approved.toString()} + + + + + - - + > + {/* Foreground path */} + + + + { studiesRows.length > 0 ? - + retryQueryHandler(id)} + onDeleteItem={(id) => deleteQueryHandler(id)} + rows={studiesRows} + /> : null @@ -148,7 +151,11 @@ export default () => { { seriesRows.length > 0 ? - + retryQueryHandler(id)} + onDeleteItem={(id) => deleteQueryHandler(id)} + rows={seriesRows} + /> : null diff --git a/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableSeries.js b/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableSeries.js index 453808ea..eee0c45a 100644 --- a/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableSeries.js +++ b/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableSeries.js @@ -57,35 +57,28 @@ export default ({ rows = [], onSelectRow, onRetryItem, onDeleteItem }) => { }, { accessorKey: 'Status', - header: 'Status', - cell: ({ row, getValue }) => { - const value = getValue() - return ( - - {value} - {value === 'failed' ? - onRetryItem(row.original.AnswerId)}> - - - : - null} - - ) - } + header: 'Status' }, { - accessorKey: 'Remove', - header: 'Remove Query', + accessorKey: 'Actions', + header: 'Actions', cell: ({ row }) => { - return row.original.approved === false ? - ( - onDeleteItem(row.original.AnswerId)} > + const status = row.original.Status + return ( + <> + onRetryItem(row.original.id)}> + + + onDeleteItem(row.original.id)} > Remove - ) - : null + > + ) } }, { diff --git a/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableStudies.js b/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableStudies.js index faa41c09..0acd8acf 100644 --- a/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableStudies.js +++ b/FrontEnd/src/components/AutoQuery/MyRobot/MyRobotTableStudies.js @@ -1,5 +1,6 @@ import React, { useMemo, useState } from 'react' import { Button, Dropdown } from 'react-bootstrap'; +import { useDispatch } from 'react-redux'; import CommonTableV8 from '../../CommonComponents/RessourcesDisplay/ReactTableV8/CommonTableV8'; import OhifLink from '../../Viewers/OhifLink'; @@ -10,6 +11,7 @@ import { ReactComponent as XSVG } from '../../../assets/images/x-circle.svg' import { ReactComponent as PendingSVG } from '../../../assets/images/pending.svg' import { ReactComponent as RepeatSVG } from '../../../assets/images/arrow-repeat.svg' import { ITEM_SUCCESS } from './MyRobotRoot'; +import ExportDeleteSendButton from '../../CommonComponents/RessourcesDisplay/ExportDeleteSendButton'; export default ({ rows = [], onRetryItem, onDeleteItem }) => { @@ -60,35 +62,28 @@ export default ({ rows = [], onRetryItem, onDeleteItem }) => { }, { accessorKey: 'Status', - header: 'Status', - cell: ({ row, getValue }) => { - const value = getValue() - return ( - - {value} - {value === 'failed' ? - onRetryItem(row.original.AnswerId)}> - - - : - null} - - ) - } + header: 'Status' }, { - accessorKey: 'Remove', - header: 'Remove Query', + accessorKey: 'Actions', + header: 'Actions', cell: ({ row }) => { - return row.original.approved === false ? - ( - onDeleteItem(row.original.AnswerId)} > + const status = row.original.Status + return ( + <> + onRetryItem(row.original.id)}> + + + onDeleteItem(row.original.id)} > Remove - ) - : null + > + ) } }, { @@ -163,7 +158,7 @@ export default ({ rows = [], onRetryItem, onDeleteItem }) => { const selectedRowKey = useMemo(() => { - let selectedRows = rows.filter((row) => selectedRowsIds.includes(row.RetrievedOrthancId)) + let selectedRows = rows.filter((row) => selectedRowIds.includes(row.RetrievedOrthancId)) return selectedRows.map(selectedRow => selectedRow.id) }, [selectedRowIds.length]) diff --git a/FrontEnd/src/components/AutoQuery/RobotHistory/RobotHistoryRoot.js b/FrontEnd/src/components/AutoQuery/RobotHistory/RobotHistoryRoot.js index db1ada87..5ba69e21 100644 --- a/FrontEnd/src/components/AutoQuery/RobotHistory/RobotHistoryRoot.js +++ b/FrontEnd/src/components/AutoQuery/RobotHistory/RobotHistoryRoot.js @@ -52,7 +52,6 @@ export default () => { }) }); }).catch(error => { - console.log(error) if (error.status !== 404) errorMessage(error.statusText + ' ' + error.message) }).finally(() => { setRows(rows) diff --git a/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/CommonTableV8.js b/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/CommonTableV8.js index 3722fd02..f12fa7e9 100644 --- a/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/CommonTableV8.js +++ b/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/CommonTableV8.js @@ -110,6 +110,7 @@ export default ({ enableSorting: canSort, enableSortingRemoval: true, enableMultiSort: true, + autoResetPageIndex : false, maxMultiSortColCount: 3, isMultiSortEvent: () => true, meta: { diff --git a/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/RobotTable.js b/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/RobotTable.js index 9d9938c8..96956cf6 100644 --- a/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/RobotTable.js +++ b/FrontEnd/src/components/CommonComponents/RessourcesDisplay/ReactTableV8/RobotTable.js @@ -21,7 +21,7 @@ export default ({ }, { id: 'name', - accessorKey: 'details.projectName', + accessorKey: 'name', header: 'Name' }, { id: 'username', diff --git a/FrontEnd/src/components/Import/ImportDicom/Import.js b/FrontEnd/src/components/Import/ImportDicom/Import.js index b10d9842..75c5e85e 100644 --- a/FrontEnd/src/components/Import/ImportDicom/Import.js +++ b/FrontEnd/src/components/Import/ImportDicom/Import.js @@ -5,7 +5,9 @@ import { Modal, Row, Col, ProgressBar } from 'react-bootstrap' import MyDropzone from '../../CommonComponents/MyDropzone' import TableImportError from './TableImportError' + import TablePatientWithNestedStudiesAndSeries from '../../CommonComponents/RessourcesDisplay/ReactTableV8/TablePatientWithNestedStudiesAndSeries' +import ExportDeleteSendButton from '../../CommonComponents/RessourcesDisplay/ExportDeleteSendButton' import { addStudiesToExportList } from '../../../actions/ExportList' import { addStudiesToDeleteList } from '../../../actions/DeleteList' @@ -13,8 +15,6 @@ import { addStudiesToAnonList } from '../../../actions/AnonList' import apis from '../../../services/apis' import Study from '../../../model/Study' import Series from '../../../model/Series' -import ExportDeleteSendButton from '../../CommonComponents/RessourcesDisplay/ExportDeleteSendButton' - export default () => { diff --git a/FrontEnd/src/model/Constant.js b/FrontEnd/src/model/Constant.js index f547b511..c3dad2ee 100644 --- a/FrontEnd/src/model/Constant.js +++ b/FrontEnd/src/model/Constant.js @@ -12,6 +12,7 @@ const keys = { USERS_KEY: 'users', BURNER_KEY: 'burner', ROBOTS_KEY: 'robots', + AUTOQUERY_KEY : 'autoQuery', ENDPOINTS_KEY: 'endpoints', EXPORT_TRANSCODING: 'export_transcoding', SSH_KEY: 'ssh',
{value}