Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: use drawer for creating idp (#16534)

boojackad3d20611fc0
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
index ce75c5108f..6d7e9542c1 100644
--- a/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
@@ -1,423 +1,434 @@
<template>
- <div class="w-full max-w-4xl mx-auto space-y-6">
- <!-- Steps Navigation -->
- <div class="bg-white">
- <NSteps :current="currentStep" size="medium">
- <NStep :title="$t('settings.sso.form.type')" />
- <NStep
- v-if="selectedType === IdentityProviderType.OAUTH2"
- :title="$t('settings.sso.form.use-template')"
- />
- <NStep :title="$t('common.general')" />
- <NStep :title="$t('settings.sso.form.configuration')" />
- <NStep :title="$t('settings.sso.form.user-information-mapping')" />
- </NSteps>
- </div>
-
- <!-- Step Content -->
- <div
- class="bg-white rounded-lg border border-gray-200 px-2 sm:px-6 pt-6 pb-10"
+ <Drawer :show="props.show" @update:show="$emit('update:show', $event)">
+ <DrawerContent
+ :title="$t('settings.sso.create')"
+ class="w-[64rem] max-w-[100vw]"
+ :closable="true"
>
- <!-- Step 1: Select Provider Type -->
- <div v-if="currentStep === 1" class="space-y-6">
- <div class="text-center space-y-2">
- <h2 class="text-2xl font-bold text-gray-900">
- {{ $t("settings.sso.form.type") }}
- </h2>
- <p class="text-gray-600">
- {{ $t("settings.sso.form.type-description") }}
- </p>
- </div>
+ <div class="w-full mx-auto space-y-6">
+ <!-- Steps Navigation -->
+ <NSteps :current="currentStep" size="medium">
+ <NStep :title="$t('settings.sso.form.type')" />
+ <NStep
+ v-if="selectedType === IdentityProviderType.OAUTH2"
+ :title="$t('settings.sso.form.use-template')"
+ />
+ <NStep :title="$t('common.general')" />
+ <NStep :title="$t('settings.sso.form.configuration')" />
+ <NStep :title="$t('settings.sso.form.user-information-mapping')" />
+ </NSteps>
+ <!-- Step Content -->
+ <div
+ class="bg-white rounded-lg border border-gray-200 px-2 sm:px-6 pt-6 pb-10"
+ >
+ <!-- Step 1: Select Provider Type -->
+ <div v-if="currentStep === 1" class="space-y-6">
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.type") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.type-description") }}
+ </p>
+ </div>
- <div class="max-w-2xl mx-auto">
- <NRadioGroup
- v-model:value="selectedType"
- size="large"
- class="space-y-4 w-full"
- >
- <div
- v-for="item in identityProviderTypeList"
- :key="item.type"
- class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
- :class="{
- 'border-blue-500 bg-blue-50': selectedType === item.type,
- }"
- >
- <NRadio
- :value="item.type"
- :disabled="!subscriptionStore.hasFeature(item.feature)"
- class="w-full"
+ <div class="max-w-2xl mx-auto">
+ <NRadioGroup
+ v-model:value="selectedType"
+ size="large"
+ class="space-y-4 w-full"
>
- <div class="flex items-start space-x-3 w-full">
- <component
- :is="getProviderIcon(item.type)"
- class="w-6 h-6 mt-1 flex-shrink-0"
- :stroke-width="1.5"
- />
- <div class="flex-1">
- <div class="flex items-center space-x-2">
- <span class="text-lg font-medium text-gray-900">
- {{ identityProviderTypeToString(item.type) }}
- </span>
- <FeatureBadge :feature="item.feature" />
+ <div
+ v-for="item in identityProviderTypeList"
+ :key="item.type"
+ class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
+ :class="{
+ 'border-blue-500 bg-blue-50': selectedType === item.type,
+ }"
+ >
+ <NRadio
+ :value="item.type"
+ :disabled="!subscriptionStore.hasFeature(item.feature)"
+ class="w-full"
+ >
+ <div class="flex items-start space-x-3 w-full">
+ <component
+ :is="getProviderIcon(item.type)"
+ class="w-6 h-6 mt-1 flex-shrink-0"
+ :stroke-width="1.5"
+ />
+ <div class="flex-1">
+ <div class="flex items-center space-x-2">
+ <span class="text-lg font-medium text-gray-900">
+ {{ identityProviderTypeToString(item.type) }}
+ </span>
+ <FeatureBadge :feature="item.feature" />
+ </div>
+ <p class="text-sm text-gray-600 mt-1">
+ {{ getProviderDescription(item.type) }}
+ </p>
+ </div>
</div>
- <p class="text-sm text-gray-600 mt-1">
- {{ getProviderDescription(item.type) }}
- </p>
- </div>
+ </NRadio>
</div>
- </NRadio>
+ </NRadioGroup>
+
+ <!-- External URL Warning -->
+ <BBAttention
+ v-if="
+ !externalUrl &&
+ (selectedType === IdentityProviderType.OAUTH2 ||
+ selectedType === IdentityProviderType.OIDC)
+ "
+ class="mt-6"
+ type="error"
+ :title="$t('banner.external-url')"
+ :description="
+ $t('settings.general.workspace.external-url.description')
+ "
+ >
+ <template #action>
+ <NButton type="primary" @click="configureSetting">
+ {{ $t("common.configure-now") }}
+ </NButton>
+ </template>
+ </BBAttention>
</div>
- </NRadioGroup>
-
- <!-- External URL Warning -->
- <BBAttention
- v-if="
- !externalUrl &&
- (selectedType === IdentityProviderType.OAUTH2 ||
- selectedType === IdentityProviderType.OIDC)
- "
- class="mt-6"
- type="error"
- :title="$t('banner.external-url')"
- :description="
- $t('settings.general.workspace.external-url.description')
- "
- >
- <template #action>
- <NButton type="primary" @click="configureSetting">
- {{ $t("common.configure-now") }}
- </NButton>
- </template>
- </BBAttention>
- </div>
- </div>
-
- <!-- Step 2: Select OAuth2 Template (only for OAuth2) -->
- <div
- v-else-if="
- currentStep === 2 && selectedType === IdentityProviderType.OAUTH2
- "
- class="space-y-6"
- >
- <div class="text-center space-y-2">
- <h2 class="text-2xl font-bold text-gray-900">
- {{ $t("settings.sso.form.use-template") }}
- </h2>
- <p class="text-gray-600">
- {{ $t("settings.sso.form.template-description") }}
- </p>
- </div>
+ </div>
- <div class="max-w-3xl mx-auto">
- <NRadioGroup
- :value="selectedTemplate?.title"
- @update:value="
- (value) => {
- const template = templateList.find((t) => t.title === value);
- if (template) handleTemplateSelect(template);
- }
+ <!-- Step 2: Select OAuth2 Template (only for OAuth2) -->
+ <div
+ v-else-if="
+ currentStep === 2 && selectedType === IdentityProviderType.OAUTH2
"
- size="large"
- class="!grid grid-cols-1 sm:grid-cols-2 gap-4"
+ class="space-y-6"
>
- <div
- v-for="template in templateList"
- :key="template.title"
- class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
- :class="{
- 'border-blue-500 bg-blue-50':
- selectedTemplate?.title === template.title,
- }"
- >
- <NRadio
- :value="template.title"
- :disabled="!subscriptionStore.hasFeature(template.feature)"
- class="w-full"
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.use-template") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.template-description") }}
+ </p>
+ </div>
+
+ <div class="max-w-3xl mx-auto">
+ <NRadioGroup
+ :value="selectedTemplate?.title"
+ @update:value="
+ (value) => {
+ const template = templateList.find(
+ (t) => t.title === value
+ );
+ if (template) handleTemplateSelect(template);
+ }
+ "
+ size="large"
+ class="!grid grid-cols-1 sm:grid-cols-2 gap-4"
>
- <div class="flex items-center space-x-3">
- <component
- :is="getTemplateIcon(template.title)"
- class="w-8 h-8 flex-shrink-0"
- :stroke-width="1"
- />
- <div class="flex-1">
- <div class="flex items-center space-x-2">
- <span class="text-base font-medium text-gray-900">
- {{ template.title }}
- </span>
- <FeatureBadge :feature="template.feature" />
+ <div
+ v-for="template in templateList"
+ :key="template.title"
+ class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
+ :class="{
+ 'border-blue-500 bg-blue-50':
+ selectedTemplate?.title === template.title,
+ }"
+ >
+ <NRadio
+ :value="template.title"
+ :disabled="!subscriptionStore.hasFeature(template.feature)"
+ class="w-full"
+ >
+ <div class="flex items-center space-x-3">
+ <component
+ :is="getTemplateIcon(template.title)"
+ class="w-8 h-8 flex-shrink-0"
+ :stroke-width="1"
+ />
+ <div class="flex-1">
+ <div class="flex items-center space-x-2">
+ <span class="text-base font-medium text-gray-900">
+ {{ template.title }}
+ </span>
+ <FeatureBadge :feature="template.feature" />
+ </div>
+ <p class="text-sm text-gray-600">
+ {{ getTemplateDescription(template.title) }}
+ </p>
+ </div>
</div>
- <p class="text-sm text-gray-600">
- {{ getTemplateDescription(template.title) }}
- </p>
- </div>
+ </NRadio>
</div>
- </NRadio>
+ </NRadioGroup>
</div>
- </NRadioGroup>
- </div>
- </div>
-
- <!-- Step 3: Basic Information -->
- <div
- v-else-if="
- currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 3 : 2)
- "
- class="space-y-6"
- >
- <div class="text-center space-y-2">
- <h2 class="text-2xl font-bold text-gray-900">
- {{ $t("common.general") }}
- </h2>
- <p class="text-gray-600">
- {{ $t("settings.sso.form.general-setting-description") }}
- </p>
- </div>
-
- <div class="max-w-2xl mx-auto space-y-6">
- <div>
- <label class="block text-base font-semibold text-gray-800 mb-2">
- {{ $t("settings.sso.form.name") }}
- <span class="text-red-600">*</span>
- </label>
- <BBTextField
- v-model:value="identityProvider.title"
- required
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.name-description')"
- />
- <ResourceIdField
- ref="resourceIdField"
- class="mt-1"
- editing-class="mt-6"
- resource-type="idp"
- v-model:value="resourceIdValue"
- :suffix="true"
- :resource-title="identityProvider.title"
- :fetch-resource="
- (id) =>
- identityProviderStore.getOrFetchIdentityProviderByName(
- `${idpNamePrefix}${id}`,
- true /* silent */
- )
- "
- />
</div>
- <div>
- <label class="block text-base font-semibold text-gray-800 mb-2">
- {{ $t("settings.sso.form.domain") }}
- </label>
- <BBTextField
- v-model:value="identityProvider.domain"
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.domain-description')"
- />
- <p class="text-sm text-gray-600 mt-1">
- {{ $t("settings.sso.form.domain-optional-hint") }}
- </p>
- </div>
- </div>
- </div>
-
- <!-- Step 4: Provider Configuration -->
- <div
- v-else-if="
- currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 4 : 3)
- "
- class="space-y-6"
- >
- <div class="text-center space-y-2">
- <h2 class="text-2xl font-bold text-gray-900">
- {{ $t("settings.sso.form.configuration") }}
- </h2>
- <p class="text-gray-600">
- {{ $t("settings.sso.form.configuration-description") }}
- </p>
- </div>
-
- <div class="max-w-3xl mx-auto">
- <!-- External URL Info -->
- <IdentityProviderExternalURL
- v-if="
- selectedType === IdentityProviderType.OAUTH2 ||
- selectedType === IdentityProviderType.OIDC
+ <!-- Step 3: Basic Information -->
+ <div
+ v-else-if="
+ currentStep ===
+ (selectedType === IdentityProviderType.OAUTH2 ? 3 : 2)
"
- :type="selectedType"
- class="mb-6"
- />
-
- <!-- Configuration Form based on type -->
- <IdentityProviderForm
- :identity-provider="identityProvider"
- :provider-type="selectedType"
- :config-for-oauth2="configForOAuth2"
- :config-for-oidc="configForOIDC"
- :config-for-ldap="configForLDAP"
- :scopes-string="scopesStringOfConfig"
- @update:config-for-oauth2="configForOAuth2 = $event"
- @update:config-for-oidc="configForOIDC = $event"
- @update:config-for-ldap="configForLDAP = $event"
- @update:scopes-string="scopesStringOfConfig = $event"
- />
- </div>
- </div>
-
- <!-- Step 5: User Information Mapping -->
- <div
- v-else-if="
- currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 5 : 4)
- "
- class="space-y-6"
- >
- <div class="text-center space-y-2">
- <h2 class="text-2xl font-bold text-gray-900">
- {{ $t("settings.sso.form.user-information-mapping") }}
- </h2>
- <p class="text-gray-600">
- {{ $t("settings.sso.form.user-information-mapping-description") }}
- <a
- href="https://docs.bytebase.com/administration/sso/oauth2#user-information-field-mapping?source=console"
- class="text-blue-600 hover:text-blue-800 underline"
- target="_blank"
- >
- {{ $t("common.learn-more") }}
- </a>
- </p>
- </div>
-
- <div class="max-w-2xl mx-auto space-y-6">
- <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
- <BBTextField
- v-model:value="fieldMapping.identifier"
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.identifier-placeholder')"
- />
- <div class="flex flex-row justify-start items-center text-base">
- <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
- <p
- class="flex flex-row justify-start items-center font-semibold text-gray-800"
- >
- {{ $t("settings.sso.form.identifier") }}
- <span class="text-red-600">*</span>
- <NTooltip>
- <template #trigger>
- <InfoIcon class="ml-1 w-4 h-auto text-blue-500" />
- </template>
- {{ $t("settings.sso.form.identifier-tips") }}
- </NTooltip>
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("common.general") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.general-setting-description") }}
</p>
</div>
- </div>
- <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
- <BBTextField
- v-model:value="fieldMapping.displayName"
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.display-name-placeholder')"
- />
- <div class="flex flex-row justify-start items-center text-base">
- <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
- <p class="font-semibold text-gray-800">
- {{ $t("settings.sso.form.display-name") }}
- </p>
+ <div class="max-w-2xl mx-auto space-y-6">
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.name") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ v-model:value="identityProvider.title"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.name-description')"
+ />
+ </div>
+
+ <ResourceIdField
+ ref="resourceIdField"
+ resource-type="idp"
+ v-model:value="resourceIdValue"
+ :suffix="true"
+ :resource-title="identityProvider.title"
+ :fetch-resource="
+ (id) =>
+ identityProviderStore.getOrFetchIdentityProviderByName(
+ `${idpNamePrefix}${id}`,
+ true /* silent */
+ )
+ "
+ />
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.domain") }}
+ </label>
+ <BBTextField
+ v-model:value="identityProvider.domain"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.domain-description')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.domain-optional-hint") }}
+ </p>
+ </div>
</div>
</div>
- <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
- <BBTextField
- v-model:value="fieldMapping.phone"
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.phone-placeholder')"
- />
- <div class="flex flex-row justify-start items-center text-base">
- <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
- <p class="font-semibold text-gray-800">
- {{ $t("settings.sso.form.phone") }}
+ <!-- Step 4: Provider Configuration -->
+ <div
+ v-else-if="
+ currentStep ===
+ (selectedType === IdentityProviderType.OAUTH2 ? 4 : 3)
+ "
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.configuration") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.configuration-description") }}
</p>
</div>
+
+ <div class="max-w-3xl mx-auto">
+ <!-- External URL Info -->
+ <IdentityProviderExternalURL
+ v-if="
+ selectedType === IdentityProviderType.OAUTH2 ||
+ selectedType === IdentityProviderType.OIDC
+ "
+ :type="selectedType"
+ class="mb-6"
+ />
+
+ <!-- Configuration Form based on type -->
+ <IdentityProviderForm
+ :identity-provider="identityProvider"
+ :provider-type="selectedType"
+ :config-for-oauth2="configForOAuth2"
+ :config-for-oidc="configForOIDC"
+ :config-for-ldap="configForLDAP"
+ :scopes-string="scopesStringOfConfig"
+ @update:config-for-oauth2="configForOAuth2 = $event"
+ @update:config-for-oidc="configForOIDC = $event"
+ @update:config-for-ldap="configForLDAP = $event"
+ @update:scopes-string="scopesStringOfConfig = $event"
+ />
+ </div>
</div>
+ <!-- Step 5: User Information Mapping -->
<div
- v-if="selectedType === IdentityProviderType.OIDC"
- class="grid grid-cols-[256px_1fr] gap-4 items-center"
+ v-else-if="
+ currentStep ===
+ (selectedType === IdentityProviderType.OAUTH2 ? 5 : 4)
+ "
+ class="space-y-6"
>
- <BBTextField
- v-model:value="fieldMapping.groups"
- size="large"
- class="w-full text-base"
- :placeholder="$t('settings.sso.form.groups-placeholder')"
- />
- <div class="flex flex-row justify-start items-center text-base">
- <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
- <p class="font-semibold text-gray-800">
- {{ $t("settings.sso.form.groups") }}
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.user-information-mapping") }}
+ </h2>
+ <p class="text-gray-600">
+ {{
+ $t("settings.sso.form.user-information-mapping-description")
+ }}
+ <a
+ href="https://docs.bytebase.com/administration/sso/oauth2#user-information-field-mapping?source=console"
+ class="text-blue-600 hover:text-blue-800 underline"
+ target="_blank"
+ >
+ {{ $t("common.learn-more") }}
+ </a>
</p>
</div>
- </div>
- <div v-if="selectedType === IdentityProviderType.OIDC">
- <p class="text-sm text-gray-600">
- {{ $t("settings.sso.form.groups-description") }}
- </p>
+ <div class="max-w-2xl mx-auto space-y-6">
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.identifier"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.identifier-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p
+ class="flex flex-row justify-start items-center font-semibold text-gray-800"
+ >
+ {{ $t("settings.sso.form.identifier") }}
+ <span class="text-red-600">*</span>
+ <NTooltip>
+ <template #trigger>
+ <InfoIcon class="ml-1 w-4 h-auto text-blue-500" />
+ </template>
+ {{ $t("settings.sso.form.identifier-tips") }}
+ </NTooltip>
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.displayName"
+ size="large"
+ class="w-full text-base"
+ :placeholder="
+ $t('settings.sso.form.display-name-placeholder')
+ "
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.display-name") }}
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.phone"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.phone-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.phone") }}
+ </p>
+ </div>
+ </div>
+
+ <div
+ v-if="selectedType === IdentityProviderType.OIDC"
+ class="grid grid-cols-[256px_1fr] gap-4 items-center"
+ >
+ <BBTextField
+ v-model:value="fieldMapping.groups"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.groups-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.groups") }}
+ </p>
+ </div>
+ </div>
+
+ <div v-if="selectedType === IdentityProviderType.OIDC">
+ <p class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.groups-description") }}
+ </p>
+ </div>
+
+ <div>
+ <NButton
+ :disabled="!allowTestConnection"
+ @click="testConnection"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("identity-provider.test-connection") }}
+ </NButton>
+ </div>
+ </div>
</div>
+ </div>
+ </div>
- <div>
+ <template #footer>
+ <div class="flex items-center justify-between">
+ <div></div>
+ <div class="flex items-center space-x-3">
+ <NButton
+ v-if="currentStep === 1"
+ @click="$emit('update:show', false)"
+ >
+ {{ $t("common.cancel") }}
+ </NButton>
+ <NButton v-if="currentStep > 1" @click="handlePrevStep">
+ {{ $t("common.back") }}
+ </NButton>
<NButton
- :disabled="!allowTestConnection"
- @click="testConnection"
- size="large"
- class="text-base"
+ v-if="!isLastStep"
+ type="primary"
+ :disabled="!canProceedToNextStep"
+ @click="handleNextStep"
>
- {{ $t("identity-provider.test-connection") }}
+ {{ $t("common.next") }}
+ </NButton>
+ <NButton
+ v-else
+ type="primary"
+ :disabled="!canCreate"
+ :loading="isCreating"
+ @click="handleCreate"
+ >
+ {{ $t("common.create") }}
</NButton>
</div>
</div>
- </div>
- </div>
-
- <!-- Navigation Buttons -->
- <div class="flex items-center justify-between pb-6">
- <div></div>
- <div class="flex items-center space-x-3">
- <NButton
- v-if="currentStep > 1"
- @click="handlePrevStep"
- size="large"
- class="text-base"
- >
- {{ $t("common.back") }}
- </NButton>
- <NButton
- v-if="!isLastStep"
- type="primary"
- :disabled="!canProceedToNextStep"
- @click="handleNextStep"
- size="large"
- class="text-base"
- >
- {{ $t("common.next") }}
- </NButton>
- <NButton
- v-else
- type="primary"
- :disabled="!canCreate"
- :loading="isCreating"
- @click="handleCreate"
- size="large"
- class="text-base"
- >
- {{ $t("common.create") }}
- </NButton>
- </div>
- </div>
- </div>
+ </template>
+ </DrawerContent>
+ </Drawer>
</template>
<script setup lang="ts">
@@ -446,8 +457,8 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBAttention, BBTextField } from "@/bbkit";
import { FeatureBadge } from "@/components/FeatureGuard";
+import { Drawer, DrawerContent } from "@/components/v2";
import ResourceIdField from "@/components/v2/Form/ResourceIdField.vue";
-import { WORKSPACE_ROUTE_SSO_DETAIL } from "@/router/dashboard/workspaceRoutes";
import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";
import { SQL_EDITOR_SETTING_GENERAL_MODULE } from "@/router/sqlEditor";
import {
@@ -468,10 +479,7 @@ import {
} from "@/types/proto/v1/idp_service";
import { PlanFeature } from "@/types/proto/v1/subscription_service";
import type { OAuth2IdentityProviderTemplate } from "@/utils";
-import {
- extractIdentityProviderResourceName,
- identityProviderTypeToString,
-} from "@/utils";
+import { identityProviderTypeToString } from "@/utils";
import IdentityProviderExternalURL from "./IdentityProviderExternalURL.vue";
import IdentityProviderForm from "./IdentityProviderForm.vue";
@@ -479,8 +487,13 @@ interface IdentityProviderTemplate extends OAuth2IdentityProviderTemplate {
feature: PlanFeature;
}
+const props = defineProps<{
+ show: boolean;
+}>();
+
const emit = defineEmits<{
(e: "created", provider: IdentityProvider): void;
+ (e: "update:show", show: boolean): void;
}>();
const { t } = useI18n();
@@ -917,13 +930,6 @@ const handleCreate = async () => {
});
emit("created", createdProvider);
-
- router.replace({
- name: WORKSPACE_ROUTE_SSO_DETAIL,
- params: {
- ssoId: extractIdentityProviderResourceName(createdProvider.name),
- },
- });
} catch (error) {
console.error("Failed to create identity provider:", error);
pushNotification({
@@ -937,44 +943,50 @@ const handleCreate = async () => {
};
// Watchers
-watch(selectedType, (newType, oldType) => {
- // Only process if type actually changed, not on initial mount
- if (oldType === undefined) {
- // Initial mount - set up OAuth2 defaults if needed
- if (newType === IdentityProviderType.OAUTH2) {
- if (!selectedTemplate.value) {
- selectedTemplate.value = head(templateList.value);
- }
- if (selectedTemplate.value) {
- handleTemplateSelect(selectedTemplate.value);
+watch(
+ selectedType,
+ (newType, oldType) => {
+ // Only process if type actually changed, not on initial mount
+ if (oldType === undefined) {
+ // Initial mount - set up OAuth2 defaults if needed
+ if (newType === IdentityProviderType.OAUTH2) {
+ if (!selectedTemplate.value) {
+ selectedTemplate.value = head(templateList.value);
+ }
+ if (selectedTemplate.value) {
+ handleTemplateSelect(selectedTemplate.value);
+ }
}
+ return;
}
- return;
- }
- if (newType !== oldType) {
- // Type changed - reset form but preserve resource ID
- if (newType === IdentityProviderType.OAUTH2) {
- // Switching to OAuth2
- if (!selectedTemplate.value) {
- selectedTemplate.value = head(templateList.value);
- }
- if (selectedTemplate.value) {
- handleTemplateSelect(selectedTemplate.value);
+ if (newType !== oldType) {
+ // Type changed - reset form but preserve resource ID
+ if (newType === IdentityProviderType.OAUTH2) {
+ // Switching to OAuth2
+ if (!selectedTemplate.value) {
+ selectedTemplate.value = head(templateList.value);
+ }
+ if (selectedTemplate.value) {
+ handleTemplateSelect(selectedTemplate.value);
+ }
+ } else {
+ // Switching to OIDC or LDAP
+ identityProvider.value.title = "";
+ identityProvider.value.domain = "";
+
+ // Clear field mapping
+ Object.keys(fieldMapping).forEach((key) => {
+ delete fieldMapping[key as keyof FieldMapping];
+ });
+ scopesStringOfConfig.value = "";
}
- } else {
- // Switching to OIDC or LDAP
- identityProvider.value.title = "";
- identityProvider.value.domain = "";
-
- // Clear field mapping
- Object.keys(fieldMapping).forEach((key) => {
- delete fieldMapping[key as keyof FieldMapping];
- });
- scopesStringOfConfig.value = "";
}
+ },
+ {
+ immediate: true,
}
-});
+);
// Watch for template changes to ensure form is updated
watch(
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderTable.vue b/frontend/src/components/IdentityProvider/IdentityProviderTable.vue
index 0eabfe4a8e..7df2732a29 100644
--- a/frontend/src/components/IdentityProvider/IdentityProviderTable.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderTable.vue
@@ -20,7 +20,10 @@ import { useRouter } from "vue-router";
import { WORKSPACE_ROUTE_SSO_DETAIL } from "@/router/dashboard/workspaceRoutes";
import { getSSOId } from "@/store/modules/v1/common";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";
-import { identityProviderTypeToString } from "@/utils";
+import {
+ extractIdentityProviderResourceName,
+ identityProviderTypeToString,
+} from "@/utils";
withDefaults(
defineProps<{
@@ -37,6 +40,12 @@ const { t } = useI18n();
const columnList = computed((): DataTableColumn<IdentityProvider>[] => {
return [
+ {
+ key: "id",
+ title: t("common.id"),
+ width: "164px",
+ render: (idp) => extractIdentityProviderResourceName(idp.name),
+ },
{
key: "title",
title: t("common.name"),
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index b25831dc73..b799214a4f 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -501,7 +501,7 @@
"ldaps-description": "Use TLS from the beginning (port 636)",
"none": "None",
"none-description": "No encryption (not recommended for production)",
- "domain-optional-hint": "Optional: Restrict access to users from this domain",
+ "domain-optional-hint": "Optional: Use to concat with identifier if it is not in email format",
"provider-type-readonly-hint": "Provider type cannot be changed after creation",
"identifier-placeholder": "e.g. login, email",
"display-name-placeholder": "e.g. name, displayName",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index cf9ef6fde3..a1f8890ed5 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -501,7 +501,7 @@
"ldaps-description": "Utilice TLS desde el principio (puerto 636)",
"none": "Ninguno",
"none-description": "Sin cifrado (no recomendado para producción)",
- "domain-optional-hint": "Opcional: Restringir el acceso a los usuarios de este dominio",
+ "domain-optional-hint": "Opcional: Úselo para concatenar con el identificador si no está en formato de correo electrónico",
"provider-type-readonly-hint": "El tipo de proveedor no se puede cambiar después de la creación",
"identifier-placeholder": "p. ej. inicio de sesión, correo electrónico",
"display-name-placeholder": "p. ej. nombre, nombre para mostrar",
@@ -2784,4 +2784,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index edf72ea523..205dd7540c 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -501,7 +501,7 @@
"ldaps-description": "最初から TLS を使用する (ポート 636)",
"none": "なし",
"none-description": "暗号化なし(本番環境では推奨されません)",
- "domain-optional-hint": "オプション: このドメインのユーザーへのアクセスを制限する",
+ "domain-optional-hint": "オプション: 電子メール形式でない場合は識別子と連結するために使用します",
"provider-type-readonly-hint": "プロバイダタイプは作成後に変更できません",
"identifier-placeholder": "例:ログイン、メール",
"display-name-placeholder": "例: name、displayName",
@@ -2784,4 +2784,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 815807edf5..aadc67f9ff 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -501,7 +501,7 @@
"ldaps-description": "Sử dụng TLS ngay từ đầu (cổng 636)",
"none": "Không có",
"none-description": "Không mã hóa (không khuyến khích sử dụng cho mục đích sản xuất)",
- "domain-optional-hint": "Tùy chọn: Hạn chế quyền truy cập của người dùng từ miền này",
+ "domain-optional-hint": "Tùy chọn: Sử dụng để nối với mã định danh nếu nó không ở định dạng email",
"provider-type-readonly-hint": "Loại nhà cung cấp không thể thay đổi sau khi tạo",
"identifier-placeholder": "ví dụ: đăng nhập, email",
"display-name-placeholder": "ví dụ tên, displayName",
@@ -2784,4 +2784,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index eeaf345fec..38665617fe 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -436,7 +436,7 @@
"delete": "删除该 SSO",
"form": {
"type": "类型",
- "type-description": "选择要配置的身份提供者类型",
+ "type-description": "选择要配置的身份提供商类型",
"oauth2-description": "适用于 OAuth 2.0 提供商,例如 Google、GitHub、GitLab 以及自部署等。",
"oidc-description": "适用于 OpenID Connect 提供商,例如 Microsoft Entra ID (Azure AD)、Okta、Auth0",
"ldap-description": "适用于 LDAP 提供商,例如 Microsoft Active Directory、OpenLDAP",
@@ -461,7 +461,7 @@
"display-name": "Bytebase 用户的昵称",
"phone": "Bytebase 用户的手机号",
"groups": "Bytebase 用户的群组",
- "general-setting-description": "提供有关您的身份提供者的基本信息。",
+ "general-setting-description": "提供有关您的身份提供商的基本信息。",
"configuration": "配置",
"configuration-description": "配置身份提供商的连接设置",
"auth-url": "授权网址",
@@ -501,7 +501,7 @@
"ldaps-description": "从一开始就使用 TLS(端口 636)",
"none": "没有任何",
"none-description": "无加密(不建议用于生产)",
- "domain-optional-hint": "可选:限制此域用户的访问",
+ "domain-optional-hint": "(可选)如果 SSO 所提供的用户唯一标识符不是电子邮件格式,则会用域名进行拼接。",
"provider-type-readonly-hint": "提供商类型创建后无法更改",
"identifier-placeholder": "例如登录名、电子邮件",
"display-name-placeholder": "例如名称、显示名称",
@@ -1025,7 +1025,7 @@
}
},
"plan": {
- "new-plan": "新计划",
+ "new-plan": "创建变更计划",
"add-spec": "添加变更项",
"change-type": "变更类型",
"schema-migration": "Schema 变更",
@@ -2292,11 +2292,11 @@
},
"identity-provider": {
"test-connection": "测试连接",
- "identity-provider-created": "身份提供者创建成功",
- "identity-provider-deleted": "身份提供者已成功删除",
- "identity-provider-update-failed": "无法更新身份提供者",
- "identity-provider-create-failed": "无法创建身份提供者",
- "identity-provider-delete-failed": "无法删除身份提供者",
+ "identity-provider-created": "身份提供商创建成功",
+ "identity-provider-deleted": "身份提供商已成功删除",
+ "identity-provider-update-failed": "无法更新身份提供商",
+ "identity-provider-create-failed": "无法创建身份提供商",
+ "identity-provider-delete-failed": "无法删除身份提供商",
"identity-provider-permission-denied": "没有权限"
},
"sensitive-data": {
diff --git a/frontend/src/router/dashboard/workspace.ts b/frontend/src/router/dashboard/workspace.ts
index 12fde28070..723ae2ab20 100644
--- a/frontend/src/router/dashboard/workspace.ts
+++ b/frontend/src/router/dashboard/workspace.ts
@@ -1,7 +1,7 @@
-import DummyRootView from "@/DummyRootView";
-import { t } from "@/plugins/i18n";
import { startCase } from "lodash-es";
import type { RouteRecordRaw } from "vue-router";
+import DummyRootView from "@/DummyRootView";
+import { t } from "@/plugins/i18n";
import {
DATABASE_ROUTE_DASHBOARD,
ENVIRONMENT_V1_ROUTE_DASHBOARD,
@@ -23,10 +23,9 @@ import {
WORKSPACE_ROUTE_SQL_REVIEW_CREATE,
WORKSPACE_ROUTE_SQL_REVIEW_DETAIL,
WORKSPACE_ROUTE_SSO,
- WORKSPACE_ROUTE_SSO_CREATE,
WORKSPACE_ROUTE_SSO_DETAIL,
WORKSPACE_ROUTE_USER_PROFILE,
- WORKSPACE_ROUTE_USERS
+ WORKSPACE_ROUTE_USERS,
} from "./workspaceRoutes";
const rootRoute: RouteRecordRaw = {
@@ -200,14 +199,6 @@ const workspaceRoutes: RouteRecordRaw[] = [
},
component: () => import("@/views/SettingWorkspaceSSO.vue"),
},
- {
- path: "new",
- name: WORKSPACE_ROUTE_SSO_CREATE,
- meta: {
- requiredPermissionList: () => ["bb.identityProviders.create"],
- },
- component: () => import("@/views/SettingWorkspaceSSODetail.vue"),
- },
{
path: ":ssoId",
name: WORKSPACE_ROUTE_SSO_DETAIL,
diff --git a/frontend/src/router/dashboard/workspaceRoutes.ts b/frontend/src/router/dashboard/workspaceRoutes.ts
index b025f297c6..918498cc58 100644
--- a/frontend/src/router/dashboard/workspaceRoutes.ts
+++ b/frontend/src/router/dashboard/workspaceRoutes.ts
@@ -26,7 +26,6 @@ export const WORKSPACE_ROUTE_MEMBERS = "workspace.members";
export const WORKSPACE_ROUTE_ROLES = "workspace.roles";
export const WORKSPACE_ROUTE_SSO = "workspace.sso";
-export const WORKSPACE_ROUTE_SSO_CREATE = `${WORKSPACE_ROUTE_SSO}.create`;
export const WORKSPACE_ROUTE_SSO_DETAIL = `${WORKSPACE_ROUTE_SSO}.detail`;
export const WORKSPACE_ROUTE_IM = "workspace.im";
diff --git a/frontend/src/views/SettingWorkspaceSSO.vue b/frontend/src/views/SettingWorkspaceSSO.vue
index b773c146b8..bab93c5969 100644
--- a/frontend/src/views/SettingWorkspaceSSO.vue
+++ b/frontend/src/views/SettingWorkspaceSSO.vue
@@ -38,6 +38,12 @@
:open="state.showFeatureModal"
@cancel="state.showFeatureModal = false"
/>
+
+ <IdentityProviderCreateWizard
+ :show="state.showCreateDrawer"
+ @update:show="state.showCreateDrawer = $event"
+ @created="handleProviderCreated"
+ />
</template>
<script lang="ts" setup>
@@ -46,28 +52,31 @@ import { NButton } from "naive-ui";
import { computed, onMounted, reactive } from "vue";
import { useRouter } from "vue-router";
import { FeatureBadge, FeatureModal } from "@/components/FeatureGuard";
-import { IdentityProviderTable } from "@/components/IdentityProvider";
-import { WORKSPACE_ROUTE_SSO_CREATE } from "@/router/dashboard/workspaceRoutes";
+import {
+ IdentityProviderTable,
+ IdentityProviderCreateWizard,
+} from "@/components/IdentityProvider";
+import { WORKSPACE_ROUTE_SSO_DETAIL } from "@/router/dashboard/workspaceRoutes";
import { featureToRef } from "@/store";
import { useIdentityProviderStore } from "@/store/modules/idp";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";
import { PlanFeature } from "@/types/proto/v1/subscription_service";
-import { hasWorkspacePermissionV2 } from "@/utils";
+import {
+ extractIdentityProviderResourceName,
+ hasWorkspacePermissionV2,
+} from "@/utils";
interface LocalState {
isLoading: boolean;
showFeatureModal: boolean;
+ showCreateDrawer: boolean;
}
-const props = defineProps<{
- onClickCreate?: () => void;
- onClickView?: (sso: IdentityProvider) => void;
-}>();
-
const router = useRouter();
const state = reactive<LocalState>({
isLoading: true,
showFeatureModal: false,
+ showCreateDrawer: false,
});
const identityProviderStore = useIdentityProviderStore();
const hasSSOFeature = featureToRef(PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO);
@@ -90,14 +99,16 @@ const handleCreateSSO = () => {
state.showFeatureModal = true;
return;
}
+ state.showCreateDrawer = true;
+};
- if (props.onClickCreate) {
- props.onClickCreate();
- return;
- }
-
- router.push({
- name: WORKSPACE_ROUTE_SSO_CREATE,
+const handleProviderCreated = (provider: IdentityProvider) => {
+ state.showCreateDrawer = false;
+ router.replace({
+ name: WORKSPACE_ROUTE_SSO_DETAIL,
+ params: {
+ ssoId: extractIdentityProviderResourceName(provider.name),
+ },
});
};
</script>
diff --git a/frontend/src/views/SettingWorkspaceSSODetail.vue b/frontend/src/views/SettingWorkspaceSSODetail.vue
index 0c2c516d00..4caab4271a 100644
--- a/frontend/src/views/SettingWorkspaceSSODetail.vue
+++ b/frontend/src/views/SettingWorkspaceSSODetail.vue
@@ -14,15 +14,9 @@
</div>
</div>
- <!-- Create new identity provider -->
- <IdentityProviderCreateWizard
- v-if="!isLoading && !currentIdentityProvider"
- @created="props.onCreated"
- />
-
<!-- Edit existing identity provider -->
<IdentityProviderEditForm
- v-else-if="!isLoading && currentIdentityProvider"
+ v-if="!isLoading && currentIdentityProvider"
:identity-provider="currentIdentityProvider"
@updated="props.onUpdated"
@deleted="props.onDeleted"
@@ -42,10 +36,7 @@
import { computed, reactive, ref, watchEffect } from "vue";
import { BBSpin } from "@/bbkit";
import { FeatureModal } from "@/components/FeatureGuard";
-import {
- IdentityProviderCreateWizard,
- IdentityProviderEditForm,
-} from "@/components/IdentityProvider";
+import { IdentityProviderEditForm } from "@/components/IdentityProvider";
import { useIdentityProviderStore } from "@/store/modules/idp";
import { idpNamePrefix } from "@/store/modules/v1/common";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";