22/* eslint-disable @typescript-eslint/no-explicit-any */
33import { ref , computed , onMounted , onUnmounted } from ' vue'
44import { useI18n } from ' vue-i18n'
5- import { useRoute } from ' vue-router'
5+ import { useRoute , useRouter } from ' vue-router'
66import { Button } from ' @/components/ui/button'
77import { DsProgressSteps , type ProgressStep } from ' @/components/ui/ds-progress-steps'
88import { toast } from ' vue-sonner'
@@ -34,6 +34,7 @@ const emit = defineEmits<{
3434
3535const { t } = useI18n ()
3636const route = useRoute ()
37+ const router = useRouter ()
3738const eventBus = useEventBus ()
3839
3940// Form data interface
@@ -97,17 +98,17 @@ const progressSteps = computed<ProgressStep[]>(() => {
9798 const wizardSteps = [
9899 {
99100 id: 1 ,
101+ title: t (' mcpInstallations.wizard.steps.selectPlatform' ),
102+ description: t (' mcpInstallations.wizard.platform.helpText' )
103+ },
104+ {
105+ id: 2 ,
100106 title: requiresOAuth .value
101107 ? ' OAuth Authorization'
102108 : t (' mcpInstallations.wizard.steps.configureEnvironment' ),
103109 description: requiresOAuth .value
104110 ? ' Authorize access to your account'
105111 : t (' mcpInstallations.wizard.environment.helpText' )
106- },
107- {
108- id: 2 ,
109- title: t (' mcpInstallations.wizard.steps.selectPlatform' ),
110- description: t (' mcpInstallations.wizard.platform.helpText' )
111112 }
112113 ]
113114
@@ -270,10 +271,16 @@ const submitInstallation = async () => {
270271 const response = await McpInstallationService .createInstallation (currentTeamId .value , installationData )
271272
272273 if (response .success ) {
273- emit ( ' complete ' , {
274- ... installationData ,
275- id: response . data . id
274+ // Show success toast
275+ toast . success ( ' Installation successful ' , {
276+ description: ` ${ formData . value . server . server_data ?. name || ' MCP server ' } has been installed. `
276277 })
278+
279+ // Emit event to refresh installation list
280+ eventBus .emit (' mcp-installations-updated' )
281+
282+ // Redirect to installation list
283+ router .push (' /mcp-server' )
277284 } else {
278285 throw new Error (response .message || ' Failed to create installation' )
279286 }
@@ -380,8 +387,7 @@ const handleOAuthAuthorization = async () => {
380387 const authorizationData = {
381388 server_id: formData .value .server .server_id ,
382389 installation_name: formData .value .server .server_data ?.name || ' Unknown Server' ,
383- team_args: formData .value .environment .team_args ,
384- team_env: formData .value .environment .team_env
390+ installation_type: formData .value .platform .installation_type
385391 }
386392
387393 // Call backend to start OAuth flow
@@ -447,27 +453,22 @@ const handleOAuthMessage = (event: MessageEvent) => {
447453
448454 // Handle success message
449455 if (event .data .type === ' oauth_success' ) {
450- const { installation_id } = event .data
451-
452456 // Close popup if still open
453457 if (oauthPopup .value && ! oauthPopup .value .closed ) {
454458 oauthPopup .value .close ()
455459 }
456460 oauthPopup .value = null
457461
458- // Store installation_id in platform data
459- formData .value .platform .installation_id = installation_id
460-
461462 // Show success toast
462- toast .success (' Authorization successful' , {
463- description: ` Connected to ${formData .value .server .server_data ?.name || ' MCP server' }. Choose your platform to continue .`
463+ toast .success (' Installation successful' , {
464+ description: ` ${formData .value .server .server_data ?.name || ' MCP server' } has been installed and connected . `
464465 })
465466
466- // Auto-advance to next step (Platform Selection)
467- currentStep .value ++
468-
469467 // Emit event to refresh installation list
470468 eventBus .emit (' mcp-installations-updated' )
469+
470+ // Redirect to installation list
471+ router .push (' /mcp-server' )
471472 }
472473
473474 // Handle error message
@@ -627,25 +628,13 @@ onUnmounted(() => {
627628 :completed-steps =" completedSteps"
628629 max-width =" max-w-3xl"
629630 >
630- <!-- Step 1 Content: Environment Variables OR OAuth Authorization -->
631+ <!-- Step 1 Content: Platform Selection -->
631632 <template #step-content-0 >
632- <!-- OAuth Authorization Step (if OAuth required) -->
633- <OAuthAuthorizationStep
634- v-if =" requiresOAuth"
635- :server-data =" formData.server.server_data"
636- :is-authorizing =" isSubmitting"
637- @authorize =" handleOAuthAuthorization"
638- />
639-
640- <!-- Environment Variables Step (if OAuth NOT required) -->
641- <EnvironmentVariablesStep
642- v-else
643- v-model =" formData.environment"
644- :server-data =" formData.server.server_data"
645- @validation-change =" handleValidationChange"
633+ <PlatformSelectionStep
634+ v-model =" formData.platform.installation_type"
646635 />
647636
648- <!-- Navigation Buttons -->
637+ <!-- Navigation Buttons for Platform Step -->
649638 <div class =" flex items-center justify-between mt-6" >
650639 <Button variant =" outline" @click =" previousStep" >
651640 {{ t('navigation.previous') }}
@@ -658,21 +647,33 @@ onUnmounted(() => {
658647
659648 <Button
660649 @click =" nextStep"
661- :disabled =" !canProceedFromEnvironment "
650+ :disabled =" !formData.platform.installation_type "
662651 >
663652 {{ t('navigation.next') }}
664653 </Button >
665654 </div >
666655 </div >
667656 </template >
668657
669- <!-- Platform Selection Step Content -->
658+ <!-- Step 2 Content: Environment Variables OR OAuth Authorization -->
670659 <template #step-content-1 >
671- <PlatformSelectionStep
672- v-model =" formData.platform.installation_type"
660+ <!-- OAuth Authorization Step (if OAuth required) -->
661+ <OAuthAuthorizationStep
662+ v-if =" requiresOAuth"
663+ :server-data =" formData.server.server_data"
664+ :is-authorizing =" isSubmitting"
665+ @authorize =" handleOAuthAuthorization"
673666 />
674667
675- <!-- Navigation Buttons for Platform Step -->
668+ <!-- Environment Variables Step (if OAuth NOT required) -->
669+ <EnvironmentVariablesStep
670+ v-else
671+ v-model =" formData.environment"
672+ :server-data =" formData.server.server_data"
673+ @validation-change =" handleValidationChange"
674+ />
675+
676+ <!-- Navigation Buttons -->
676677 <div class =" flex items-center justify-between mt-6" >
677678 <Button variant =" outline" @click =" previousStep" >
678679 {{ t('navigation.previous') }}
@@ -683,7 +684,20 @@ onUnmounted(() => {
683684 {{ t('navigation.cancel') }}
684685 </Button >
685686
687+ <!-- OAuth: "Authorize & Install" button -->
688+ <Button
689+ v-if =" requiresOAuth"
690+ @click =" handleOAuthAuthorization"
691+ :loading =" isSubmitting"
692+ :loading-text =" t('mcpInstallations.wizard.authorizing')"
693+ :disabled =" !formData.platform.installation_type"
694+ >
695+ {{ t('mcpInstallations.wizard.authorizeAndInstall') }}
696+ </Button >
697+
698+ <!-- Non-OAuth: "Install" button -->
686699 <Button
700+ v-else
687701 @click =" submitInstallation"
688702 :disabled =" !canSubmit"
689703 :loading =" isSubmitting"
0 commit comments