Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed May 17, 2021
1 parent 0c14276 commit c1d365a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function StatusMessage({
function UnknownAdapterPrompt({ model }: { model: AddTrackModel }) {
const classes = useStyles()
const session = getSession(model)
const { trackAdapterHint } = model
const { adapterHint } = model
return (
<>
<Typography className={classes.spacing}>
Expand All @@ -69,13 +69,13 @@ function UnknownAdapterPrompt({ model }: { model: AddTrackModel }) {
</Typography>
<TextField
className={classes.spacing}
value={trackAdapterHint}
value={adapterHint}
label="adapterType"
helperText="An adapter type"
select
fullWidth
onChange={event => {
model.setTrackAdapterHint(event.target.value)
model.setAdapterHint(event.target.value)
}}
SelectProps={{
// @ts-ignore
Expand All @@ -84,19 +84,13 @@ function UnknownAdapterPrompt({ model }: { model: AddTrackModel }) {
>
{getEnv(session)
.pluginManager.getElementTypesInGroup('adapter')
.map(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(installedAdapterType: any) =>
// Exclude SNPCoverageAdapter from primary adapter user selection
installedAdapterType.name !== 'SNPCoverageAdapter' && (
<MenuItem
key={installedAdapterType.name}
value={installedAdapterType.name}
>
{installedAdapterType.name}
</MenuItem>
),
)}
// Exclude SNPCoverageAdapter from primary adapter user selection
.filter((elt: { name: string }) => elt.name !== 'SNPCoverageAdapter')
.map((elt: { name: string }) => (
<MenuItem key={elt.name} value={elt.name}>
{elt.name}
</MenuItem>
))}
</TextField>
</>
)
Expand Down Expand Up @@ -133,7 +127,7 @@ function ConfirmTrack({ model }: { model: AddTrackModel }) {
)
}
if (trackAdapter?.type === UNKNOWN) {
return <UnknownAdapterPrompt model={model} trackAdapter={trackAdapter} />
return <UnknownAdapterPrompt model={model} />
}

if (!trackAdapter?.type) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/data-management/src/AddTrackWidget/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export default function f(pluginManager: PluginManager) {
altTrackName: '',
altTrackType: '',

adapterHint: '' as any,
adapterHint: '',
}))
.actions(self => ({
setTrackAdapterHint(obj: any) {
setAdapterHint(obj: string) {
self.adapterHint = obj
},
setTrackSource(str: string) {
Expand Down

0 comments on commit c1d365a

Please sign in to comment.