@jbrowse/plugin-data-management 3.0.3 → 3.0.4

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.
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doSubmit = doSubmit;
4
4
  const util_1 = require("@jbrowse/core/util");
5
5
  const mobx_state_tree_1 = require("mobx-state-tree");
6
- function doTextIndexTrack({ model }) {
7
- const { textIndexingConf, trackConfig, trackName, assembly } = model;
6
+ function doTextIndexTrack({ trackId, model, }) {
7
+ const { textIndexingConf, trackName, assembly } = model;
8
8
  const { jobsManager } = (0, mobx_state_tree_1.getRoot)(model);
9
9
  const attr = textIndexingConf || {
10
10
  attributes: ['Name', 'ID'],
@@ -15,7 +15,7 @@ function doTextIndexTrack({ model }) {
15
15
  indexingParams: {
16
16
  ...attr,
17
17
  assemblies: [assembly],
18
- tracks: [trackConfig.trackId],
18
+ tracks: [trackId],
19
19
  indexType: 'perTrack',
20
20
  name: indexName,
21
21
  timestamp: new Date().toISOString(),
@@ -26,18 +26,23 @@ function doTextIndexTrack({ model }) {
26
26
  }
27
27
  function doSubmit({ model }) {
28
28
  var _a;
29
- const { textIndexTrack, trackConfig, trackAdapter, view } = model;
29
+ const { textIndexTrack, trackAdapter, view } = model;
30
30
  const session = (0, util_1.getSession)(model);
31
+ const trackConfig = model.getTrackConfig(Date.now());
31
32
  if (!(0, util_1.isSessionWithAddTracks)(session)) {
32
33
  throw new Error("Can't add tracks to this session");
33
34
  }
34
35
  else if (trackConfig && trackAdapter) {
36
+ const { trackId } = trackConfig;
35
37
  session.addTrackConf(trackConfig);
36
- (_a = view === null || view === void 0 ? void 0 : view.showTrack) === null || _a === void 0 ? void 0 : _a.call(view, trackConfig.trackId);
38
+ (_a = view === null || view === void 0 ? void 0 : view.showTrack) === null || _a === void 0 ? void 0 : _a.call(view, trackId);
37
39
  if (util_1.isElectron &&
38
40
  textIndexTrack &&
39
41
  (0, util_1.isSupportedIndexingAdapter)(trackAdapter.type)) {
40
- doTextIndexTrack({ model });
42
+ doTextIndexTrack({
43
+ model,
44
+ trackId,
45
+ });
41
46
  }
42
47
  model.clearData();
43
48
  if ((0, util_1.isSessionModelWithWidgets)(session)) {
@@ -47,7 +47,7 @@ export default function f(pluginManager: PluginManager): import("mobx-state-tree
47
47
  readonly trackAdapterType: string | undefined;
48
48
  readonly trackType: string;
49
49
  } & {
50
- readonly trackConfig: {
50
+ getTrackConfig(timestamp: number): {
51
51
  trackId: string;
52
52
  type: string;
53
53
  name: string;
@@ -142,7 +142,7 @@ function f(pluginManager) {
142
142
  },
143
143
  }))
144
144
  .views(self => ({
145
- get trackConfig() {
145
+ getTrackConfig(timestamp) {
146
146
  const session = (0, util_1.getSession)(self);
147
147
  const assemblyInstance = session.assemblyManager.get(self.assembly);
148
148
  return assemblyInstance &&
@@ -150,7 +150,7 @@ function f(pluginManager) {
150
150
  self.trackAdapter.type !== 'UNKNOWN'
151
151
  ? (0, deepmerge_1.default)({
152
152
  trackId: [
153
- `${self.trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
153
+ `${self.trackName.toLowerCase().replaceAll(' ', '_')}-${timestamp}`,
154
154
  session.adminMode ? '' : '-sessionTrack',
155
155
  ].join(''),
156
156
  type: self.trackType,
@@ -15,17 +15,17 @@ function FacetedHeader({ model, }) {
15
15
  const { faceted } = model;
16
16
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
17
17
  const { showOptions, showFilters, showSparse, useShoppingCart } = faceted;
18
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 4, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Search...", value: faceted.filterText, onChange: event => {
19
- faceted.setFilterText(event.target.value);
20
- }, slotProps: {
21
- input: {
22
- endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => {
23
- faceted.setFilterText('');
24
- }, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) }) })),
25
- },
26
- } }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: event => {
27
- setAnchorEl(event.currentTarget);
28
- }, children: (0, jsx_runtime_1.jsx)(MoreVert_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, children: (0, jsx_runtime_1.jsx)(ShoppingCart_1.default, { model: model }) })] }), (0, jsx_runtime_1.jsx)(ui_1.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
18
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid2, { container: true, spacing: 4, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Search...", value: faceted.filterText, onChange: event => {
19
+ faceted.setFilterText(event.target.value);
20
+ }, slotProps: {
21
+ input: {
22
+ endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => {
23
+ faceted.setFilterText('');
24
+ }, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) }) })),
25
+ },
26
+ } }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: event => {
27
+ setAnchorEl(event.currentTarget);
28
+ }, children: (0, jsx_runtime_1.jsx)(MoreVert_1.default, {}) }), (0, jsx_runtime_1.jsx)(ShoppingCart_1.default, { model: model })] }), (0, jsx_runtime_1.jsx)(ui_1.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
29
29
  setAnchorEl(null);
30
30
  }, onMenuItemClick: (_event, callback) => {
31
31
  callback();
@@ -41,7 +41,9 @@ function TrackLabel({ data }) {
41
41
  }
42
42
  }, control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { className: classes.compactCheckbox, checked: checked, onChange: () => {
43
43
  onChange(trackId);
44
- }, disabled: (0, util_1.isUnsupported)(name), inputProps: {
45
- 'data-testid': `htsTrackEntry-${id}`,
44
+ }, disabled: (0, util_1.isUnsupported)(name), slotProps: {
45
+ input: {
46
+ 'data-testid': `htsTrackEntry-${id}`,
47
+ },
46
48
  } }), label: (0, jsx_runtime_1.jsx)("div", { "data-testid": `htsTrackLabel-${id}`, className: selected ? classes.selected : undefined, children: (0, jsx_runtime_1.jsx)(SanitizedHTML_1.default, { html: name }) }) }) }), (0, jsx_runtime_1.jsx)(TrackLabelMenu_1.default, { model: model, trackId: trackId, id: id, conf: conf })] }));
47
49
  }
@@ -1,7 +1,7 @@
1
1
  import { getSession, isElectron, isSessionModelWithWidgets, isSessionWithAddTracks, isSupportedIndexingAdapter, } from '@jbrowse/core/util';
2
2
  import { getRoot } from 'mobx-state-tree';
3
- function doTextIndexTrack({ model }) {
4
- const { textIndexingConf, trackConfig, trackName, assembly } = model;
3
+ function doTextIndexTrack({ trackId, model, }) {
4
+ const { textIndexingConf, trackName, assembly } = model;
5
5
  const { jobsManager } = getRoot(model);
6
6
  const attr = textIndexingConf || {
7
7
  attributes: ['Name', 'ID'],
@@ -12,7 +12,7 @@ function doTextIndexTrack({ model }) {
12
12
  indexingParams: {
13
13
  ...attr,
14
14
  assemblies: [assembly],
15
- tracks: [trackConfig.trackId],
15
+ tracks: [trackId],
16
16
  indexType: 'perTrack',
17
17
  name: indexName,
18
18
  timestamp: new Date().toISOString(),
@@ -23,18 +23,23 @@ function doTextIndexTrack({ model }) {
23
23
  }
24
24
  export function doSubmit({ model }) {
25
25
  var _a;
26
- const { textIndexTrack, trackConfig, trackAdapter, view } = model;
26
+ const { textIndexTrack, trackAdapter, view } = model;
27
27
  const session = getSession(model);
28
+ const trackConfig = model.getTrackConfig(Date.now());
28
29
  if (!isSessionWithAddTracks(session)) {
29
30
  throw new Error("Can't add tracks to this session");
30
31
  }
31
32
  else if (trackConfig && trackAdapter) {
33
+ const { trackId } = trackConfig;
32
34
  session.addTrackConf(trackConfig);
33
- (_a = view === null || view === void 0 ? void 0 : view.showTrack) === null || _a === void 0 ? void 0 : _a.call(view, trackConfig.trackId);
35
+ (_a = view === null || view === void 0 ? void 0 : view.showTrack) === null || _a === void 0 ? void 0 : _a.call(view, trackId);
34
36
  if (isElectron &&
35
37
  textIndexTrack &&
36
38
  isSupportedIndexingAdapter(trackAdapter.type)) {
37
- doTextIndexTrack({ model });
39
+ doTextIndexTrack({
40
+ model,
41
+ trackId,
42
+ });
38
43
  }
39
44
  model.clearData();
40
45
  if (isSessionModelWithWidgets(session)) {
@@ -47,7 +47,7 @@ export default function f(pluginManager: PluginManager): import("mobx-state-tree
47
47
  readonly trackAdapterType: string | undefined;
48
48
  readonly trackType: string;
49
49
  } & {
50
- readonly trackConfig: {
50
+ getTrackConfig(timestamp: number): {
51
51
  trackId: string;
52
52
  type: string;
53
53
  name: string;
@@ -136,7 +136,7 @@ export default function f(pluginManager) {
136
136
  },
137
137
  }))
138
138
  .views(self => ({
139
- get trackConfig() {
139
+ getTrackConfig(timestamp) {
140
140
  const session = getSession(self);
141
141
  const assemblyInstance = session.assemblyManager.get(self.assembly);
142
142
  return assemblyInstance &&
@@ -144,7 +144,7 @@ export default function f(pluginManager) {
144
144
  self.trackAdapter.type !== 'UNKNOWN'
145
145
  ? deepmerge({
146
146
  trackId: [
147
- `${self.trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
147
+ `${self.trackName.toLowerCase().replaceAll(' ', '_')}-${timestamp}`,
148
148
  session.adminMode ? '' : '-sessionTrack',
149
149
  ].join(''),
150
150
  type: self.trackType,
@@ -3,23 +3,23 @@ import { useState } from 'react';
3
3
  import { Menu } from '@jbrowse/core/ui';
4
4
  import ClearIcon from '@mui/icons-material/Clear';
5
5
  import MoreVert from '@mui/icons-material/MoreVert';
6
- import { Grid, IconButton, InputAdornment, TextField } from '@mui/material';
6
+ import { Grid2, IconButton, InputAdornment, TextField } from '@mui/material';
7
7
  import ShoppingCart from '../ShoppingCart';
8
8
  export default function FacetedHeader({ model, }) {
9
9
  const { faceted } = model;
10
10
  const [anchorEl, setAnchorEl] = useState(null);
11
11
  const { showOptions, showFilters, showSparse, useShoppingCart } = faceted;
12
- return (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: 4, alignItems: "center", children: [_jsx(Grid, { item: true, children: _jsx(TextField, { label: "Search...", value: faceted.filterText, onChange: event => {
13
- faceted.setFilterText(event.target.value);
14
- }, slotProps: {
15
- input: {
16
- endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { onClick: () => {
17
- faceted.setFilterText('');
18
- }, children: _jsx(ClearIcon, {}) }) })),
19
- },
20
- } }) }), _jsx(Grid, { item: true, children: _jsx(IconButton, { onClick: event => {
21
- setAnchorEl(event.currentTarget);
22
- }, children: _jsx(MoreVert, {}) }) }), _jsx(Grid, { item: true, children: _jsx(ShoppingCart, { model: model }) })] }), _jsx(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
12
+ return (_jsxs(_Fragment, { children: [_jsxs(Grid2, { container: true, spacing: 4, alignItems: "center", children: [_jsx(TextField, { label: "Search...", value: faceted.filterText, onChange: event => {
13
+ faceted.setFilterText(event.target.value);
14
+ }, slotProps: {
15
+ input: {
16
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { onClick: () => {
17
+ faceted.setFilterText('');
18
+ }, children: _jsx(ClearIcon, {}) }) })),
19
+ },
20
+ } }), _jsx(IconButton, { onClick: event => {
21
+ setAnchorEl(event.currentTarget);
22
+ }, children: _jsx(MoreVert, {}) }), _jsx(ShoppingCart, { model: model })] }), _jsx(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => {
23
23
  setAnchorEl(null);
24
24
  }, onMenuItemClick: (_event, callback) => {
25
25
  callback();
@@ -35,7 +35,9 @@ export default function TrackLabel({ data }) {
35
35
  }
36
36
  }, control: _jsx(Checkbox, { className: classes.compactCheckbox, checked: checked, onChange: () => {
37
37
  onChange(trackId);
38
- }, disabled: isUnsupported(name), inputProps: {
39
- 'data-testid': `htsTrackEntry-${id}`,
38
+ }, disabled: isUnsupported(name), slotProps: {
39
+ input: {
40
+ 'data-testid': `htsTrackEntry-${id}`,
41
+ },
40
42
  } }), label: _jsx("div", { "data-testid": `htsTrackLabel-${id}`, className: selected ? classes.selected : undefined, children: _jsx(SanitizedHTML, { html: name }) }) }) }), _jsx(TrackLabelMenu, { model: model, trackId: trackId, id: id, conf: conf })] }));
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@gmod/ucsc-hub": "^1.0.0",
40
- "@jbrowse/core": "^3.0.3",
41
- "@jbrowse/plugin-config": "^3.0.3",
42
- "@jbrowse/product-core": "^3.0.3",
40
+ "@jbrowse/core": "^3.0.4",
41
+ "@jbrowse/plugin-config": "^3.0.4",
42
+ "@jbrowse/product-core": "^3.0.4",
43
43
  "@mui/icons-material": "^6.0.0",
44
44
  "@mui/material": "^6.0.0",
45
45
  "@mui/x-data-grid": "^7.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": "f516540428282351d26e46743e69a724651bfb2c"
64
+ "gitHead": "61e6d26f83acbf58a946c2add3415bc46b878df9"
65
65
  }