File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
core/pluggableElementTypes/models Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
import CascadingMenu from '@jbrowse/core/ui/CascadingMenu'
2
2
import { getSession } from '@jbrowse/core/util'
3
+ import ContentCopyIcon from '@mui/icons-material/ContentCopy'
3
4
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
4
5
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'
5
6
import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown'
@@ -12,6 +13,7 @@ import {
12
13
usePopupState ,
13
14
} from 'material-ui-popup-state/hooks'
14
15
import { observer } from 'mobx-react'
16
+ import { getSnapshot } from 'mobx-state-tree'
15
17
16
18
import type { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'
17
19
import type { AbstractSessionModel } from '@jbrowse/core/util'
@@ -108,6 +110,17 @@ const ViewMenu = observer(function ({
108
110
} ,
109
111
]
110
112
: [ ] ) ,
113
+ {
114
+ label : 'Copy view' ,
115
+ icon : ContentCopyIcon ,
116
+ onClick : ( ) => {
117
+ const { id, ...rest } = getSnapshot ( model )
118
+ session . addView ( model . type , rest )
119
+ } ,
120
+ } ,
121
+ {
122
+ type : 'divider' ,
123
+ } ,
111
124
...model . menuItems ( ) ,
112
125
] }
113
126
popupState = { popupState }
Original file line number Diff line number Diff line change @@ -51,9 +51,7 @@ const ViewPanel = observer(function ({
51
51
< ReactComponent model = { view } session = { session } />
52
52
</ Suspense >
53
53
</ ErrorBoundary >
54
- ) : (
55
- false
56
- ) }
54
+ ) : null }
57
55
</ ViewContainer >
58
56
)
59
57
} )
Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ const BaseViewModel = types
74
74
75
75
export default BaseViewModel
76
76
77
- export type IBaseViewModel = Instance < typeof BaseViewModel >
77
+ // the base view does not have type but any derived type needs to add type, so
78
+ // just add it here
79
+ export type IBaseViewModel = Instance < typeof BaseViewModel > & { type : string }
78
80
79
81
export const BaseViewModelWithDisplayedRegions = BaseViewModel . props ( {
80
82
displayedRegions : types . array ( Region ) ,
You can’t perform that action at this time.
0 commit comments