Line data Source code
1 1 : <template>
2 : <Button
3 0 : v-if="state.status === 'ready'"
4 : variant="inverted"
5 : size="lg"
6 : class="w-full @xl:w-auto"
7 : as="a"
8 : :href="state.url"
9 : target="_blank"
10 : rel="noopener noreferrer"
11 : data-testid="deploy-to-comfy-api-open-builder"
12 : @click="openBuilder"
13 : @auxclick.middle="openBuilder"
14 : >
15 : {{ $t('deployToComfyApi.openBuilder') }}
16 : <i class="icon-[lucide--square-arrow-out-up-right]" aria-hidden="true" />
17 : </Button>
18 : <Button
19 : v-else
20 : variant="inverted"
21 : size="lg"
22 : class="w-full @xl:w-auto"
23 : :loading="state.status === 'uploading'"
24 : data-testid="deploy-to-comfy-api-platform"
25 : @click="deployInstallation"
26 : >
27 : {{ $t('deployToComfyApi.deployOnPlatform') }}
28 : </Button>
29 : </template>
30 :
31 : <script setup lang="ts">
32 : import Button from '@comfyorg/design-system/button/Button'
33 : import { useTelemetry } from '@comfyorg/telemetry'
34 : import { useInstallationDeploy } from '@/platform/workflow/deploy/composables/useInstallationDeploy'
35 :
36 0 : const emit = defineEmits<{ opened: [] }>()
37 :
38 0 : const { state, deploy } = useInstallationDeploy()
39 :
40 0 : function track(buttonId: string) {
41 0 : useTelemetry()?.trackUiButtonClicked({
42 : button_id: buttonId,
43 : element_group: 'deploy_to_comfy_api'
44 : })
45 : }
46 :
47 0 : function openBuilder() {
48 0 : track('deploy_to_comfy_api_builder_opened')
49 0 : emit('opened')
50 : }
51 :
52 0 : async function deployInstallation() {
53 0 : track('deploy_to_comfy_api_platform_clicked')
54 0 : await deploy()
55 : }
56 : </script>
|