fix(project): don't allow archival or deletion of default projects in UI
This commit is contained in:
parent
3d39fc3960
commit
8a82093233
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<BaseButton class="dropdown-item">
|
<BaseButton class="dropdown-item" :class="{'is-disabled': disabled}">
|
||||||
<span
|
<span
|
||||||
v-if="icon"
|
v-if="icon"
|
||||||
class="icon is-small"
|
class="icon is-small"
|
||||||
@ -21,6 +21,7 @@ import type {IconProp} from '@fortawesome/fontawesome-svg-core'
|
|||||||
export interface DropDownItemProps extends /* @vue-ignore */ BaseButtonProps {
|
export interface DropDownItemProps extends /* @vue-ignore */ BaseButtonProps {
|
||||||
icon?: IconProp,
|
icon?: IconProp,
|
||||||
iconClass?: object | string,
|
iconClass?: object | string,
|
||||||
|
disabled?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
defineProps<DropDownItemProps>()
|
defineProps<DropDownItemProps>()
|
||||||
|
@ -69,6 +69,8 @@
|
|||||||
<DropdownItem
|
<DropdownItem
|
||||||
:to="{ name: 'project.settings.archive', params: { projectId: project.id } }"
|
:to="{ name: 'project.settings.archive', params: { projectId: project.id } }"
|
||||||
icon="archive"
|
icon="archive"
|
||||||
|
:disabled="isDefaultProject"
|
||||||
|
v-tooltip="isDefaultProject ? $t('menu.cantArchiveIsDefault') : ''"
|
||||||
>
|
>
|
||||||
{{ $t('menu.archive') }}
|
{{ $t('menu.archive') }}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
@ -98,6 +100,8 @@
|
|||||||
:to="{ name: 'project.settings.delete', params: { projectId: project.id } }"
|
:to="{ name: 'project.settings.delete', params: { projectId: project.id } }"
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="has-text-danger"
|
class="has-text-danger"
|
||||||
|
:disabled="isDefaultProject"
|
||||||
|
v-tooltip="isDefaultProject ? $t('menu.cantDeleteIsDefault') : ''"
|
||||||
>
|
>
|
||||||
{{ $t('menu.delete') }}
|
{{ $t('menu.delete') }}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
@ -106,7 +110,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, watchEffect, type PropType} from 'vue'
|
import {computed, type PropType, ref, watchEffect} from 'vue'
|
||||||
|
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
import Dropdown from '@/components/misc/dropdown.vue'
|
import Dropdown from '@/components/misc/dropdown.vue'
|
||||||
@ -118,6 +122,7 @@ import type {ISubscription} from '@/modelTypes/ISubscription'
|
|||||||
import {isSavedFilter} from '@/services/savedFilter'
|
import {isSavedFilter} from '@/services/savedFilter'
|
||||||
import {useConfigStore} from '@/stores/config'
|
import {useConfigStore} from '@/stores/config'
|
||||||
import {useProjectStore} from '@/stores/projects'
|
import {useProjectStore} from '@/stores/projects'
|
||||||
|
import {useAuthStore} from '@/stores/auth'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
project: {
|
project: {
|
||||||
@ -146,4 +151,7 @@ function setSubscriptionInStore(sub: ISubscription) {
|
|||||||
}
|
}
|
||||||
projectStore.setProject(updatedProject)
|
projectStore.setProject(updatedProject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const isDefaultProject = computed(() => props.project?.id === authStore.settings.defaultProjectId)
|
||||||
</script>
|
</script>
|
@ -978,7 +978,9 @@
|
|||||||
"setBackground": "Set background",
|
"setBackground": "Set background",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"newProject": "New project",
|
"newProject": "New project",
|
||||||
"createProject": "Create project"
|
"createProject": "Create project",
|
||||||
|
"cantArchiveIsDefault": "You cannot archive this because it is your default project.",
|
||||||
|
"cantDeleteIsDefault": "You cannot delete this because it is your default project."
|
||||||
},
|
},
|
||||||
"apiConfig": {
|
"apiConfig": {
|
||||||
"url": "Vikunja URL",
|
"url": "Vikunja URL",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user