Skip to content

Commit

Permalink
[desktop beta] Make the default session name get a timestamp and make
Browse files Browse the repository at this point in the history
filter not shown by default
  • Loading branch information
cmdcolin committed Aug 30, 2021
1 parent 3c45454 commit 96d05e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import {
Button,
Checkbox,
FormControlLabel,
IconButton,
TextField,
Tooltip,
Typography,
makeStyles,
} from '@material-ui/core'
import PluginManager from '@jbrowse/core/PluginManager'
import SearchIcon from '@material-ui/icons/Search'
import { createPluginManager } from './util'
import preloadedConfigs from './preloadedConfigs'
import deepmerge from 'deepmerge'
Expand Down Expand Up @@ -37,22 +40,31 @@ function PreloadedDatasetSelector({
const classes = useStyles()
const [selected, setSelected] = useState({} as Record<string, boolean>)
const [search, setSearch] = useState('')
const [filterShown, setFilterShown] = useState(false)

return (
<div className={classes.container}>
<div style={{ display: 'flex' }}>
<Typography className={classes.header}>
Select assembly (or multiple assemblies) for your session
<IconButton onClick={() => setFilterShown(!filterShown)}>
<Tooltip title="Show filter?">
<SearchIcon />
</Tooltip>
</IconButton>
</Typography>
<Button
className={classes.button}
onClick={async () => {
const pm = await createPluginManager(
deepmerge.all(
// @ts-ignore
Object.keys(selected).map(name => preloadedConfigs[name]),
),
const config = deepmerge.all(
// @ts-ignore
Object.keys(selected).map(name => preloadedConfigs[name]),
)

// @ts-ignore
config.defaultSession.name +=
' ' + new Date().toLocaleString('en-US')
const pm = await createPluginManager(config)
setPluginManager(pm)
}}
variant="contained"
Expand All @@ -61,11 +73,13 @@ function PreloadedDatasetSelector({
Go
</Button>
</div>
<TextField
label="Filter datasets"
value={search}
onChange={event => setSearch(event.target.value as string)}
/>
{filterShown ? (
<TextField
label="Filter datasets"
value={search}
onChange={event => setSearch(event.target.value as string)}
/>
) : null}
<br />
{Object.keys(preloadedConfigs)
.filter(name => (search ? name.match(new RegExp(search, 'i')) : true))
Expand Down
4 changes: 3 additions & 1 deletion products/jbrowse-desktop/src/StartScreen/preloadedConfigs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
const preloadedConfigs = {
hg38: {
assemblies: [
{
Expand Down Expand Up @@ -423,3 +423,5 @@ export default {
],
},
}

export default preloadedConfigs

0 comments on commit 96d05e6

Please sign in to comment.