Skip to content

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

chore: some ux fix and optimize (#16533)

ecmadao941a7021cdd6
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
index 47b71c4aab..ce75c5108f 100644
--- a/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
@@ -188,23 +188,24 @@
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>
- <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") }}
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
index 5c8d12c67f..39e2c323cc 100644
--- a/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
@@ -9,6 +9,24 @@
</h1>
</div>
<div class="flex-1 mt-4 lg:px-4 lg:mt-0 space-y-6">
+ <div>
+ <p class="text-base font-semibold text-gray-800 mb-2">
+ {{ $t("common.type") }}
+ </p>
+ <div class="flex items-center space-x-3 p-3 bg-gray-50 rounded-md">
+ <component
+ :is="getProviderIcon(localIdentityProvider.type)"
+ class="w-5 h-5 text-gray-600"
+ />
+ <span class="text-base font-medium text-gray-800">
+ {{ identityProviderTypeToString(localIdentityProvider.type) }}
+ </span>
+ </div>
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.provider-type-readonly-hint") }}
+ </p>
+ </div>
+
<div>
<p class="text-base font-semibold text-gray-800 mb-2">
{{ $t("settings.sso.form.name") }}
@@ -22,21 +40,12 @@
class="w-full text-base"
:placeholder="$t('settings.sso.form.name-description')"
/>
- </div>
-
- <div>
- <p class="text-base font-semibold text-gray-800 mb-2">
- {{ $t("settings.sso.form.resource-id") }}
- </p>
- <BBTextField
+ <ResourceIdField
+ resource-type="idp"
+ :readonly="true"
:value="resourceId"
- readonly
- size="large"
- class="w-full text-base bg-gray-50"
+ class="mt-1"
/>
- <p class="text-sm text-gray-600 mt-1">
- {{ $t("settings.sso.form.resource-id-readonly-hint") }}
- </p>
</div>
<div>
@@ -54,24 +63,6 @@
{{ $t("settings.sso.form.domain-optional-hint") }}
</p>
</div>
-
- <div>
- <p class="text-base font-semibold text-gray-800 mb-2">
- {{ $t("common.type") }}
- </p>
- <div class="flex items-center space-x-3 p-3 bg-gray-50 rounded-md">
- <component
- :is="getProviderIcon(localIdentityProvider.type)"
- class="w-5 h-5 text-gray-600"
- />
- <span class="text-base font-medium text-gray-800">
- {{ identityProviderTypeToString(localIdentityProvider.type) }}
- </span>
- </div>
- <p class="text-sm text-gray-600 mt-1">
- {{ $t("settings.sso.form.provider-type-readonly-hint") }}
- </p>
- </div>
</div>
</div>
@@ -263,6 +254,7 @@ import { computed, reactive, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBTextField, BBButtonConfirm } from "@/bbkit";
+import { ResourceIdField } from "@/components/v2";
import { WORKSPACE_ROUTE_SSO } from "@/router/dashboard/workspaceRoutes";
import { pushNotification } from "@/store";
import { useIdentityProviderStore } from "@/store/modules/idp";
diff --git a/frontend/src/components/v2/Form/ResourceIdField.vue b/frontend/src/components/v2/Form/ResourceIdField.vue
index 184754a33c..bedc7cc9c7 100644
--- a/frontend/src/components/v2/Form/ResourceIdField.vue
+++ b/frontend/src/components/v2/Form/ResourceIdField.vue
@@ -1,11 +1,16 @@
<template>
<div v-if="visible">
<template v-if="readonly || !state.manualEdit">
- <div class="textinfolabel text-sm space-x-1">
+ <div class="textinfolabel text-sm gap-x-1 flex items-center">
{{ $t("resource-id.self", { resource: resourceName }) }}:
- <span v-if="state.resourceId" class="text-gray-600 font-medium mr-1">
+ <div v-if="state.resourceId" class="text-gray-600 font-medium mr-1 flex items-center gap-x-1">
{{ state.resourceId }}
- </span>
+ <NButton v-if="isSupported && readonly" text size="tiny" @click="handleCopy">
+ <template #icon>
+ <CopyIcon class="w-3 h-3" />
+ </template>
+ </NButton>
+ </div>
<span v-else class="text-control-placeholder italic">
{{ "<EMPTY>" }}
</span>
@@ -58,13 +63,16 @@
</template>
<script lang="ts" setup>
-import { NInput, type InputProps } from "naive-ui";
+import { NInput, NButton, type InputProps } from "naive-ui";
import { Status } from "nice-grpc-common";
import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
import type { ResourceId, ValidatedMessage } from "@/types";
import { randomString } from "@/utils";
import { getErrorCode } from "@/utils/grpcweb";
+import { CopyIcon } from "lucide-vue-next";
+import { useClipboard } from "@vueuse/core";
+import { pushNotification } from "@/store"
// characters is the validated characters for resource id.
const characters = "abcdefghijklmnopqrstuvwxyz1234567890-";
@@ -289,6 +297,24 @@ watch(
}
);
+const { copy: copyTextToClipboard, isSupported } = useClipboard({
+ legacy: true,
+});
+
+const handleCopy = () => {
+ if (!isSupported.value) {
+ return;
+ }
+ copyTextToClipboard(props.value).then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.copied"),
+ });
+ });
+};
+
+
defineExpose({
resourceId: computed(() => state.resourceId),
isValidated: computed(() => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 982873b842..b25831dc73 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -446,7 +446,6 @@
"template-description": "Choose a pre-configured template or set up a custom OAuth 2.0 provider",
"name": "Name",
"name-description": "The display name to be shown to the users",
- "resource-id": "Resource ID",
"domain": "Domain",
"domain-description": "The identity provider's domain name",
"identity-provider-needed-information": "Create your SSO application with the following information.",
@@ -502,7 +501,6 @@
"ldaps-description": "Use TLS from the beginning (port 636)",
"none": "None",
"none-description": "No encryption (not recommended for production)",
- "resource-id-readonly-hint": "Resource ID cannot be changed after creation",
"domain-optional-hint": "Optional: Restrict access to users from this domain",
"provider-type-readonly-hint": "Provider type cannot be changed after creation",
"identifier-placeholder": "e.g. login, email",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 94089da4fa..cf9ef6fde3 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -446,7 +446,6 @@
"template-description": "Elija una plantilla preconfigurada o configure un proveedor OAuth 2.0 personalizado",
"name": "Nombre",
"name-description": "El nombre de visualización que se mostrará a los usuarios",
- "resource-id": "ID de recurso",
"domain": "Dominio",
"domain-description": "El nombre de dominio del proveedor de identidad",
"identity-provider-needed-information": "Cree su aplicación SSO con la siguiente información.",
@@ -502,7 +501,6 @@
"ldaps-description": "Utilice TLS desde el principio (puerto 636)",
"none": "Ninguno",
"none-description": "Sin cifrado (no recomendado para producción)",
- "resource-id-readonly-hint": "El ID del recurso no se puede cambiar después de su creación",
"domain-optional-hint": "Opcional: Restringir el acceso a los usuarios de este dominio",
"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",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 82f1178e5e..edf72ea523 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -446,7 +446,6 @@
"template-description": "事前設定されたテンプレートを選択するか、カスタムのOAuth 2.0プロバイダーを設定します",
"name": "名前",
"name-description": "ログインユーザーに表示される名前",
- "resource-id": "リソースID",
"domain": "ドメイン名",
"domain-description": "OAuthプロバイダーのドメイン名",
"identity-provider-needed-information": "次の情報を使用して SSO アプリケーションを作成します。",
@@ -502,7 +501,6 @@
"ldaps-description": "最初から TLS を使用する (ポート 636)",
"none": "なし",
"none-description": "暗号化なし(本番環境では推奨されません)",
- "resource-id-readonly-hint": "リソースIDは作成後に変更できません",
"domain-optional-hint": "オプション: このドメインのユーザーへのアクセスを制限する",
"provider-type-readonly-hint": "プロバイダタイプは作成後に変更できません",
"identifier-placeholder": "例:ログイン、メール",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 4093bf3fea..815807edf5 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -446,7 +446,6 @@
"template-description": "Chọn một mẫu được cấu hình sẵn hoặc thiết lập một nhà cung cấp OAuth 2.0 tùy chỉnh",
"name": "Tên",
"name-description": "Tên hiển thị sẽ được hiển thị cho người dùng",
- "resource-id": "ID tài nguyên",
"domain": "Tên miền",
"domain-description": "Tên miền của nhà cung cấp danh tính",
"identity-provider-needed-information": "Tạo ứng dụng SSO của bạn với các thông tin sau.",
@@ -502,7 +501,6 @@
"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)",
- "resource-id-readonly-hint": "ID tài nguyên không thể thay đổi sau khi tạo",
"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",
"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",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 3a3a25af79..eeaf345fec 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -446,7 +446,6 @@
"template-description": "选择预配置的模板或自定义 OAuth 2.0 提供商。",
"name": "名称",
"name-description": "显示给登录用户的名称",
- "resource-id": "资源 ID",
"domain": "域名",
"domain-description": "OAuth 提供商的域名",
"identity-provider-needed-information": "用以下信息创建您的 SSO 应用程序。",
@@ -502,7 +501,6 @@
"ldaps-description": "从一开始就使用 TLS(端口 636)",
"none": "没有任何",
"none-description": "无加密(不建议用于生产)",
- "resource-id-readonly-hint": "资源 ID 创建后无法更改",
"domain-optional-hint": "可选:限制此域用户的访问",
"provider-type-readonly-hint": "提供商类型创建后无法更改",
"identifier-placeholder": "例如登录名、电子邮件",
diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
index 6de5d1feb2..77d204728e 100644
--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
@@ -429,7 +429,7 @@ const handleCopyDatabaseName = (name: string) => {
pushNotification({
module: "bytebase",
style: "SUCCESS",
- title: "Database full name copied.",
+ title: t("common.copied"),
});
});
};