fix: Remove savePath rule when creating category (#970)

This commit is contained in:
Rémi Marseault 2023-07-17 10:13:13 +02:00 committed by GitHub
parent 10ada6ed23
commit 9f59632d91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 19 additions and 31 deletions

View file

@ -16,15 +16,15 @@
:autofocus="!hasInitialCategory" :autofocus="!hasInitialCategory"
:disabled="hasInitialCategory" :disabled="hasInitialCategory"
/> />
<v-text-field v-model="category.savePath" :rules="pathRules" :label="$t('path')" required :autofocus="hasInitialCategory" /> <v-text-field v-model="category.savePath" :label="$t('path')" :autofocus="hasInitialCategory" />
</v-container> </v-container>
</v-card-text> </v-card-text>
<v-divider /> <v-divider />
<v-card-actions class="justify-end"> <v-card-actions class="justify-end">
<v-btn v-if="!hasInitialCategory" class="accent white--text elevation-0 px-4" @click="create" :disabled="!isValid"> <v-btn v-if="!hasInitialCategory" class="accent white--text elevation-0 px-4" :disabled="!isValid" @click="create">
{{ $t('create') }} {{ $t('create') }}
</v-btn> </v-btn>
<v-btn v-else class="accent white--text elevation-0 px-4" @click="edit" :disabled="!isValid"> <v-btn v-else class="accent white--text elevation-0 px-4" :disabled="!isValid" @click="edit">
{{ $t('edit') }} {{ $t('edit') }}
</v-btn> </v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="cancel"> <v-btn class="error white--text elevation-0 px-4" @click="cancel">
@ -62,11 +62,8 @@ export default {
nameRules() { nameRules() {
return [v => !!v || this.$t('modals.newCategory.tipOnNoName')] return [v => !!v || this.$t('modals.newCategory.tipOnNoName')]
}, },
pathRules() {
return [v => !!v || this.$t('modals.newCategory.tipOnNoPath')]
},
isValid() { isValid() {
return !!this.category.name && !!this.category.savePath return !!this.category.name
} }
}, },
created() { created() {

View file

@ -31,7 +31,7 @@ import qbit from '@/services/qbit'
import { Modal } from '@/mixins' import { Modal } from '@/mixins'
export default defineComponent({ export default defineComponent({
name: 'CreateTagDialog', name: 'CreateNewTagDialog',
mixins: [Modal], mixins: [Modal],
data() { data() {
return { return {

View file

@ -1,4 +1,4 @@
import CreateNewTagDialog from './CreateTagDialog.vue' import CreateNewTagDialog from './CreateNewTagDialog.vue'
import CreateNewCategoryDialog from './CreateCategoryDialog.vue' import CreateNewCategoryDialog from './CreateNewCategoryDialog.vue'
export { CreateNewTagDialog, CreateNewCategoryDialog } export { CreateNewTagDialog, CreateNewCategoryDialog }

View file

@ -90,10 +90,10 @@ export default {
this.$store.commit('FETCH_TAGS') this.$store.commit('FETCH_TAGS')
}, },
createTag() { createTag() {
this.createModal('CreateTagDialog') this.createModal('CreateNewTagDialog')
}, },
createCategory() { createCategory() {
this.createModal('CreateCategoryDialog') this.createModal('CreateNewCategoryDialog')
}, },
async deleteCategory(category) { async deleteCategory(category) {
await qbit.deleteCategory([category.name]) await qbit.deleteCategory([category.name])
@ -104,7 +104,7 @@ export default {
this.$store.commit('FETCH_TAGS') this.$store.commit('FETCH_TAGS')
}, },
editCategory(cat) { editCategory(cat) {
this.createModal('CreateCategoryDialog', { initialCategory: cat }) this.createModal('CreateNewCategoryDialog', { initialCategory: cat })
} }
} }
} }

View file

@ -643,8 +643,7 @@
"newCategory": { "newCategory": {
"categoryName": "Category name", "categoryName": "Category name",
"Path": "Path", "Path": "Path",
"tipOnNoName": "Category name is required", "tipOnNoName": "Category name is required"
"tipOnNoPath": "Path is required"
}, },
"newTag": { "newTag": {
"createNewTag": "Create New Tag", "createNewTag": "Create New Tag",

View file

@ -351,8 +351,7 @@
"newCategory": { "newCategory": {
"categoryName": "Nom de la catégorie", "categoryName": "Nom de la catégorie",
"Path": "Chemin d'accès", "Path": "Chemin d'accès",
"tipOnNoName": "Le nom de la catégorie est obligatoire", "tipOnNoName": "Le nom de la catégorie est obligatoire"
"tipOnNoPath": "Le chemin d'accès est obligatoire"
}, },
"newTag": { "newTag": {
"createNewTag": "Créer un nouveau tag", "createNewTag": "Créer un nouveau tag",

View file

@ -271,8 +271,7 @@
"newCategory": { "newCategory": {
"categoryName": "Nama kategori", "categoryName": "Nama kategori",
"Path": "Path", "Path": "Path",
"tipOnNoName": "Nama kategori diperlukan", "tipOnNoName": "Nama kategori diperlukan"
"tipOnNoPath": "Path is required"
}, },
"newTag": { "newTag": {
"createNewTag": "Buat Tag Baru", "createNewTag": "Buat Tag Baru",

View file

@ -266,8 +266,7 @@
"newCategory": { "newCategory": {
"categoryName": "カテゴリ名", "categoryName": "カテゴリ名",
"Path": "パス", "Path": "パス",
"tipOnNoName": "カテゴリ名が必要です", "tipOnNoName": "カテゴリ名が必要です"
"tipOnNoPath": "パスが必要です"
}, },
"newTag": { "newTag": {
"createNewTag": "タグを作成", "createNewTag": "タグを作成",

View file

@ -608,8 +608,7 @@
"newCategory": { "newCategory": {
"categoryName": "Название категории", "categoryName": "Название категории",
"Path": "Путь", "Path": "Путь",
"tipOnNoName": "Требуется название категории", "tipOnNoName": "Требуется название категории"
"tipOnNoPath": "Нужный путь"
}, },
"newTag": { "newTag": {
"createNewTag": "Создать новый тэг", "createNewTag": "Создать новый тэг",

View file

@ -608,8 +608,7 @@
"newCategory": { "newCategory": {
"categoryName": "Назва категорії", "categoryName": "Назва категорії",
"Path": "Шлях", "Path": "Шлях",
"tipOnNoName": "Вкажіть назву категорії", "tipOnNoName": "Вкажіть назву категорії"
"tipOnNoPath": "Вкажіть шлях до теки"
}, },
"newTag": { "newTag": {
"createNewTag": "Створити нову мітку", "createNewTag": "Створити нову мітку",

View file

@ -334,8 +334,7 @@
"newCategory": { "newCategory": {
"categoryName": "Tên danh mục", "categoryName": "Tên danh mục",
"Path": "Nơi lưu", "Path": "Nơi lưu",
"tipOnNoName": "Tên danh mục là bắt buộc", "tipOnNoName": "Tên danh mục là bắt buộc"
"tipOnNoPath": "Nơi lưu là bắt buộc"
}, },
"newTag": { "newTag": {
"createNewTag": "Tạo thẻ mới", "createNewTag": "Tạo thẻ mới",

View file

@ -637,8 +637,7 @@
"newCategory": { "newCategory": {
"categoryName": "分类名称", "categoryName": "分类名称",
"Path": "路径", "Path": "路径",
"tipOnNoName": "分类名称是必须的", "tipOnNoName": "分类名称是必须的"
"tipOnNoPath": "路径是必须的"
}, },
"newTag": { "newTag": {
"createNewTag": "新建标签", "createNewTag": "新建标签",

View file

@ -643,8 +643,7 @@
"newCategory": { "newCategory": {
"categoryName": "分類名稱", "categoryName": "分類名稱",
"Path": "路徑", "Path": "路徑",
"tipOnNoName": "必須填寫分類名稱", "tipOnNoName": "必須填寫分類名稱"
"tipOnNoPath": "必須填寫路徑"
}, },
"newTag": { "newTag": {
"createNewTag": "新增標籤", "createNewTag": "新增標籤",