@apollo-annotation/jbrowse-plugin-apollo 0.1.19 → 0.1.21

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.
@@ -100,7 +100,7 @@ var ExpandMoreIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExpandMoreIcon)
100
100
  var ErrorIcon__default = /*#__PURE__*/_interopDefaultLegacy(ErrorIcon);
101
101
  var SaveIcon__default = /*#__PURE__*/_interopDefaultLegacy(SaveIcon);
102
102
 
103
- var version = "0.1.19";
103
+ var version = "0.1.21";
104
104
 
105
105
  const ApolloConfigSchema = configuration.ConfigurationSchema('ApolloInternetAccount', {
106
106
  baseURL: {
@@ -363,7 +363,7 @@ function AddAssembly({ changeManager, handleClose, session, }) {
363
363
  const fileUploadChangeBase = {
364
364
  assembly: new ObjectID__default["default"]().toHexString(),
365
365
  assemblyName,
366
- fileId,
366
+ fileIds: { fa: fileId },
367
367
  };
368
368
  change =
369
369
  fileType === FileType.GFF3 && importFeatures
@@ -2472,7 +2472,26 @@ function ManageUsers({ changeManager, handleClose, session, }) {
2472
2472
  headerName: 'Role',
2473
2473
  width: 140,
2474
2474
  type: 'singleSelect',
2475
- valueOptions: ['', 'readOnly', 'user', 'admin'],
2475
+ valueOptions: ['readOnly', 'user', 'admin', 'none'],
2476
+ getOptionLabel(value) {
2477
+ switch (value) {
2478
+ case 'readOnly': {
2479
+ return 'Read-only';
2480
+ }
2481
+ case 'user': {
2482
+ return 'User';
2483
+ }
2484
+ case 'admin': {
2485
+ return 'Admin';
2486
+ }
2487
+ case 'none': {
2488
+ return 'None';
2489
+ }
2490
+ default: {
2491
+ return 'unknown';
2492
+ }
2493
+ }
2494
+ },
2476
2495
  editable: true,
2477
2496
  },
2478
2497
  {
@@ -4088,7 +4107,7 @@ class ApolloSequenceAdapter extends BaseAdapter.BaseSequenceAdapter {
4088
4107
  freeResources( /* { region } */) { }
4089
4108
  }
4090
4109
 
4091
- var configSchema$2 = configuration.ConfigurationSchema('ApolloSequenceAdapter', {
4110
+ var configSchema$3 = configuration.ConfigurationSchema('ApolloSequenceAdapter', {
4092
4111
  assemblyId: {
4093
4112
  type: 'string',
4094
4113
  defaultValue: '',
@@ -4098,7 +4117,7 @@ var configSchema$2 = configuration.ConfigurationSchema('ApolloSequenceAdapter',
4098
4117
  function installApolloSequenceAdapter(pluginManager) {
4099
4118
  pluginManager.addAdapterType(() => new AdapterType__default["default"]({
4100
4119
  name: 'ApolloSequenceAdapter',
4101
- configSchema: configSchema$2,
4120
+ configSchema: configSchema$3,
4102
4121
  adapterMetadata: {
4103
4122
  category: undefined,
4104
4123
  hiddenFromGUI: true,
@@ -4692,7 +4711,7 @@ class ApolloTextSearchAdapter extends BaseAdapter.BaseAdapter {
4692
4711
  freeResources() { }
4693
4712
  }
4694
4713
 
4695
- var configSchema$1 = configuration.ConfigurationSchema('ApolloTextSearchAdapter', {
4714
+ var configSchema$2 = configuration.ConfigurationSchema('ApolloTextSearchAdapter', {
4696
4715
  assemblyNames: {
4697
4716
  type: 'stringArray',
4698
4717
  defaultValue: [],
@@ -4715,7 +4734,7 @@ function installApolloTextSearchAdapter(pluginManager) {
4715
4734
  pluginManager.addTextSearchAdapterType(() => new pluggableElementTypes.TextSearchAdapterType({
4716
4735
  name: 'ApolloTextSearchAdapter',
4717
4736
  displayName: 'Apollo text search adapter',
4718
- configSchema: configSchema$1,
4737
+ configSchema: configSchema$2,
4719
4738
  AdapterClass: ApolloTextSearchAdapter,
4720
4739
  description: 'Apollo Text Search adapter',
4721
4740
  }));
@@ -6018,11 +6037,7 @@ const ApolloTranscriptDetailsWidget = mobxReact.observer(function ApolloTranscri
6018
6037
  React__default["default"].createElement(TranscriptSequence, { feature: feature, session: apolloSession, assembly: currentAssembly._id || '', refName: refName })));
6019
6038
  });
6020
6039
 
6021
- function configSchemaFactory$1(pluginManager) {
6022
- const LGVPlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
6023
- const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;
6024
- return configuration.ConfigurationSchema('LinearApolloDisplay', { height: { type: 'number', defaultValue: 500 } }, { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true });
6025
- }
6040
+ const configSchema$1 = configuration.ConfigurationSchema('LinearApolloDisplay', {}, { explicitIdentifier: 'displayId', explicitlyTyped: true });
6026
6041
 
6027
6042
  function handleFeatureTypeChange(changeManager, feature, oldType, newType) {
6028
6043
  const featureId = feature._id;
@@ -6266,56 +6281,16 @@ const NumberCell = mobxReact.observer(function NumberCell({ initialValue, notify
6266
6281
  } })));
6267
6282
  });
6268
6283
 
6269
- // TODO: get this added to LGV runtime exports so we don't have to duplicate it
6270
6284
  const minDisplayHeight = 20;
6271
- /**
6272
- * #stateModel TrackHeightMixin
6273
- * #category display
6274
- */
6275
- const TrackHeightMixin = mobxStateTree.types
6276
- .model({
6277
- heightPreConfig: mobxStateTree.types.maybe(mobxStateTree.types.refinement('displayHeight', mobxStateTree.types.number, (n) => n >= minDisplayHeight)),
6278
- })
6279
- .volatile(() => ({
6280
- scrollTop: 0,
6281
- }))
6282
- .views((self) => ({
6283
- get height() {
6284
- // @ts-expect-error getConf needs self.configuration
6285
- return self.heightPreConfig ?? configuration.getConf(self, 'height');
6286
- },
6287
- }))
6288
- .actions((self) => ({
6289
- setScrollTop(scrollTop) {
6290
- self.scrollTop = scrollTop;
6291
- },
6292
- setHeight(displayHeight) {
6293
- self.heightPreConfig = Math.max(displayHeight, minDisplayHeight);
6294
- return self.height;
6295
- },
6296
- resizeHeight(distance) {
6297
- const oldHeight = self.height;
6298
- const newHeight = this.setHeight(self.height + distance);
6299
- return newHeight - oldHeight;
6300
- },
6301
- }));
6302
-
6303
6285
  function baseModelFactory(_pluginManager, configSchema) {
6304
- // TODO: Restore this when TRackHeightMixin is in LGV runtime exports
6305
- // const LGVPlugin = pluginManager.getPlugin(
6306
- // 'LinearGenomeViewPlugin',
6307
- // ) as LinearGenomeViewPlugin
6308
- // const { TrackHeightMixin } = LGVPlugin.exports
6309
- return mobxStateTree.types
6310
- .compose(pluggableElementTypes.BaseDisplay, TrackHeightMixin)
6311
- .named('BaseLinearApolloDisplay')
6286
+ return pluggableElementTypes.BaseDisplay.named('BaseLinearApolloDisplay')
6312
6287
  .props({
6313
6288
  type: mobxStateTree.types.literal('LinearApolloDisplay'),
6314
6289
  configuration: configuration.ConfigurationReference(configSchema),
6290
+ graphical: true,
6291
+ table: false,
6292
+ heightPreConfig: mobxStateTree.types.maybe(mobxStateTree.types.refinement('displayHeight', mobxStateTree.types.number, (n) => n >= minDisplayHeight)),
6315
6293
  })
6316
- .volatile((self) => ({
6317
- lgv: util.getContainingView(self),
6318
- }))
6319
6294
  .views((self) => {
6320
6295
  const { configuration, renderProps: superRenderProps } = self;
6321
6296
  return {
@@ -6328,6 +6303,26 @@ function baseModelFactory(_pluginManager, configSchema) {
6328
6303
  },
6329
6304
  };
6330
6305
  })
6306
+ .volatile(() => ({
6307
+ scrollTop: 0,
6308
+ }))
6309
+ .views((self) => ({
6310
+ get lgv() {
6311
+ return util.getContainingView(self);
6312
+ },
6313
+ get height() {
6314
+ if (self.heightPreConfig) {
6315
+ return self.heightPreConfig;
6316
+ }
6317
+ if (self.graphical && self.table) {
6318
+ return 500;
6319
+ }
6320
+ if (self.graphical) {
6321
+ return 200;
6322
+ }
6323
+ return 300;
6324
+ },
6325
+ }))
6331
6326
  .views((self) => ({
6332
6327
  get rendererTypeName() {
6333
6328
  return self.configuration.renderer.type;
@@ -6384,6 +6379,73 @@ function baseModelFactory(_pluginManager, configSchema) {
6384
6379
  .apolloSelectedFeature;
6385
6380
  },
6386
6381
  }))
6382
+ .actions((self) => ({
6383
+ setScrollTop(scrollTop) {
6384
+ self.scrollTop = scrollTop;
6385
+ },
6386
+ setHeight(displayHeight) {
6387
+ self.heightPreConfig = Math.max(displayHeight, minDisplayHeight);
6388
+ return self.height;
6389
+ },
6390
+ resizeHeight(distance) {
6391
+ const oldHeight = self.height;
6392
+ const newHeight = this.setHeight(self.height + distance);
6393
+ return newHeight - oldHeight;
6394
+ },
6395
+ showGraphicalOnly() {
6396
+ self.graphical = true;
6397
+ self.table = false;
6398
+ },
6399
+ showTableOnly() {
6400
+ self.graphical = false;
6401
+ self.table = true;
6402
+ },
6403
+ showGraphicalAndTable() {
6404
+ self.graphical = true;
6405
+ self.table = true;
6406
+ },
6407
+ }))
6408
+ .views((self) => {
6409
+ const { trackMenuItems: superTrackMenuItems } = self;
6410
+ return {
6411
+ trackMenuItems() {
6412
+ const { graphical, table } = self;
6413
+ return [
6414
+ ...superTrackMenuItems(),
6415
+ {
6416
+ type: 'subMenu',
6417
+ label: 'Appearance',
6418
+ subMenu: [
6419
+ {
6420
+ label: 'Show graphical display',
6421
+ type: 'radio',
6422
+ checked: graphical && !table,
6423
+ onClick: () => {
6424
+ self.showGraphicalOnly();
6425
+ },
6426
+ },
6427
+ {
6428
+ label: 'Show table display',
6429
+ type: 'radio',
6430
+ checked: table && !graphical,
6431
+ onClick: () => {
6432
+ self.showTableOnly();
6433
+ },
6434
+ },
6435
+ {
6436
+ label: 'Show both graphical and table display',
6437
+ type: 'radio',
6438
+ checked: table && graphical,
6439
+ onClick: () => {
6440
+ self.showGraphicalAndTable();
6441
+ },
6442
+ },
6443
+ ],
6444
+ },
6445
+ ];
6446
+ },
6447
+ };
6448
+ })
6387
6449
  .actions((self) => ({
6388
6450
  setSelectedFeature(feature) {
6389
6451
  self.session.apolloSetSelectedFeature(feature);
@@ -8397,7 +8459,7 @@ const useStyles$1 = mui.makeStyles()((theme) => ({
8397
8459
  const LinearApolloDisplay = mobxReact.observer(function LinearApolloDisplay(props) {
8398
8460
  const theme = material.useTheme();
8399
8461
  const { model } = props;
8400
- const { apolloRowHeight, contextMenuItems: getContextMenuItems, cursor, featuresHeight, isShown, onMouseDown, onMouseLeave, onMouseMove, onMouseUp, regionCannotBeRendered, session, setCanvas, setCollaboratorCanvas, setOverlayCanvas, setSeqTrackCanvas, setSeqTrackOverlayCanvas, setTheme, tabularEditor, } = model;
8462
+ const { apolloRowHeight, contextMenuItems: getContextMenuItems, cursor, featuresHeight, isShown, onMouseDown, onMouseLeave, onMouseMove, onMouseUp, regionCannotBeRendered, session, setCanvas, setCollaboratorCanvas, setOverlayCanvas, setSeqTrackCanvas, setSeqTrackOverlayCanvas, setTheme, } = model;
8401
8463
  const { classes } = useStyles$1();
8402
8464
  const lgv = util.getContainingView(model);
8403
8465
  React.useEffect(() => {
@@ -8454,9 +8516,7 @@ const LinearApolloDisplay = mobxReact.observer(function LinearApolloDisplay(prop
8454
8516
  React__default["default"].createElement("canvas", { ref: async (node) => {
8455
8517
  await Promise.resolve();
8456
8518
  setOverlayCanvas(node);
8457
- }, width: lgv.dynamicBlocks.totalWidthPx, height: featuresHeight, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onClick: () => {
8458
- tabularEditor.showPane();
8459
- }, className: classes.canvas, style: { cursor: cursor ?? 'default' }, "data-testid": "overlayCanvas" }),
8519
+ }, width: lgv.dynamicBlocks.totalWidthPx, height: featuresHeight, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, className: classes.canvas, style: { cursor: cursor ?? 'default' }, "data-testid": "overlayCanvas" }),
8460
8520
  lgv.displayedRegions.flatMap((region, idx) => {
8461
8521
  const assembly = assemblyManager.get(region.assemblyName);
8462
8522
  return [...session.apolloDataStore.checkResults.values()]
@@ -8592,25 +8652,33 @@ const AccordionControl = mobxReact.observer(function AccordionControl({ onClick,
8592
8652
  });
8593
8653
  const DisplayComponent = mobxReact.observer(function DisplayComponent({ model, ...other }) {
8594
8654
  const { classes } = useStyles();
8595
- const { height: overallHeight, isShown, selectedFeature, tabularEditor, toggleShown, } = model;
8596
- const detailsHeight = tabularEditor.isShown ? model.detailsHeight : 0;
8597
- const featureAreaHeight = isShown
8598
- ? overallHeight - detailsHeight - accordionControlHeight * 2
8599
- : 0;
8600
- const onDetailsResize = (delta) => {
8601
- model.setDetailsHeight(model.detailsHeight - delta);
8602
- };
8655
+ const { detailsHeight, graphical, height: overallHeight, isShown, selectedFeature, table, tabularEditor, toggleShown, } = model;
8603
8656
  const canvasScrollContainerRef = React.useRef(null);
8604
8657
  React.useEffect(() => {
8605
8658
  scrollSelectedFeatureIntoView(model, canvasScrollContainerRef);
8606
8659
  }, [model, selectedFeature]);
8660
+ const onDetailsResize = (delta) => {
8661
+ model.setDetailsHeight(detailsHeight - delta);
8662
+ };
8663
+ if (graphical && table) {
8664
+ const tabularHeight = tabularEditor.isShown ? detailsHeight : 0;
8665
+ const featureAreaHeight = isShown
8666
+ ? overallHeight - detailsHeight - accordionControlHeight * 2
8667
+ : 0;
8668
+ return (React__default["default"].createElement("div", { style: { height: overallHeight } },
8669
+ React__default["default"].createElement(AccordionControl, { open: isShown, title: "Graphical", onClick: toggleShown }),
8670
+ React__default["default"].createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: featureAreaHeight } },
8671
+ React__default["default"].createElement(LinearApolloDisplay, { model: model, ...other })),
8672
+ React__default["default"].createElement(AccordionControl, { title: "Table", open: tabularEditor.isShown, onClick: tabularEditor.togglePane, onResize: onDetailsResize }),
8673
+ React__default["default"].createElement("div", { className: classes.details, style: { height: tabularHeight } },
8674
+ React__default["default"].createElement(TabularEditorPane, { model: model }))));
8675
+ }
8676
+ if (graphical) {
8677
+ return (React__default["default"].createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: overallHeight } },
8678
+ React__default["default"].createElement(LinearApolloDisplay, { model: model, ...other })));
8679
+ }
8607
8680
  return (React__default["default"].createElement("div", { className: classes.details, style: { height: overallHeight } },
8608
- React__default["default"].createElement(AccordionControl, { open: isShown, title: "Graphical", onClick: toggleShown }),
8609
- React__default["default"].createElement("div", { className: classes.shading, ref: canvasScrollContainerRef, style: { height: featureAreaHeight } },
8610
- React__default["default"].createElement(LinearApolloDisplay, { model: model, ...other })),
8611
- React__default["default"].createElement(AccordionControl, { title: "Table", open: tabularEditor.isShown, onClick: tabularEditor.togglePane, onResize: onDetailsResize }),
8612
- React__default["default"].createElement("div", { style: { height: detailsHeight } },
8613
- React__default["default"].createElement(TabularEditorPane, { model: model }))));
8681
+ React__default["default"].createElement(TabularEditorPane, { model: model })));
8614
8682
  });
8615
8683
  function makeSixFrameDisplayComponent(pluginManager) {
8616
8684
  const LGVPlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
@@ -9731,9 +9799,9 @@ function extendSession(pluginManager, sessionModel) {
9731
9799
  if (Object.keys(filteredConfig).length === 0) {
9732
9800
  filteredConfig = undefined;
9733
9801
  }
9734
- let trackConfigSnapshot = mobxStateTree.getSnapshot(conf);
9802
+ const trackConfigSnapshot = mobxStateTree.getSnapshot(conf);
9735
9803
  const newTrackId = trackId.slice(0, trackId.length - sessionTrackIdentifier.length);
9736
- trackConfigSnapshot = {
9804
+ const newTrackConfigSnapshot = {
9737
9805
  ...trackConfigSnapshot,
9738
9806
  trackId: newTrackId,
9739
9807
  };
@@ -9748,7 +9816,7 @@ function extendSession(pluginManager, sessionModel) {
9748
9816
  ...filteredConfig,
9749
9817
  tracks: filteredConfig?.tracks && [
9750
9818
  ...filteredConfig.tracks,
9751
- trackConfigSnapshot,
9819
+ newTrackConfigSnapshot,
9752
9820
  ],
9753
9821
  },
9754
9822
  });
@@ -9759,6 +9827,10 @@ function extendSession(pluginManager, sessionModel) {
9759
9827
  const { notify } = self;
9760
9828
  notify('Track added', 'success');
9761
9829
  }
9830
+ // @ts-expect-error This method is missing in the JB types
9831
+ self.deleteTrackConf(conf);
9832
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9833
+ jbrowse.addTrackConf(newTrackConfigSnapshot);
9762
9834
  },
9763
9835
  icon: SaveIcon__default["default"],
9764
9836
  },
@@ -9795,6 +9867,10 @@ function extendSession(pluginManager, sessionModel) {
9795
9867
  const { notify } = self;
9796
9868
  notify('Track removed', 'success');
9797
9869
  }
9870
+ // @ts-expect-error This method is missing in the JB types
9871
+ self.deleteTrackConf(conf);
9872
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9873
+ jbrowse.deleteTrackConf(conf);
9798
9874
  },
9799
9875
  icon: SaveIcon__default["default"],
9800
9876
  },
@@ -10322,7 +10398,7 @@ class ApolloPlugin extends Plugin__default["default"] {
10322
10398
  });
10323
10399
  });
10324
10400
  pluginManager.addDisplayType(() => {
10325
- const configSchema = configSchemaFactory$1(pluginManager);
10401
+ const configSchema = configSchema$1;
10326
10402
  return new pluggableElementTypes.DisplayType({
10327
10403
  name: 'LinearApolloDisplay',
10328
10404
  configSchema,