Browse Source

Merge pull request #1193 from doccano/fix/#1188

Add a single file rules
pull/1197/head
Hiroki Nakayama 3 years ago
committed by GitHub
parent
commit
75b6aa5363
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions
  1. 6
      frontend/components/organisms/labels/LabelImportForm.vue
  2. 7
      frontend/rules/index.js

6
frontend/components/organisms/labels/LabelImportForm.vue

@ -32,7 +32,7 @@
<h2>{{ $t('labels.importMessage2') }}</h2>
<v-file-input
v-model="file"
:rules="uploadFileRules($t('rules.uploadFileRules'))"
:rules="uploadSingleFileRules($t('rules.uploadFileRules'))"
accept=".json"
:label="$t('labels.filePlaceholder')"
/>
@ -43,7 +43,7 @@
<script>
import BaseCard from '@/components/molecules/BaseCard'
import { uploadFileRules } from '@/rules/index'
import { uploadSingleFileRules } from '@/rules/index'
export default {
components: {
@ -60,7 +60,7 @@ export default {
return {
valid: false,
file: null,
uploadFileRules,
uploadSingleFileRules,
showError: false
}
},

7
frontend/rules/index.js

@ -61,6 +61,13 @@ export const uploadFileRules = (msg) => {
]
}
export const uploadSingleFileRules = (msg) => {
return [
v => !!v || msg.fileRequired,
v => !v || v.size < 1000000 || msg.fileLessThan1MB
]
}
// Rules for user.
export const passwordRules = (msg) => {
return [

Loading…
Cancel
Save