@jbrowse/plugin-data-management 2.1.4 → 2.1.5

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 (72) hide show
  1. package/dist/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
  2. package/dist/AddConnectionWidget/components/AddConnectionWidget.js +15 -20
  3. package/dist/AddConnectionWidget/components/AddConnectionWidget.js.map +1 -1
  4. package/dist/AddConnectionWidget/components/ConfigureConnection.d.ts +9 -1
  5. package/dist/AddConnectionWidget/components/ConfigureConnection.js +3 -3
  6. package/dist/AddConnectionWidget/components/ConfigureConnection.js.map +1 -1
  7. package/dist/AddConnectionWidget/components/ConnectionTypeSelect.d.ts +4 -4
  8. package/dist/AddConnectionWidget/components/ConnectionTypeSelect.js +6 -12
  9. package/dist/AddConnectionWidget/components/ConnectionTypeSelect.js.map +1 -1
  10. package/dist/AddConnectionWidget/index.d.ts +2 -2
  11. package/dist/AddConnectionWidget/index.js.map +1 -1
  12. package/dist/AddConnectionWidget/model.js.map +1 -1
  13. package/dist/AddTrackWidget/index.d.ts +2 -2
  14. package/dist/AddTrackWidget/index.js.map +1 -1
  15. package/dist/HierarchicalTrackSelectorWidget/components/Header.js +2 -3
  16. package/dist/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
  17. package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
  18. package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
  19. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
  20. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +10 -13
  21. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  22. package/dist/HierarchicalTrackSelectorWidget/model.js +13 -17
  23. package/dist/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  24. package/dist/PluginStoreWidget/index.d.ts +2 -2
  25. package/dist/PluginStoreWidget/index.js.map +1 -1
  26. package/dist/ucsc-trackhub/model.d.ts +16 -4
  27. package/dist/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
  28. package/esm/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
  29. package/esm/AddConnectionWidget/components/AddConnectionWidget.js +16 -21
  30. package/esm/AddConnectionWidget/components/AddConnectionWidget.js.map +1 -1
  31. package/esm/AddConnectionWidget/components/ConfigureConnection.d.ts +9 -1
  32. package/esm/AddConnectionWidget/components/ConfigureConnection.js +3 -3
  33. package/esm/AddConnectionWidget/components/ConfigureConnection.js.map +1 -1
  34. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.d.ts +4 -4
  35. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js +6 -12
  36. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js.map +1 -1
  37. package/esm/AddConnectionWidget/index.d.ts +2 -2
  38. package/esm/AddConnectionWidget/index.js.map +1 -1
  39. package/esm/AddConnectionWidget/model.js.map +1 -1
  40. package/esm/AddTrackWidget/index.d.ts +2 -2
  41. package/esm/AddTrackWidget/index.js.map +1 -1
  42. package/esm/HierarchicalTrackSelectorWidget/components/Header.js +2 -3
  43. package/esm/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
  44. package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
  45. package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
  46. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
  47. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +8 -13
  48. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  49. package/esm/HierarchicalTrackSelectorWidget/model.js +14 -18
  50. package/esm/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  51. package/esm/PluginStoreWidget/index.d.ts +2 -2
  52. package/esm/PluginStoreWidget/index.js.map +1 -1
  53. package/esm/ucsc-trackhub/model.d.ts +16 -4
  54. package/esm/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
  55. package/package.json +3 -3
  56. package/src/AddConnectionWidget/components/{AddConnectionWidget.js → AddConnectionWidget.tsx} +28 -33
  57. package/src/AddConnectionWidget/components/ConfigureConnection.tsx +26 -0
  58. package/src/AddConnectionWidget/components/ConnectionTypeSelect.tsx +43 -52
  59. package/src/AddConnectionWidget/components/__snapshots__/AddConnectionWidget.test.js.snap +8 -8
  60. package/src/AddConnectionWidget/{index.js → index.ts} +0 -0
  61. package/src/AddConnectionWidget/{model.js → model.ts} +0 -0
  62. package/src/AddTrackWidget/components/AddTrackWidget.test.tsx +75 -85
  63. package/src/AddTrackWidget/{index.js → index.ts} +0 -0
  64. package/src/HierarchicalTrackSelectorWidget/components/Header.tsx +2 -2
  65. package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.tsx +7 -15
  66. package/src/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.tsx +13 -15
  67. package/src/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.tsx +9 -14
  68. package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +2 -2
  69. package/src/HierarchicalTrackSelectorWidget/model.ts +25 -20
  70. package/src/PluginStoreWidget/components/__snapshots__/PluginStoreWidget.test.js.snap +2 -2
  71. package/src/PluginStoreWidget/{index.js → index.ts} +0 -0
  72. package/src/AddConnectionWidget/components/ConfigureConnection.js +0 -20
@@ -9,12 +9,14 @@ import {
9
9
  Typography,
10
10
  } from '@mui/material'
11
11
  import { makeStyles } from 'tss-react/mui'
12
- import { observer, PropTypes as MobxPropTypes } from 'mobx-react'
12
+ import { observer } from 'mobx-react'
13
13
  import { getEnv } from 'mobx-state-tree'
14
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes'
14
15
 
15
16
  // locals
16
17
  import ConfigureConnection from './ConfigureConnection'
17
18
  import ConnectionTypeSelect from './ConnectionTypeSelect'
19
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration'
18
20
 
19
21
  const useStyles = makeStyles()(theme => ({
20
22
  root: {
@@ -34,10 +36,9 @@ const useStyles = makeStyles()(theme => ({
34
36
 
35
37
  const steps = ['Select a Connection Type', 'Configure Connection']
36
38
 
37
- function AddConnectionWidget({ model }) {
38
- const [connectionType, setConnectionType] = useState({})
39
- const [configModel, setConfigModel] = useState({})
40
- const [configModelReady, setConfigModelReady] = useState(true)
39
+ function AddConnectionWidget({ model }: { model: unknown }) {
40
+ const [connectionType, setConnectionType] = useState<ConnectionType>()
41
+ const [configModel, setConfigModel] = useState<AnyConfigurationModel>()
41
42
  const [activeStep, setActiveStep] = useState(0)
42
43
  const { classes } = useStyles()
43
44
 
@@ -45,18 +46,6 @@ function AddConnectionWidget({ model }) {
45
46
 
46
47
  const { pluginManager } = getEnv(session)
47
48
 
48
- function handleSetConnectionType(newConnectionType) {
49
- setConnectionType(newConnectionType)
50
- setConfigModel(
51
- newConnectionType.configSchema.create(
52
- {
53
- connectionId: `${newConnectionType.name}-${Date.now()}`,
54
- },
55
- getEnv(model),
56
- ),
57
- )
58
- }
59
-
60
49
  function stepContent() {
61
50
  switch (activeStep) {
62
51
  case 0:
@@ -66,17 +55,29 @@ function AddConnectionWidget({ model }) {
66
55
  'connection',
67
56
  )}
68
57
  connectionType={connectionType}
69
- setConnectionType={handleSetConnectionType}
58
+ setConnectionType={c => {
59
+ setConnectionType(c)
60
+ if (c) {
61
+ setConfigModel(
62
+ c.configSchema.create(
63
+ {
64
+ connectionId: `${c.name}-${Date.now()}`,
65
+ },
66
+ getEnv(model),
67
+ ),
68
+ )
69
+ }
70
+ }}
70
71
  />
71
72
  )
72
73
  case 1:
73
- return (
74
+ return connectionType && configModel ? (
74
75
  <ConfigureConnection
75
76
  connectionType={connectionType}
76
77
  model={configModel}
77
- setModelReady={setConfigModelReady}
78
+ session={session}
78
79
  />
79
- )
80
+ ) : null
80
81
 
81
82
  default:
82
83
  return <Typography>Unknown step</Typography>
@@ -97,18 +98,16 @@ function AddConnectionWidget({ model }) {
97
98
 
98
99
  function handleFinish() {
99
100
  const connectionConf = session.addConnectionConf(configModel)
100
- session.makeConnection(connectionConf)
101
+ if (session.makeConnection) {
102
+ session.makeConnection(connectionConf)
103
+ }
101
104
  session.hideWidget(model)
102
105
  }
103
106
 
104
107
  function checkNextEnabled() {
105
- if (
106
- (activeStep === 0 && connectionType.name) ||
107
- (activeStep === 1 && configModel && configModelReady)
108
- ) {
109
- return true
110
- }
111
- return false
108
+ return (
109
+ (activeStep === 0 && connectionType) || (activeStep === 1 && configModel)
110
+ )
112
111
  }
113
112
 
114
113
  return (
@@ -150,8 +149,4 @@ function AddConnectionWidget({ model }) {
150
149
  )
151
150
  }
152
151
 
153
- AddConnectionWidget.propTypes = {
154
- model: MobxPropTypes.observableObject.isRequired,
155
- }
156
-
157
152
  export default observer(AddConnectionWidget)
@@ -0,0 +1,26 @@
1
+ import React, { Suspense } from 'react'
2
+ import { ConfigurationEditor } from '@jbrowse/plugin-config'
3
+ import { observer } from 'mobx-react'
4
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes'
5
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration'
6
+ import { AbstractSessionModel } from '@jbrowse/core/util'
7
+
8
+ const ConfigureConnection = observer(
9
+ (props: {
10
+ connectionType: ConnectionType
11
+ model: AnyConfigurationModel
12
+ session: AbstractSessionModel
13
+ }) => {
14
+ const { connectionType, model, session } = props
15
+ const ConfigEditorComponent =
16
+ connectionType.configEditorComponent || ConfigurationEditor
17
+
18
+ return (
19
+ <Suspense fallback={<div>Loading...</div>}>
20
+ <ConfigEditorComponent model={{ target: model }} session={session} />
21
+ </Suspense>
22
+ )
23
+ },
24
+ )
25
+
26
+ export default ConfigureConnection
@@ -1,71 +1,62 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { IconButton, MenuItem, TextField } from '@mui/material'
3
- import OpenInNewIcon from '@mui/icons-material/OpenInNew'
3
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes'
4
4
 
5
- import ConnectionType from '@jbrowse/core/pluggableElementTypes/ConnectionType'
5
+ // icons
6
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew'
6
7
 
7
8
  function ConnectionTypeSelect(props: {
8
9
  connectionTypeChoices: ConnectionType[]
9
- connectionType: ConnectionType
10
- setConnectionType: Function
10
+ connectionType?: ConnectionType
11
+ setConnectionType: (c?: ConnectionType) => void
11
12
  }) {
12
13
  const { connectionTypeChoices, connectionType, setConnectionType } = props
13
14
 
14
15
  useEffect(() => {
15
- if (!connectionType.name) {
16
+ if (!connectionType) {
16
17
  setConnectionType(connectionTypeChoices[0])
17
18
  }
18
19
  })
19
20
 
20
- function handleChange(
21
- event: React.ChangeEvent<{ name?: string; value: unknown }>,
22
- ): void {
23
- setConnectionType(
24
- connectionTypeChoices.find(
25
- (connectionTypeChoice: ConnectionType) =>
26
- connectionTypeChoice.name === event.target.value,
27
- ),
28
- )
29
- }
30
- if (!connectionType.name) {
31
- return null
32
- }
33
21
  return (
34
22
  <form autoComplete="off">
35
- <TextField
36
- value={connectionType.name}
37
- label="connectionType"
38
- helperText={
39
- connectionType.description ? (
40
- <>
41
- {connectionType.description}
42
- {connectionType.url ? (
43
- <IconButton
44
- href={connectionType.url}
45
- rel="noopener noreferrer"
46
- target="_blank"
47
- color="secondary"
48
- >
49
- <OpenInNewIcon />
50
- </IconButton>
51
- ) : null}
52
- </>
53
- ) : null
54
- }
55
- select
56
- fullWidth
57
- onChange={handleChange}
58
- variant="outlined"
59
- >
60
- {connectionTypeChoices.map((connectionTypeChoice: ConnectionType) => (
61
- <MenuItem
62
- key={connectionTypeChoice.name}
63
- value={connectionTypeChoice.name}
64
- >
65
- {connectionTypeChoice.displayName || connectionTypeChoice.name}
66
- </MenuItem>
67
- ))}
68
- </TextField>
23
+ {connectionType ? (
24
+ <TextField
25
+ value={connectionType.name}
26
+ label="connectionType"
27
+ helperText={
28
+ connectionType.description ? (
29
+ <>
30
+ {connectionType.description}
31
+ {connectionType.url ? (
32
+ <IconButton
33
+ href={connectionType.url}
34
+ rel="noopener noreferrer"
35
+ target="_blank"
36
+ color="secondary"
37
+ >
38
+ <OpenInNewIcon />
39
+ </IconButton>
40
+ ) : null}
41
+ </>
42
+ ) : null
43
+ }
44
+ select
45
+ fullWidth
46
+ onChange={event =>
47
+ setConnectionType(
48
+ connectionTypeChoices.find(c => c.name === event.target.value),
49
+ )
50
+ }
51
+ variant="outlined"
52
+ >
53
+ {connectionTypeChoices.map(c => (
54
+ <MenuItem key={c.name} value={c.name}>
55
+ {c.displayName || c.name}
56
+ </MenuItem>
57
+ ))}
58
+ </TextField>
59
+ ) : null}
69
60
  </form>
70
61
  )
71
62
  }
@@ -39,10 +39,10 @@ exports[`<AddConnectionWidget /> renders 1`] = `
39
39
  </svg>
40
40
  </span>
41
41
  <span
42
- class="MuiStepLabel-labelContainer css-16ubnlw-MuiStepLabel-labelContainer"
42
+ class="MuiStepLabel-labelContainer css-1vyamtt-MuiStepLabel-labelContainer"
43
43
  >
44
44
  <span
45
- class="MuiStepLabel-label Mui-active css-qivjh0-MuiStepLabel-label"
45
+ class="MuiStepLabel-label Mui-active css-1hv8oq8-MuiStepLabel-label"
46
46
  >
47
47
  Select a Connection Type
48
48
  </span>
@@ -68,7 +68,7 @@ exports[`<AddConnectionWidget /> renders 1`] = `
68
68
  class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root css-wb57ya-MuiFormControl-root-MuiTextField-root"
69
69
  >
70
70
  <label
71
- class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiFormLabel-filled css-1sumxir-MuiFormLabel-root-MuiInputLabel-root"
71
+ class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiFormLabel-filled MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined css-1sumxir-MuiFormLabel-root-MuiInputLabel-root"
72
72
  data-shrink="true"
73
73
  for="mui-1"
74
74
  id="mui-1-label"
@@ -112,7 +112,7 @@ exports[`<AddConnectionWidget /> renders 1`] = `
112
112
  class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
113
113
  >
114
114
  <legend
115
- class="css-1in441m"
115
+ class="css-14lo706"
116
116
  >
117
117
  <span>
118
118
  connectionType
@@ -154,7 +154,7 @@ exports[`<AddConnectionWidget /> renders 1`] = `
154
154
  class="tss-1spe31o-actionsContainer"
155
155
  >
156
156
  <button
157
- class="MuiButtonBase-root Mui-disabled MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium tss-11xjtta-button css-1e6y48t-MuiButtonBase-root-MuiButton-root"
157
+ class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium Mui-disabled MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium tss-11xjtta-button css-1e6y48t-MuiButtonBase-root-MuiButton-root"
158
158
  disabled=""
159
159
  tabindex="-1"
160
160
  type="button"
@@ -162,7 +162,7 @@ exports[`<AddConnectionWidget /> renders 1`] = `
162
162
  Back
163
163
  </button>
164
164
  <button
165
- class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium tss-11xjtta-button css-sghohy-MuiButtonBase-root-MuiButton-root"
165
+ class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium tss-11xjtta-button css-sghohy-MuiButtonBase-root-MuiButton-root"
166
166
  data-testid="addConnectionNext"
167
167
  tabindex="0"
168
168
  type="button"
@@ -217,10 +217,10 @@ exports[`<AddConnectionWidget /> renders 1`] = `
217
217
  </svg>
218
218
  </span>
219
219
  <span
220
- class="MuiStepLabel-labelContainer css-16ubnlw-MuiStepLabel-labelContainer"
220
+ class="MuiStepLabel-labelContainer css-1vyamtt-MuiStepLabel-labelContainer"
221
221
  >
222
222
  <span
223
- class="MuiStepLabel-label Mui-disabled css-qivjh0-MuiStepLabel-label"
223
+ class="MuiStepLabel-label Mui-disabled css-1hv8oq8-MuiStepLabel-label"
224
224
  >
225
225
  Configure Connection
226
226
  </span>
File without changes
File without changes
@@ -2,110 +2,101 @@ import React from 'react'
2
2
  import { render, fireEvent } from '@testing-library/react'
3
3
  import { createTestSession } from '@jbrowse/web/src/rootModel'
4
4
  import AddTrackWidget from './AddTrackWidget'
5
- import { AddTrackModel } from '../model'
6
- import { AbstractSessionModel } from '@jbrowse/core/util'
7
5
  jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
8
6
 
9
- describe('<AddTrackWidget />', () => {
10
- let session: AbstractSessionModel
11
- let model: AddTrackModel
12
-
13
- beforeAll(() => {
14
- // @ts-ignore
15
- session = createTestSession()
16
- // @ts-ignore
17
- session.addAssemblyConf({
18
- name: 'volMyt1',
19
- sequence: {
20
- trackId: 'ref0',
21
- type: 'ReferenceSequenceTrack',
22
- adapter: {
23
- type: 'FromConfigSequenceAdapter',
24
- features: [
25
- {
26
- refName: 'ctgA',
27
- uniqueId: 'firstId',
28
- start: 0,
29
- end: 1000,
30
- seq: 'cattgttgcggagttgaacaACGGCATTAGGAACACTTCCGTCTCtcacttttatacgattatgattggttctttagccttggtttagattggtagtagtagcggcgctaatgctacctgaattgagaactcgagcgggggctaggcaaattctgattcagcctgacttctcttggaaccctgcccataaatcaaagggttagtgcggccaaaacgttggacaacggtattagaagaccaacctgaccaccaaaccgtcaattaaccggtatcttctcggaaacggcggttctctcctagatagcgatctgtggtctcaccatgcaatttaaacaggtgagtaaagattgctacaaatacgagactagctgtcaccagatgctgttcatctgttggctccttggtcgctccgttgtacccaggctactttgaaagagcgcagaatacttagacggtatcgatcatggtagcatagcattctgataacatgtatggagttcgaacatccgtctggggccggacggtccgtttgaggttggttgatctgggtgatagtcagcaagatagacgttagataacaaattaaaggattttaccttagattgcgactagtacaacggtacatcggtgattcgcgctctactagatcacgctatgggtaccataaacaaacggtggaccttctcaagctggttgacgcctcagcaacataggcttcctcctccacgcatctcagcataaaaggcttataaactgcttctttgtgccagagcaactcaattaagcccttggtaccgtgggcacgcattctgtcacggtgaccaactgttcatcctgaatcgccgaatgggactatttggtacaggaatcaagcggatggcactactgcagcttatttacgacggtattcttaaagtttttaagacaatgtatttcatgggtagttcggtttgttttattgctacacaggctcttgtagacgacctacttagcactacgg',
31
- },
32
- ],
33
- },
34
- },
35
- })
36
- // @ts-ignore
37
- session.addTrackConf({
38
- trackId: 'i3jUPmrgMOS',
39
- type: 'FeatureTrack',
40
- name: 'Filter Test',
41
- assemblyNames: ['volMyt1'],
7
+ function getSession() {
8
+ const session = createTestSession()
9
+ session.addAssemblyConf({
10
+ name: 'volMyt1',
11
+ sequence: {
12
+ trackId: 'ref0',
13
+ type: 'ReferenceSequenceTrack',
42
14
  adapter: {
43
- type: 'FromConfigAdapter',
15
+ type: 'FromConfigSequenceAdapter',
44
16
  features: [
45
17
  {
46
- uniqueId: 'one',
47
18
  refName: 'ctgA',
48
- start: 100,
49
- end: 101,
50
- type: 'foo',
51
- name: 'Boris',
52
- note: 'note for boris',
53
- },
54
- {
55
- uniqueId: 'two',
56
- refName: 'ctgA',
57
- start: 110,
58
- end: 111,
59
- type: 'bar',
60
- name: 'Theresa',
61
- note: 'note for theresa',
62
- },
63
- {
64
- uniqueId: 'three',
65
- refName: 'ctgA',
66
- start: 120,
67
- end: 121,
68
- type: 'baz',
69
- name: 'Nigel',
70
- note: 'note for nigel',
71
- },
72
- {
73
- uniqueId: 'four',
74
- refName: 'ctgA',
75
- start: 130,
76
- end: 131,
77
- type: 'quux',
78
- name: 'Geoffray',
79
- note: 'note for geoffray',
19
+ uniqueId: 'firstId',
20
+ start: 0,
21
+ end: 1000,
22
+ seq: 'cattgttgcggagttgaacaACGGCATTAGGAACACTTCCGTCTCtcacttttatacgattatgattggttctttagccttggtttagattggtagtagtagcggcgctaatgctacctgaattgagaactcgagcgggggctaggcaaattctgattcagcctgacttctcttggaaccctgcccataaatcaaagggttagtgcggccaaaacgttggacaacggtattagaagaccaacctgaccaccaaaccgtcaattaaccggtatcttctcggaaacggcggttctctcctagatagcgatctgtggtctcaccatgcaatttaaacaggtgagtaaagattgctacaaatacgagactagctgtcaccagatgctgttcatctgttggctccttggtcgctccgttgtacccaggctactttgaaagagcgcagaatacttagacggtatcgatcatggtagcatagcattctgataacatgtatggagttcgaacatccgtctggggccggacggtccgtttgaggttggttgatctgggtgatagtcagcaagatagacgttagataacaaattaaaggattttaccttagattgcgactagtacaacggtacatcggtgattcgcgctctactagatcacgctatgggtaccataaacaaacggtggaccttctcaagctggttgacgcctcagcaacataggcttcctcctccacgcatctcagcataaaaggcttataaactgcttctttgtgccagagcaactcaattaagcccttggtaccgtgggcacgcattctgtcacggtgaccaactgttcatcctgaatcgccgaatgggactatttggtacaggaatcaagcggatggcactactgcagcttatttacgacggtattcttaaagtttttaagacaatgtatttcatgggtagttcggtttgttttattgctacacaggctcttgtagacgacctacttagcactacgg',
80
23
  },
81
24
  ],
82
25
  },
83
- filterAttributes: ['type', 'start', 'end'],
84
- })
85
-
86
- // @ts-ignore
87
- const view = session.addView('LinearGenomeView', {
88
- displayedRegions: [
26
+ },
27
+ })
28
+ session.addTrackConf({
29
+ trackId: 'i3jUPmrgMOS',
30
+ type: 'FeatureTrack',
31
+ name: 'Filter Test',
32
+ assemblyNames: ['volMyt1'],
33
+ adapter: {
34
+ type: 'FromConfigAdapter',
35
+ features: [
89
36
  {
90
- assemblyName: 'volMyt1',
37
+ uniqueId: 'one',
91
38
  refName: 'ctgA',
92
- start: 0,
93
- end: 1000,
39
+ start: 100,
40
+ end: 101,
41
+ type: 'foo',
42
+ name: 'Boris',
43
+ note: 'note for boris',
44
+ },
45
+ {
46
+ uniqueId: 'two',
47
+ refName: 'ctgA',
48
+ start: 110,
49
+ end: 111,
50
+ type: 'bar',
51
+ name: 'Theresa',
52
+ note: 'note for theresa',
53
+ },
54
+ {
55
+ uniqueId: 'three',
56
+ refName: 'ctgA',
57
+ start: 120,
58
+ end: 121,
59
+ type: 'baz',
60
+ name: 'Nigel',
61
+ note: 'note for nigel',
62
+ },
63
+ {
64
+ uniqueId: 'four',
65
+ refName: 'ctgA',
66
+ start: 130,
67
+ end: 131,
68
+ type: 'quux',
69
+ name: 'Geoffray',
70
+ note: 'note for geoffray',
94
71
  },
95
72
  ],
96
- })
73
+ },
74
+ filterAttributes: ['type', 'start', 'end'],
75
+ })
97
76
 
98
- // @ts-ignore
99
- model = session.addWidget('AddTrackWidget', 'addTrackWidget', {
100
- view: view.id,
101
- })
77
+ const view = session.addView('LinearGenomeView', {
78
+ displayedRegions: [
79
+ {
80
+ assemblyName: 'volMyt1',
81
+ refName: 'ctgA',
82
+ start: 0,
83
+ end: 1000,
84
+ },
85
+ ],
86
+ })
87
+
88
+ const model = session.addWidget('AddTrackWidget', 'addTrackWidget', {
89
+ view: view.id,
102
90
  })
91
+ return { session, model }
92
+ }
103
93
 
94
+ describe('<AddTrackWidget />', () => {
104
95
  it('adds a track', async () => {
96
+ const { session, model } = getSession()
105
97
  const { getByTestId, getAllByTestId, findByText, findAllByText } = render(
106
98
  <AddTrackWidget model={model} />,
107
99
  )
108
- // @ts-ignore
109
100
  expect(session.sessionTracks.length).toBe(1)
110
101
  fireEvent.change(getAllByTestId('urlInput')[0], {
111
102
  target: { value: 'test.txt' },
@@ -123,7 +114,6 @@ describe('<AddTrackWidget />', () => {
123
114
  const volMyt1 = await findAllByText('volMyt1')
124
115
  fireEvent.click(volMyt1[1])
125
116
  fireEvent.click(getAllByTestId('addTrackNextButton')[0])
126
- // @ts-ignore
127
117
  expect(session.sessionTracks.length).toBe(2)
128
118
  })
129
119
  })
File without changes
@@ -74,7 +74,6 @@ function HierarchicalTrackSelectorHeader({
74
74
  const [connectionManagerOpen, setConnectionManagerOpen] = useState(false)
75
75
  const [connectionToggleOpen, setConnectionToggleOpen] = useState(false)
76
76
  const { assemblyNames } = model
77
- const assemblyName = assemblyNames[assemblyIdx]
78
77
 
79
78
  function breakConnection(
80
79
  connectionConf: AnyConfigurationModel,
@@ -159,6 +158,8 @@ function HierarchicalTrackSelectorHeader({
159
158
 
160
159
  const items = getEnv(model).pluginManager.evaluateExtensionPoint(
161
160
  'TrackSelector-multiTrackMenuItems',
161
+ [],
162
+ { session },
162
163
  ) as MenuItem[]
163
164
  return (
164
165
  <div
@@ -276,7 +277,6 @@ function HierarchicalTrackSelectorHeader({
276
277
  handleClose={() => setConnectionToggleOpen(false)}
277
278
  session={session}
278
279
  breakConnection={breakConnection}
279
- assemblyName={assemblyName}
280
280
  />
281
281
  ) : null}
282
282
  </Suspense>
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
-
3
1
  import React from 'react'
4
2
  import { createJBrowseTheme } from '@jbrowse/core/ui'
5
3
  import { createTestSession } from '@jbrowse/web/src/rootModel'
@@ -20,7 +18,7 @@ describe('HierarchicalTrackSelector widget', () => {
20
18
 
21
19
  it('renders nothing with no assembly', () => {
22
20
  const session = createTestSession()
23
- const firstView = session!.addView('LinearGenomeView')
21
+ const firstView = session.addView('LinearGenomeView')
24
22
  const model = firstView.activateTrackSelector()
25
23
 
26
24
  const { container } = render(
@@ -34,7 +32,6 @@ describe('HierarchicalTrackSelector widget', () => {
34
32
 
35
33
  it('renders with a couple of uncategorized tracks', async () => {
36
34
  const session = createTestSession()
37
- // @ts-ignore
38
35
  session.addAssemblyConf({
39
36
  name: 'volMyt1',
40
37
  sequence: {
@@ -54,21 +51,19 @@ describe('HierarchicalTrackSelector widget', () => {
54
51
  },
55
52
  },
56
53
  })
57
- // @ts-ignore
58
54
  session.addTrackConf({
59
55
  trackId: 'fooC',
60
56
  assemblyNames: ['volMyt1'],
61
57
  type: 'FeatureTrack',
62
58
  adapter: { type: 'FromConfigAdapter', features: [] },
63
59
  })
64
- // @ts-ignore
65
60
  session.addTrackConf({
66
61
  trackId: 'barC',
67
62
  assemblyNames: ['volMyt1'],
68
63
  type: 'FeatureTrack',
69
64
  adapter: { type: 'FromConfigAdapter', features: [] },
70
65
  })
71
- const firstView = session!.addView('LinearGenomeView', {
66
+ const firstView = session.addView('LinearGenomeView', {
72
67
  displayedRegions: [
73
68
  {
74
69
  assemblyName: 'volMyt1',
@@ -78,8 +73,8 @@ describe('HierarchicalTrackSelector widget', () => {
78
73
  },
79
74
  ],
80
75
  })
81
- firstView.showTrack(session!.sessionTracks[0].trackId)
82
- firstView.showTrack(session!.sessionTracks[1].trackId)
76
+ firstView.showTrack(session.sessionTracks[0].trackId)
77
+ firstView.showTrack(session.sessionTracks[1].trackId)
83
78
  const model = firstView.activateTrackSelector()
84
79
 
85
80
  const { container, findByTestId } = render(
@@ -94,7 +89,6 @@ describe('HierarchicalTrackSelector widget', () => {
94
89
 
95
90
  it('renders with a couple of categorized tracks', async () => {
96
91
  const session = createTestSession()
97
- // @ts-ignore
98
92
  session.addAssemblyConf({
99
93
  name: 'volMyt1',
100
94
  sequence: {
@@ -115,21 +109,19 @@ describe('HierarchicalTrackSelector widget', () => {
115
109
  },
116
110
  })
117
111
 
118
- // @ts-ignore
119
112
  session.addTrackConf({
120
113
  trackId: 'fooC',
121
114
  assemblyNames: ['volMyt1'],
122
115
  type: 'FeatureTrack',
123
116
  adapter: { type: 'FromConfigAdapter', features: [] },
124
117
  })
125
- // @ts-ignore
126
118
  session.addTrackConf({
127
119
  trackId: 'barC',
128
120
  assemblyNames: ['volMyt1'],
129
121
  type: 'FeatureTrack',
130
122
  adapter: { type: 'FromConfigAdapter', features: [] },
131
123
  })
132
- const firstView = session!.addView('LinearGenomeView', {
124
+ const firstView = session.addView('LinearGenomeView', {
133
125
  displayedRegions: [
134
126
  {
135
127
  assemblyName: 'volMyt1',
@@ -139,8 +131,8 @@ describe('HierarchicalTrackSelector widget', () => {
139
131
  },
140
132
  ],
141
133
  })
142
- firstView.showTrack(session!.sessionTracks[0].trackId)
143
- firstView.showTrack(session!.sessionTracks[1].trackId)
134
+ firstView.showTrack(session.sessionTracks[0].trackId)
135
+ firstView.showTrack(session.sessionTracks[1].trackId)
144
136
  firstView.tracks[0].configuration.category.set(['Foo Category'])
145
137
  firstView.tracks[1].configuration.category.set([
146
138
  'Foo Category',