@@ -5,7 +5,7 @@ conditions defined in the file COPYING, which is part of this source code packag
55-->
66
77<script setup lang="ts">
8- import { onMounted , ref } from ' vue'
8+ import { ref } from ' vue'
99
1010import usei18n from ' @/lib/i18n'
1111import usePersistentRef from ' @/lib/usePersistentRef'
@@ -23,8 +23,9 @@ import CmkWizardStep from '@/components/CmkWizard/CmkWizardStep.vue'
2323import CmkHeading from ' @/components/typography/CmkHeading.vue'
2424import CmkParagraph from ' @/components/typography/CmkParagraph.vue'
2525
26+ import GenerateToken from ' @/mode-host/agent-connection-test/components/GenerateToken.vue'
27+
2628import { finalStepText , tabs } from ' ./FirstHostSlideoutContent'
27- import { CseOnboardingApiClient } from ' ./onboarding-api-client'
2829
2930const { _t } = usei18n ()
3031
@@ -35,8 +36,7 @@ const openedTab = usePersistentRef<string | number>(
3536 (v ) => v as string | number
3637)
3738const currentStep = ref <number >(1 )
38- const onboardingApiClient = new CseOnboardingApiClient (' api/v1/' )
39- const agentSecret = ref <string | null >(null )
39+ const ott = ref <string | null | Error >(null )
4040
4141function onClose() {
4242 slideInOpen .value = false
@@ -46,16 +46,6 @@ function onClose() {
4646function goToHostOverview() {
4747 window .location .href = ' wato.py?mode=folder'
4848}
49-
50- onMounted (async () => {
51- try {
52- if (! agentSecret .value ) {
53- agentSecret .value = (await onboardingApiClient .getAgentSecret ()).secret
54- }
55- } catch (e ) {
56- console .error (' Failed to fetch agent download information' , e )
57- }
58- })
5949 </script >
6050
6151<template >
@@ -98,23 +88,26 @@ onMounted(async () => {
9888 <CmkParagraph >
9989 {{ step.description_top }}
10090 </CmkParagraph >
101- <CmkCode
102- :code_txt = "
103- step.code.replace(
104- '[AGENT_DOWNLOAD_SECRET]',
105- agentSecret || '<agent- download-secret>'
106- )
107- "
108- class = " welcome-first-host-slideout__code "
91+ <GenerateToken
92+ v-if = " currentStep === 1 "
93+ v-model = " ott "
94+ token-generation-endpoint-uri = " domain-types/agent_download_token/collections/all "
95+ :description = " _t('This requires the generation of a download token.') "
96+ :token-generation-body = " {
97+ expires_at: null
98+ } "
10999 />
110- <CmkParagraph v-if =" step.description_bottom" >
111- {{ step.description_bottom }}
112- </CmkParagraph >
113- <CmkSpace ></CmkSpace >
100+ <template v-if =" typeof ott === ' string' " >
101+ <CmkCode
102+ :code_txt =" step.code.replace('[AGENT_DOWNLOAD_OTT]', ott)"
103+ class =" welcome-first-host-slideout__code"
104+ />
105+ <CmkSpace ></CmkSpace >
106+ </template >
114107 </template >
115108
116109 <template #actions >
117- <CmkWizardButton type =" next" />
110+ <CmkWizardButton type =" next" :disabled = " ott === null " />
118111 <CmkWizardButton v-if =" step.stepNumber > 1" type =" previous" />
119112 </template >
120113 </CmkWizardStep >
0 commit comments