@@ -2,25 +2,22 @@ import { selectAttributesDict, selectLabelingTasksAll, selectVisibleAttributesHe
22import { selectProjectId } from "@/src/reduxStore/states/project" ;
33import { attributeCreateSearchGroup , commentsCreateSearchGroup , generateRandomSeed , getBasicGroupItems , getBasicSearchGroup , getBasicSearchItem , labelingTasksCreateSearchGroup , orderByCreateSearchGroup , userCreateSearchGroup } from "@/src/util/components/projects/projectId/data-browser/search-groups-helper" ;
44import { SearchGroup , Slice , StaticOrderByKeys } from "@/submodules/javascript-functions/enums/enums" ;
5- import { IconArrowDown , IconArrowsRandom , IconFilterOff , IconInfoCircle , IconPlus , IconPointerOff , IconTrash } from "@tabler/icons-react" ;
5+ import { IconArrowDown , IconArrowsRandom , IconFilterOff , IconPlus , IconPointerOff , IconTrash } from "@tabler/icons-react" ;
66import { useEffect , useState } from "react" ;
77import { useDispatch , useSelector } from "react-redux" ;
88import style from '@/src/styles/components/projects/projectId/data-browser.module.css' ;
99import { SearchOperator } from "@/src/types/components/projects/projectId/data-browser/search-operators" ;
1010import { checkDecimalPatterns , getAttributeType , getSearchOperatorTooltip } from "@/src/util/components/projects/projectId/data-browser/search-operators-helper" ;
1111import { DataTypeEnum } from "@/src/types/shared/general" ;
1212import { selectAllUsers , selectUser } from "@/src/reduxStore/states/general" ;
13- import { selectActiveSearchParams , selectActiveSlice , selectAdditionalData , selectConfiguration , selectDataSlicesAll , selectFullSearchStore , selectIsTextHighlightNeeded , selectRecords , selectSearchGroupsStore , selectSimilaritySearch , selectTextHighlight , selectUniqueValuesDict , selectUsersCount , setActiveDataSlice , setActiveSearchParams , setFullSearchStore , setIsTextHighlightNeeded , setRecordsInDisplay , setSearchGroupsStore , setSearchRecordsExtended , setTextHighlight , updateAdditionalDataState } from "@/src/reduxStore/states/pages/data-browser" ;
13+ import { selectActiveSearchParams , selectActiveSlice , selectAdditionalData , selectConfiguration , selectDataSlicesAll , selectFullSearchStore , selectIsTextHighlightNeeded , selectRecords , selectSearchGroupsStore , selectSimilaritySearch , selectTextHighlight , selectUniqueValuesDict , setActiveSearchParams , setFullSearchStore , setIsTextHighlightNeeded , setRecordsInDisplay , setSearchGroupsStore , setSearchRecordsExtended , setTextHighlight , updateAdditionalDataState } from "@/src/reduxStore/states/pages/data-browser" ;
1414import { Tooltip } from "@nextui-org/react" ;
15- import { setModalStates } from "@/src/reduxStore/states/modal" ;
16- import { ModalEnum } from "@/src/types/shared/modal" ;
1715import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants" ;
1816import { DataSliceOperations } from "./DataSliceOperations" ;
1917import { getActiveNegateGroupColor , postProcessRecordsExtended } from "@/src/util/components/projects/projectId/data-browser/data-browser-helper" ;
2018import { parseFilterToExtended } from "@/src/util/components/projects/projectId/data-browser/filter-parser-helper" ;
2119import { getRegexFromFilter , updateSearchParameters } from "@/src/util/components/projects/projectId/data-browser/search-parameters" ;
2220import { jsonCopy } from "@/submodules/javascript-functions/general" ;
23- import UserInfoModal from "./modals/UserInfoModal" ;
2421import { getColorForDataType } from "@/src/util/components/projects/projectId/settings/data-schema-helper" ;
2522import { Status } from "@/src/types/shared/statuses" ;
2623import { postProcessCurrentWeakSupervisionRun } from "@/src/util/components/projects/projectId/heuristics/heuristics-helper" ;
@@ -42,7 +39,6 @@ export default function SearchGroups() {
4239 const attributes = useSelector ( selectVisibleAttributesHeuristics ) ;
4340 const labelingTasks = useSelector ( selectLabelingTasksAll ) ;
4441 const users = useSelector ( selectAllUsers ) ;
45- const usersMap = useSelector ( selectUsersCount ) ;
4642 const attributesDict = useSelector ( selectAttributesDict ) ;
4743 const activeSearchParams = useSelector ( selectActiveSearchParams ) ;
4844 const configuration = useSelector ( selectConfiguration ) ;
@@ -70,10 +66,10 @@ export default function SearchGroups() {
7066 const [ selectedHeuristicsWS , setSelectedHeuristicsWS ] = useState < string [ ] > ( [ ] ) ;
7167
7268 useEffect ( ( ) => {
73- if ( ! projectId || ! users || ! labelingTasks || ! attributesSortOrder || ! usersMap ) return ;
69+ if ( ! projectId || ! users || ! labelingTasks || ! attributesSortOrder ) return ;
7470 prepareSearchGroups ( ) ;
7571 refetchCurrentWeakSupervisionAndProcess ( ) ;
76- } , [ projectId , users , labelingTasks , attributesSortOrder , usersMap ] ) ;
72+ } , [ projectId , users , labelingTasks , attributesSortOrder ] ) ;
7773
7874 useEffect ( ( ) => {
7975 if ( ! attributes ) return ;
@@ -168,7 +164,7 @@ export default function SearchGroups() {
168164 } , [ activeSlice , labelingTasks , searchGroupsStore , dataSlices ] ) ;
169165
170166 useEffect ( ( ) => {
171- if ( ! activeSlice || ! usersMap ) return ;
167+ if ( ! activeSlice ) return ;
172168 if ( activeSlice . sliceType == Slice . STATIC_OUTLIER ) {
173169 dispatch ( updateAdditionalDataState ( 'clearFullSearch' , true ) ) ;
174170 return ;
@@ -177,8 +173,8 @@ export default function SearchGroups() {
177173 Object . keys ( searchGroupsCopy ) . forEach ( ( key ) => {
178174 searchGroupsCopy [ key ] . isOpen = false ;
179175 } ) ;
180- prepareNewFormGroups ( activeSlice . filterRaw , usersMap , searchGroupsCopy ) ;
181- } , [ activeSlice , usersMap , recordsInDisplay ] ) ;
176+ prepareNewFormGroups ( activeSlice . filterRaw , searchGroupsCopy ) ;
177+ } , [ activeSlice , recordsInDisplay ] ) ;
182178
183179 useEffect ( ( ) => {
184180 if ( recordsInDisplay ) {
@@ -227,14 +223,6 @@ export default function SearchGroups() {
227223 fullSearchCopy [ SearchGroup . ATTRIBUTES ] . groupElements . push ( attributeCreateSearchGroup ( baseItem , ++ GLOBAL_SEARCH_GROUP_COUNT ) ) ;
228224 }
229225
230- // User Filter
231- const searchGroupUserFilter = getBasicSearchGroup ( SearchGroup . USER_FILTER , GROUP_SORT_ORDER + 200 ) ;
232- fullSearchCopy [ SearchGroup . USER_FILTER ] = { groupElements : [ ] } ;
233- searchGroupsCopy [ SearchGroup . USER_FILTER ] = searchGroupUserFilter ;
234- for ( let baseItem of getBasicGroupItems ( searchGroupUserFilter . group , searchGroupUserFilter . key ) ) {
235- fullSearchCopy [ SearchGroup . USER_FILTER ] . groupElements = userCreateSearchGroup ( baseItem , ++ GLOBAL_SEARCH_GROUP_COUNT , usersMap ) ;
236- }
237-
238226 // Labeling Tasks
239227 let count = 0 ;
240228 for ( let task of labelingTasks ) {
@@ -251,7 +239,7 @@ export default function SearchGroups() {
251239 const searchGroupOrder = getBasicSearchGroup ( SearchGroup . ORDER_STATEMENTS , GROUP_SORT_ORDER + 400 ) ;
252240 fullSearchCopy [ SearchGroup . ORDER_STATEMENTS ] = { groupElements : [ ] } ;
253241 searchGroupsCopy [ SearchGroup . ORDER_STATEMENTS ] = searchGroupOrder ;
254- for ( let baseItem of getBasicGroupItems ( searchGroupOrder . group , searchGroupUserFilter . key ) ) {
242+ for ( let baseItem of getBasicGroupItems ( searchGroupOrder . group , searchGroupOrder . key ) ) {
255243 fullSearchCopy [ SearchGroup . ORDER_STATEMENTS ] . groupElements = orderByCreateSearchGroup ( baseItem , ++ GLOBAL_SEARCH_GROUP_COUNT , attributesSortOrder , attributesDict ) ;
256244 }
257245
@@ -276,7 +264,7 @@ export default function SearchGroups() {
276264 setSearchGroupsOrder ( searchGroupsOrderCopy ) ;
277265 }
278266
279- function prepareNewFormGroups ( filterRaw : any , usersMap : any , searchGroupsCopy ) {
267+ function prepareNewFormGroups ( filterRaw : any , searchGroupsCopy : any ) {
280268 const parse = JSON . parse ( filterRaw ) ;
281269 const labelingTasksInSlice = Object . keys ( parse ) . filter ( ( el ) => el . includes ( SearchGroup . LABELING_TASKS ) ) ;
282270 const tasksIds = labelingTasksInSlice . map ( ( el ) => el . split ( '_' ) [ 2 ] ) ;
@@ -295,7 +283,7 @@ export default function SearchGroups() {
295283 const openGroups = checkActiveGroups ( parse , searchGroupsCopy ) ;
296284 dispatch ( setSearchGroupsStore ( openGroups ) ) ;
297285 } else {
298- const prefilledValues = prefillActiveValues ( parse , fullSearchStoreCopy , usersMap ) ;
286+ const prefilledValues = prefillActiveValues ( parse , fullSearchStoreCopy ) ;
299287 dispatch ( setFullSearchStore ( prefilledValues ) ) ;
300288 const openGroups = checkActiveGroups ( fullSearchStoreCopy , searchGroupsCopy ) ;
301289 dispatch ( setSearchGroupsStore ( openGroups ) ) ;
@@ -323,9 +311,7 @@ export default function SearchGroups() {
323311 }
324312 groupItemCopy [ 'color' ] = getActiveNegateGroupColor ( groupItemCopy ) ;
325313 const fullSearchCopy = jsonCopy ( fullSearchStore ) ;
326- if ( group . key == SearchGroup . USER_FILTER ) {
327- fullSearchCopy [ group . key ] . groupElements [ 'users' ] [ index ] = groupItemCopy ;
328- } else if ( forceValue ) { // for the labeling tasks because of the different structure
314+ if ( forceValue ) { // for the labeling tasks because of the different structure
329315 fullSearchCopy [ group . key ] . groupElements [ 'heuristics' ] [ index ] = groupItemCopy ;
330316 } else if ( group . key == SearchGroup . ORDER_STATEMENTS ) {
331317 fullSearchCopy [ group . key ] . groupElements [ 'orderBy' ] [ index ] = groupItemCopy ;
@@ -668,26 +654,6 @@ export default function SearchGroups() {
668654 </ div >
669655 </ div > ) ) }
670656 </ div > }
671- { searchGroupsStore [ group . key ] . group == SearchGroup . USER_FILTER && < div className = "flex flex-row items-center mt-4" >
672- < div className = "flex flex-grow" >
673- < div className = "flex flex-col" >
674- { fullSearchStore [ group . key ] . groupElements [ 'users' ] && fullSearchStore [ group . key ] . groupElements [ 'users' ] . map ( ( groupItem , index ) => ( < div key = { groupItem . id } className = "my-1" >
675- < div className = "form-control flex flex-row flex-nowrap items-center" >
676- < span className = "flex flex-row items-center cursor-pointer" onClick = { ( ) => setActiveNegateGroup ( groupItem , index , group ) } >
677- < div style = { { backgroundColor : groupItem . color , borderColor : groupItem . color } }
678- className = "ml-2 mr-2 h-4 w-4 border-gray-300 border rounded cursor-pointer hover:bg-gray-200" >
679- </ div >
680- < span className = "text-sm truncate" > { groupItem [ 'displayName' ] } </ span >
681- </ span >
682- { usersMap && usersMap [ groupItem [ 'id' ] ] && < div > < Tooltip content = { groupItem [ 'dataTip' ] } placement = "right" color = "invert" >
683- < IconInfoCircle className = "ml-1 text-gray-700 h-5 w-5" onClick = { ( ) => dispatch ( setModalStates ( ModalEnum . USER_INFO , { open : true , userInfo : usersMap [ groupItem [ 'id' ] ] } ) ) } />
684- </ Tooltip > </ div > }
685- </ div >
686- </ div > ) ) }
687- </ div >
688- </ div >
689- < UserInfoModal />
690- </ div > }
691657 { searchGroupsStore [ group . key ] . group == SearchGroup . LABELING_TASKS && < div className = "flex flex-row items-center mt-4" >
692658 { fullSearchStore [ group . key ] && < div className = "flex-grow flex flex-col" >
693659 < div > Manually labeled</ div >
@@ -799,7 +765,7 @@ export default function SearchGroups() {
799765 </ div >
800766 </ div > }
801767
802- { ( searchGroupsStore [ group . key ] . group != SearchGroup . ATTRIBUTES && searchGroupsStore [ group . key ] . group != SearchGroup . USER_FILTER && searchGroupsStore [ group . key ] . group != SearchGroup . LABELING_TASKS && searchGroupsStore [ group . key ] . group != SearchGroup . ORDER_STATEMENTS && searchGroupsStore [ group . key ] . group != SearchGroup . COMMENTS ) && < p > { 'Default :(' } </ p > }
768+ { ( searchGroupsStore [ group . key ] . group != SearchGroup . ATTRIBUTES && searchGroupsStore [ group . key ] . group != SearchGroup . LABELING_TASKS && searchGroupsStore [ group . key ] . group != SearchGroup . ORDER_STATEMENTS && searchGroupsStore [ group . key ] . group != SearchGroup . COMMENTS ) && < p > { 'Default :(' } </ p > }
803769 </ form >
804770 </ div >
805771 </ div > ) )
0 commit comments