All files / src/components/navigation/mcad McadDeleteModal.vue

100% Statements 13/13
100% Branches 4/4
100% Functions 7/7
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60    2x         10x           10x             1x   10x               10x                               44x   44x 44x   44x     1x 1x 1x      
<template>
  <v-dialog
    v-model="modal"
    width="535"
  >
    <v-card>
      <v-card-title class="px-6 pb-2 pt-4">
        <span>{{ t('labels.mcadDelete') }}</span>
      </v-card-title>
      <v-card-text
        class="px-6 pt-0 pb-4"
        style="font-size: 14px; line-height: 20px; font-weight: 400"
      >
        <span>{{ t('texts.mcadDeleteConfirm') }}</span>
      </v-card-text>
      <v-card-actions class="px-6 pt-0 pb-4">
        <v-spacer />
        <v-btn
          variant="plain"
          data-testid="close"
          @click="modal = false"
        >
          <span>{{ t('labels.cancel') }}</span>
        </v-btn>
        <v-btn
          color="amaranth_600"
          data-testid="delete"
          variant="flat"
          @click="deleteMcadObject"
        >
          <span>{{ t('labels.confirm') }}</span>
        </v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>
 
<script setup lang="ts">
import { useViewer3cr } from '@/composables/useViewer3cr';
import { useI18n } from 'vue-i18n';
import { DataOverlayMcad } from '@3cr/viewer-types-ts';
 
interface Props {
  mcad: DataOverlayMcad | undefined;
}
 
const props = defineProps<Props>();
 
const { t } = useI18n();
const viewer3cr = useViewer3cr();
 
const modal = defineModel<boolean>({ default: false });
 
async function deleteMcadObject(): Promise<void> {
  const message = { Version: '0.0.0', Id: props.mcad!.Id };
  await viewer3cr.removeMcadObject({ message });
  modal.value = false;
}
</script>