@jbrowse/plugin-menus 2.16.1 → 2.18.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/AboutWidget/components/AboutWidget.d.ts +1 -1
- package/dist/AboutWidget/components/AboutWidget.js +2 -2
- package/dist/AboutWidget/index.d.ts +2 -5
- package/dist/AboutWidget/index.js +39 -3
- package/dist/HelpWidget/components/HelpWidget.d.ts +1 -1
- package/dist/HelpWidget/components/HelpWidget.js +2 -2
- package/dist/HelpWidget/index.d.ts +2 -5
- package/dist/HelpWidget/index.js +39 -3
- package/dist/ImportSessionWidget/components/ImportError.js +1 -2
- package/dist/ImportSessionWidget/components/ImportSessionWidget.d.ts +1 -1
- package/dist/ImportSessionWidget/components/ImportSessionWidget.js +4 -9
- package/dist/ImportSessionWidget/index.d.ts +2 -5
- package/dist/ImportSessionWidget/index.js +39 -3
- package/dist/SessionManager/components/SessionManager.d.ts +1 -1
- package/dist/SessionManager/components/SessionManager.js +101 -5
- package/dist/SessionManager/components/util.d.ts +18 -7
- package/dist/SessionManager/index.d.ts +2 -0
- package/dist/SessionManager/index.js +37 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -65
- package/esm/AboutWidget/components/AboutWidget.d.ts +1 -1
- package/esm/AboutWidget/components/AboutWidget.js +2 -2
- package/esm/AboutWidget/index.d.ts +2 -5
- package/esm/AboutWidget/index.js +15 -2
- package/esm/HelpWidget/components/HelpWidget.d.ts +1 -1
- package/esm/HelpWidget/components/HelpWidget.js +2 -2
- package/esm/HelpWidget/index.d.ts +2 -5
- package/esm/HelpWidget/index.js +15 -2
- package/esm/ImportSessionWidget/components/ImportError.js +1 -2
- package/esm/ImportSessionWidget/components/ImportSessionWidget.d.ts +1 -1
- package/esm/ImportSessionWidget/components/ImportSessionWidget.js +4 -9
- package/esm/ImportSessionWidget/index.d.ts +2 -5
- package/esm/ImportSessionWidget/index.js +15 -2
- package/esm/SessionManager/components/SessionManager.d.ts +1 -1
- package/esm/SessionManager/components/SessionManager.js +101 -5
- package/esm/SessionManager/components/util.d.ts +18 -7
- package/esm/SessionManager/index.d.ts +2 -0
- package/esm/SessionManager/index.js +13 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +8 -42
- package/package.json +3 -2
- package/dist/SessionManager/components/AutosavedSessionsList.d.ts +0 -6
- package/dist/SessionManager/components/AutosavedSessionsList.js +0 -25
- package/dist/SessionManager/components/DeleteSavedSessionDialog.d.ts +0 -6
- package/dist/SessionManager/components/DeleteSavedSessionDialog.js +0 -21
- package/dist/SessionManager/components/RegularSavedSessionsList.d.ts +0 -6
- package/dist/SessionManager/components/RegularSavedSessionsList.js +0 -67
- package/dist/SessionManager/components/SessionListItem.d.ts +0 -10
- package/dist/SessionManager/components/SessionListItem.js +0 -25
- package/esm/SessionManager/components/AutosavedSessionsList.d.ts +0 -6
- package/esm/SessionManager/components/AutosavedSessionsList.js +0 -20
- package/esm/SessionManager/components/DeleteSavedSessionDialog.d.ts +0 -6
- package/esm/SessionManager/components/DeleteSavedSessionDialog.js +0 -15
- package/esm/SessionManager/components/RegularSavedSessionsList.d.ts +0 -6
- package/esm/SessionManager/components/RegularSavedSessionsList.js +0 -39
- package/esm/SessionManager/components/SessionListItem.d.ts +0 -10
- package/esm/SessionManager/components/SessionListItem.js +0 -20
package/esm/AboutWidget/index.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
5
|
import { types } from 'mobx-state-tree';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const configSchema = ConfigurationSchema('AboutWidget', {});
|
|
7
|
+
const stateModel = types.model('AboutWidget', {
|
|
6
8
|
id: ElementId,
|
|
7
9
|
type: types.literal('AboutWidget'),
|
|
8
10
|
});
|
|
11
|
+
export default function AboutWidgetF(pluginManager) {
|
|
12
|
+
pluginManager.addWidgetType(() => {
|
|
13
|
+
return new WidgetType({
|
|
14
|
+
name: 'AboutWidget',
|
|
15
|
+
heading: 'About',
|
|
16
|
+
configSchema,
|
|
17
|
+
stateModel,
|
|
18
|
+
ReactComponent: lazy(() => import('./components/AboutWidget')),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
2
|
import { getSession } from '@jbrowse/core/util';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
3
|
import { Link, Typography } from '@mui/material';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
6
|
const useStyles = makeStyles()(theme => ({
|
|
7
7
|
root: {
|
|
8
8
|
margin: theme.spacing(2),
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4
|
-
type: import("mobx-state-tree").ISimpleType<"HelpWidget">;
|
|
5
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function HelpWidgetF(pluginManager: PluginManager): void;
|
package/esm/HelpWidget/index.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
5
|
import { types } from 'mobx-state-tree';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const configSchema = ConfigurationSchema('HelpWidget', {});
|
|
7
|
+
const stateModel = types.model('HelpWidget', {
|
|
6
8
|
id: ElementId,
|
|
7
9
|
type: types.literal('HelpWidget'),
|
|
8
10
|
});
|
|
11
|
+
export default function HelpWidgetF(pluginManager) {
|
|
12
|
+
pluginManager.addWidgetType(() => {
|
|
13
|
+
return new WidgetType({
|
|
14
|
+
name: 'HelpWidget',
|
|
15
|
+
heading: 'Help',
|
|
16
|
+
configSchema,
|
|
17
|
+
stateModel,
|
|
18
|
+
ReactComponent: lazy(() => import('./components/HelpWidget')),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import ErrorIcon from '@mui/icons-material/Error';
|
|
2
3
|
import { Paper, Typography } from '@mui/material';
|
|
3
4
|
import { makeStyles } from 'tss-react/mui';
|
|
4
|
-
// icons
|
|
5
|
-
import ErrorIcon from '@mui/icons-material/Error';
|
|
6
5
|
const useStyles = makeStyles()(theme => ({
|
|
7
6
|
error: {
|
|
8
7
|
margin: theme.spacing(2),
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, Paper, Typography, alpha } from '@mui/material';
|
|
3
2
|
import { getSession } from '@jbrowse/core/util';
|
|
4
|
-
import
|
|
3
|
+
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
|
|
4
|
+
import { Button, Paper, Typography, alpha } from '@mui/material';
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
6
|
import { useDropzone } from 'react-dropzone';
|
|
7
|
-
|
|
8
|
-
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
|
|
9
|
-
// locals
|
|
7
|
+
import { makeStyles } from 'tss-react/mui';
|
|
10
8
|
import ImportError from './ImportError';
|
|
11
|
-
const MAX_FILE_SIZE = 512 * 1024 ** 2;
|
|
9
|
+
const MAX_FILE_SIZE = 512 * 1024 ** 2;
|
|
12
10
|
function styledBy(property, mapping) {
|
|
13
11
|
return (props) => mapping[props[property]];
|
|
14
12
|
}
|
|
15
|
-
// @ts-expect-error
|
|
16
13
|
const useStyles = makeStyles()(theme => ({
|
|
17
14
|
root: {
|
|
18
15
|
margin: theme.spacing(1),
|
|
@@ -49,7 +46,6 @@ const useStyles = makeStyles()(theme => ({
|
|
|
49
46
|
const ImportSessionWidget = observer(function ({ model, }) {
|
|
50
47
|
const [error, setError] = useState();
|
|
51
48
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
52
|
-
// @ts-expect-error
|
|
53
49
|
accept: 'application/json',
|
|
54
50
|
maxSize: MAX_FILE_SIZE,
|
|
55
51
|
multiple: false,
|
|
@@ -68,7 +64,6 @@ const ImportSessionWidget = observer(function ({ model, }) {
|
|
|
68
64
|
}
|
|
69
65
|
},
|
|
70
66
|
});
|
|
71
|
-
// @ts-expect-error
|
|
72
67
|
const { classes } = useStyles({ isDragActive });
|
|
73
68
|
return (React.createElement("div", { className: classes.root },
|
|
74
69
|
React.createElement(Paper, { className: classes.paper },
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4
|
-
type: import("mobx-state-tree").ISimpleType<"ImportSessionWidget">;
|
|
5
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function ImportSessionWidgetF(pluginManager: PluginManager): void;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
5
|
import { types } from 'mobx-state-tree';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const configSchema = ConfigurationSchema('ImportSessionWidget', {});
|
|
7
|
+
const stateModel = types.model('ImportSessionWidget', {
|
|
6
8
|
id: ElementId,
|
|
7
9
|
type: types.literal('ImportSessionWidget'),
|
|
8
10
|
});
|
|
11
|
+
export default function ImportSessionWidgetF(pluginManager) {
|
|
12
|
+
pluginManager.addWidgetType(() => {
|
|
13
|
+
return new WidgetType({
|
|
14
|
+
name: 'ImportSessionWidget',
|
|
15
|
+
heading: 'Import session',
|
|
16
|
+
configSchema,
|
|
17
|
+
stateModel,
|
|
18
|
+
ReactComponent: lazy(() => import('./components/ImportSessionWidget')),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,10 +1,106 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { measureGridWidth, useLocalStorage } from '@jbrowse/core/util';
|
|
3
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
4
|
+
import StarIcon from '@mui/icons-material/Star';
|
|
5
|
+
import StarBorderIcon from '@mui/icons-material/StarBorder';
|
|
6
|
+
import { Button, Checkbox, FormControlLabel, IconButton, Link, Tooltip, } from '@mui/material';
|
|
7
|
+
import { DataGrid } from '@mui/x-data-grid';
|
|
8
|
+
import { differenceInDays, formatDistanceToNow } from 'date-fns';
|
|
2
9
|
import { observer } from 'mobx-react';
|
|
3
|
-
import
|
|
4
|
-
|
|
10
|
+
import { makeStyles } from 'tss-react/mui';
|
|
11
|
+
const useStyles = makeStyles()(theme => ({
|
|
12
|
+
mb: {
|
|
13
|
+
margin: theme.spacing(1),
|
|
14
|
+
marginBottom: theme.spacing(4),
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
5
17
|
const SessionManager = observer(function ({ session, }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const { classes } = useStyles();
|
|
20
|
+
const [showOnlyFavs, setShowOnlyFavs] = useLocalStorage('sessionManager-showOnlyFavs', false);
|
|
21
|
+
const rows = (_a = session.savedSessionMetadata) === null || _a === void 0 ? void 0 : _a.map(r => ({
|
|
22
|
+
id: r.id,
|
|
23
|
+
name: r.name,
|
|
24
|
+
createdAt: r.createdAt,
|
|
25
|
+
fav: r.favorite,
|
|
26
|
+
})).filter(f => (showOnlyFavs ? f.fav : true));
|
|
27
|
+
return (React.createElement("div", null,
|
|
28
|
+
React.createElement("div", { className: classes.mb },
|
|
29
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: showOnlyFavs, onChange: () => {
|
|
30
|
+
setShowOnlyFavs(val => !val);
|
|
31
|
+
} }), label: "Show only favorites?" }),
|
|
32
|
+
React.createElement(Button, { variant: "contained", onClick: () => {
|
|
33
|
+
var _a;
|
|
34
|
+
let i = 0;
|
|
35
|
+
(_a = session.savedSessionMetadata) === null || _a === void 0 ? void 0 : _a.forEach(elt => {
|
|
36
|
+
if (differenceInDays(+Date.now(), elt.createdAt) > 1 &&
|
|
37
|
+
!elt.favorite) {
|
|
38
|
+
session.deleteSavedSession(elt.id);
|
|
39
|
+
i++;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
session.notify(`${i} sessions deleted`, 'info');
|
|
43
|
+
} }, "Delete non-fav sessions older than 7 days?")),
|
|
44
|
+
rows ? (React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
|
|
45
|
+
React.createElement(DataGrid, { disableRowSelectionOnClick: true, columnHeaderHeight: 35, rowHeight: 25, hideFooter: rows.length < 100, slotProps: {
|
|
46
|
+
toolbar: {
|
|
47
|
+
showQuickFilter: true,
|
|
48
|
+
},
|
|
49
|
+
}, rows: rows, columns: [
|
|
50
|
+
{
|
|
51
|
+
field: 'fav',
|
|
52
|
+
headerName: 'Fav',
|
|
53
|
+
width: 20,
|
|
54
|
+
renderCell: ({ row }) => {
|
|
55
|
+
return (React.createElement(IconButton, { onClick: () => {
|
|
56
|
+
if (row.fav) {
|
|
57
|
+
session.unfavoriteSavedSession(row.id);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
session.favoriteSavedSession(row.id);
|
|
61
|
+
}
|
|
62
|
+
} }, row.fav ? React.createElement(StarIcon, null) : React.createElement(StarBorderIcon, null)));
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
field: 'name',
|
|
67
|
+
headerName: 'Name',
|
|
68
|
+
editable: true,
|
|
69
|
+
width: measureGridWidth(rows.map(r => r.name)),
|
|
70
|
+
renderCell: ({ row }) => {
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement(Link, { href: "#", onClick: event => {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
session.activateSession(row.id);
|
|
75
|
+
} }, row.name),
|
|
76
|
+
session.id === row.id ? ' (current)' : ''));
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
headerName: 'Created at',
|
|
81
|
+
field: 'createdAt',
|
|
82
|
+
renderCell: ({ row }) => {
|
|
83
|
+
return (React.createElement(Tooltip, { disableInteractive: true, slotProps: {
|
|
84
|
+
transition: {
|
|
85
|
+
timeout: 0,
|
|
86
|
+
},
|
|
87
|
+
}, title: row.createdAt.toLocaleString() },
|
|
88
|
+
React.createElement("div", null, formatDistanceToNow(row.createdAt, {
|
|
89
|
+
addSuffix: true,
|
|
90
|
+
}))));
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
field: 'delete',
|
|
95
|
+
width: 10,
|
|
96
|
+
headerName: 'Delete',
|
|
97
|
+
renderCell: ({ row }) => {
|
|
98
|
+
return (React.createElement(IconButton, { onClick: () => {
|
|
99
|
+
session.deleteSavedSession(row.id);
|
|
100
|
+
} },
|
|
101
|
+
React.createElement(DeleteIcon, null)));
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
] }))) : (React.createElement("div", null, "No sessions loaded"))));
|
|
9
105
|
});
|
|
10
106
|
export default SessionManager;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
-
export interface
|
|
1
|
+
import type { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
+
export interface SessionMetadata {
|
|
3
|
+
id: string;
|
|
3
4
|
name: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
configPath: string;
|
|
7
|
+
favorite: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionSnap {
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
session: {
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
views?: {
|
|
15
|
+
tracks?: unknown[];
|
|
16
|
+
}[];
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
8
19
|
}
|
|
9
20
|
export interface SessionModel extends AbstractSessionModel {
|
|
10
|
-
|
|
21
|
+
savedSessionMetadata?: SessionMetadata[];
|
|
11
22
|
removeSavedSession: (arg: SessionSnap) => void;
|
|
12
23
|
activateSession: (arg: string) => void;
|
|
13
24
|
loadAutosaveSession: () => void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
1
2
|
export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
2
3
|
export declare const stateModel: import("mobx-state-tree").IModelType<{
|
|
3
4
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4
5
|
type: import("mobx-state-tree").ISimpleType<"SessionManager">;
|
|
5
6
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
7
|
+
export default function SessionManagerF(pluginManager: PluginManager): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
3
5
|
import { types } from 'mobx-state-tree';
|
|
4
6
|
export const configSchema = ConfigurationSchema('SessionManager', {});
|
|
@@ -6,3 +8,14 @@ export const stateModel = types.model('SessionManager', {
|
|
|
6
8
|
id: ElementId,
|
|
7
9
|
type: types.literal('SessionManager'),
|
|
8
10
|
});
|
|
11
|
+
export default function SessionManagerF(pluginManager) {
|
|
12
|
+
pluginManager.addWidgetType(() => {
|
|
13
|
+
return new WidgetType({
|
|
14
|
+
name: 'SessionManager',
|
|
15
|
+
heading: 'Recent sessions',
|
|
16
|
+
configSchema,
|
|
17
|
+
stateModel,
|
|
18
|
+
ReactComponent: lazy(() => import('./components/SessionManager')),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class MenusPlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
package/esm/index.js
CHANGED
|
@@ -1,55 +1,21 @@
|
|
|
1
|
-
import { lazy } from 'react';
|
|
2
|
-
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
3
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
4
2
|
import { isAbstractMenuManager } from '@jbrowse/core/util';
|
|
5
3
|
import HelpIcon from '@mui/icons-material/Help';
|
|
6
4
|
import InfoIcon from '@mui/icons-material/Info';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
5
|
+
import AboutWidgetF from './AboutWidget';
|
|
6
|
+
import HelpWidgetF from './HelpWidget';
|
|
7
|
+
import ImportSessionWidgetF from './ImportSessionWidget';
|
|
8
|
+
import SessionManagerF from './SessionManager';
|
|
11
9
|
export default class MenusPlugin extends Plugin {
|
|
12
10
|
constructor() {
|
|
13
11
|
super(...arguments);
|
|
14
12
|
this.name = 'MenusPlugin';
|
|
15
13
|
}
|
|
16
14
|
install(pluginManager) {
|
|
17
|
-
pluginManager
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
configSchema: aboutConfigSchema,
|
|
22
|
-
stateModel: aboutStateModel,
|
|
23
|
-
ReactComponent: lazy(() => import('./AboutWidget/components/AboutWidget')),
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
pluginManager.addWidgetType(() => {
|
|
27
|
-
return new WidgetType({
|
|
28
|
-
name: 'HelpWidget',
|
|
29
|
-
heading: 'Help',
|
|
30
|
-
configSchema: helpConfigSchema,
|
|
31
|
-
stateModel: helpStateModel,
|
|
32
|
-
ReactComponent: lazy(() => import('./HelpWidget/components/HelpWidget')),
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
pluginManager.addWidgetType(() => {
|
|
36
|
-
return new WidgetType({
|
|
37
|
-
name: 'ImportSessionWidget',
|
|
38
|
-
heading: 'Import session',
|
|
39
|
-
configSchema: importSessionConfigSchema,
|
|
40
|
-
stateModel: importSessionStateModel,
|
|
41
|
-
ReactComponent: lazy(() => import('./ImportSessionWidget/components/ImportSessionWidget')),
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
pluginManager.addWidgetType(() => {
|
|
45
|
-
return new WidgetType({
|
|
46
|
-
name: 'SessionManager',
|
|
47
|
-
heading: 'Sessions',
|
|
48
|
-
configSchema: sessionManagerConfigSchema,
|
|
49
|
-
stateModel: sessionManagerStateModel,
|
|
50
|
-
ReactComponent: lazy(() => import('./SessionManager/components/SessionManager')),
|
|
51
|
-
});
|
|
52
|
-
});
|
|
15
|
+
AboutWidgetF(pluginManager);
|
|
16
|
+
HelpWidgetF(pluginManager);
|
|
17
|
+
ImportSessionWidgetF(pluginManager);
|
|
18
|
+
SessionManagerF(pluginManager);
|
|
53
19
|
}
|
|
54
20
|
configure(pluginManager) {
|
|
55
21
|
if (isAbstractMenuManager(pluginManager.rootModel)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-menus",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "JBrowse 2 basic menus",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@mui/icons-material": "^6.0.0",
|
|
40
|
+
"date-fns": "^4.1.0",
|
|
40
41
|
"pluralize": "^8.0.0",
|
|
41
42
|
"react-dropzone": "^14.2.1"
|
|
42
43
|
},
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
|
|
60
61
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const mui_1 = require("tss-react/mui");
|
|
9
|
-
const mobx_react_1 = require("mobx-react");
|
|
10
|
-
const SessionListItem_1 = __importDefault(require("./SessionListItem"));
|
|
11
|
-
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
12
|
-
root: {
|
|
13
|
-
margin: theme.spacing(1),
|
|
14
|
-
},
|
|
15
|
-
}));
|
|
16
|
-
const AutosaveSessionsList = (0, mobx_react_1.observer)(function ({ session, }) {
|
|
17
|
-
const { classes } = useStyles();
|
|
18
|
-
const autosavedSession = JSON.parse(localStorage.getItem(session.previousAutosaveId) || '{}').session;
|
|
19
|
-
return autosavedSession ? (react_1.default.createElement(material_1.Paper, { className: classes.root },
|
|
20
|
-
react_1.default.createElement(material_1.List, { subheader: react_1.default.createElement(material_1.ListSubheader, null, "Previous autosaved entry") },
|
|
21
|
-
react_1.default.createElement(SessionListItem_1.default, { session: session, sessionSnapshot: autosavedSession, onClick: () => {
|
|
22
|
-
session.loadAutosaveSession();
|
|
23
|
-
} })))) : null;
|
|
24
|
-
});
|
|
25
|
-
exports.default = AutosaveSessionsList;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = DeleteSavedSessionDialog;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const material_1 = require("@mui/material");
|
|
9
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
10
|
-
function DeleteSavedSessionDialog({ open, sessionNameToDelete, handleClose, }) {
|
|
11
|
-
return (react_1.default.createElement(ui_1.Dialog, { open: open, title: `Delete session "${sessionNameToDelete}"?` },
|
|
12
|
-
react_1.default.createElement(material_1.DialogContent, null,
|
|
13
|
-
react_1.default.createElement(material_1.DialogContentText, null, "This action cannot be undone")),
|
|
14
|
-
react_1.default.createElement(material_1.DialogActions, null,
|
|
15
|
-
react_1.default.createElement(material_1.Button, { onClick: () => {
|
|
16
|
-
handleClose();
|
|
17
|
-
}, color: "primary" }, "Cancel"),
|
|
18
|
-
react_1.default.createElement(material_1.Button, { onClick: () => {
|
|
19
|
-
handleClose(true);
|
|
20
|
-
}, color: "primary", autoFocus: true }, "Delete"))));
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const material_1 = require("@mui/material");
|
|
31
|
-
const mui_1 = require("tss-react/mui");
|
|
32
|
-
const mobx_react_1 = require("mobx-react");
|
|
33
|
-
// icons
|
|
34
|
-
const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
35
|
-
const DeleteSavedSessionDialog_1 = __importDefault(require("./DeleteSavedSessionDialog"));
|
|
36
|
-
const SessionListItem_1 = __importDefault(require("./SessionListItem"));
|
|
37
|
-
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
38
|
-
root: {
|
|
39
|
-
margin: theme.spacing(1),
|
|
40
|
-
},
|
|
41
|
-
message: {
|
|
42
|
-
padding: theme.spacing(3),
|
|
43
|
-
},
|
|
44
|
-
}));
|
|
45
|
-
const RegularSavedSessionsList = (0, mobx_react_1.observer)(function ({ session, }) {
|
|
46
|
-
const { classes } = useStyles();
|
|
47
|
-
const [sessionIndexToDelete, setSessionIndexToDelete] = (0, react_1.useState)();
|
|
48
|
-
function handleDialogClose(deleteSession = false) {
|
|
49
|
-
if (deleteSession && sessionIndexToDelete !== undefined) {
|
|
50
|
-
session.removeSavedSession(session.savedSessions[sessionIndexToDelete]);
|
|
51
|
-
}
|
|
52
|
-
setSessionIndexToDelete(undefined);
|
|
53
|
-
}
|
|
54
|
-
const sessionNameToDelete = sessionIndexToDelete !== undefined
|
|
55
|
-
? session.savedSessions[sessionIndexToDelete].name
|
|
56
|
-
: '';
|
|
57
|
-
return (react_1.default.createElement(material_1.Paper, { className: classes.root },
|
|
58
|
-
react_1.default.createElement(material_1.List, { subheader: react_1.default.createElement(material_1.ListSubheader, null, "Saved sessions") }, session.savedSessions.length ? (session.savedSessions.map((sessionSnapshot, idx) => (react_1.default.createElement(SessionListItem_1.default, { onClick: () => {
|
|
59
|
-
session.activateSession(sessionSnapshot.name);
|
|
60
|
-
}, sessionSnapshot: sessionSnapshot, session: session, key: sessionSnapshot.name, secondaryAction: react_1.default.createElement(material_1.IconButton, { edge: "end", disabled: session.name === sessionSnapshot.name, onClick: () => {
|
|
61
|
-
setSessionIndexToDelete(idx);
|
|
62
|
-
} },
|
|
63
|
-
react_1.default.createElement(Delete_1.default, null)) })))) : (react_1.default.createElement(material_1.Typography, { className: classes.message }, "No saved sessions found"))),
|
|
64
|
-
sessionNameToDelete ? (react_1.default.createElement(react_1.default.Suspense, { fallback: null },
|
|
65
|
-
react_1.default.createElement(DeleteSavedSessionDialog_1.default, { open: true, sessionNameToDelete: sessionNameToDelete, handleClose: handleDialogClose }))) : null));
|
|
66
|
-
});
|
|
67
|
-
exports.default = RegularSavedSessionsList;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
3
|
-
import { SessionSnap } from './util';
|
|
4
|
-
declare const SessionListItem: ({ session, sessionSnapshot, onClick, secondaryAction, }: {
|
|
5
|
-
sessionSnapshot: SessionSnap;
|
|
6
|
-
session: AbstractSessionModel;
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
secondaryAction?: React.ReactNode;
|
|
9
|
-
}) => React.JSX.Element;
|
|
10
|
-
export default SessionListItem;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
const pluralize_1 = __importDefault(require("pluralize"));
|
|
10
|
-
// icons
|
|
11
|
-
const ViewList_1 = __importDefault(require("@mui/icons-material/ViewList"));
|
|
12
|
-
const util_1 = require("@jbrowse/core/util");
|
|
13
|
-
const SessionListItem = (0, mobx_react_1.observer)(function ({ session, sessionSnapshot, onClick, secondaryAction, }) {
|
|
14
|
-
const { views = [] } = sessionSnapshot;
|
|
15
|
-
const totalTracks = (0, util_1.sum)(views.map(view => { var _a, _b; return (_b = (_a = view.tracks) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; }));
|
|
16
|
-
const n = views.length;
|
|
17
|
-
return (react_1.default.createElement(material_1.ListItem, { secondaryAction: secondaryAction },
|
|
18
|
-
react_1.default.createElement(material_1.ListItemButton, { onClick: onClick },
|
|
19
|
-
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
20
|
-
react_1.default.createElement(ViewList_1.default, null)),
|
|
21
|
-
react_1.default.createElement(material_1.ListItemText, { primary: sessionSnapshot.name, secondary: session.name === sessionSnapshot.name
|
|
22
|
-
? 'Currently open'
|
|
23
|
-
: `${n} ${(0, pluralize_1.default)('view', n)}; ${totalTracks} open ${(0, pluralize_1.default)('track', totalTracks)}` }))));
|
|
24
|
-
});
|
|
25
|
-
exports.default = SessionListItem;
|