Skip to content

Commit 3b3eb0e

Browse files
authored
Merge pull request #81 from LuCEresearchlab/search-feature
Search feature
2 parents 5e4e91b + af09e06 commit 3b3eb0e

File tree

7 files changed

+555
-23
lines changed

7 files changed

+555
-23
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ docker-compose down
3232
In case there are issues due to dependencies try to rebuild the containers (will wipe tagged data) with
3333

3434
```
35-
docker-compose up --build # rebuil
35+
docker-compose up --build # rebuild
3636
```
3737

38-
Note: by default `SIMILARITY_CLUSTERING_STATE=False`, this means that fake clustering will be used, to have actual
39-
clustering change the value to `True` inside `.env`.
38+
Note: by default `SIMILARITY_CLUSTERING_STATE=True`, this means that true clustering will be used, this means that the
39+
first time the dataset will be loaded clusters will be computed, this is time-consuming. To turn real clustering off
40+
set `SIMILARITY_CLUSTERING_STATE=False` inside `.env` (clusters are stored in the database so deleting clusters
41+
associated with user ```""``` might be required).
4042

4143
## Convert data from LUMI to required data format
4244

frontend/package-lock.json

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"@material-ui/core": "^4.11.3",
1111
"@material-ui/icons": "^4.11.2",
1212
"@material-ui/lab": "^4.0.0-alpha.57",
13+
"@types/react-beautiful-dnd": "^13.0.0",
14+
"fuse.js": "^6.4.6",
1315
"highlightable": "github:malags/react-highlight#master",
1416
"react": "^17.0.1",
17+
"react-beautiful-dnd": "^13.1.0",
1518
"react-dom": "^17.0.1",
1619
"react-router": "^5.2.0",
1720
"react-router-dom": "^5.2.0",

frontend/src/components/v2/TaggingUI.tsx

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, {useEffect, useState} from "react";
2-
import {Grid, Paper} from "@material-ui/core";
2+
import {Grid, Paper, Tab} from "@material-ui/core";
33
import {useFetch} from "../../helpers/LoaderHelper";
44
import {StyledPagination} from "../styled/StyledPagination";
55
import {createStyles, makeStyles} from "@material-ui/core/styles";
6+
import {TabContext, TabList, TabPanel} from "@material-ui/lab";
67
import {MisconceptionElement} from "../../interfaces/MisconceptionElement";
78
import QuestionSelect from "../question_component/QuestionSelect";
89
import TagView from "./tagger_component/TagView";
@@ -15,6 +16,7 @@ import {
1516
} from "../../model/TaggingClusterSession";
1617
import {TaggingSession, TaggingSessionDispatch} from "../../model/TaggingSession";
1718
import {setClusters, setCurrentCluster} from "../../model/TaggingClusterSessionDispatch";
19+
import ClusterHandler from "./cluster_handler_component/ClusterHandler";
1820

1921
const {TAGGING_SERVICE_URL} = require('../../../config.json')
2022

@@ -55,6 +57,7 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
5557
const get_available_url = TAGGING_SERVICE_URL + '/progmiscon_api/misconceptions'
5658

5759
const [page, setPage] = useState<number>(1)
60+
const [tab, setTab] = useState<string>('1')
5861

5962

6063
const paginationChange = (event: any, value: number) => {
@@ -96,28 +99,61 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
9699
setQuestionSelect={selectedChange}/>
97100
</Grid>
98101
<Grid item xs={8}>
99-
<Grid container direction={'row'} className={classes.taggingMiscBlock} spacing={2} component={Paper}
100-
style={{backgroundColor: LIGHT_GREY}}>
101-
<Grid item xs={6}>
102-
<ClusterView
103-
taggingClusterSession={taggingClusterSession}
104-
dispatchTaggingClusterSession={dispatchTaggingClusterSession}
102+
<TabContext value={tab}>
103+
<TabList
104+
indicatorColor='primary'
105+
textColor='primary'
106+
centered={true}
107+
onChange={(_, e: string) => {
108+
setTab(e)
109+
}}
110+
>
111+
<Tab
112+
label={'Tagging'}
113+
value={'1'}
114+
/>
115+
<Tab
116+
label={'Clusters'}
117+
value={'2'}
105118
/>
106-
</Grid>
107-
<Grid item xs={6}>
108-
<TagView
109-
misconceptionsAvailable={data}
119+
</TabList>
120+
<TabPanel value={'1'}>
121+
<Grid container direction={'row'} className={classes.taggingMiscBlock} spacing={2}
122+
component={Paper}
123+
style={{backgroundColor: LIGHT_GREY}}>
124+
<Grid item xs={6}>
125+
<ClusterView
126+
taggingClusterSession={taggingClusterSession}
127+
dispatchTaggingClusterSession={dispatchTaggingClusterSession}
128+
/>
129+
</Grid>
130+
<Grid item xs={6}>
131+
<TagView
132+
misconceptionsAvailable={data}
133+
taggingClusterSession={taggingClusterSession}
134+
dispatchTaggingClusterSession={dispatchTaggingClusterSession}
135+
/>
136+
</Grid>
137+
<StyledPagination
138+
count={total_clusters}
139+
page={page}
140+
onChange={paginationChange}
141+
siblingCount={5}
142+
/>
143+
</Grid>
144+
</TabPanel>
145+
<TabPanel value={'2'}>
146+
<ClusterHandler
147+
taggingSession={taggingSession}
110148
taggingClusterSession={taggingClusterSession}
111149
dispatchTaggingClusterSession={dispatchTaggingClusterSession}
150+
setCluster={(value: number) => {
151+
setTab('1')
152+
paginationChange(null, value)
153+
}}
112154
/>
113-
</Grid>
114-
<StyledPagination
115-
count={total_clusters}
116-
page={page}
117-
onChange={paginationChange}
118-
siblingCount={5}
119-
/>
120-
</Grid>
155+
</TabPanel>
156+
</TabContext>
121157
</Grid>
122158
</Grid>
123159
)

0 commit comments

Comments
 (0)