Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Website
Commits
21d81d1a
Commit
21d81d1a
authored
1 year ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
Add validation to pasted sequences
parent
09f0001c
No related branches found
No related tags found
1 merge request
!21
Copy paste sequence
Pipeline
#128314
passed
1 year ago
Stage: delete-release
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/components/SubmitAnalysis.vue
+34
-40
34 additions, 40 deletions
frontend/components/SubmitAnalysis.vue
frontend/package-lock.json
+3010
-5352
3010 additions, 5352 deletions
frontend/package-lock.json
frontend/package.json
+1
-1
1 addition, 1 deletion
frontend/package.json
with
3045 additions
and
5393 deletions
frontend/components/SubmitAnalysis.vue
+
34
−
40
View file @
21d81d1a
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
"
vue
"
;
import
{
useField
,
useForm
}
from
"
vee-validate
"
;
const
router
=
useRouter
();
// import { ref } from "vue";
import
{
useField
,
useForm
}
from
'
vee-validate
'
import
{
useCsrfToken
}
from
"
@/composables/useCsrfToken
"
const
uppyComponentRef
=
ref
(
null
)
const
tab
=
ref
<
"
local
"
|
"
paste
"
>
(
"
local
"
)
const
pasteSequence
=
ref
(
null
)
import
{
useCsrfToken
}
from
"
@/composables/useCsrfToken
"
const
maxSequenceLength
=
ref
(
10000
)
const
valid
=
ref
<
boolean
>
(
false
)
const
{
csrfToken
}
=
await
useCsrfToken
()
const
sequenceRules
=
ref
([
value
=>
{
if
(
value
)
return
true
return
'
Sequence is required.
'
},
])
const
{
meta
,
handleSubmit
}
=
useForm
({
const
{
handleSubmit
}
=
useForm
({
validationSchema
:
{
files
(
value
)
{
if
(
value
?.
length
>
0
)
return
true
// files(value) {
// if (value?.length > 0) return true
// return "You need to pass at least one file"
// },
sequence
(
value
:
string
)
{
const
seqLength
=
value
?.
length
if
(
seqLength
<=
maxSequenceLength
.
value
)
return
true
return
`Sequences needs to be less than
${
maxSequenceLength
.
value
}
characters.`
}
}
});
const
files
=
useField
(
"
files
"
);
const
files
=
useField
(
"
files
"
)
const
{
value
:
sequence
,
errorMessage
:
sequenceErrorMessage
}
=
useField
(
"
sequence
"
);
const
{
data
,
error
}
=
await
useAPI
<
{
is_online
:
boolean
}
>
(
"
/analysis/is-galaxy-online
"
,
{
...
...
@@ -38,8 +41,6 @@ if (data.value !== null && !data.value.is_online) {
const
loading
=
ref
(
false
)
async
function
addExample
()
{
loading
.
value
=
true
try
{
await
$fetch
(
'
/dfapi/analysis/add-example
'
,
{
method
:
'
POST
'
,
...
...
@@ -55,13 +56,12 @@ async function addExample() {
}
async
function
submit
(
event
)
{
const
submit
=
handleSubmit
(
async
(
values
)
=>
{
loading
.
value
=
true
const
formData
=
new
FormData
();
const
blob
=
new
Blob
([
pasteS
equence
.
value
],
{
type
:
'
text/plain
'
})
const
blob
=
new
Blob
([
toValue
(
s
equence
)
],
{
type
:
'
text/plain
'
})
formData
.
append
(
'
genomefile
'
,
blob
,
'
pasted-sequence.fasta
'
)
try
{
await
$fetch
(
'
/dfapi/analysis/add
'
,
{
method
:
'
POST
'
,
...
...
@@ -76,9 +76,7 @@ async function submit(event) {
}
}
})
</
script
>
<
template
>
<v-card
flat
color=
"transparent"
>
...
...
@@ -97,29 +95,25 @@ async function submit(event) {
<UppyGenomeUpload
v-model=
"files.value.value"
ref=
"uppyComponentRef"
class=
"mb-2"
/>
</v-window-item>
<v-window-item
value=
"paste"
>
<v-form
v-model=
"valid"
validate-on=
"submit lazy"
@
submit.prevent=
"submit"
>
<v-textarea
v-model=
"
pasteS
equence"
:
rules=
"sequenceRules"
required
label=
"Fasta s
equence
s
"
variant=
"filled"
auto-grow
></v-textarea>
<v-form
@
submit.prevent=
"submit"
>
<v-textarea
v-model=
"
s
equence"
:
error-messages=
"sequenceErrorMessage"
:count=
"maxS
equence
Length
"
label=
"Fasta sequences"
variant=
"filled"
auto-grow
></v-textarea>
<v-btn
type=
"submit"
:loading=
"loading"
>
Submit
</v-btn>
</v-form>
</v-window-item>
<v-window-item
value=
"example"
>
<v-card
flat
color=
"transparent"
>
<v-form>
<v-card-text>
You can try an example with Escherichia coli str. K-12 substr. MG1655 proteins downloaded from
<a
target=
"_blank"
href=
"https://www.ncbi.nlm.nih.gov/datasets/genome/GCF_000005845.2"
>
GCF_000005845.2
</a>
</v-card-text>
<v-card-actions>
<v-btn
variant=
"elevated"
density=
"default"
size=
"default"
:slim=
"false"
rounded=
"xl"
color=
"primary"
:loading=
"loading"
@
click=
"addExample()"
>
Submit
</v-btn>
</v-card-actions>
</v-form>
<v-card-text>
You can try an example with Escherichia coli str. K-12 substr. MG1655 proteins downloaded from
<a
target=
"_blank"
href=
"https://www.ncbi.nlm.nih.gov/datasets/genome/GCF_000005845.2"
>
GCF_000005845.2
</a>
</v-card-text>
<v-card-actions>
<v-btn
variant=
"elevated"
density=
"default"
size=
"default"
:slim=
"false"
rounded=
"xl"
color=
"primary"
:loading=
"loading"
@
click=
"addExample()"
>
Submit
</v-btn>
</v-card-actions>
</v-card>
</v-window-item>
</v-window>
</v-card-text>
</v-card>
...
...
This diff is collapsed.
Click to expand it.
frontend/package-lock.json
+
3010
−
5352
View file @
21d81d1a
This diff is collapsed.
Click to expand it.
frontend/package.json
+
1
−
1
View file @
21d81d1a
...
...
@@ -37,6 +37,6 @@
"@vue-flow/minimap"
:
"^1.1.1"
,
"@vueuse/core"
:
"^10.7.2"
,
"d3"
:
"^7.8.5"
,
"vee-validate"
:
"^4.12.
4
"
"vee-validate"
:
"^4.12.
6
"
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment