@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.
- package/dist/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
- package/dist/AddConnectionWidget/components/AddConnectionWidget.js +16 -22
- package/dist/AddConnectionWidget/components/AddConnectionWidget.js.map +1 -1
- package/dist/AddConnectionWidget/components/ConfigureConnection.d.ts +9 -1
- package/dist/AddConnectionWidget/components/ConfigureConnection.js +3 -3
- package/dist/AddConnectionWidget/components/ConfigureConnection.js.map +1 -1
- package/dist/AddConnectionWidget/components/ConnectionTypeSelect.d.ts +4 -4
- package/dist/AddConnectionWidget/components/ConnectionTypeSelect.js +6 -12
- package/dist/AddConnectionWidget/components/ConnectionTypeSelect.js.map +1 -1
- package/dist/AddConnectionWidget/index.d.ts +2 -2
- package/dist/AddConnectionWidget/index.js.map +1 -1
- package/dist/AddConnectionWidget/model.js.map +1 -1
- package/dist/AddTrackWidget/components/AddTrackWidget.js +1 -2
- package/dist/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
- package/dist/AddTrackWidget/components/ConfirmTrack.js +6 -7
- package/dist/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
- package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js +3 -4
- package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
- package/dist/AddTrackWidget/index.d.ts +2 -2
- package/dist/AddTrackWidget/index.js.map +1 -1
- package/dist/HierarchicalTrackSelectorWidget/components/Header.js +12 -15
- package/dist/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
- package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
- package/dist/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
- package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
- package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +10 -13
- package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
- package/dist/HierarchicalTrackSelectorWidget/model.js +20 -30
- package/dist/HierarchicalTrackSelectorWidget/model.js.map +1 -1
- package/dist/PluginStoreWidget/components/PluginCard.js +1 -1
- package/dist/PluginStoreWidget/components/PluginCard.js.map +1 -1
- package/dist/PluginStoreWidget/index.d.ts +2 -2
- package/dist/PluginStoreWidget/index.js.map +1 -1
- package/dist/ucsc-trackhub/model.d.ts +16 -4
- package/dist/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
- package/esm/AddConnectionWidget/components/AddConnectionWidget.d.ts +4 -7
- package/esm/AddConnectionWidget/components/AddConnectionWidget.js +17 -23
- package/esm/AddConnectionWidget/components/AddConnectionWidget.js.map +1 -1
- package/esm/AddConnectionWidget/components/ConfigureConnection.d.ts +9 -1
- package/esm/AddConnectionWidget/components/ConfigureConnection.js +3 -3
- package/esm/AddConnectionWidget/components/ConfigureConnection.js.map +1 -1
- package/esm/AddConnectionWidget/components/ConnectionTypeSelect.d.ts +4 -4
- package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js +6 -12
- package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js.map +1 -1
- package/esm/AddConnectionWidget/index.d.ts +2 -2
- package/esm/AddConnectionWidget/index.js.map +1 -1
- package/esm/AddConnectionWidget/model.js.map +1 -1
- package/esm/AddTrackWidget/components/AddTrackWidget.js +1 -2
- package/esm/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
- package/esm/AddTrackWidget/components/ConfirmTrack.js +4 -5
- package/esm/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
- package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js +3 -4
- package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
- package/esm/AddTrackWidget/index.d.ts +2 -2
- package/esm/AddTrackWidget/index.js.map +1 -1
- package/esm/HierarchicalTrackSelectorWidget/components/Header.js +7 -10
- package/esm/HierarchicalTrackSelectorWidget/components/Header.js.map +1 -1
- package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js +6 -7
- package/esm/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.js.map +1 -1
- package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.d.ts +2 -2
- package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +8 -13
- package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
- package/esm/HierarchicalTrackSelectorWidget/model.js +21 -31
- package/esm/HierarchicalTrackSelectorWidget/model.js.map +1 -1
- package/esm/PluginStoreWidget/components/PluginCard.js +2 -2
- package/esm/PluginStoreWidget/components/PluginCard.js.map +1 -1
- package/esm/PluginStoreWidget/index.d.ts +2 -2
- package/esm/PluginStoreWidget/index.js.map +1 -1
- package/esm/ucsc-trackhub/model.d.ts +16 -4
- package/esm/ucsc-trackhub/ucscTrackHub.d.ts +3 -3
- package/package.json +3 -3
- package/src/AddConnectionWidget/components/{AddConnectionWidget.js → AddConnectionWidget.tsx} +34 -38
- package/src/AddConnectionWidget/components/ConfigureConnection.tsx +26 -0
- package/src/AddConnectionWidget/components/ConnectionTypeSelect.tsx +43 -52
- package/src/AddConnectionWidget/components/__snapshots__/AddConnectionWidget.test.js.snap +8 -8
- package/src/AddConnectionWidget/{index.js → index.ts} +0 -0
- package/src/AddConnectionWidget/{model.js → model.ts} +0 -0
- package/src/AddTrackWidget/components/AddTrackWidget.test.tsx +75 -85
- package/src/AddTrackWidget/components/AddTrackWidget.tsx +1 -2
- package/src/AddTrackWidget/components/ConfirmTrack.tsx +11 -13
- package/src/AddTrackWidget/components/DefaultAddTrackWorkflow.tsx +4 -4
- package/src/AddTrackWidget/{index.js → index.ts} +0 -0
- package/src/HierarchicalTrackSelectorWidget/components/Header.tsx +11 -12
- package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.tsx +7 -15
- package/src/HierarchicalTrackSelectorWidget/components/ManageConnectionsDialog.tsx +13 -15
- package/src/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.tsx +9 -14
- package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +2 -2
- package/src/HierarchicalTrackSelectorWidget/model.ts +30 -38
- package/src/PluginStoreWidget/components/PluginCard.tsx +3 -4
- package/src/PluginStoreWidget/components/__snapshots__/PluginStoreWidget.test.js.snap +2 -2
- package/src/PluginStoreWidget/{index.js → index.ts} +0 -0
- package/src/AddConnectionWidget/components/ConfigureConnection.js +0 -20
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import React, { Suspense, lazy, useState } from 'react'
|
|
2
|
-
import { makeStyles } from 'tss-react/mui'
|
|
3
2
|
import { Badge, IconButton, InputAdornment, TextField } from '@mui/material'
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import MenuIcon from '@mui/icons-material/Menu'
|
|
7
|
-
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart'
|
|
8
|
-
import { Cable } from '@jbrowse/core/ui/Icons'
|
|
9
|
-
|
|
10
|
-
// other
|
|
3
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
|
+
import { observer } from 'mobx-react'
|
|
11
5
|
import JBrowseMenu, { MenuItem } from '@jbrowse/core/ui/Menu'
|
|
12
6
|
import {
|
|
13
7
|
getSession,
|
|
8
|
+
getEnv,
|
|
14
9
|
isSessionModelWithWidgets,
|
|
15
10
|
isSessionModelWithConnections,
|
|
16
11
|
isSessionWithAddTracks,
|
|
@@ -19,8 +14,12 @@ import {
|
|
|
19
14
|
AnyConfigurationModel,
|
|
20
15
|
readConfObject,
|
|
21
16
|
} from '@jbrowse/core/configuration'
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
|
|
18
|
+
// icons
|
|
19
|
+
import ClearIcon from '@mui/icons-material/Clear'
|
|
20
|
+
import MenuIcon from '@mui/icons-material/Menu'
|
|
21
|
+
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart'
|
|
22
|
+
import { Cable } from '@jbrowse/core/ui/Icons'
|
|
24
23
|
|
|
25
24
|
// locals
|
|
26
25
|
import { HierarchicalTrackSelectorModel } from '../model'
|
|
@@ -74,7 +73,6 @@ function HierarchicalTrackSelectorHeader({
|
|
|
74
73
|
const [connectionManagerOpen, setConnectionManagerOpen] = useState(false)
|
|
75
74
|
const [connectionToggleOpen, setConnectionToggleOpen] = useState(false)
|
|
76
75
|
const { assemblyNames } = model
|
|
77
|
-
const assemblyName = assemblyNames[assemblyIdx]
|
|
78
76
|
|
|
79
77
|
function breakConnection(
|
|
80
78
|
connectionConf: AnyConfigurationModel,
|
|
@@ -159,6 +157,8 @@ function HierarchicalTrackSelectorHeader({
|
|
|
159
157
|
|
|
160
158
|
const items = getEnv(model).pluginManager.evaluateExtensionPoint(
|
|
161
159
|
'TrackSelector-multiTrackMenuItems',
|
|
160
|
+
[],
|
|
161
|
+
{ session },
|
|
162
162
|
) as MenuItem[]
|
|
163
163
|
return (
|
|
164
164
|
<div
|
|
@@ -276,7 +276,6 @@ function HierarchicalTrackSelectorHeader({
|
|
|
276
276
|
handleClose={() => setConnectionToggleOpen(false)}
|
|
277
277
|
session={session}
|
|
278
278
|
breakConnection={breakConnection}
|
|
279
|
-
assemblyName={assemblyName}
|
|
280
279
|
/>
|
|
281
280
|
) : null}
|
|
282
281
|
</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
|
|
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
|
|
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
|
|
82
|
-
firstView.showTrack(session
|
|
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
|
|
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
|
|
143
|
-
firstView.showTrack(session
|
|
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',
|
|
@@ -62,22 +62,20 @@ function ManageConnectionsDlg({
|
|
|
62
62
|
{connections.map(conf => {
|
|
63
63
|
const name = readConfObject(conf, 'name')
|
|
64
64
|
return (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
<
|
|
69
|
-
|
|
65
|
+
<Typography key={`conn-${name}`}>
|
|
66
|
+
{adminMode || sessionConnections?.includes(conf) ? (
|
|
67
|
+
<IconButton onClick={() => breakConnection(conf, true)}>
|
|
68
|
+
<CloseIcon color="error" />
|
|
69
|
+
</IconButton>
|
|
70
|
+
) : (
|
|
71
|
+
<Tooltip title="Unable to delete connection in config file as non-admin user">
|
|
72
|
+
<IconButton>
|
|
73
|
+
<CloseIcon color="disabled" />
|
|
70
74
|
</IconButton>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
</IconButton>
|
|
76
|
-
</Tooltip>
|
|
77
|
-
)}
|
|
78
|
-
{name}
|
|
79
|
-
</Typography>
|
|
80
|
-
</div>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
)}
|
|
77
|
+
{name}
|
|
78
|
+
</Typography>
|
|
81
79
|
)
|
|
82
80
|
})}
|
|
83
81
|
{!connections.length ? (
|
|
@@ -19,6 +19,10 @@ import {
|
|
|
19
19
|
} from '@jbrowse/core/configuration'
|
|
20
20
|
import { AbstractSessionModel } from '@jbrowse/core/util'
|
|
21
21
|
|
|
22
|
+
export function ellipses(slug: string) {
|
|
23
|
+
return slug.length > 20 ? `${slug.slice(0, 20)}...` : slug
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
const useStyles = makeStyles()(theme => ({
|
|
23
27
|
closeButton: {
|
|
24
28
|
position: 'absolute',
|
|
@@ -36,24 +40,14 @@ const useStyles = makeStyles()(theme => ({
|
|
|
36
40
|
function ToggleConnectionDialog({
|
|
37
41
|
session,
|
|
38
42
|
handleClose,
|
|
39
|
-
assemblyName,
|
|
40
43
|
breakConnection,
|
|
41
44
|
}: {
|
|
42
45
|
handleClose: () => void
|
|
43
46
|
session: AbstractSessionModel
|
|
44
|
-
assemblyName: string
|
|
45
47
|
breakConnection: (arg: AnyConfigurationModel) => void
|
|
46
48
|
}) {
|
|
47
49
|
const { classes } = useStyles()
|
|
48
50
|
const { connections, connectionInstances: instances = [] } = session
|
|
49
|
-
const assemblySpecificConnections = connections.filter(c => {
|
|
50
|
-
const configAssemblyNames = readConfObject(c, 'assemblyNames')
|
|
51
|
-
if (configAssemblyNames.length === 0) {
|
|
52
|
-
return true
|
|
53
|
-
}
|
|
54
|
-
return configAssemblyNames.includes(assemblyName)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
51
|
return (
|
|
58
52
|
<Dialog open onClose={handleClose} maxWidth="lg">
|
|
59
53
|
<DialogTitle>
|
|
@@ -68,8 +62,9 @@ function ToggleConnectionDialog({
|
|
|
68
62
|
<DialogContent>
|
|
69
63
|
<Typography>Use the checkbox to turn on/off connections</Typography>
|
|
70
64
|
<div className={classes.connectionContainer}>
|
|
71
|
-
{
|
|
65
|
+
{connections.map(conf => {
|
|
72
66
|
const name = readConfObject(conf, 'name')
|
|
67
|
+
const assemblyNames = readConfObject(conf, 'assemblyNames')
|
|
73
68
|
const found = instances.find(conn => name === conn.name)
|
|
74
69
|
return (
|
|
75
70
|
<FormControlLabel
|
|
@@ -87,12 +82,12 @@ function ToggleConnectionDialog({
|
|
|
87
82
|
color="primary"
|
|
88
83
|
/>
|
|
89
84
|
}
|
|
90
|
-
label={name}
|
|
85
|
+
label={`${name} (${ellipses(assemblyNames.join(','))})`}
|
|
91
86
|
/>
|
|
92
87
|
)
|
|
93
88
|
})}
|
|
94
|
-
{!
|
|
95
|
-
<Typography>No connections found
|
|
89
|
+
{!connections.length ? (
|
|
90
|
+
<Typography>No connections found</Typography>
|
|
96
91
|
) : null}
|
|
97
92
|
</div>
|
|
98
93
|
</DialogContent>
|
|
@@ -73,7 +73,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of categorized t
|
|
|
73
73
|
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root tss-45fwc5-searchBox css-1z10yd4-MuiFormControl-root-MuiTextField-root"
|
|
74
74
|
>
|
|
75
75
|
<label
|
|
76
|
-
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
76
|
+
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
77
77
|
data-shrink="false"
|
|
78
78
|
for="mui-5"
|
|
79
79
|
id="mui-5-label"
|
|
@@ -170,7 +170,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of uncategorized
|
|
|
170
170
|
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root tss-45fwc5-searchBox css-1z10yd4-MuiFormControl-root-MuiTextField-root"
|
|
171
171
|
>
|
|
172
172
|
<label
|
|
173
|
-
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
173
|
+
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
174
174
|
data-shrink="false"
|
|
175
175
|
for="mui-1"
|
|
176
176
|
id="mui-1-label"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { types,
|
|
1
|
+
import { types, getSnapshot, Instance } from 'mobx-state-tree'
|
|
2
2
|
import {
|
|
3
3
|
getConf,
|
|
4
4
|
readConfObject,
|
|
5
5
|
AnyConfigurationModel,
|
|
6
6
|
} from '@jbrowse/core/configuration'
|
|
7
|
-
import { getSession } from '@jbrowse/core/util'
|
|
7
|
+
import { AbstractSessionModel, getSession, getEnv } from '@jbrowse/core/util'
|
|
8
|
+
import { getTrackName } from '@jbrowse/core/util/tracks'
|
|
8
9
|
import { ElementId } from '@jbrowse/core/util/types/mst'
|
|
9
10
|
import PluginManager from '@jbrowse/core/PluginManager'
|
|
10
11
|
|
|
@@ -12,28 +13,19 @@ function hasAnyOverlap<T>(a1: T[] = [], a2: T[] = []) {
|
|
|
12
13
|
return !!a1.find(value => a2.includes(value))
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
function passesFilter(
|
|
16
|
+
function passesFilter(
|
|
17
|
+
filter: string,
|
|
18
|
+
config: AnyConfigurationModel,
|
|
19
|
+
session: AbstractSessionModel,
|
|
20
|
+
) {
|
|
16
21
|
const categories = readConfObject(config, 'category') as string[] | undefined
|
|
17
22
|
const filterLower = filter.toLowerCase()
|
|
18
23
|
return (
|
|
19
|
-
getTrackName(config).toLowerCase().includes(filterLower) ||
|
|
24
|
+
getTrackName(config, session).toLowerCase().includes(filterLower) ||
|
|
20
25
|
!!categories?.filter(c => c.toLowerCase().includes(filterLower)).length
|
|
21
26
|
)
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
function getTrackName(config: AnyConfigurationModel): string {
|
|
25
|
-
if (!config.trackId) {
|
|
26
|
-
throw new Error('not a track')
|
|
27
|
-
}
|
|
28
|
-
return (
|
|
29
|
-
readConfObject(config, 'name') ||
|
|
30
|
-
`Reference sequence (${
|
|
31
|
-
readConfObject(getParent(config), 'displayName') ||
|
|
32
|
-
readConfObject(getParent(config), 'name')
|
|
33
|
-
})`
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
29
|
export type TreeNode = {
|
|
38
30
|
name: string
|
|
39
31
|
id: string
|
|
@@ -55,12 +47,9 @@ function filterTracks(
|
|
|
55
47
|
if (!assembly) {
|
|
56
48
|
return []
|
|
57
49
|
}
|
|
50
|
+
const { allAliases } = assembly
|
|
58
51
|
return tracks
|
|
59
|
-
.filter(c =>
|
|
60
|
-
const trackConfAssemblies = readConfObject(c, 'assemblyNames')
|
|
61
|
-
const { allAliases } = assembly
|
|
62
|
-
return hasAnyOverlap(allAliases, trackConfAssemblies)
|
|
63
|
-
})
|
|
52
|
+
.filter(c => hasAnyOverlap(allAliases, readConfObject(c, 'assemblyNames')))
|
|
64
53
|
.filter(c => {
|
|
65
54
|
const { displayTypes } = pluginManager.getViewType(self.view.type)
|
|
66
55
|
const compatDisplays = displayTypes.map((d: { name: string }) => d.name)
|
|
@@ -76,9 +65,10 @@ export function generateHierarchy(
|
|
|
76
65
|
) {
|
|
77
66
|
const hierarchy = { children: [] as TreeNode[] } as TreeNode
|
|
78
67
|
const { filterText, view } = model
|
|
68
|
+
const session = getSession(model)
|
|
79
69
|
|
|
80
70
|
trackConfigurations
|
|
81
|
-
.filter(conf => passesFilter(filterText, conf))
|
|
71
|
+
.filter(conf => passesFilter(filterText, conf, session))
|
|
82
72
|
.forEach(conf => {
|
|
83
73
|
// copy the categories since this array can be mutated downstream
|
|
84
74
|
const categories = [...(readConfObject(conf, 'category') || [])]
|
|
@@ -118,7 +108,7 @@ export function generateHierarchy(
|
|
|
118
108
|
0,
|
|
119
109
|
{
|
|
120
110
|
id: conf.trackId,
|
|
121
|
-
name: getTrackName(conf),
|
|
111
|
+
name: getTrackName(conf, session),
|
|
122
112
|
conf,
|
|
123
113
|
checked: !!tracks.find(f => f.configuration === conf),
|
|
124
114
|
children: [],
|
|
@@ -226,24 +216,26 @@ export default function stateTreeFactory(pluginManager: PluginManager) {
|
|
|
226
216
|
)
|
|
227
217
|
|
|
228
218
|
const session = getSession(self)
|
|
229
|
-
const {
|
|
219
|
+
const { connectionInstances } = session
|
|
220
|
+
|
|
221
|
+
const { assemblyManager } = getSession(self)
|
|
222
|
+
const assembly = assemblyManager.get(assemblyName)
|
|
230
223
|
const conns =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
children: this.connectionHierarchy(assemblyName, conn),
|
|
224
|
+
(assembly &&
|
|
225
|
+
connectionInstances
|
|
226
|
+
?.filter(c =>
|
|
227
|
+
hasAnyOverlap(assembly.allAliases, getConf(c, 'assemblyNames')),
|
|
228
|
+
)
|
|
229
|
+
.map(c => ({
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
id: getSnapshot(c).configuration,
|
|
232
|
+
name: getConf(c, 'name'),
|
|
233
|
+
children: this.connectionHierarchy(assemblyName, c),
|
|
242
234
|
state: {
|
|
243
235
|
expanded: true,
|
|
244
236
|
},
|
|
245
|
-
}
|
|
246
|
-
|
|
237
|
+
}))) ||
|
|
238
|
+
[]
|
|
247
239
|
|
|
248
240
|
return {
|
|
249
241
|
name: 'Root',
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
2
|
import { observer } from 'mobx-react'
|
|
4
|
-
import {
|
|
5
|
-
import { getSession } from '@jbrowse/core/util'
|
|
3
|
+
import { getParent } from 'mobx-state-tree'
|
|
4
|
+
import { getSession, getEnv } from '@jbrowse/core/util'
|
|
6
5
|
import {
|
|
7
6
|
JBrowsePlugin,
|
|
8
7
|
isSessionWithSessionPlugins,
|
|
@@ -52,7 +51,7 @@ function PluginCard({
|
|
|
52
51
|
}) {
|
|
53
52
|
const { classes } = useStyles()
|
|
54
53
|
const session = getSession(model)
|
|
55
|
-
const { pluginManager } = getEnv(model)
|
|
54
|
+
const { pluginManager } = getEnv(model)
|
|
56
55
|
const isInstalled = Boolean(
|
|
57
56
|
pluginManager.runtimePluginDefinitions.find(def => def.url === plugin.url),
|
|
58
57
|
)
|
|
@@ -8,7 +8,7 @@ exports[`<PluginStoreWidget /> renders with the available plugins 1`] = `
|
|
|
8
8
|
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root css-1z10yd4-MuiFormControl-root-MuiTextField-root"
|
|
9
9
|
>
|
|
10
10
|
<label
|
|
11
|
-
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
11
|
+
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-standard css-1s1jvl0-MuiFormLabel-root-MuiInputLabel-root"
|
|
12
12
|
data-shrink="false"
|
|
13
13
|
for="mui-1"
|
|
14
14
|
id="mui-1-label"
|
|
@@ -834,7 +834,7 @@ exports[`<PluginStoreWidget /> renders with the available plugins 1`] = `
|
|
|
834
834
|
class="MuiCardActions-root MuiCardActions-spacing css-1t6e9jv-MuiCardActions-root"
|
|
835
835
|
>
|
|
836
836
|
<button
|
|
837
|
-
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall css-1cpxz0y-MuiButtonBase-root-MuiButton-root"
|
|
837
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall css-1cpxz0y-MuiButtonBase-root-MuiButton-root"
|
|
838
838
|
tabindex="0"
|
|
839
839
|
type="button"
|
|
840
840
|
>
|
|
File without changes
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { Suspense } from 'react'
|
|
2
|
-
import { ConfigurationEditor } from '@jbrowse/plugin-config'
|
|
3
|
-
import { observer } from 'mobx-react'
|
|
4
|
-
|
|
5
|
-
const ConfigureConnection = observer(props => {
|
|
6
|
-
const { connectionType, model, setModelReady } = props
|
|
7
|
-
const ConfigEditorComponent =
|
|
8
|
-
connectionType.configEditorComponent || ConfigurationEditor
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Suspense fallback={<div>Loading...</div>}>
|
|
12
|
-
<ConfigEditorComponent
|
|
13
|
-
model={{ target: model }}
|
|
14
|
-
setModelReady={setModelReady}
|
|
15
|
-
/>
|
|
16
|
-
</Suspense>
|
|
17
|
-
)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
export default ConfigureConnection
|