@jbrowse/plugin-data-management 1.5.2 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "1.5.2",
3
+ "version": "1.5.6",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "94fdfbc34787ab8f12a87e00038da74b247b42fa"
59
+ "gitHead": "f3d36cfd90f7c5bdf86869d6698d8cb68a8e122f"
60
60
  }
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
  import { makeStyles } from '@material-ui/core/styles'
4
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
4
5
  import {
5
6
  Button,
6
7
  Dialog,
@@ -52,7 +53,8 @@ const AssemblyManager = observer(
52
53
  const classes = useStyles()
53
54
  const [isFormOpen, setFormOpen] = useState(false)
54
55
  const [isAssemblyBeingEdited, setIsAssemblyBeingEdited] = useState(false)
55
- const [assemblyBeingEdited, setAssemblyBeingEdited] = useState()
56
+ const [assemblyBeingEdited, setAssemblyBeingEdited] =
57
+ useState<AnyConfigurationModel>()
56
58
 
57
59
  const showAssemblyTable = !isFormOpen && !isAssemblyBeingEdited
58
60
 
@@ -42,11 +42,14 @@ const AssemblyTable = observer(
42
42
  setIsAssemblyBeingEdited,
43
43
  setAssemblyBeingEdited,
44
44
  }: {
45
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
- rootModel: any
45
+ rootModel: {
46
+ jbrowse: {
47
+ removeAssemblyConf: (arg: string) => void
48
+ assemblies: AnyConfigurationModel[]
49
+ }
50
+ }
47
51
  setIsAssemblyBeingEdited(arg: boolean): void
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- setAssemblyBeingEdited(arg: any): void
52
+ setAssemblyBeingEdited(arg: AnyConfigurationModel): void
50
53
  }) => {
51
54
  const classes = useStyles()
52
55
 
@@ -54,41 +57,39 @@ const AssemblyTable = observer(
54
57
  rootModel.jbrowse.removeAssemblyConf(name)
55
58
  }
56
59
 
57
- const rows = rootModel.jbrowse.assemblies.map(
58
- (assembly: AnyConfigurationModel) => {
59
- const name = readConfObject(assembly, 'name')
60
- const displayName = readConfObject(assembly, 'displayName')
61
- const aliases = readConfObject(assembly, 'aliases')
62
- return (
63
- <TableRow key={name}>
64
- <TableCell>{name}</TableCell>
65
- <TableCell>{displayName}</TableCell>
66
- <TableCell>{aliases ? aliases.toString() : ''}</TableCell>
67
- <TableCell className={classes.buttonCell}>
68
- <IconButton
69
- data-testid={`${name}-edit`}
70
- className={classes.button}
71
- onClick={() => {
72
- setIsAssemblyBeingEdited(true)
73
- setAssemblyBeingEdited(assembly)
74
- }}
75
- >
76
- <CreateIcon color="primary" />
77
- </IconButton>
78
- <IconButton
79
- data-testid={`${name}-delete`}
80
- className={classes.button}
81
- onClick={() => {
82
- removeAssembly(name)
83
- }}
84
- >
85
- <DeleteIcon color="error" />
86
- </IconButton>
87
- </TableCell>
88
- </TableRow>
89
- )
90
- },
91
- )
60
+ const rows = rootModel.jbrowse.assemblies.map(assembly => {
61
+ const name = readConfObject(assembly, 'name')
62
+ const displayName = readConfObject(assembly, 'displayName')
63
+ const aliases = readConfObject(assembly, 'aliases')
64
+ return (
65
+ <TableRow key={name}>
66
+ <TableCell>{name}</TableCell>
67
+ <TableCell>{displayName}</TableCell>
68
+ <TableCell>{aliases ? aliases.toString() : ''}</TableCell>
69
+ <TableCell className={classes.buttonCell}>
70
+ <IconButton
71
+ data-testid={`${name}-edit`}
72
+ className={classes.button}
73
+ onClick={() => {
74
+ setIsAssemblyBeingEdited(true)
75
+ setAssemblyBeingEdited(assembly)
76
+ }}
77
+ >
78
+ <CreateIcon color="primary" />
79
+ </IconButton>
80
+ <IconButton
81
+ data-testid={`${name}-delete`}
82
+ className={classes.button}
83
+ onClick={() => {
84
+ removeAssembly(name)
85
+ }}
86
+ >
87
+ <DeleteIcon color="error" />
88
+ </IconButton>
89
+ </TableCell>
90
+ </TableRow>
91
+ )
92
+ })
92
93
 
93
94
  return (
94
95
  <TableContainer component={Paper}>
@@ -1,8 +1,6 @@
1
1
  import React, { useState } from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
  import { getParent } from 'mobx-state-tree'
4
-
5
- import { makeStyles } from '@material-ui/core/styles'
6
4
  import {
7
5
  Button,
8
6
  Dialog,
@@ -13,6 +11,7 @@ import {
13
11
  ListItem,
14
12
  Tooltip,
15
13
  Typography,
14
+ makeStyles,
16
15
  } from '@material-ui/core'
17
16
 
18
17
  import CloseIcon from '@material-ui/icons/Close'
@@ -71,7 +70,9 @@ function PluginDialog({
71
70
  </DialogTitle>
72
71
  <DialogContent>
73
72
  <Typography>
74
- Please confirm that you want to remove {plugin}:
73
+ Please confirm that you want to remove {plugin}. Note: if any
74
+ resources in this session still use this plugin, it may cause your
75
+ session to crash
75
76
  </Typography>
76
77
  <DialogActions>
77
78
  <Button
@@ -113,11 +114,11 @@ function InstalledPlugin({
113
114
  const [dialogPlugin, setDialogPlugin] = useState<string>()
114
115
 
115
116
  const session = getSession(model)
116
-
117
- // @ts-ignore
118
- const { sessionPlugins } = session
117
+ const { sessionPlugins } = session as unknown as {
118
+ sessionPlugins: BasePlugin[]
119
+ }
119
120
  const isSessionPlugin = sessionPlugins?.some(
120
- (p: BasePlugin) => pluginManager.pluginMetadata[plugin.name].url === p.url,
121
+ p => pluginManager.pluginMetadata[plugin.name].url === p.url,
121
122
  )
122
123
 
123
124
  const rootModel = getParent(model, 3)
@@ -131,15 +132,11 @@ function InstalledPlugin({
131
132
  onClose={name => {
132
133
  if (name) {
133
134
  const pluginMetadata = pluginManager.pluginMetadata[plugin.name]
134
- const pluginUrl =
135
- pluginMetadata.url ||
136
- pluginMetadata.esmUrl ||
137
- pluginMetadata.umdUrl ||
138
- pluginMetadata.cjsUrl
135
+
139
136
  if (adminMode) {
140
- jbrowse.removePlugin(pluginUrl)
137
+ jbrowse.removePlugin(pluginMetadata)
141
138
  } else if (isSessionWithSessionPlugins(session)) {
142
- session.removeSessionPlugin(pluginUrl)
139
+ session.removeSessionPlugin(pluginMetadata)
143
140
  }
144
141
  }
145
142
  setDialogPlugin(undefined)