Skip to content

Commit

Permalink
Less mods
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 3, 2025
1 parent e305909 commit 5efd930
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
- name: Use Node.js 22.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 22.x
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Get latest JBrowse
Expand Down
28 changes: 20 additions & 8 deletions src/MultilevelLinearView/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
addDisposer,
cast,
Expand All @@ -7,13 +6,15 @@ import {
types,
Instance,
SnapshotIn,
getEnv,
} from 'mobx-state-tree'
import FolderOpenIcon from '@mui/icons-material/FolderOpen'
import SwapVertIcon from '@mui/icons-material/SwapVert'
import MenuIcon from '@mui/icons-material/Menu'
import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter'
import LinkIcon from '@mui/icons-material/Link'
import LinkOffIcon from '@mui/icons-material/LinkOff'
/* eslint-disable @typescript-eslint/no-explicit-any */
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel'
import { MenuItem } from '@jbrowse/core/ui'
import { getSession } from '@jbrowse/core/util'
Expand Down Expand Up @@ -61,13 +62,9 @@ export default function stateModelFactory(pluginManager: PluginManager) {
},

get refNames() {
return [
...new Set(
self.views
.map((v) => v.staticBlocks.map((m: any) => m.refName))
.flat(),
),
]
return self.views.map((v) => [
...new Set(v.staticBlocks.map((m: any) => m.refName)),
])
},

get assemblyNames() {
Expand Down Expand Up @@ -409,6 +406,21 @@ export default function stateModelFactory(pluginManager: PluginManager) {
self.views = cast([])
self.linkViews = false
},

removeView(target: any) {
const session = getSession(self)
const pluginManager = getEnv(session)
// cannot remove the anchor or the overview -- needs to have minimum these two views
if (target.isAnchor === false && target.isOverview === false) {
self.views.remove(target)
session.notify(`A view has been closed`, 'info', {
name: 'undo' as any,
onClick: () => {
pluginManager.rootModel.history.undo()
},
})
}
},
}))
.actions((self) => ({
async addView(isAbove: boolean, neighbour: any) {
Expand Down

0 comments on commit 5efd930

Please sign in to comment.