main
vue 84 lines 2.41 KB
Raw
1 <template>
2 <div>
3 <CardEntity hoverable :embedded>
4 <template #default>
5 {{ serviceName }}
6 </template>
7
8 <template v-if="integration.deployed" #footerMain>
9 <Badge type="active">
10 <template #iconLeft>
11 <Icon :name="DeployIcon" :size="13" />
12 </template>
13 <template #value>Deployed</template>
14 </Badge>
15 </template>
16 <template #footerExtra>
17 <div class="flex flex-wrap gap-3">
18 <n-button size="small" @click.stop="showDetails = true">
19 <template #icon>
20 <Icon :name="DetailsIcon" />
21 </template>
22 Details
23 </n-button>
24
25 <CustomerIntegrationMetaButton
26 size="small"
27 :customer-code="integration.customer_code"
28 :integration-name="serviceName"
29 />
30
31 <CustomerIntegrationActions
32 class="flex flex-wrap gap-3"
33 :integration
34 size="small"
35 @deployed="emit('deployed')"
36 @deleted="emit('deleted')"
37 />
38 </div>
39 </template>
40 </CardEntity>
41
42 <!-- Existing Details Modal -->
43 <n-modal
44 v-model:show="showDetails"
45 preset="card"
46 :style="{ maxWidth: 'min(800px, 90vw)', minHeight: 'min(404px, 90vh)', overflow: 'hidden' }"
47 :title="serviceName"
48 :bordered="false"
49 segmented
50 display-directive="show"
51 >
52 <CustomerIntegrationDetails :integration @deleted="emit('deleted')" @updated="integration = $event" />
53 </n-modal>
54 </div>
55 </template>
56
57 <script setup lang="ts">
58 import type { CustomerIntegration } from "@/types/integrations.d"
59 import { NButton, NModal } from "naive-ui"
60 import { computed, defineAsyncComponent, ref } from "vue"
61 import Badge from "@/components/common/Badge.vue"
62 import CardEntity from "@/components/common/cards/CardEntity.vue"
63 import Icon from "@/components/common/Icon.vue"
64 import CustomerIntegrationMetaButton from "../metadata/CustomerIntegrationMetaButton.vue"
65 import CustomerIntegrationActions from "./CustomerIntegrationActions.vue"
66
67 const { integration: customerIntegration, embedded } = defineProps<{
68 integration: CustomerIntegration
69 embedded?: boolean
70 }>()
71
72 const emit = defineEmits<{
73 (e: "deployed"): void
74 (e: "deleted"): void
75 }>()
76
77 const CustomerIntegrationDetails = defineAsyncComponent(() => import("./CustomerIntegrationDetails.vue"))
78
79 const DeployIcon = "carbon:deploy"
80 const DetailsIcon = "carbon:settings-adjust"
81 const integration = ref(customerIntegration)
82 const showDetails = ref(false)
83 const serviceName = computed(() => integration.value.integration_service_name)
84 </script>