Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update create identity provider form (#4562)
boojacka128f32450a8
diff --git a/frontend/src/components/IdentityProviderCreateForm.vue b/frontend/src/components/IdentityProviderCreateForm.vueindex 11e90664c8..40f4ad3f49 100644--- a/frontend/src/components/IdentityProviderCreateForm.vue+++ b/frontend/src/components/IdentityProviderCreateForm.vue@@ -7,23 +7,34 @@v-if="isCreating"class="w-full flex flex-col justify-start items-start">- <p class="textinfolabel my-2">{{ $t("settings.sso.form.type") }}</p>+ <div class="w-full flex flex-row justify-between items-center">+ <p class="textlabel my-2">{{ $t("settings.sso.form.type") }}</p>+ <a+ v-if="userDocLink"+ :href="userDocLink"+ class="normal-link text-sm inline-flex flex-row items-center"+ target="_blank"+ >+ {{ $t("settings.sso.form.learn-more-with-user-doc") }}+ <heroicons-outline:external-link class="w-4 h-4" />+ </a>+ </div><div class="w-full flex flex-row justify-start items-start space-x-2"><labelv-for="item in identityProviderTypeList":key="item"- class="w-24 h-24 border rounded-md flex flex-col justify-center items-center cursor-pointer"+ class="flex flex-row justify-center items-center cursor-pointer mr-2":for="`radio-${item}`">- <span>{{ identityProviderTypeToString(item) }}</span><input:id="`radio-${item}`"v-model="state.type"type="radio"- class="btn mt-4"+ class="btn mr-2":value="item":checked="state.type === item"/>+ <span>{{ identityProviderTypeToString(item) }}</span></label></div></div>@@ -34,45 +45,33 @@class="w-full flex flex-col justify-start items-start space-y-3"><template v-if="isCreating">- <p class="textinfolabel !mt-4">- {{ $t("settings.sso.form.redirect-url") }}+ <p class="textlabel mt-4">+ {{ $t("settings.sso.form.use-template") }}</p>- <div class="w-full relative mt-1">- <input- type="text"- class="textfield w-full"- readonly- :value="redirectUrl"- />- <button- tabindex="-1"- class="absolute right-0 top-1/2 -translate-y-1/2 mr-2 p-1 text-control-light rounded hover:bg-gray-100"- @click.prevent="copyRedirectUrl"+ <div class="w-full flex flex-row justify-start items-start space-x-2">+ <label+ v-for="template in templateList"+ :key="template.title"+ class="w-24 h-24 border rounded-md flex flex-col justify-center items-center cursor-pointer hover:bg-gray-100"+ :for="`radio-${template.title}`"+ @click="handleTemplateSelect(template)">- <heroicons-outline:clipboard class="w-5 h-5" />- </button>+ <span>{{ template.title }}</span>+ <input+ :id="`radio-${template.title}`"+ type="radio"+ class="btn mt-4"+ :checked="selectedTemplate?.title === template.title"+ />+ </label></div>- <p class="textinfolabel !mt-4">- {{ $t("settings.sso.form.use-template") }}- </p>- <BBSelect- class="w-full"- :selected-item="selectedTemplate"- :item-list="templateList"- :placeholder="$t('settings.sso.form.select-template')"- @select-item="handleTemplateSelect"- >- <template #menuItem="{ item: template }">- {{ template.title }}- </template>- </BBSelect></template><hr class="w-full bg-gray-50" />- <p class="textinfolabel !mt-4">+ <p class="text-lg font-medium !mt-4">{{ $t("settings.sso.form.basic-information") }}</p><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">{{ $t("settings.sso.form.name") }}<span class="text-red-600">*</span></p>@@ -86,7 +85,7 @@v-if="isCreating"class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">{{ $t("settings.sso.form.resource-id") }}<span class="text-red-600">*</span></p>@@ -98,7 +97,7 @@/></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">{{ $t("settings.sso.form.domain") }}<span class="text-red-600">*</span></p>@@ -110,19 +109,46 @@/></div>- <div class="w-full flex flex-row !mt-4">- <p class="textinfolabel">+ <div class="w-full flex flex-col justify-start items-start">+ <p class="text-lg font-medium mt-2">{{ $t("settings.sso.form.identity-provider-information") }}</p>+ <p class="textinfolabel">+ {{+ $t("settings.sso.form.identity-provider-information-description")+ }}+ </p>+ </div>+ <div+ v-if="isCreating"+ class="w-full flex flex-row justify-start items-center"+ >+ <p class="textlabel">+ {{ $t("settings.sso.form.redirect-url") }}+ </p><ShowMoreIcon- class="inline-block ml-1"- :content="- $t('settings.sso.form.identity-provider-information-description')- "+ class="ml-1 mr-2"+ :content="$t('settings.sso.form.redirect-url-description')"/>+ <div class="relative grow">+ <input+ type="text"+ class="textfield w-full pr-10"+ readonly+ disabled+ :value="redirectUrl"+ />+ <button+ tabindex="-1"+ class="absolute right-0 top-1/2 -translate-y-1/2 mr-2 p-1 text-control-light rounded hover:bg-gray-100"+ @click.prevent="copyRedirectUrl"+ >+ <heroicons-outline:clipboard class="w-5 h-5" />+ </button>+ </div></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">Client ID<span class="text-red-600">*</span></p>@@ -134,7 +160,7 @@/></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">Client secret<span class="text-red-600">*</span></p>@@ -149,19 +175,13 @@"/></div>-- <div class="w-full flex flex-row !mt-4">- <p class="textinfolabel">- {{ $t("settings.sso.form.endpoints") }}- </p>- </div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">Auth URL<span class="text-red-600">*</span>- <span class="textinfolabel"- >({{ $t("settings.sso.form.auth-url-description") }})</span- >+ <span class="textinfolabel">+ ({{ $t("settings.sso.form.auth-url-description") }})+ </span></p><inputv-model="configForOAuth2.authUrl"@@ -171,12 +191,12 @@/></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">Scopes<span class="text-red-600">*</span>- <span class="textinfolabel"- >({{ $t("settings.sso.form.scopes-description") }})</span- >+ <span class="textinfolabel">+ ({{ $t("settings.sso.form.scopes-description") }})+ </span></p><inputv-model="scopesStringOfConfig"@@ -186,12 +206,12 @@/></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">Token URL<span class="text-red-600">*</span>- <span class="textinfolabel"- >({{ $t("settings.sso.form.token-url-description") }})</span- >+ <span class="textinfolabel">+ ({{ $t("settings.sso.form.token-url-description") }})+ </span></p><inputv-model="configForOAuth2.tokenUrl"@@ -201,12 +221,12 @@/></div><div class="w-full flex flex-col justify-start items-start">- <p>+ <p class="textlabel">User information URL<span class="text-red-600">*</span>- <span class="textinfolabel"- >({{ $t("settings.sso.form.user-info-url-description") }})</span- >+ <span class="textinfolabel">+ ({{ $t("settings.sso.form.user-info-url-description") }})+ </span></p><inputv-model="configForOAuth2.userInfoUrl"@@ -216,50 +236,70 @@/></div>- <div class="w-full flex flex-row !mt-4">- <p class="textinfolabel">+ <div class="w-full flex flex-col justify-start items-start">+ <p class="text-lg font-medium mt-2">{{ $t("settings.sso.form.user-information-mapping") }}</p>- <ShowMoreIcon- class="inline-block ml-1"- :content="- $t('settings.sso.form.user-information-mapping-description')- "- />- </div>- <div class="w-full flex flex-col justify-start items-start">- <p>- {{ $t("settings.sso.form.identifier") }}- <span class="text-red-600">*</span>+ <p class="textinfolabel">+ {{ $t("settings.sso.form.user-information-mapping-description") }}+ <a+ href="https://www.bytebase.com/docs/administration/sso/oauth2#user-information-field-mapping?source=console"+ class="normal-link text-sm inline-flex flex-row items-center"+ target="_blank"+ >+ {{ $t("common.learn-more") }}+ <heroicons-outline:external-link class="w-4 h-4" />+ </a></p>+ </div>+ <div class="w-full grid grid-cols-2"><inputv-model="configForOAuth2.fieldMapping!.identifier"type="text"class="textfield mt-1 w-full"placeholder="ex. login"/>+ <div class="w-full flex flex-row justify-start items-center text-sm">+ <heroicons-outline:arrow-right+ class="mx-1 h-auto w-4 text-gray-300"+ />+ <p>+ {{ $t("settings.sso.form.identifier") }}+ <span class="text-red-600">*</span>+ </p>+ </div></div>- <div class="w-full flex flex-col justify-start items-start">- <p>- {{ $t("settings.sso.form.display-name") }}- </p>+ <div class="w-full grid grid-cols-2"><inputv-model="configForOAuth2.fieldMapping!.displayName"type="text"class="textfield mt-1 w-full"placeholder="ex. name"/>+ <div class="w-full flex flex-row justify-start items-center text-sm">+ <heroicons-outline:arrow-right+ class="mx-1 h-auto w-4 text-gray-300"+ />+ <p>+ {{ $t("settings.sso.form.display-name") }}+ </p>+ </div></div>- <div class="w-full flex flex-col justify-start items-start">- <p>- {{ $t("common.email") }}- </p>+ <div class="w-full grid grid-cols-2"><inputv-model="configForOAuth2.fieldMapping!.email"type="text"class="textfield mt-1 w-full"placeholder="ex. email"/>+ <div class="w-full flex flex-row justify-start items-center text-sm">+ <heroicons-outline:arrow-right+ class="mx-1 h-auto w-4 text-gray-300"+ />+ <p>+ {{ $t("settings.sso.form.email") }}+ </p>+ </div></div></div>@@ -409,7 +449,7 @@</template><script lang="ts" setup>-import { cloneDeep, isEqual } from "lodash-es";+import { cloneDeep, head, isEqual } from "lodash-es";import { ClientError } from "nice-grpc-common";import { toClipboard } from "@soerenmartius/vue3-clipboard";import { useI18n } from "vue-i18n";@@ -421,6 +461,7 @@ import {ref,onMounted,onUnmounted,+ watch,} from "vue";import {FieldMapping,@@ -441,7 +482,6 @@ import {} from "@/utils";import { OAuthWindowEventPayload } from "@/types";import { identityProviderClient } from "@/grpcweb";-import ShowMoreIcon from "./ShowMoreIcon.vue";interface LocalState {type: IdentityProviderType;@@ -496,6 +536,13 @@ const isCreating = computed(() => {return !props.identityProviderName || props.identityProviderName === "";});+const userDocLink = computed(() => {+ if (state.type === IdentityProviderType.OAUTH2) {+ return "https://www.bytebase.com/docs/administration/sso/oauth2?source=console";+ }+ return "";+});+const templateList = computed(() => {if (state.type === IdentityProviderType.OAUTH2) {return identityProviderTemplateList.filter(@@ -764,4 +811,23 @@ const handleUpdateButtonClick = async () => {});updateEditState(updatedIdentityProvider);};++watch(+ () => state.type,+ () => {+ if (!isCreating.value) {+ return;+ }+ if (state.type === IdentityProviderType.OAUTH2) {+ if (!selectedTemplate.value && head(templateList.value)) {+ handleTemplateSelect(+ head(templateList.value) as IdentityProviderTemplate+ );+ }+ }+ },+ {+ immediate: true,+ }+);</script>diff --git a/frontend/src/components/ShowMoreIcon.vue b/frontend/src/components/ShowMoreIcon.vueindex 93bc26c828..d37a2d93a0 100644--- a/frontend/src/components/ShowMoreIcon.vue+++ b/frontend/src/components/ShowMoreIcon.vue@@ -1,7 +1,7 @@<template><n-tooltip trigger="hover"><template #trigger>- <heroicons-outline:question-mark-circle class="w-5 h-5" />+ <heroicons-outline:question-mark-circle class="w-5 h-5" v-bind="$attrs" /></template>{{ content }}</n-tooltip>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex dab9e47ff5..d37c1cb91f 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -403,13 +403,15 @@},"sso": {"create": "Create SSO",- "description": "Single sign-on (SSO) is an authentication method that enables users to authenticate with multiple applications and websites via a single set of credentials.",+ "description": "Single Sign-On (SSO) is an authentication method that enables users to authenticate with multiple applications and websites via a single set of credentials.","deletion": "Delete this SSO","form": {+ "type": "Type",+ "learn-more-with-user-doc": "Learn more about the configuration","redirect-url": "Authorization redirect url",+ "redirect-url-description": "It will be used to fill in the appropriate field in the OAuth provider application form.","use-template": "Use template","select-template": "Select template",- "type": "Type","basic-information": "Basic information","name": "Name","resource-id": "Resource ID",@@ -425,9 +427,10 @@"token-url-description": "The API address for obtaining accessToken","user-info-url-description": "The API address for obtaining user information by accessToken","user-information-mapping": "User information mapping",- "user-information-mapping-description": "Field mapping saves the field names from user info API.",- "identifier": "Identifier",- "display-name": "Display name"+ "user-information-mapping-description": "Maps the field names from user info API to the Bytebase user.",+ "identifier": "Bytebase User Identifier",+ "display-name": "Bytebase User Display name",+ "email": "Bytebase User Email"},"copy-redirect-url": "Redirect URL copied to clipboard. Paste to the corresponding field on the OAuth application form."},@@ -1689,7 +1692,7 @@"desc": "Connect to a read replica for the read-only data source."},"bb-feature-sso": {- "title": "Single sign-on (SSO)",+ "title": "Single Sign-On (SSO)","desc": "Enables users to securely authenticate with multiple applications and websites via a single set of credentials."}}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex bf97bcf2ae..988d7dfe2e 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -406,10 +406,12 @@"description": "单点登录(SSO)是一种认证方法,使用户能够通过其他应用程序和网站来进行登录。","deletion": "删除这个 SSO","form": {+ "type": "类型",+ "learn-more-with-user-doc": "了解更多如何配置","redirect-url": "回调地址",+ "redirect-url-description": "将会用于填写到 OAuth 提供商申请表单中的相应字段。","use-template": "使用模版","select-template": "选择模版",- "type": "类型","basic-information": "基础信息","name": "名称","resource-id": "资源 ID",@@ -426,8 +428,9 @@"user-info-url-description": "用于通过 accessToken 获取用户信息的 API 地址","user-information-mapping": "用户信息映射","user-information-mapping-description": "字段映射保存了来自 API 用户信息的字段名。",- "identifier": "唯一标识符",- "display-name": "昵称"+ "identifier": "Bytebase 用户的唯一标识符",+ "display-name": "Bytebase 用户的昵称",+ "email": "Bytebase 用户的 Email"},"copy-redirect-url": "Redirect URL 已复制到剪切板,请粘贴至 OAuth 应用的对应字段内。"},@@ -1690,7 +1693,7 @@"desc": "使用只读副本连接到只读数据源。"},"bb-feature-sso": {- "title": "Single sign-on (SSO)",+ "title": "Single Sign-On (SSO)","desc": "使得用户能够通过 SSO 安全地进行登录 Bytebase。"}}diff --git a/frontend/src/views/SettingWorkspaceSSO.vue b/frontend/src/views/SettingWorkspaceSSO.vueindex 7d1b1fa14f..9fcc23bf84 100644--- a/frontend/src/views/SettingWorkspaceSSO.vue+++ b/frontend/src/views/SettingWorkspaceSSO.vue@@ -3,6 +3,14 @@<div class="w-full flex flex-row justify-between items-center"><div class="textinfolabel mr-4">{{ $t("settings.sso.description") }}+ <a+ href="https://bytebase.com/docs/administration/sso?source=console"+ class="normal-link inline-flex flex-row items-center"+ target="_blank"+ >+ {{ $t("common.learn-more") }}+ <heroicons-outline:external-link class="w-4 h-4" />+ </a></div><div><button class="btn-primary" @click="handleCreateSSO">