@jbrowse/plugin-data-management 1.7.3 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/AddConnectionWidget/components/AddConnectionWidget.js +17 -17
  2. package/dist/AddConnectionWidget/components/AddConnectionWidget.test.js +7 -7
  3. package/dist/AddConnectionWidget/components/ConfigureConnection.js +6 -6
  4. package/dist/AddConnectionWidget/components/ConnectionTypeSelect.js +8 -8
  5. package/dist/AddConnectionWidget/index.js +1 -1
  6. package/dist/AddConnectionWidget/model.js +2 -2
  7. package/dist/AddTrackWidget/components/AddTrackWidget.js +58 -22
  8. package/dist/AddTrackWidget/components/AddTrackWidget.test.js +7 -7
  9. package/dist/AddTrackWidget/components/ConfirmTrack.js +182 -41
  10. package/dist/AddTrackWidget/components/TrackSourceSelect.js +6 -6
  11. package/dist/AddTrackWidget/index.js +1 -1
  12. package/dist/AddTrackWidget/index.test.js +13 -13
  13. package/dist/AddTrackWidget/model.d.ts +9 -0
  14. package/dist/AddTrackWidget/model.js +13 -3
  15. package/dist/AssemblyManager/AssemblyAddForm.js +36 -36
  16. package/dist/AssemblyManager/AssemblyEditor.js +3 -3
  17. package/dist/AssemblyManager/AssemblyManager.js +18 -18
  18. package/dist/AssemblyManager/AssemblyManager.test.js +6 -6
  19. package/dist/AssemblyManager/AssemblyTable.js +15 -15
  20. package/dist/AssemblyManager/index.js +1 -1
  21. package/dist/HierarchicalTrackSelectorWidget/components/CloseConnectionDialog.js +8 -8
  22. package/dist/HierarchicalTrackSelectorWidget/components/DeleteConnectionDialog.js +5 -5
  23. package/dist/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.js +58 -58
  24. package/dist/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.js +10 -10
  25. package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +11 -11
  26. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +9 -9
  27. package/dist/HierarchicalTrackSelectorWidget/index.js +1 -1
  28. package/dist/HierarchicalTrackSelectorWidget/model.js +8 -8
  29. package/dist/PluginStoreWidget/components/CustomPluginForm.js +24 -24
  30. package/dist/PluginStoreWidget/components/InstalledPlugin.js +14 -14
  31. package/dist/PluginStoreWidget/components/InstalledPluginsList.js +5 -5
  32. package/dist/PluginStoreWidget/components/PluginCard.js +13 -13
  33. package/dist/PluginStoreWidget/components/PluginStoreWidget.js +31 -31
  34. package/dist/PluginStoreWidget/components/PluginStoreWidget.test.js +13 -13
  35. package/dist/PluginStoreWidget/index.js +2 -2
  36. package/dist/PluginStoreWidget/model.js +1 -1
  37. package/dist/SetDefaultSession/SetDefaultSession.js +7 -7
  38. package/dist/SetDefaultSession/SetDefaultSession.test.js +3 -3
  39. package/dist/SetDefaultSession/index.js +1 -1
  40. package/dist/index.js +15 -15
  41. package/dist/index.test.js +2 -2
  42. package/dist/ucsc-trackhub/configSchema.js +2 -2
  43. package/dist/ucsc-trackhub/index.js +2 -2
  44. package/dist/ucsc-trackhub/model.js +7 -7
  45. package/dist/ucsc-trackhub/ucscAssemblies.js +2 -2
  46. package/dist/ucsc-trackhub/ucscTrackHub.js +9 -9
  47. package/package.json +3 -3
  48. package/src/AddTrackWidget/components/AddTrackWidget.tsx +44 -2
  49. package/src/AddTrackWidget/components/ConfirmTrack.tsx +153 -2
  50. package/src/AddTrackWidget/model.ts +14 -1
@@ -1,14 +1,34 @@
1
- import React from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { readConfObject } from '@jbrowse/core/configuration'
3
- import { getSession } from '@jbrowse/core/util'
3
+ import {
4
+ supportedIndexingAdapters,
5
+ getSession,
6
+ isElectron,
7
+ } from '@jbrowse/core/util'
4
8
  import {
5
9
  Link,
6
10
  MenuItem,
7
11
  TextField,
8
12
  ListSubheader,
9
13
  Typography,
14
+ FormControl,
15
+ FormControlLabel,
16
+ Checkbox,
17
+ Paper,
18
+ Card,
19
+ List,
20
+ ListItem,
21
+ CardContent,
22
+ IconButton,
23
+ InputLabel,
24
+ InputAdornment,
10
25
  makeStyles,
11
26
  } from '@material-ui/core'
27
+
28
+ // icons
29
+ import DeleteIcon from '@material-ui/icons/Delete'
30
+ import AddIcon from '@material-ui/icons/Add'
31
+ // other
12
32
  import PluginManager from '@jbrowse/core/PluginManager'
13
33
  import { observer } from 'mobx-react'
14
34
  import { getEnv } from 'mobx-state-tree'
@@ -22,6 +42,17 @@ const useStyles = makeStyles(theme => ({
22
42
  spacing: {
23
43
  marginBottom: theme.spacing(3),
24
44
  },
45
+ paper: {
46
+ display: 'flex',
47
+ flexDirection: 'column',
48
+ padding: theme.spacing(1),
49
+ },
50
+ spacer: {
51
+ height: theme.spacing(8),
52
+ },
53
+ card: {
54
+ marginTop: theme.spacing(1),
55
+ },
25
56
  }))
26
57
 
27
58
  function StatusMessage({
@@ -98,6 +129,105 @@ function getTrackTypes(pluginManager: PluginManager) {
98
129
  return pluginManager.getElementTypesInGroup('track') as { name: string }[]
99
130
  }
100
131
 
132
+ const TextIndexingConfig = observer(({ model }: { model: AddTrackModel }) => {
133
+ const classes = useStyles()
134
+ const [value1, setValue1] = useState('')
135
+ const [value2, setValue2] = useState('')
136
+ const [attributes, setAttributes] = useState(['Name', 'ID'])
137
+ const [exclude, setExclude] = useState(['CDS', 'exon'])
138
+ const sections = [
139
+ {
140
+ label: 'Indexing attributes',
141
+ values: attributes,
142
+ },
143
+ {
144
+ label: 'Feature types to exclude',
145
+ values: exclude,
146
+ },
147
+ ]
148
+ useEffect(() => {
149
+ model.setTextIndexingConf({ attributes, exclude })
150
+ }, [model, attributes, exclude])
151
+
152
+ return (
153
+ <Paper className={classes.paper}>
154
+ <InputLabel>Indexing configuration</InputLabel>
155
+ {sections.map((section, index) => (
156
+ <Card raised key={section.label} className={classes.card}>
157
+ <CardContent>
158
+ <InputLabel>{section.label}</InputLabel>
159
+ <List disablePadding>
160
+ {section.values.map((val: string, idx: number) => (
161
+ <ListItem key={idx} disableGutters>
162
+ <TextField
163
+ value={val}
164
+ InputProps={{
165
+ endAdornment: (
166
+ <InputAdornment position="end">
167
+ <IconButton
168
+ color="secondary"
169
+ onClick={() => {
170
+ const newAttr = section.values.filter((a, i) => {
171
+ return i !== idx
172
+ })
173
+ index === 0
174
+ ? setAttributes(newAttr)
175
+ : setExclude(newAttr)
176
+ }}
177
+ >
178
+ <DeleteIcon />
179
+ </IconButton>
180
+ </InputAdornment>
181
+ ),
182
+ }}
183
+ />
184
+ </ListItem>
185
+ ))}
186
+ <ListItem disableGutters>
187
+ <TextField
188
+ value={index === 0 ? value1 : value2}
189
+ placeholder="add new"
190
+ onChange={event => {
191
+ index === 0
192
+ ? setValue1(event.target.value)
193
+ : setValue2(event.target.value)
194
+ }}
195
+ InputProps={{
196
+ endAdornment: (
197
+ <InputAdornment position="end">
198
+ <IconButton
199
+ onClick={() => {
200
+ if (index === 0) {
201
+ const newAttr: string[] = attributes
202
+ newAttr.push(value1)
203
+ setAttributes(newAttr)
204
+ setValue1('')
205
+ } else {
206
+ const newFeat: string[] = exclude
207
+ newFeat.push(value2)
208
+ setExclude(newFeat)
209
+ setValue2('')
210
+ }
211
+ }}
212
+ disabled={index === 0 ? value1 === '' : value2 === ''}
213
+ color="secondary"
214
+ data-testid={`stringArrayAdd-Feat`}
215
+ >
216
+ <AddIcon />
217
+ </IconButton>
218
+ </InputAdornment>
219
+ ),
220
+ }}
221
+ />
222
+ </ListItem>
223
+ </List>
224
+ </CardContent>
225
+ </Card>
226
+ ))}
227
+ </Paper>
228
+ )
229
+ })
230
+
101
231
  const TrackAdapterSelector = observer(({ model }: { model: AddTrackModel }) => {
102
232
  const classes = useStyles()
103
233
  const session = getSession(model)
@@ -233,6 +363,7 @@ const TrackAssemblySelector = observer(
233
363
 
234
364
  function ConfirmTrack({ model }: { model: AddTrackModel }) {
235
365
  const classes = useStyles()
366
+ const [check, setCheck] = useState(true)
236
367
  const { trackName, trackAdapter, trackType, warningMessage, adapterHint } =
237
368
  model
238
369
 
@@ -273,6 +404,7 @@ function ConfirmTrack({ model }: { model: AddTrackModel }) {
273
404
  return <Typography>Could not recognize this data type.</Typography>
274
405
  }
275
406
 
407
+ const supportedForIndexing = supportedIndexingAdapters(trackAdapter?.type)
276
408
  return (
277
409
  <div>
278
410
  {trackAdapter ? (
@@ -293,6 +425,25 @@ function ConfirmTrack({ model }: { model: AddTrackModel }) {
293
425
  <TrackAdapterSelector model={model} />
294
426
  <TrackTypeSelector model={model} />
295
427
  <TrackAssemblySelector model={model} />
428
+ {isElectron && supportedForIndexing && (
429
+ <FormControl>
430
+ <FormControlLabel
431
+ label={'Index track for text searching?'}
432
+ control={
433
+ <Checkbox
434
+ checked={check}
435
+ onChange={e => {
436
+ setCheck(e.target.checked)
437
+ model.setTextIndexTrack(e.target.checked)
438
+ }}
439
+ />
440
+ }
441
+ />
442
+ </FormControl>
443
+ )}
444
+ {isElectron && check && supportedForIndexing ? (
445
+ <TextIndexingConfig model={model} />
446
+ ) : null}
296
447
  </div>
297
448
  )
298
449
  }
@@ -17,7 +17,10 @@ function isAbsoluteUrl(url = '') {
17
17
  return url.startsWith('/')
18
18
  }
19
19
  }
20
-
20
+ interface IndexingAttr {
21
+ attributes: string[]
22
+ exclude: string[]
23
+ }
21
24
  export default function f(pluginManager: PluginManager) {
22
25
  return types
23
26
  .model('AddTrackModel', {
@@ -38,6 +41,8 @@ export default function f(pluginManager: PluginManager) {
38
41
  altTrackType: '',
39
42
 
40
43
  adapterHint: '',
44
+ textIndexTrack: true,
45
+ textIndexingConf: undefined as IndexingAttr | undefined,
41
46
  }))
42
47
  .actions(self => ({
43
48
  setAdapterHint(obj: string) {
@@ -46,6 +51,12 @@ export default function f(pluginManager: PluginManager) {
46
51
  setTrackSource(str: string) {
47
52
  self.trackSource = str
48
53
  },
54
+ setTextIndexingConf(conf: IndexingAttr) {
55
+ self.textIndexingConf = conf
56
+ },
57
+ setTextIndexTrack(flag: boolean) {
58
+ self.textIndexTrack = flag
59
+ },
49
60
  setTrackData(obj: FileLocation) {
50
61
  self.trackData = obj
51
62
  },
@@ -70,6 +81,8 @@ export default function f(pluginManager: PluginManager) {
70
81
  self.adapterHint = ''
71
82
  self.indexTrackData = undefined
72
83
  self.trackData = undefined
84
+ self.textIndexingConf = undefined
85
+ self.textIndexTrack = false
73
86
  },
74
87
  }))
75
88
  .views(self => ({