11import Statuses from "@/src/components/shared/statuses/Statuses" ;
22import { selectAllLookupLists , setAllLookupLists } from "@/src/reduxStore/states/pages/lookup-lists" ;
3- import { selectAttributes , selectVisibleAttributeAC , setAllAttributes , updateAttributeById } from "@/src/reduxStore/states/pages/settings" ;
3+ import { selectAttributes , selectVisibleAttributeAC , setAllAttributes , setLabelingTasksAll , updateAttributeById } from "@/src/reduxStore/states/pages/settings" ;
44import { selectProjectId } from "@/src/reduxStore/states/project"
55import { UPDATE_ATTRIBUTE } from "@/src/services/gql/mutations/project-settings" ;
66import { LOOKUP_LISTS_BY_PROJECT_ID } from "@/src/services/gql/queries/lookup-lists" ;
7- import { GET_ATTRIBUTES_BY_PROJECT_ID , GET_ATTRIBUTE_BY_ATTRIBUTE_ID , GET_PROJECT_TOKENIZATION } from "@/src/services/gql/queries/project-setting" ;
7+ import { GET_ATTRIBUTES_BY_PROJECT_ID , GET_ATTRIBUTE_BY_ATTRIBUTE_ID , GET_LABELING_TASKS_BY_PROJECT_ID , GET_PROJECT_TOKENIZATION } from "@/src/services/gql/queries/project-setting" ;
88import { Attribute , AttributeState } from "@/src/types/components/projects/projectId/settings/data-schema" ;
99import { CurrentPage , DataTypeEnum } from "@/src/types/shared/general" ;
1010import { postProcessCurrentAttribute } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper" ;
@@ -34,7 +34,7 @@ import { CommentType } from "@/src/types/shared/comments";
3434import BricksIntegrator from "@/src/components/shared/bricks-integrator/BricksIntegrator" ;
3535import { AttributeCodeLookup } from "@/src/util/classes/attribute-calculation" ;
3636import Dropdown2 from "@/submodules/react-components/components/Dropdown2" ;
37- import { getEmptyBricksIntegratorConfig } from "@/src/util/shared/bricks-integrator -helper" ;
37+ import { postProcessLabelingTasks , postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks -helper" ;
3838
3939const EDITOR_OPTIONS = { theme : 'vs-light' , language : 'python' , readOnly : false } ;
4040
@@ -66,6 +66,7 @@ export default function AttributeCalculation() {
6666 const [ refetchProjectTokenization ] = useLazyQuery ( GET_PROJECT_TOKENIZATION , { fetchPolicy : "no-cache" } ) ;
6767 const [ refetchAttributeByAttributeId ] = useLazyQuery ( GET_ATTRIBUTE_BY_ATTRIBUTE_ID , { fetchPolicy : "no-cache" } ) ;
6868 const [ refetchComments ] = useLazyQuery ( REQUEST_COMMENTS , { fetchPolicy : "no-cache" } ) ;
69+ const [ refetchLabelingTasksByProjectId ] = useLazyQuery ( GET_LABELING_TASKS_BY_PROJECT_ID , { fetchPolicy : "network-only" } ) ;
6970
7071 useEffect ( unsubscribeWSOnDestroy ( router , [ CurrentPage . ATTRIBUTE_CALCULATION ] ) , [ ] ) ;
7172
@@ -89,6 +90,7 @@ export default function AttributeCalculation() {
8990 dispatch ( setAllLookupLists ( res . data [ 'knowledgeBasesByProjectId' ] ) ) ;
9091 } ) ;
9192 }
93+ refetchLabelingTasksAndProcess ( ) ;
9294 checkProjectTokenization ( ) ;
9395 WebSocketsService . subscribeToNotification ( CurrentPage . ATTRIBUTE_CALCULATION , {
9496 projectId : projectId ,
@@ -249,6 +251,13 @@ export default function AttributeCalculation() {
249251 setIsInitial ( false ) ;
250252 }
251253
254+ function refetchLabelingTasksAndProcess ( ) {
255+ refetchLabelingTasksByProjectId ( { variables : { projectId : projectId } } ) . then ( ( res ) => {
256+ const labelingTasks = postProcessLabelingTasks ( res [ 'data' ] [ 'projectByProjectId' ] [ 'labelingTasks' ] [ 'edges' ] ) ;
257+ dispatch ( setLabelingTasksAll ( postProcessLabelingTasksSchema ( labelingTasks ) ) ) ;
258+ } ) ;
259+ }
260+
252261 const handleWebsocketNotification = useCallback ( ( msgParts : string [ ] ) => {
253262 if ( ! currentAttribute ) return ;
254263 if ( ! projectId ) return ;
0 commit comments