Browse Source

Add a single file rules

pull/1193/head
Hironsan 3 years ago
parent
commit
ff9e229262
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