-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1925 from sanger/develop
Develop to master
- Loading branch information
Showing
7 changed files
with
70 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v20.16.0 | ||
v20.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
10.7.1 | ||
10.7.2 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,83 @@ | ||
<template> | ||
<traction-select | ||
id="data-type" | ||
:model-value="value" | ||
data-attribute="data-type-list" | ||
:options="dataTypes" | ||
@update:model-value="handleInput" | ||
></traction-select> | ||
<traction-field-group label="Data Type" label-for="data-type" layout="spacious"> | ||
<traction-select | ||
id="data-type" | ||
:model-value="dataType" | ||
data-attribute="data-type-list" | ||
:options="dataTypes" | ||
@update:model-value="handleInput" | ||
></traction-select | ||
></traction-field-group> | ||
</template> | ||
|
||
<script> | ||
import useSWRV from 'swrv' | ||
import { filterByAttribute, mapAttribute } from '@/api/JsonApi' | ||
const encode = (value) => (value === undefined ? 'basecalls and raw data' : value) | ||
const decode = (value) => (value === '' ? null : value) | ||
export default { | ||
name: 'DataTypeSelect', | ||
props: { | ||
pipeline: { | ||
// Filter to only list data_types for a given pipeline, leave null | ||
// to apply no filters | ||
type: String, | ||
required: false, | ||
default: null, | ||
}, | ||
value: { | ||
// The data type, we use value to allow us to simply bind it with v-model | ||
modelValue: { | ||
type: String, | ||
default: undefined, | ||
}, | ||
}, | ||
emits: ['input'], | ||
emits: ['update:modelValue'], | ||
setup() { | ||
const baseURL = import.meta.env.VITE_TRACTION_BASE_URL | ||
const { data: remoteDataTypes } = useSWRV( | ||
`${baseURL}/v1/data_types?fields[data_types]=name,pipeline`, | ||
) | ||
return { remoteDataTypes } | ||
}, | ||
data() { | ||
return { | ||
dataType: encode(this.modelValue), | ||
} | ||
}, | ||
computed: { | ||
filters: ({ pipeline }) => (pipeline ? { pipeline } : {}), | ||
// Same approach as src/components/shared/LibraryTypeSelect.vue | ||
filters: ({ pipeline }) => (pipeline ? { pipeline, name: 'basecalls and raw data' } : {}), | ||
filteredDataTypes() { | ||
return filterByAttribute(this.remoteDataTypes?.data || [], this.filters) | ||
}, | ||
emptyOption: ({ allowNone }) => (allowNone ? [{ value: '', text: 'None' }] : []), | ||
dataTypes() { | ||
return mapAttribute(this.filteredDataTypes, 'name') | ||
const dataTypesOptions = mapAttribute(this.filteredDataTypes, 'name').map((val) => { | ||
return { | ||
text: val, | ||
value: val, | ||
} | ||
}) | ||
return [...dataTypesOptions, ...this.emptyOption] | ||
}, | ||
}, | ||
watch: { | ||
remoteDataTypes: { | ||
handler() { | ||
this.setDataType() | ||
}, | ||
immediate: true, | ||
}, | ||
}, | ||
methods: { | ||
handleInput(input) { | ||
this.$emit('input', input) | ||
this.$emit('update:modelValue', decode(input)) | ||
}, | ||
setDataType() { | ||
if (this.dataTypes.length === 1) { | ||
this.dataType = encode(this.dataTypes[0].value) | ||
this.$emit('update:modelValue', this.dataTypes[0].value) | ||
} | ||
}, | ||
}, | ||
} | ||
</script> | ||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters