@jbrowse/plugin-data-management 3.3.0 → 3.5.0
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/ConnectionTypeSelect.js +2 -5
- package/dist/AddTrackWidget/components/AddTrackUnknownAdapterPrompt.js +2 -1
- package/dist/AddTrackWidget/components/Unsupported.js +2 -1
- package/dist/PluginStoreWidget/components/InstalledPlugin.js +32 -26
- package/dist/PluginStoreWidget/components/PluginCard.js +2 -1
- package/dist/PluginStoreWidget/components/util.d.ts +2 -1
- package/dist/PluginStoreWidget/components/util.js +8 -0
- package/esm/AddConnectionWidget/components/ConnectionTypeSelect.js +3 -3
- package/esm/AddTrackWidget/components/AddTrackUnknownAdapterPrompt.js +3 -2
- package/esm/AddTrackWidget/components/Unsupported.js +3 -2
- package/esm/PluginStoreWidget/components/InstalledPlugin.js +32 -26
- package/esm/PluginStoreWidget/components/PluginCard.js +3 -2
- package/esm/PluginStoreWidget/components/util.d.ts +2 -1
- package/esm/PluginStoreWidget/components/util.js +7 -0
- package/package.json +6 -6
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
4
|
const react_1 = require("react");
|
|
8
|
-
const
|
|
5
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
9
6
|
const material_1 = require("@mui/material");
|
|
10
7
|
const mobx_react_1 = require("mobx-react");
|
|
11
8
|
const ConnectionTypeSelect = (0, mobx_react_1.observer)(function ConnectionTypeSelect({ connectionTypeChoices, connectionType, setConnectionType, }) {
|
|
@@ -15,7 +12,7 @@ const ConnectionTypeSelect = (0, mobx_react_1.observer)(function ConnectionTypeS
|
|
|
15
12
|
setConnectionType(firstChoice);
|
|
16
13
|
}
|
|
17
14
|
}, [connectionType, firstChoice, setConnectionType]);
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)("form", { autoComplete: "off", children: connectionType ? ((0, jsx_runtime_1.jsx)(material_1.TextField, { value: connectionType.name, label: "connectionType", helperText: connectionType.description ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [connectionType.description, connectionType.url ? ((0, jsx_runtime_1.jsx)(
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("form", { autoComplete: "off", children: connectionType ? ((0, jsx_runtime_1.jsx)(material_1.TextField, { value: connectionType.name, label: "connectionType", helperText: connectionType.description ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [connectionType.description, connectionType.url ? ((0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: connectionType.url })) : null] })) : null, select: true, fullWidth: true, onChange: event => {
|
|
19
16
|
setConnectionType(connectionTypeChoices.find(c => c.name === event.target.value));
|
|
20
17
|
}, variant: "outlined", children: connectionTypeChoices.map(c => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: c.name, children: c.displayName || c.name }, c.name))) })) : null }));
|
|
21
18
|
});
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = UnknownAdapterPrompt;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
8
9
|
const material_1 = require("@mui/material");
|
|
9
10
|
const mui_1 = require("tss-react/mui");
|
|
10
11
|
const TrackAdapterSelector_1 = __importDefault(require("./TrackAdapterSelector"));
|
|
@@ -15,5 +16,5 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
15
16
|
}));
|
|
16
17
|
function UnknownAdapterPrompt({ model, }) {
|
|
17
18
|
const { classes } = useStyles();
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { className: classes.spacing, children: ["JBrowse was not able to guess the adapter type for this data, but it may be in the list below. If not, you can", ' ', (0, jsx_runtime_1.jsx)(
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { className: classes.spacing, children: ["JBrowse was not able to guess the adapter type for this data, but it may be in the list below. If not, you can", ' ', (0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/releases", children: "check for new releases" }), ' ', "of JBrowse to see if they support this data type or", ' ', (0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/issues/new", children: "file an issue" }), ' ', "and add a feature request for this data type."] }), (0, jsx_runtime_1.jsx)(TrackAdapterSelector_1.default, { model: model })] }));
|
|
19
20
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = Unsupported;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
5
6
|
const material_1 = require("@mui/material");
|
|
6
7
|
const mui_1 = require("tss-react/mui");
|
|
7
8
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
@@ -11,5 +12,5 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
11
12
|
}));
|
|
12
13
|
function Unsupported() {
|
|
13
14
|
const { classes } = useStyles();
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, { className: classes.spacing, children: ["This version of JBrowse cannot display data of this type. It is possible, however, that there is a newer version that can display them. You can", ' ', (0, jsx_runtime_1.jsx)(
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, { className: classes.spacing, children: ["This version of JBrowse cannot display data of this type. It is possible, however, that there is a newer version that can display them. You can", ' ', (0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/releases", children: "check for new releases" }), ' ', "of JBrowse or", ' ', (0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/issues/new", children: "file an issue" }), ' ', "and add a feature request for this data type."] }));
|
|
15
16
|
}
|
|
@@ -40,47 +40,53 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
40
40
|
const react_1 = require("react");
|
|
41
41
|
const util_1 = require("@jbrowse/core/util");
|
|
42
42
|
const types_1 = require("@jbrowse/core/util/types");
|
|
43
|
-
const
|
|
43
|
+
const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
44
44
|
const Lock_1 = __importDefault(require("@mui/icons-material/Lock"));
|
|
45
45
|
const material_1 = require("@mui/material");
|
|
46
46
|
const mobx_react_1 = require("mobx-react");
|
|
47
47
|
const mui_1 = require("tss-react/mui");
|
|
48
|
+
const util_2 = require("./util");
|
|
48
49
|
const DeletePluginDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./DeletePluginDialog'))));
|
|
49
50
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
50
|
-
|
|
51
|
+
iconMargin: {
|
|
51
52
|
marginRight: '0.5rem',
|
|
52
53
|
},
|
|
53
54
|
}));
|
|
54
|
-
function
|
|
55
|
+
function LockedPluginIconButton() {
|
|
55
56
|
const { classes } = useStyles();
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { className: classes.
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { className: classes.iconMargin, title: "This plugin was installed by an administrator, you cannot remove it.", children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { disabled: true, children: (0, jsx_runtime_1.jsx)(Lock_1.default, {}) }) }) }));
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
+
const UninstallPluginIconButton = (0, mobx_react_1.observer)(function ({ plugin, model, }) {
|
|
60
|
+
const { classes } = useStyles();
|
|
59
61
|
const { pluginManager } = (0, util_1.getEnv)(model);
|
|
60
62
|
const session = (0, util_1.getSession)(model);
|
|
61
63
|
const { jbrowse, adminMode } = session;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else if ((0, types_1.isSessionWithSessionPlugins)(session)) {
|
|
77
|
-
session.removeSessionPlugin(pluginMetadata);
|
|
78
|
-
}
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { className: classes.iconMargin, title: "Uninstall plugin", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "data-testid": `removePlugin-${plugin.name}`, onClick: () => {
|
|
65
|
+
session.queueDialog(onClose => [
|
|
66
|
+
DeletePluginDialog,
|
|
67
|
+
{
|
|
68
|
+
plugin: plugin.name,
|
|
69
|
+
onClose: (name) => {
|
|
70
|
+
if (name) {
|
|
71
|
+
const pluginMetadata = pluginManager.pluginMetadata[plugin.name];
|
|
72
|
+
if (adminMode) {
|
|
73
|
+
jbrowse.removePlugin(pluginMetadata);
|
|
74
|
+
}
|
|
75
|
+
else if ((0, types_1.isSessionWithSessionPlugins)(session)) {
|
|
76
|
+
session.removeSessionPlugin(pluginMetadata);
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
}
|
|
79
|
+
onClose();
|
|
82
80
|
},
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
}, children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }) }));
|
|
84
|
+
});
|
|
85
|
+
const InstalledPlugin = (0, mobx_react_1.observer)(function ({ plugin, model, }) {
|
|
86
|
+
const session = (0, util_1.getSession)(model);
|
|
87
|
+
const { adminMode } = session;
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.ListItem, { children: [adminMode || (0, util_2.isSessionPlugin)(plugin, session) ? ((0, jsx_runtime_1.jsx)(UninstallPluginIconButton, { plugin: plugin, model: model })) : ((0, jsx_runtime_1.jsx)(LockedPluginIconButton, {})), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: [plugin.name, plugin.version ? `(v${plugin.version})` : '']
|
|
89
|
+
.filter(f => !!f)
|
|
90
|
+
.join(' ') })] }, plugin.name));
|
|
85
91
|
});
|
|
86
92
|
exports.default = InstalledPlugin;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
8
9
|
const util_1 = require("@jbrowse/core/util");
|
|
9
10
|
const types_1 = require("@jbrowse/core/util/types");
|
|
10
11
|
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
@@ -41,7 +42,7 @@ const PluginCard = (0, mobx_react_1.observer)(function PluginCard({ plugin, mode
|
|
|
41
42
|
const [tempDisabled, setTempDisabled] = (0, react_1.useState)(false);
|
|
42
43
|
const { adminMode, jbrowse } = session;
|
|
43
44
|
const { name, authors, description } = plugin;
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Card, { variant: "outlined", className: classes.card, children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", children: (0, jsx_runtime_1.jsx)(
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Card, { variant: "outlined", className: classes.card, children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", children: (0, jsx_runtime_1.jsx)(ui_1.ExternalLink, { href: `${plugin.location}#readme`, children: plugin.name }) }), (0, jsx_runtime_1.jsxs)("div", { className: classes.dataField, children: [(0, jsx_runtime_1.jsx)(Person_1.default, { className: classes.mr }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: authors.join(', ') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.bold, children: "Description:" }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: description })] }), (0, jsx_runtime_1.jsx)(material_1.CardActions, { children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", disabled: isInstalled || tempDisabled, startIcon: isInstalled ? (0, jsx_runtime_1.jsx)(Check_1.default, {}) : (0, jsx_runtime_1.jsx)(Add_1.default, {}), onClick: () => {
|
|
45
46
|
if (adminMode) {
|
|
46
47
|
jbrowse.addPlugin(plugin);
|
|
47
48
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { JBrowsePlugin } from '@jbrowse/core/util/types';
|
|
1
|
+
import type { AbstractSessionModel, BasePlugin, JBrowsePlugin } from '@jbrowse/core/util/types';
|
|
2
2
|
export declare function useFetchPlugins(): {
|
|
3
3
|
plugins: JBrowsePlugin[] | undefined;
|
|
4
4
|
error: unknown;
|
|
5
5
|
};
|
|
6
|
+
export declare function isSessionPlugin(plugin: BasePlugin, session: AbstractSessionModel): boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFetchPlugins = useFetchPlugins;
|
|
4
|
+
exports.isSessionPlugin = isSessionPlugin;
|
|
4
5
|
const react_1 = require("react");
|
|
6
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
7
|
function useFetchPlugins() {
|
|
6
8
|
const [plugins, setPlugins] = (0, react_1.useState)();
|
|
7
9
|
const [error, setError] = (0, react_1.useState)();
|
|
@@ -25,3 +27,9 @@ function useFetchPlugins() {
|
|
|
25
27
|
}, []);
|
|
26
28
|
return { plugins, error };
|
|
27
29
|
}
|
|
30
|
+
function isSessionPlugin(plugin, session) {
|
|
31
|
+
const { pluginManager } = (0, util_1.getEnv)(session);
|
|
32
|
+
return (0, util_1.isSessionWithSessionPlugins)(session)
|
|
33
|
+
? session.sessionPlugins.some(p => { var _a; return ((_a = pluginManager.pluginMetadata[plugin.name]) === null || _a === void 0 ? void 0 : _a.url) === p.url; })
|
|
34
|
+
: false;
|
|
35
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { ExternalLink } from '@jbrowse/core/ui';
|
|
4
|
+
import { MenuItem, TextField } from '@mui/material';
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
6
|
const ConnectionTypeSelect = observer(function ConnectionTypeSelect({ connectionTypeChoices, connectionType, setConnectionType, }) {
|
|
7
7
|
const firstChoice = connectionTypeChoices[0];
|
|
@@ -10,7 +10,7 @@ const ConnectionTypeSelect = observer(function ConnectionTypeSelect({ connection
|
|
|
10
10
|
setConnectionType(firstChoice);
|
|
11
11
|
}
|
|
12
12
|
}, [connectionType, firstChoice, setConnectionType]);
|
|
13
|
-
return (_jsx("form", { autoComplete: "off", children: connectionType ? (_jsx(TextField, { value: connectionType.name, label: "connectionType", helperText: connectionType.description ? (_jsxs(_Fragment, { children: [connectionType.description, connectionType.url ? (_jsx(
|
|
13
|
+
return (_jsx("form", { autoComplete: "off", children: connectionType ? (_jsx(TextField, { value: connectionType.name, label: "connectionType", helperText: connectionType.description ? (_jsxs(_Fragment, { children: [connectionType.description, connectionType.url ? (_jsx(ExternalLink, { href: connectionType.url })) : null] })) : null, select: true, fullWidth: true, onChange: event => {
|
|
14
14
|
setConnectionType(connectionTypeChoices.find(c => c.name === event.target.value));
|
|
15
15
|
}, variant: "outlined", children: connectionTypeChoices.map(c => (_jsx(MenuItem, { value: c.name, children: c.displayName || c.name }, c.name))) })) : null }));
|
|
16
16
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { ExternalLink } from '@jbrowse/core/ui';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
3
4
|
import { makeStyles } from 'tss-react/mui';
|
|
4
5
|
import TrackAdapterSelector from './TrackAdapterSelector';
|
|
5
6
|
const useStyles = makeStyles()(theme => ({
|
|
@@ -9,5 +10,5 @@ const useStyles = makeStyles()(theme => ({
|
|
|
9
10
|
}));
|
|
10
11
|
export default function UnknownAdapterPrompt({ model, }) {
|
|
11
12
|
const { classes } = useStyles();
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Typography, { className: classes.spacing, children: ["JBrowse was not able to guess the adapter type for this data, but it may be in the list below. If not, you can", ' ', _jsx(
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Typography, { className: classes.spacing, children: ["JBrowse was not able to guess the adapter type for this data, but it may be in the list below. If not, you can", ' ', _jsx(ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/releases", children: "check for new releases" }), ' ', "of JBrowse to see if they support this data type or", ' ', _jsx(ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/issues/new", children: "file an issue" }), ' ', "and add a feature request for this data type."] }), _jsx(TrackAdapterSelector, { model: model })] }));
|
|
13
14
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { ExternalLink } from '@jbrowse/core/ui';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
3
4
|
import { makeStyles } from 'tss-react/mui';
|
|
4
5
|
const useStyles = makeStyles()(theme => ({
|
|
5
6
|
spacing: {
|
|
@@ -8,5 +9,5 @@ const useStyles = makeStyles()(theme => ({
|
|
|
8
9
|
}));
|
|
9
10
|
export default function Unsupported() {
|
|
10
11
|
const { classes } = useStyles();
|
|
11
|
-
return (_jsxs(Typography, { className: classes.spacing, children: ["This version of JBrowse cannot display data of this type. It is possible, however, that there is a newer version that can display them. You can", ' ', _jsx(
|
|
12
|
+
return (_jsxs(Typography, { className: classes.spacing, children: ["This version of JBrowse cannot display data of this type. It is possible, however, that there is a newer version that can display them. You can", ' ', _jsx(ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/releases", children: "check for new releases" }), ' ', "of JBrowse or", ' ', _jsx(ExternalLink, { href: "https://github.com/GMOD/jbrowse-components/issues/new", children: "file an issue" }), ' ', "and add a feature request for this data type."] }));
|
|
12
13
|
}
|
|
@@ -2,47 +2,53 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { lazy } from 'react';
|
|
3
3
|
import { getEnv, getSession } from '@jbrowse/core/util';
|
|
4
4
|
import { isSessionWithSessionPlugins } from '@jbrowse/core/util/types';
|
|
5
|
-
import
|
|
5
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
6
6
|
import LockIcon from '@mui/icons-material/Lock';
|
|
7
7
|
import { IconButton, ListItem, Tooltip, Typography } from '@mui/material';
|
|
8
8
|
import { observer } from 'mobx-react';
|
|
9
9
|
import { makeStyles } from 'tss-react/mui';
|
|
10
|
+
import { isSessionPlugin } from './util';
|
|
10
11
|
const DeletePluginDialog = lazy(() => import('./DeletePluginDialog'));
|
|
11
12
|
const useStyles = makeStyles()(() => ({
|
|
12
|
-
|
|
13
|
+
iconMargin: {
|
|
13
14
|
marginRight: '0.5rem',
|
|
14
15
|
},
|
|
15
16
|
}));
|
|
16
|
-
function
|
|
17
|
+
function LockedPluginIconButton() {
|
|
17
18
|
const { classes } = useStyles();
|
|
18
|
-
return (_jsx(Tooltip, { className: classes.
|
|
19
|
+
return (_jsx(Tooltip, { className: classes.iconMargin, title: "This plugin was installed by an administrator, you cannot remove it.", children: _jsx("span", { children: _jsx(IconButton, { disabled: true, children: _jsx(LockIcon, {}) }) }) }));
|
|
19
20
|
}
|
|
20
|
-
const
|
|
21
|
+
const UninstallPluginIconButton = observer(function ({ plugin, model, }) {
|
|
22
|
+
const { classes } = useStyles();
|
|
21
23
|
const { pluginManager } = getEnv(model);
|
|
22
24
|
const session = getSession(model);
|
|
23
25
|
const { jbrowse, adminMode } = session;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
else if (isSessionWithSessionPlugins(session)) {
|
|
39
|
-
session.removeSessionPlugin(pluginMetadata);
|
|
40
|
-
}
|
|
26
|
+
return (_jsx(Tooltip, { className: classes.iconMargin, title: "Uninstall plugin", children: _jsx(IconButton, { "data-testid": `removePlugin-${plugin.name}`, onClick: () => {
|
|
27
|
+
session.queueDialog(onClose => [
|
|
28
|
+
DeletePluginDialog,
|
|
29
|
+
{
|
|
30
|
+
plugin: plugin.name,
|
|
31
|
+
onClose: (name) => {
|
|
32
|
+
if (name) {
|
|
33
|
+
const pluginMetadata = pluginManager.pluginMetadata[plugin.name];
|
|
34
|
+
if (adminMode) {
|
|
35
|
+
jbrowse.removePlugin(pluginMetadata);
|
|
36
|
+
}
|
|
37
|
+
else if (isSessionWithSessionPlugins(session)) {
|
|
38
|
+
session.removeSessionPlugin(pluginMetadata);
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}
|
|
41
|
+
onClose();
|
|
44
42
|
},
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
},
|
|
44
|
+
]);
|
|
45
|
+
}, children: _jsx(DeleteIcon, {}) }) }));
|
|
46
|
+
});
|
|
47
|
+
const InstalledPlugin = observer(function ({ plugin, model, }) {
|
|
48
|
+
const session = getSession(model);
|
|
49
|
+
const { adminMode } = session;
|
|
50
|
+
return (_jsxs(ListItem, { children: [adminMode || isSessionPlugin(plugin, session) ? (_jsx(UninstallPluginIconButton, { plugin: plugin, model: model })) : (_jsx(LockedPluginIconButton, {})), _jsx(Typography, { children: [plugin.name, plugin.version ? `(v${plugin.version})` : '']
|
|
51
|
+
.filter(f => !!f)
|
|
52
|
+
.join(' ') })] }, plugin.name));
|
|
47
53
|
});
|
|
48
54
|
export default InstalledPlugin;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
+
import { ExternalLink } from '@jbrowse/core/ui';
|
|
3
4
|
import { getEnv, getSession } from '@jbrowse/core/util';
|
|
4
5
|
import { isSessionWithSessionPlugins } from '@jbrowse/core/util/types';
|
|
5
6
|
import AddIcon from '@mui/icons-material/Add';
|
|
6
7
|
import CheckIcon from '@mui/icons-material/Check';
|
|
7
8
|
import PersonIcon from '@mui/icons-material/Person';
|
|
8
|
-
import { Button, Card, CardActions, CardContent,
|
|
9
|
+
import { Button, Card, CardActions, CardContent, Typography, } from '@mui/material';
|
|
9
10
|
import { observer } from 'mobx-react';
|
|
10
11
|
import { makeStyles } from 'tss-react/mui';
|
|
11
12
|
const useStyles = makeStyles()({
|
|
@@ -36,7 +37,7 @@ const PluginCard = observer(function PluginCard({ plugin, model, }) {
|
|
|
36
37
|
const [tempDisabled, setTempDisabled] = useState(false);
|
|
37
38
|
const { adminMode, jbrowse } = session;
|
|
38
39
|
const { name, authors, description } = plugin;
|
|
39
|
-
return (_jsxs(Card, { variant: "outlined", className: classes.card, children: [_jsxs(CardContent, { children: [_jsx(Typography, { variant: "h5", children: _jsx(
|
|
40
|
+
return (_jsxs(Card, { variant: "outlined", className: classes.card, children: [_jsxs(CardContent, { children: [_jsx(Typography, { variant: "h5", children: _jsx(ExternalLink, { href: `${plugin.location}#readme`, children: plugin.name }) }), _jsxs("div", { className: classes.dataField, children: [_jsx(PersonIcon, { className: classes.mr }), _jsx(Typography, { children: authors.join(', ') })] }), _jsx(Typography, { className: classes.bold, children: "Description:" }), _jsx(Typography, { children: description })] }), _jsx(CardActions, { children: _jsx(Button, { variant: "contained", disabled: isInstalled || tempDisabled, startIcon: isInstalled ? _jsx(CheckIcon, {}) : _jsx(AddIcon, {}), onClick: () => {
|
|
40
41
|
if (adminMode) {
|
|
41
42
|
jbrowse.addPlugin(plugin);
|
|
42
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { JBrowsePlugin } from '@jbrowse/core/util/types';
|
|
1
|
+
import type { AbstractSessionModel, BasePlugin, JBrowsePlugin } from '@jbrowse/core/util/types';
|
|
2
2
|
export declare function useFetchPlugins(): {
|
|
3
3
|
plugins: JBrowsePlugin[] | undefined;
|
|
4
4
|
error: unknown;
|
|
5
5
|
};
|
|
6
|
+
export declare function isSessionPlugin(plugin: BasePlugin, session: AbstractSessionModel): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { getEnv, isSessionWithSessionPlugins } from '@jbrowse/core/util';
|
|
2
3
|
export function useFetchPlugins() {
|
|
3
4
|
const [plugins, setPlugins] = useState();
|
|
4
5
|
const [error, setError] = useState();
|
|
@@ -22,3 +23,9 @@ export function useFetchPlugins() {
|
|
|
22
23
|
}, []);
|
|
23
24
|
return { plugins, error };
|
|
24
25
|
}
|
|
26
|
+
export function isSessionPlugin(plugin, session) {
|
|
27
|
+
const { pluginManager } = getEnv(session);
|
|
28
|
+
return isSessionWithSessionPlugins(session)
|
|
29
|
+
? session.sessionPlugins.some(p => { var _a; return ((_a = pluginManager.pluginMetadata[plugin.name]) === null || _a === void 0 ? void 0 : _a.url) === p.url; })
|
|
30
|
+
: false;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-data-management",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@gmod/ucsc-hub": "^
|
|
40
|
-
"@jbrowse/core": "^3.
|
|
41
|
-
"@jbrowse/plugin-config": "^3.
|
|
42
|
-
"@jbrowse/product-core": "^3.
|
|
39
|
+
"@gmod/ucsc-hub": "^2.0.1",
|
|
40
|
+
"@jbrowse/core": "^3.5.0",
|
|
41
|
+
"@jbrowse/plugin-config": "^3.5.0",
|
|
42
|
+
"@jbrowse/product-core": "^3.5.0",
|
|
43
43
|
"@mui/icons-material": "^7.0.0",
|
|
44
44
|
"@mui/material": "^7.0.0",
|
|
45
45
|
"@mui/x-data-grid": "^8.0.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"distModule": "esm/index.js",
|
|
62
62
|
"srcModule": "src/index.ts",
|
|
63
63
|
"module": "esm/index.js",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "8a8aa0aab2229dece106a5715a767e649e2fe92b"
|
|
65
65
|
}
|