@jbrowse/plugin-data-management 2.1.4 → 2.1.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 (92) hide show
  1. package/dist/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
  2. package/dist/AddConnectionWidget/components/AddConnectionWidget.js +16 -22
  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/components/AddTrackWidget.js +1 -2
  14. package/dist/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
  15. package/dist/AddTrackWidget/components/ConfirmTrack.js +6 -7
  16. package/dist/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
  17. package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js +3 -4
  18. package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
  19. package/dist/AddTrackWidget/index.d.ts +2 -2
  20. package/dist/AddTrackWidget/index.js.map +1 -1
  21. package/dist/HierarchicalTrackSelectorWidget/components/Header.js +12 -15
  22. package/dist/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
  23. package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
  24. package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
  25. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
  26. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +10 -13
  27. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  28. package/dist/HierarchicalTrackSelectorWidget/model.js +20 -30
  29. package/dist/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  30. package/dist/PluginStoreWidget/components/PluginCard.js +1 -1
  31. package/dist/PluginStoreWidget/components/PluginCard.js.map +1 -1
  32. package/dist/PluginStoreWidget/index.d.ts +2 -2
  33. package/dist/PluginStoreWidget/index.js.map +1 -1
  34. package/dist/ucsc-trackhub/model.d.ts +16 -4
  35. package/dist/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
  36. package/esm/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
  37. package/esm/AddConnectionWidget/components/AddConnectionWidget.js +17 -23
  38. package/esm/AddConnectionWidget/components/AddConnectionWidget.js.map +1 -1
  39. package/esm/AddConnectionWidget/components/ConfigureConnection.d.ts +9 -1
  40. package/esm/AddConnectionWidget/components/ConfigureConnection.js +3 -3
  41. package/esm/AddConnectionWidget/components/ConfigureConnection.js.map +1 -1
  42. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.d.ts +4 -4
  43. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js +6 -12
  44. package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js.map +1 -1
  45. package/esm/AddConnectionWidget/index.d.ts +2 -2
  46. package/esm/AddConnectionWidget/index.js.map +1 -1
  47. package/esm/AddConnectionWidget/model.js.map +1 -1
  48. package/esm/AddTrackWidget/components/AddTrackWidget.js +1 -2
  49. package/esm/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
  50. package/esm/AddTrackWidget/components/ConfirmTrack.js +4 -5
  51. package/esm/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
  52. package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js +3 -4
  53. package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
  54. package/esm/AddTrackWidget/index.d.ts +2 -2
  55. package/esm/AddTrackWidget/index.js.map +1 -1
  56. package/esm/HierarchicalTrackSelectorWidget/components/Header.js +7 -10
  57. package/esm/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
  58. package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
  59. package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
  60. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
  61. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +8 -13
  62. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  63. package/esm/HierarchicalTrackSelectorWidget/model.js +21 -31
  64. package/esm/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  65. package/esm/PluginStoreWidget/components/PluginCard.js +2 -2
  66. package/esm/PluginStoreWidget/components/PluginCard.js.map +1 -1
  67. package/esm/PluginStoreWidget/index.d.ts +2 -2
  68. package/esm/PluginStoreWidget/index.js.map +1 -1
  69. package/esm/ucsc-trackhub/model.d.ts +16 -4
  70. package/esm/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
  71. package/package.json +3 -3
  72. package/src/AddConnectionWidget/components/{AddConnectionWidget.js → AddConnectionWidget.tsx} +34 -38
  73. package/src/AddConnectionWidget/components/ConfigureConnection.tsx +26 -0
  74. package/src/AddConnectionWidget/components/ConnectionTypeSelect.tsx +43 -52
  75. package/src/AddConnectionWidget/components/__snapshots__/AddConnectionWidget.test.js.snap +8 -8
  76. package/src/AddConnectionWidget/{index.js → index.ts} +0 -0
  77. package/src/AddConnectionWidget/{model.js → model.ts} +0 -0
  78. package/src/AddTrackWidget/components/AddTrackWidget.test.tsx +75 -85
  79. package/src/AddTrackWidget/components/AddTrackWidget.tsx +1 -2
  80. package/src/AddTrackWidget/components/ConfirmTrack.tsx +11 -13
  81. package/src/AddTrackWidget/components/DefaultAddTrackWorkflow.tsx +4 -4
  82. package/src/AddTrackWidget/{index.js → index.ts} +0 -0
  83. package/src/HierarchicalTrackSelectorWidget/components/Header.tsx +11 -12
  84. package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.tsx +7 -15
  85. package/src/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.tsx +13 -15
  86. package/src/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.tsx +9 -14
  87. package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +2 -2
  88. package/src/HierarchicalTrackSelectorWidget/model.ts +30 -38
  89. package/src/PluginStoreWidget/components/PluginCard.tsx +3 -4
  90. package/src/PluginStoreWidget/components/__snapshots__/PluginStoreWidget.test.js.snap +2 -2
  91. package/src/PluginStoreWidget/{index.js → index.ts} +0 -0
  92. package/src/AddConnectionWidget/components/ConfigureConnection.js +0 -20
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { getSession } from '@jbrowse/core/util'
2
+ import { getSession, getEnv } from '@jbrowse/core/util'
3
3
  import {
4
4
  Button,
5
5
  Step,
@@ -9,12 +9,13 @@ 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'
13
- import { getEnv } from 'mobx-state-tree'
12
+ import { observer } from 'mobx-react'
13
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes'
14
14
 
15
15
  // locals
16
16
  import ConfigureConnection from './ConfigureConnection'
17
17
  import ConnectionTypeSelect from './ConnectionTypeSelect'
18
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration'
18
19
 
19
20
  const useStyles = makeStyles()(theme => ({
20
21
  root: {
@@ -34,10 +35,9 @@ const useStyles = makeStyles()(theme => ({
34
35
 
35
36
  const steps = ['Select a Connection Type', 'Configure Connection']
36
37
 
37
- function AddConnectionWidget({ model }) {
38
- const [connectionType, setConnectionType] = useState({})
39
- const [configModel, setConfigModel] = useState({})
40
- const [configModelReady, setConfigModelReady] = useState(true)
38
+ function AddConnectionWidget({ model }: { model: unknown }) {
39
+ const [connectionType, setConnectionType] = useState<ConnectionType>()
40
+ const [configModel, setConfigModel] = useState<AnyConfigurationModel>()
41
41
  const [activeStep, setActiveStep] = useState(0)
42
42
  const { classes } = useStyles()
43
43
 
@@ -45,38 +45,40 @@ function AddConnectionWidget({ model }) {
45
45
 
46
46
  const { pluginManager } = getEnv(session)
47
47
 
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
48
  function stepContent() {
61
49
  switch (activeStep) {
62
50
  case 0:
63
51
  return (
64
52
  <ConnectionTypeSelect
65
- connectionTypeChoices={pluginManager.getElementTypesInGroup(
66
- 'connection',
67
- )}
53
+ connectionTypeChoices={
54
+ pluginManager.getElementTypesInGroup(
55
+ 'connection',
56
+ ) as ConnectionType[]
57
+ }
68
58
  connectionType={connectionType}
69
- setConnectionType={handleSetConnectionType}
59
+ setConnectionType={c => {
60
+ setConnectionType(c)
61
+ if (c) {
62
+ setConfigModel(
63
+ c.configSchema.create(
64
+ {
65
+ connectionId: `${c.name}-${Date.now()}`,
66
+ },
67
+ getEnv(model),
68
+ ),
69
+ )
70
+ }
71
+ }}
70
72
  />
71
73
  )
72
74
  case 1:
73
- return (
75
+ return connectionType && configModel ? (
74
76
  <ConfigureConnection
75
77
  connectionType={connectionType}
76
78
  model={configModel}
77
- setModelReady={setConfigModelReady}
79
+ session={session}
78
80
  />
79
- )
81
+ ) : null
80
82
 
81
83
  default:
82
84
  return <Typography>Unknown step</Typography>
@@ -97,18 +99,16 @@ function AddConnectionWidget({ model }) {
97
99
 
98
100
  function handleFinish() {
99
101
  const connectionConf = session.addConnectionConf(configModel)
100
- session.makeConnection(connectionConf)
102
+ if (session.makeConnection) {
103
+ session.makeConnection(connectionConf)
104
+ }
101
105
  session.hideWidget(model)
102
106
  }
103
107
 
104
108
  function checkNextEnabled() {
105
- if (
106
- (activeStep === 0 && connectionType.name) ||
107
- (activeStep === 1 && configModel && configModelReady)
108
- ) {
109
- return true
110
- }
111
- return false
109
+ return (
110
+ (activeStep === 0 && connectionType) || (activeStep === 1 && configModel)
111
+ )
112
112
  }
113
113
 
114
114
  return (
@@ -150,8 +150,4 @@ function AddConnectionWidget({ model }) {
150
150
  )
151
151
  }
152
152
 
153
- AddConnectionWidget.propTypes = {
154
- model: MobxPropTypes.observableObject.isRequired,
155
- }
156
-
157
153
  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
  })
@@ -2,8 +2,7 @@ import React from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
  import { FormControl, FormHelperText, Select, MenuItem } from '@mui/material'
4
4
  import { AddTrackWorkflowType } from '@jbrowse/core/pluggableElementTypes'
5
- import { useLocalStorage } from '@jbrowse/core/util'
6
- import { getEnv } from 'mobx-state-tree'
5
+ import { getEnv, useLocalStorage } from '@jbrowse/core/util'
7
6
 
8
7
  // locals
9
8
  import { AddTrackModel } from '../model'
@@ -1,10 +1,4 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { readConfObject } from '@jbrowse/core/configuration'
3
- import {
4
- supportedIndexingAdapters,
5
- getSession,
6
- isElectron,
7
- } from '@jbrowse/core/util'
8
2
  import {
9
3
  Card,
10
4
  CardContent,
@@ -24,19 +18,23 @@ import {
24
18
  Typography,
25
19
  } from '@mui/material'
26
20
  import { makeStyles } from 'tss-react/mui'
27
-
28
- // icons
29
- import DeleteIcon from '@mui/icons-material/Delete'
30
- import AddIcon from '@mui/icons-material//Add'
31
- // other
21
+ import { readConfObject } from '@jbrowse/core/configuration'
22
+ import {
23
+ supportedIndexingAdapters,
24
+ getSession,
25
+ getEnv,
26
+ isElectron,
27
+ } from '@jbrowse/core/util'
32
28
  import PluginManager from '@jbrowse/core/PluginManager'
33
29
  import { observer } from 'mobx-react'
34
- import { getEnv } from 'mobx-state-tree'
35
30
  import { UNKNOWN } from '@jbrowse/core/util/tracks'
31
+ import { AdapterMetadata } from '@jbrowse/core/pluggableElementTypes/AdapterType'
36
32
 
33
+ // icons
34
+ import DeleteIcon from '@mui/icons-material/Delete'
35
+ import AddIcon from '@mui/icons-material//Add'
37
36
  // locals
38
37
  import { AddTrackModel } from '../model'
39
- import { AdapterMetadata } from '@jbrowse/core/pluggableElementTypes/AdapterType'
40
38
 
41
39
  const useStyles = makeStyles()(theme => ({
42
40
  spacing: {
@@ -9,6 +9,7 @@ import {
9
9
  Typography,
10
10
  } from '@mui/material'
11
11
  import { makeStyles } from 'tss-react/mui'
12
+ import { getRoot } from 'mobx-state-tree'
12
13
 
13
14
  import {
14
15
  getSession,
@@ -17,7 +18,6 @@ import {
17
18
  } from '@jbrowse/core/util'
18
19
  import { getConf } from '@jbrowse/core/configuration'
19
20
  import { observer } from 'mobx-react'
20
- import { getEnv } from 'mobx-state-tree'
21
21
 
22
22
  // locals
23
23
  import ConfirmTrack from './ConfirmTrack'
@@ -52,9 +52,9 @@ const steps = ['Enter track data', 'Confirm track type']
52
52
  function AddTrackWorkflow({ model }: { model: AddTrackModel }) {
53
53
  const [activeStep, setActiveStep] = useState(0)
54
54
  const { classes } = useStyles()
55
- const { pluginManager } = getEnv(model)
56
- const { rootModel } = pluginManager
57
- const { jobsManager } = rootModel
55
+
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ const { jobsManager } = getRoot<any>(model)
58
58
  const session = getSession(model)
59
59
  const {
60
60
  assembly,
File without changes