You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

  1. <template>
  2. <base-card
  3. :title="$t('overview.deleteProjectTitle')"
  4. :agree-text="$t('generic.yes')"
  5. :cancel-text="$t('generic.cancel')"
  6. @agree="$emit('remove')"
  7. @cancel="$emit('cancel')"
  8. >
  9. <template #content>
  10. {{ $t('overview.deleteProjectMessage') }}
  11. <v-list dense>
  12. <v-list-item v-for="(item, i) in selected" :key="i">
  13. <v-list-item-content>
  14. <v-list-item-title>{{ item.name }}</v-list-item-title>
  15. </v-list-item-content>
  16. </v-list-item>
  17. </v-list>
  18. <span v-show="hasNonDeletableProjects" class="font-weight-bold">
  19. You don't have permission to delete the following projects. We try to delete the projects except for the following.
  20. </span>
  21. <v-list dense>
  22. <v-list-item v-for="(item, i) in nonDeletableProjects" :key="i">
  23. <v-list-item-content>
  24. <v-list-item-title>{{ item.name }}</v-list-item-title>
  25. </v-list-item-content>
  26. </v-list-item>
  27. </v-list>
  28. </template>
  29. </base-card>
  30. </template>
  31. <script lang="ts">
  32. import Vue, { PropType } from 'vue'
  33. import BaseCard from '@/components/utils/BaseCard.vue'
  34. import { ProjectDTO } from '~/services/application/project/projectData'
  35. export default Vue.extend({
  36. components: {
  37. BaseCard
  38. },
  39. props: {
  40. selected: {
  41. type: Array as PropType<ProjectDTO[]>,
  42. default: () => []
  43. }
  44. },
  45. computed: {
  46. nonDeletableProjects(): ProjectDTO[] {
  47. return this.selected.filter(item => !item.current_users_role.is_project_admin)
  48. },
  49. hasNonDeletableProjects(): boolean {
  50. return this.nonDeletableProjects.length > 0
  51. }
  52. }
  53. })
  54. </script>