@jbrowse/web-core 2.17.0 → 3.0.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/BaseWebSession/index.d.ts +104 -15062
- package/dist/BaseWebSession/index.js +48 -175
- package/dist/SessionConnections.d.ts +5 -33
- package/dist/SessionConnections.js +19 -25
- package/esm/BaseWebSession/index.d.ts +104 -15062
- package/esm/BaseWebSession/index.js +32 -169
- package/esm/SessionConnections.d.ts +5 -33
- package/esm/SessionConnections.js +19 -25
- package/package.json +4 -5
|
@@ -15,182 +15,97 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.BaseWebSession = BaseWebSession;
|
|
30
40
|
const react_1 = require("react");
|
|
31
|
-
const
|
|
41
|
+
const app_core_1 = require("@jbrowse/app-core");
|
|
32
42
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
43
|
+
const SnackbarModel_1 = __importDefault(require("@jbrowse/core/ui/SnackbarModel"));
|
|
33
44
|
const util_1 = require("@jbrowse/core/util");
|
|
34
|
-
const mobx_1 = require("mobx");
|
|
35
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
36
45
|
const product_core_1 = require("@jbrowse/product-core");
|
|
37
|
-
const app_core_1 = require("@jbrowse/app-core");
|
|
38
|
-
const SnackbarModel_1 = __importDefault(require("@jbrowse/core/ui/SnackbarModel"));
|
|
39
|
-
// icons
|
|
40
|
-
const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
41
|
-
const FileCopy_1 = __importDefault(require("@mui/icons-material/FileCopy"));
|
|
42
46
|
const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
47
|
+
const FileCopy_1 = __importDefault(require("@mui/icons-material/FileCopy"));
|
|
43
48
|
const Info_1 = __importDefault(require("@mui/icons-material/Info"));
|
|
44
|
-
|
|
49
|
+
const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
50
|
+
const mobx_1 = require("mobx");
|
|
51
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
45
52
|
const SessionConnections_1 = require("../SessionConnections");
|
|
46
|
-
// lazies
|
|
47
53
|
const AboutDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./AboutDialog'))));
|
|
48
|
-
/**
|
|
49
|
-
* #stateModel BaseWebSession
|
|
50
|
-
* used for "web based" products, including jbrowse-web and react-app
|
|
51
|
-
* composed of
|
|
52
|
-
* - [ReferenceManagementSessionMixin](../referencemanagementsessionmixin)
|
|
53
|
-
* - [DrawerWidgetSessionMixin](../drawerwidgetsessionmixin)
|
|
54
|
-
* - [DialogQueueSessionMixin](../dialogqueuesessionmixin)
|
|
55
|
-
* - [ThemeManagerSessionMixin](../thememanagersessionmixin)
|
|
56
|
-
* - [MultipleViewsSessionMixin](../multipleviewssessionmixin)
|
|
57
|
-
* - [SessionTracksManagerSessionMixin](../sessiontracksmanagersessionmixin)
|
|
58
|
-
* - [SessionAssembliesMixin](../sessionassembliesmixin)
|
|
59
|
-
* - [TemporaryAssembliesMixin](../temporaryassembliesmixin)
|
|
60
|
-
* - [WebSessionConnectionsMixin](../websessionconnectionsmixin)
|
|
61
|
-
* - [AppFocusMixin](../appfocusmixin)
|
|
62
|
-
*/
|
|
63
54
|
function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
64
55
|
const sessionModel = mobx_state_tree_1.types
|
|
65
56
|
.compose('WebCoreSessionModel', mobx_state_tree_1.types.compose('WebCoreSessionModelGroupA', (0, product_core_1.ReferenceManagementSessionMixin)(pluginManager), (0, product_core_1.DrawerWidgetSessionMixin)(pluginManager), (0, product_core_1.DialogQueueSessionMixin)(pluginManager), (0, product_core_1.ThemeManagerSessionMixin)(pluginManager), (0, product_core_1.MultipleViewsSessionMixin)(pluginManager)), mobx_state_tree_1.types.compose('WebCoreSessionModelGroupB', (0, product_core_1.SessionTracksManagerSessionMixin)(pluginManager), (0, app_core_1.SessionAssembliesMixin)(pluginManager, assemblyConfigSchema), (0, app_core_1.TemporaryAssembliesMixin)(pluginManager, assemblyConfigSchema), (0, SessionConnections_1.WebSessionConnectionsMixin)(pluginManager), (0, app_core_1.AppFocusMixin)(), (0, SnackbarModel_1.default)()))
|
|
66
57
|
.props({
|
|
67
|
-
/**
|
|
68
|
-
* #property
|
|
69
|
-
*/
|
|
70
58
|
margin: 0,
|
|
71
|
-
/**
|
|
72
|
-
* #property
|
|
73
|
-
*/
|
|
74
59
|
sessionPlugins: mobx_state_tree_1.types.array(mobx_state_tree_1.types.frozen()),
|
|
75
60
|
})
|
|
76
|
-
.volatile((
|
|
77
|
-
/**
|
|
78
|
-
* #volatile
|
|
79
|
-
*/
|
|
61
|
+
.volatile(() => ({
|
|
80
62
|
sessionThemeName: (0, util_1.localStorageGetItem)('themeName') || 'default',
|
|
81
|
-
/**
|
|
82
|
-
* #volatile
|
|
83
|
-
* this is the current "task" that is being performed in the UI.
|
|
84
|
-
* this is usually an object of the form
|
|
85
|
-
* `{ taskName: "configure", target: thing_being_configured }`
|
|
86
|
-
*/
|
|
87
63
|
task: undefined,
|
|
88
64
|
}))
|
|
89
65
|
.views(self => ({
|
|
90
|
-
/**
|
|
91
|
-
* #getter
|
|
92
|
-
*/
|
|
93
66
|
get tracks() {
|
|
94
67
|
return [...self.sessionTracks, ...self.jbrowse.tracks];
|
|
95
68
|
},
|
|
96
|
-
/**
|
|
97
|
-
* #getter
|
|
98
|
-
*/
|
|
99
69
|
get root() {
|
|
100
70
|
return (0, mobx_state_tree_1.getParent)(self);
|
|
101
71
|
},
|
|
102
|
-
/**
|
|
103
|
-
* #getter
|
|
104
|
-
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
105
|
-
* include temporaryAssemblies. basically the list to be displayed in a
|
|
106
|
-
* AssemblySelector dropdown
|
|
107
|
-
*/
|
|
108
72
|
get assemblies() {
|
|
109
73
|
return [...self.jbrowse.assemblies, ...self.sessionAssemblies];
|
|
110
74
|
},
|
|
111
|
-
/**
|
|
112
|
-
* #getter
|
|
113
|
-
* list of config connections and session connections
|
|
114
|
-
*/
|
|
115
75
|
get connections() {
|
|
116
76
|
return [...self.jbrowse.connections, ...self.sessionConnections];
|
|
117
77
|
},
|
|
118
78
|
}))
|
|
119
79
|
.actions(self => ({
|
|
120
|
-
/**
|
|
121
|
-
* #action
|
|
122
|
-
*/
|
|
123
80
|
setName(str) {
|
|
124
81
|
self.name = str;
|
|
125
82
|
},
|
|
126
83
|
}))
|
|
127
84
|
.views(self => ({
|
|
128
|
-
/**
|
|
129
|
-
* #getter
|
|
130
|
-
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
131
|
-
* include temporaryAssemblies. basically the list to be displayed in a
|
|
132
|
-
* AssemblySelector dropdown
|
|
133
|
-
*/
|
|
134
85
|
get assemblyNames() {
|
|
135
86
|
return self.assemblies.map(f => (0, configuration_1.readConfObject)(f, 'name'));
|
|
136
87
|
},
|
|
137
|
-
/**
|
|
138
|
-
* #getter
|
|
139
|
-
*/
|
|
140
88
|
get version() {
|
|
141
89
|
return self.root.version;
|
|
142
90
|
},
|
|
143
|
-
/**
|
|
144
|
-
* #getter
|
|
145
|
-
*/
|
|
146
91
|
get shareURL() {
|
|
147
92
|
return (0, configuration_1.getConf)(self.jbrowse, 'shareURL');
|
|
148
93
|
},
|
|
149
|
-
/**
|
|
150
|
-
* #getter
|
|
151
|
-
*/
|
|
152
94
|
get textSearchManager() {
|
|
153
95
|
return self.root.textSearchManager;
|
|
154
96
|
},
|
|
155
|
-
/**
|
|
156
|
-
* #getter
|
|
157
|
-
*/
|
|
158
97
|
get assemblyManager() {
|
|
159
98
|
return self.root.assemblyManager;
|
|
160
99
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
*/
|
|
164
|
-
get savedSessions() {
|
|
165
|
-
return self.root.savedSessions;
|
|
100
|
+
get savedSessionMetadata() {
|
|
101
|
+
return self.root.savedSessionMetadata;
|
|
166
102
|
},
|
|
167
|
-
/**
|
|
168
|
-
* #getter
|
|
169
|
-
*/
|
|
170
103
|
get previousAutosaveId() {
|
|
171
104
|
return self.root.previousAutosaveId;
|
|
172
105
|
},
|
|
173
|
-
/**
|
|
174
|
-
* #getter
|
|
175
|
-
*/
|
|
176
|
-
get savedSessionNames() {
|
|
177
|
-
return self.root.savedSessionNames;
|
|
178
|
-
},
|
|
179
|
-
/**
|
|
180
|
-
* #getter
|
|
181
|
-
*/
|
|
182
106
|
get history() {
|
|
183
107
|
return self.root.history;
|
|
184
108
|
},
|
|
185
|
-
/**
|
|
186
|
-
* #getter
|
|
187
|
-
*/
|
|
188
|
-
get menus() {
|
|
189
|
-
return self.root.menus;
|
|
190
|
-
},
|
|
191
|
-
/**
|
|
192
|
-
* #method
|
|
193
|
-
*/
|
|
194
109
|
renderProps() {
|
|
195
110
|
return {
|
|
196
111
|
theme: self.theme,
|
|
@@ -199,15 +114,9 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
199
114
|
},
|
|
200
115
|
}))
|
|
201
116
|
.actions(self => ({
|
|
202
|
-
/**
|
|
203
|
-
* #action
|
|
204
|
-
*/
|
|
205
117
|
addAssemblyConf(conf) {
|
|
206
118
|
self.jbrowse.addAssemblyConf(conf);
|
|
207
119
|
},
|
|
208
|
-
/**
|
|
209
|
-
* #action
|
|
210
|
-
*/
|
|
211
120
|
addSessionPlugin(plugin) {
|
|
212
121
|
if (self.sessionPlugins.some(p => p.name === plugin.name)) {
|
|
213
122
|
throw new Error('session plugin cannot be installed twice');
|
|
@@ -215,80 +124,48 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
215
124
|
self.sessionPlugins.push(plugin);
|
|
216
125
|
self.root.setPluginsUpdated(true);
|
|
217
126
|
},
|
|
218
|
-
/**
|
|
219
|
-
* #action
|
|
220
|
-
*/
|
|
221
127
|
removeSessionPlugin(pluginDefinition) {
|
|
222
|
-
self.sessionPlugins = (0, mobx_state_tree_1.cast)(self.sessionPlugins.filter(plugin =>
|
|
223
|
-
// @ts-expect-error
|
|
224
|
-
plugin.url !== pluginDefinition.url ||
|
|
225
|
-
// @ts-expect-error
|
|
128
|
+
self.sessionPlugins = (0, mobx_state_tree_1.cast)(self.sessionPlugins.filter(plugin => plugin.url !== pluginDefinition.url ||
|
|
226
129
|
plugin.umdUrl !== pluginDefinition.umdUrl ||
|
|
227
|
-
// @ts-expect-error
|
|
228
130
|
plugin.cjsUrl !== pluginDefinition.cjsUrl ||
|
|
229
|
-
// @ts-expect-error
|
|
230
131
|
plugin.esmUrl !== pluginDefinition.esmUrl));
|
|
231
132
|
(0, mobx_state_tree_1.getParent)(self).setPluginsUpdated(true);
|
|
232
133
|
},
|
|
233
|
-
/**
|
|
234
|
-
* #action
|
|
235
|
-
*/
|
|
236
134
|
addSavedSession(sessionSnapshot) {
|
|
237
135
|
return self.root.addSavedSession(sessionSnapshot);
|
|
238
136
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return self.root.
|
|
137
|
+
deleteSavedSession(id) {
|
|
138
|
+
return self.root.deleteSavedSession(id);
|
|
139
|
+
},
|
|
140
|
+
favoriteSavedSession(id) {
|
|
141
|
+
return self.root.favoriteSavedSession(id);
|
|
142
|
+
},
|
|
143
|
+
unfavoriteSavedSession(id) {
|
|
144
|
+
return self.root.unfavoriteSavedSession(id);
|
|
244
145
|
},
|
|
245
|
-
/**
|
|
246
|
-
* #action
|
|
247
|
-
*/
|
|
248
146
|
renameCurrentSession(sessionName) {
|
|
249
147
|
return self.root.renameCurrentSession(sessionName);
|
|
250
148
|
},
|
|
251
|
-
/**
|
|
252
|
-
* #action
|
|
253
|
-
*/
|
|
254
149
|
duplicateCurrentSession() {
|
|
255
150
|
return self.root.duplicateCurrentSession();
|
|
256
151
|
},
|
|
257
|
-
/**
|
|
258
|
-
* #action
|
|
259
|
-
*/
|
|
260
152
|
activateSession(sessionName) {
|
|
261
153
|
return self.root.activateSession(sessionName);
|
|
262
154
|
},
|
|
263
|
-
/**
|
|
264
|
-
* #action
|
|
265
|
-
*/
|
|
266
155
|
setDefaultSession() {
|
|
267
156
|
return self.root.setDefaultSession();
|
|
268
157
|
},
|
|
269
|
-
/**
|
|
270
|
-
* #action
|
|
271
|
-
*/
|
|
272
158
|
saveSessionToLocalStorage() {
|
|
273
159
|
return self.root.saveSessionToLocalStorage();
|
|
274
160
|
},
|
|
275
|
-
/**
|
|
276
|
-
* #action
|
|
277
|
-
*/
|
|
278
161
|
loadAutosaveSession() {
|
|
279
162
|
return self.root.loadAutosaveSession();
|
|
280
163
|
},
|
|
281
|
-
/**
|
|
282
|
-
* #action
|
|
283
|
-
*/
|
|
284
164
|
setSession(sessionSnapshot) {
|
|
285
165
|
return self.root.setSession(sessionSnapshot);
|
|
286
166
|
},
|
|
287
167
|
}))
|
|
288
168
|
.actions(self => ({
|
|
289
|
-
/**
|
|
290
|
-
* #action
|
|
291
|
-
*/
|
|
292
169
|
editTrackConfiguration(configuration) {
|
|
293
170
|
const { adminMode, sessionTracks } = self;
|
|
294
171
|
if (!adminMode && !sessionTracks.includes(configuration)) {
|
|
@@ -298,13 +175,9 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
298
175
|
},
|
|
299
176
|
}))
|
|
300
177
|
.views(self => ({
|
|
301
|
-
/**
|
|
302
|
-
* #method
|
|
303
|
-
*/
|
|
304
178
|
getTrackActionMenuItems(config) {
|
|
305
179
|
const { adminMode, sessionTracks } = self;
|
|
306
180
|
const canEdit = adminMode || sessionTracks.find(t => t.trackId === config.trackId);
|
|
307
|
-
// disable if it is a reference sequence track
|
|
308
181
|
const isRefSeq = config.type === 'ReferenceSequenceTrack';
|
|
309
182
|
return [
|
|
310
183
|
{
|
|
@@ -313,7 +186,10 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
313
186
|
onClick: () => {
|
|
314
187
|
self.queueDialog(handleClose => [
|
|
315
188
|
AboutDialog,
|
|
316
|
-
{
|
|
189
|
+
{
|
|
190
|
+
config,
|
|
191
|
+
handleClose,
|
|
192
|
+
},
|
|
317
193
|
]);
|
|
318
194
|
},
|
|
319
195
|
icon: Info_1.default,
|
|
@@ -322,32 +198,31 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
322
198
|
label: 'Settings',
|
|
323
199
|
priority: 1001,
|
|
324
200
|
disabled: !canEdit,
|
|
201
|
+
icon: Settings_1.default,
|
|
325
202
|
onClick: () => {
|
|
326
203
|
self.editTrackConfiguration(config);
|
|
327
204
|
},
|
|
328
|
-
icon: Settings_1.default,
|
|
329
205
|
},
|
|
330
206
|
{
|
|
331
207
|
label: 'Delete track',
|
|
332
208
|
priority: 1000,
|
|
333
209
|
disabled: !canEdit || isRefSeq,
|
|
334
|
-
onClick: () => self.deleteTrackConf(config),
|
|
335
210
|
icon: Delete_1.default,
|
|
211
|
+
onClick: () => {
|
|
212
|
+
self.deleteTrackConf(config);
|
|
213
|
+
},
|
|
336
214
|
},
|
|
337
215
|
{
|
|
338
216
|
label: 'Copy track',
|
|
339
217
|
priority: 999,
|
|
340
218
|
disabled: isRefSeq,
|
|
341
219
|
onClick: () => {
|
|
342
|
-
const snap = (
|
|
220
|
+
const snap = structuredClone((0, mobx_state_tree_1.getSnapshot)(config));
|
|
343
221
|
const now = Date.now();
|
|
344
222
|
snap.trackId += `-${now}`;
|
|
345
223
|
snap.displays.forEach(display => {
|
|
346
224
|
display.displayId += `-${now}`;
|
|
347
225
|
});
|
|
348
|
-
// the -sessionTrack suffix to trackId is used as metadata for
|
|
349
|
-
// the track selector to store the track in a special category,
|
|
350
|
-
// and default category is also cleared
|
|
351
226
|
if (!self.adminMode) {
|
|
352
227
|
snap.trackId += '-sessionTrack';
|
|
353
228
|
snap.category = undefined;
|
|
@@ -357,8 +232,12 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
357
232
|
},
|
|
358
233
|
icon: FileCopy_1.default,
|
|
359
234
|
},
|
|
235
|
+
{ type: 'divider' },
|
|
360
236
|
];
|
|
361
237
|
},
|
|
238
|
+
menus() {
|
|
239
|
+
return self.root.menus();
|
|
240
|
+
},
|
|
362
241
|
}))
|
|
363
242
|
.actions(self => ({
|
|
364
243
|
afterAttach() {
|
|
@@ -370,14 +249,8 @@ function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
|
370
249
|
}));
|
|
371
250
|
const extendedSessionModel = pluginManager.evaluateExtensionPoint('Core-extendSession', sessionModel);
|
|
372
251
|
return mobx_state_tree_1.types.snapshotProcessor(extendedSessionModel, {
|
|
373
|
-
// @ts-expect-error
|
|
374
252
|
preProcessor(snapshot) {
|
|
375
|
-
// @ts-expect-error
|
|
376
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
377
253
|
const { connectionInstances, ...rest } = snapshot || {};
|
|
378
|
-
// connectionInstances schema changed from object to an array, so any
|
|
379
|
-
// old connectionInstances as object is in snapshot, filter it out
|
|
380
|
-
// https://github.com/GMOD/jbrowse-components/issues/1903
|
|
381
254
|
return !Array.isArray(connectionInstances) ? rest : snapshot;
|
|
382
255
|
},
|
|
383
256
|
});
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
-
import { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig';
|
|
4
|
-
/**
|
|
5
|
-
* #stateModel WebSessionConnectionsMixin
|
|
6
|
-
* #category session
|
|
7
|
-
*/
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig';
|
|
8
4
|
export declare function WebSessionConnectionsMixin(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
9
5
|
connectionInstances: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
10
6
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -51,33 +47,9 @@ export declare function WebSessionConnectionsMixin(pluginManager: PluginManager)
|
|
|
51
47
|
clear(): void;
|
|
52
48
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
53
49
|
} & {
|
|
54
|
-
/**
|
|
55
|
-
* #property
|
|
56
|
-
*/
|
|
57
50
|
sessionConnections: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
58
51
|
}, {
|
|
59
|
-
readonly connections:
|
|
60
|
-
[x: string]: any;
|
|
61
|
-
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
62
|
-
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
63
|
-
[x: string]: any;
|
|
64
|
-
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
65
|
-
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
66
|
-
[x: string]: any;
|
|
67
|
-
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
68
|
-
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
69
|
-
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
70
|
-
name: {
|
|
71
|
-
type: string;
|
|
72
|
-
defaultValue: string;
|
|
73
|
-
description: string;
|
|
74
|
-
};
|
|
75
|
-
assemblyNames: {
|
|
76
|
-
type: string;
|
|
77
|
-
defaultValue: never[];
|
|
78
|
-
description: string;
|
|
79
|
-
};
|
|
80
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>)[];
|
|
52
|
+
readonly connections: BaseConnectionConfigModel[];
|
|
81
53
|
} & {
|
|
82
54
|
makeConnection(configuration: AnyConfigurationModel, initialSnapshot?: {}): ({
|
|
83
55
|
name: string;
|
|
@@ -183,5 +155,5 @@ export declare function WebSessionConnectionsMixin(pluginManager: PluginManager)
|
|
|
183
155
|
clearConnections(): void;
|
|
184
156
|
} & {
|
|
185
157
|
addConnectionConf(connectionConf: BaseConnectionConfigModel): any;
|
|
186
|
-
deleteConnection(configuration: AnyConfigurationModel):
|
|
158
|
+
deleteConnection(configuration: AnyConfigurationModel): any;
|
|
187
159
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebSessionConnectionsMixin = WebSessionConnectionsMixin;
|
|
4
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
4
|
const product_core_1 = require("@jbrowse/product-core");
|
|
6
|
-
|
|
7
|
-
* #stateModel WebSessionConnectionsMixin
|
|
8
|
-
* #category session
|
|
9
|
-
*/
|
|
5
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
10
6
|
function WebSessionConnectionsMixin(pluginManager) {
|
|
11
7
|
return mobx_state_tree_1.types
|
|
12
8
|
.compose('SessionConnectionsManagement', (0, product_core_1.ConnectionManagementSessionMixin)(pluginManager), mobx_state_tree_1.types.model({
|
|
13
|
-
/**
|
|
14
|
-
* #property
|
|
15
|
-
*/
|
|
16
9
|
sessionConnections: mobx_state_tree_1.types.array(pluginManager.pluggableConfigSchemaType('connection')),
|
|
17
10
|
}))
|
|
18
11
|
.actions(s => {
|
|
@@ -24,31 +17,32 @@ function WebSessionConnectionsMixin(pluginManager) {
|
|
|
24
17
|
if (self.adminMode) {
|
|
25
18
|
return superAddConnectionConf(connectionConf);
|
|
26
19
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
else {
|
|
21
|
+
const { connectionId, type } = connectionConf;
|
|
22
|
+
if (!type) {
|
|
23
|
+
throw new Error(`unknown connection type ${type}`);
|
|
24
|
+
}
|
|
25
|
+
const connection = self.sessionTracks.find(c => c.connectionId === connectionId);
|
|
26
|
+
if (connection) {
|
|
27
|
+
return connection;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const length = self.sessionConnections.push(connectionConf);
|
|
31
|
+
return self.sessionConnections[length - 1];
|
|
32
|
+
}
|
|
34
33
|
}
|
|
35
|
-
const length = self.sessionConnections.push(connectionConf);
|
|
36
|
-
return self.sessionConnections[length - 1];
|
|
37
34
|
},
|
|
38
35
|
deleteConnection(configuration) {
|
|
39
|
-
let deletedConn;
|
|
40
36
|
if (self.adminMode) {
|
|
41
|
-
|
|
37
|
+
return superDeleteConnection(configuration);
|
|
42
38
|
}
|
|
43
|
-
|
|
39
|
+
else {
|
|
44
40
|
const { connectionId } = configuration;
|
|
45
41
|
const idx = self.sessionConnections.findIndex(c => c.connectionId === connectionId);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return self.sessionConnections.splice(idx, 1);
|
|
42
|
+
return idx === -1
|
|
43
|
+
? undefined
|
|
44
|
+
: self.sessionConnections.splice(idx, 1);
|
|
50
45
|
}
|
|
51
|
-
return deletedConn;
|
|
52
46
|
},
|
|
53
47
|
};
|
|
54
48
|
});
|