Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(settings): redesign the vault list, create menu and credential forms (#23645)

Rdmclin2f09018061efe
diff --git a/locales/ar/setting.json b/locales/ar/setting.json
index a715e9d7cb0..c7b1ca2e5d3 100644
--- a/locales/ar/setting.json
+++ b/locales/ar/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "تعديل",
"creds.actions.view": "عرض",
"creds.create": "بيانات اعتماد جديدة",
- "creds.createModal.fillForm": "املأ التفاصيل",
- "creds.createModal.selectType": "اختر النوع",
- "creds.createModal.title": "إنشاء بيانات اعتماد",
- "creds.edit.title": "تعديل بيانات الاعتماد",
"creds.empty": "لم يتم تكوين أي بيانات اعتماد حتى الآن",
"creds.errors.createFailed": "تعذّر إنشاء بيانات الاعتماد. حاول مرة أخرى.",
"creds.errors.multiOrgShareDisabled": "مشاركة بيانات اعتماد واحدة في عدة مساحات عمل غير متاحة بعد. أزل المشاركة الأخرى أولاً.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "فشل تحميل الملف",
"creds.file.uploadSuccess": "تم تحميل الملف بنجاح",
"creds.file.uploading": "جارٍ التحميل...",
- "creds.form.addPair": "إضافة زوج مفتاح-قيمة",
- "creds.form.back": "رجوع",
"creds.form.cancel": "إلغاء",
"creds.form.connectionRequired": "يرجى اختيار اتصال OAuth",
"creds.form.description": "الوصف",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "يدعم تنسيقات ملفات JSON وPEM وغيرها من ملفات بيانات الاعتماد",
"creds.form.uploadHint": "انقر أو اسحب الملف لتحميله",
"creds.form.valuePlaceholder": "أدخل القيمة",
- "creds.form.values": "أزواج المفتاح-القيمة",
"creds.oauth.noConnections": "لا توجد اتصالات OAuth متاحة. يرجى توصيل حساب أولاً.",
"creds.orgSetupRequired": "لم يتم إعداد ملف تعريف المجتمع بعد. يرجى إكمال إعداد ملف تعريف مجتمع مساحة العمل لإدارة بيانات الاعتماد.",
"creds.owner.fromPersonal": "من حسابك الشخصي",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "لم يتم الاستخدام",
"creds.table.preview": "معاينة",
"creds.table.type": "النوع",
- "creds.typeDesc.file": "تحميل ملفات بيانات الاعتماد مثل حسابات الخدمة أو الشهادات",
- "creds.typeDesc.kv-env": "تخزين مفاتيح API والرموز كمتغيرات بيئية",
- "creds.typeDesc.kv-header": "تخزين قيم التفويض كعناوين HTTP",
- "creds.typeDesc.oauth": "ربط باتصال OAuth موجود",
"creds.types.all": "الكل",
"creds.types.file": "ملف",
"creds.types.kv-env": "بيئة",
diff --git a/locales/bg-BG/setting.json b/locales/bg-BG/setting.json
index 7da7b6a084a..7a171096bfc 100644
--- a/locales/bg-BG/setting.json
+++ b/locales/bg-BG/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Редактирай",
"creds.actions.view": "Преглед",
"creds.create": "Нов идентификатор",
- "creds.createModal.fillForm": "Попълнете детайлите",
- "creds.createModal.selectType": "Изберете тип",
- "creds.createModal.title": "Създаване на идентификатор",
- "creds.edit.title": "Редактиране на идентификатор",
"creds.empty": "Все още няма конфигурирани идентификатори",
"creds.errors.createFailed": "Неуспешно създаване на удостоверението за достъп. Опитайте отново.",
"creds.errors.multiOrgShareDisabled": "Споделянето на едно удостоверение за достъп в няколко работни пространства все още не е налично. Първо премахнете другото му споделяне.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Качването на файла не бе успешно",
"creds.file.uploadSuccess": "Файлът беше качен успешно",
"creds.file.uploading": "Качване...",
- "creds.form.addPair": "Добавяне на ключ-стойност двойка",
- "creds.form.back": "Назад",
"creds.form.cancel": "Отказ",
"creds.form.connectionRequired": "Моля, изберете OAuth връзка",
"creds.form.description": "Описание",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Поддържа JSON, PEM и други формати на файлове с идентификатори",
"creds.form.uploadHint": "Кликнете или плъзнете файл за качване",
"creds.form.valuePlaceholder": "Въведете стойност",
- "creds.form.values": "Ключ-стойност двойки",
"creds.oauth.noConnections": "Няма налични OAuth връзки. Моля, свържете акаунт първо.",
"creds.orgSetupRequired": "Профилът на общността не е настроен. Моля, завършете настройката на профила на общността на работното пространство, за да управлявате идентификационните данни.",
"creds.owner.fromPersonal": "От вашия личен акаунт",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Никога",
"creds.table.preview": "Преглед",
"creds.table.type": "Тип",
- "creds.typeDesc.file": "Качете файлове с идентификатори като акаунти за услуги или сертификати",
- "creds.typeDesc.kv-env": "Съхранявайте API ключове и токени като променливи на средата",
- "creds.typeDesc.kv-header": "Съхранявайте стойности за удостоверяване като HTTP заглавки",
- "creds.typeDesc.oauth": "Свържете се със съществуваща OAuth връзка",
"creds.types.all": "Всички",
"creds.types.file": "Файл",
"creds.types.kv-env": "Среда",
diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json
index fb1467ed971..fb1b9c6065e 100644
--- a/locales/de-DE/setting.json
+++ b/locales/de-DE/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Bearbeiten",
"creds.actions.view": "Ansehen",
"creds.create": "Neue Berechtigung",
- "creds.createModal.fillForm": "Details ausfüllen",
- "creds.createModal.selectType": "Typ auswählen",
- "creds.createModal.title": "Berechtigung erstellen",
- "creds.edit.title": "Berechtigung bearbeiten",
"creds.empty": "Noch keine Berechtigungen konfiguriert",
"creds.errors.createFailed": "Zugangsdaten konnten nicht erstellt werden. Bitte versuche es erneut.",
"creds.errors.multiOrgShareDisabled": "Dieselben Zugangsdaten können noch nicht in mehrere Arbeitsbereiche geteilt werden. Entferne zuerst die andere Freigabe.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Datei-Upload fehlgeschlagen",
"creds.file.uploadSuccess": "Datei erfolgreich hochgeladen",
"creds.file.uploading": "Hochladen...",
- "creds.form.addPair": "Schlüssel-Wert-Paar hinzufügen",
- "creds.form.back": "Zurück",
"creds.form.cancel": "Abbrechen",
"creds.form.connectionRequired": "Bitte wählen Sie eine OAuth-Verbindung aus",
"creds.form.description": "Beschreibung",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Unterstützt JSON-, PEM- und andere Berechtigungsdateiformate",
"creds.form.uploadHint": "Klicken oder Datei ziehen, um hochzuladen",
"creds.form.valuePlaceholder": "Wert eingeben",
- "creds.form.values": "Schlüssel-Wert-Paare",
"creds.oauth.noConnections": "Keine OAuth-Verbindungen verfügbar. Bitte verbinden Sie zuerst ein Konto.",
"creds.orgSetupRequired": "Community-Profil noch nicht eingerichtet. Bitte richten Sie das Community-Profil des Arbeitsbereichs ein, um Anmeldedaten zu verwalten.",
"creds.owner.fromPersonal": "Aus deinem persönlichen Konto",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Nie",
"creds.table.preview": "Vorschau",
"creds.table.type": "Typ",
- "creds.typeDesc.file": "Berechtigungsdateien wie Servicekonten oder Zertifikate hochladen",
- "creds.typeDesc.kv-env": "API-Schlüssel und Tokens als Umgebungsvariablen speichern",
- "creds.typeDesc.kv-header": "Autorisierungswerte als HTTP-Header speichern",
- "creds.typeDesc.oauth": "Mit einer bestehenden OAuth-Verbindung verknüpfen",
"creds.types.all": "Alle",
"creds.types.file": "Datei",
"creds.types.kv-env": "Umgebung",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 0e80a414854..24751b85b44 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -469,10 +469,10 @@
"creds.actions.edit": "Edit",
"creds.actions.view": "View",
"creds.create": "New Credential",
- "creds.createModal.fillForm": "Fill Details",
- "creds.createModal.selectType": "Select Type",
- "creds.createModal.title": "Create Credential",
- "creds.edit.title": "Edit Credential",
+ "creds.createModal.titles.file": "New credential file",
+ "creds.createModal.titles.kv-env": "New environment variable",
+ "creds.createModal.titles.kv-header": "New HTTP header",
+ "creds.createModal.titles.oauth": "New OAuth credential",
"creds.empty": "No credentials configured yet",
"creds.errors.createFailed": "Failed to create the credential. Please try again.",
"creds.errors.multiOrgShareDisabled": "Sharing one credential into several workspaces is not available yet. Remove its other share first.",
@@ -483,19 +483,23 @@
"creds.file.uploadFailed": "File upload failed",
"creds.file.uploadSuccess": "File uploaded successfully",
"creds.file.uploading": "Uploading...",
- "creds.form.addPair": "Add Key-Value Pair",
- "creds.form.back": "Back",
+ "creds.form.addEnvVar": "Add variable",
+ "creds.form.addHeader": "Add header",
"creds.form.cancel": "Cancel",
"creds.form.connectionRequired": "Please select an OAuth connection",
"creds.form.description": "Description",
"creds.form.descriptionPlaceholder": "Optional description for this credential",
+ "creds.form.envVars": "Environment variables",
"creds.form.file": "Credential File",
"creds.form.fileRequired": "Please upload a file",
+ "creds.form.headers": "Headers",
"creds.form.key": "Identifier",
+ "creds.form.keyDesc": "Agents find this credential by its identifier. Letters, numbers, hyphens and underscores only.",
"creds.form.keyPattern": "Identifier can only contain letters, numbers, underscores, and hyphens",
"creds.form.keyRequired": "Identifier is required",
"creds.form.name": "Display Name",
"creds.form.nameRequired": "Display name is required",
+ "creds.form.removePair": "Remove",
"creds.form.save": "Save",
"creds.form.selectConnection": "Select OAuth Connection",
"creds.form.selectConnectionPlaceholder": "Choose a connected account",
@@ -504,11 +508,13 @@
"creds.form.uploadDesc": "Supports JSON, PEM, and other credential file formats",
"creds.form.uploadHint": "Click or drag file to upload",
"creds.form.valuePlaceholder": "Enter value",
- "creds.form.values": "Key-Value Pairs",
+ "creds.form.valuesDesc.kv-env": "Set as environment variables when an agent uses this credential.",
+ "creds.form.valuesDesc.kv-header": "Sent as HTTP request headers when an agent uses this credential.",
"creds.oauth.noConnections": "No OAuth connections available. Please connect an account first.",
"creds.orgSetupRequired": "Community Profile not set up yet. Please complete the workspace Community Profile setup to manage credentials.",
"creds.owner.fromPersonal": "From your personal account",
"creds.owner.sharedBy": "Shared by {{name}}",
+ "creds.searchPlaceholder": "Search the vault",
"creds.share.alreadyShared": "Shared",
"creds.share.badge": "Shared to {{count}} workspaces",
"creds.share.confirm": "Share",
@@ -536,13 +542,9 @@
"creds.table.neverUsed": "Never",
"creds.table.preview": "Preview",
"creds.table.type": "Type",
- "creds.typeDesc.file": "Upload credential files like service accounts or certificates",
- "creds.typeDesc.kv-env": "Store API keys and tokens as environment variables",
- "creds.typeDesc.kv-header": "Store authorization values as HTTP headers",
- "creds.typeDesc.oauth": "Link to an existing OAuth connection",
"creds.types.all": "All",
"creds.types.file": "File",
- "creds.types.kv-env": "Environment",
+ "creds.types.kv-env": "Environment variable",
"creds.types.kv-header": "Header",
"creds.types.oauth": "OAuth",
"creds.view.error": "Failed to load credential",
diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json
index 70ccfc1bbdf..e1c7105f545 100644
--- a/locales/es-ES/setting.json
+++ b/locales/es-ES/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Editar",
"creds.actions.view": "Ver",
"creds.create": "Nueva Credencial",
- "creds.createModal.fillForm": "Completar Detalles",
- "creds.createModal.selectType": "Seleccionar Tipo",
- "creds.createModal.title": "Crear Credencial",
- "creds.edit.title": "Editar Credencial",
"creds.empty": "Aún no se han configurado credenciales",
"creds.errors.createFailed": "No se pudo crear la credencial. Inténtalo de nuevo.",
"creds.errors.multiOrgShareDisabled": "Aún no se puede compartir una credencial en varios espacios de trabajo. Elimina primero las demás comparticiones.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Error al cargar el archivo",
"creds.file.uploadSuccess": "Archivo cargado con éxito",
"creds.file.uploading": "Cargando...",
- "creds.form.addPair": "Agregar Par Clave-Valor",
- "creds.form.back": "Atrás",
"creds.form.cancel": "Cancelar",
"creds.form.connectionRequired": "Por favor, seleccione una conexión OAuth",
"creds.form.description": "Descripción",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Admite formatos de archivo de credenciales como JSON, PEM y otros",
"creds.form.uploadHint": "Haga clic o arrastre el archivo para cargarlo",
"creds.form.valuePlaceholder": "Ingrese valor",
- "creds.form.values": "Pares Clave-Valor",
"creds.oauth.noConnections": "No hay conexiones OAuth disponibles. Por favor, conecte una cuenta primero.",
"creds.orgSetupRequired": "El perfil de la comunidad no está configurado aún. Por favor, complete la configuración del perfil de la comunidad del espacio de trabajo para gestionar las credenciales.",
"creds.owner.fromPersonal": "De tu cuenta personal",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Nunca",
"creds.table.preview": "Vista Previa",
"creds.table.type": "Tipo",
- "creds.typeDesc.file": "Cargue archivos de credenciales como cuentas de servicio o certificados",
- "creds.typeDesc.kv-env": "Almacene claves API y tokens como variables de entorno",
- "creds.typeDesc.kv-header": "Almacene valores de autorización como encabezados HTTP",
- "creds.typeDesc.oauth": "Enlace a una conexión OAuth existente",
"creds.types.all": "Todos",
"creds.types.file": "Archivo",
"creds.types.kv-env": "Entorno",
diff --git a/locales/fa-IR/setting.json b/locales/fa-IR/setting.json
index 05590b4ea65..2efe812b824 100644
--- a/locales/fa-IR/setting.json
+++ b/locales/fa-IR/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "ویرایش",
"creds.actions.view": "مشاهده",
"creds.create": "ایجاد اعتبارنامه جدید",
- "creds.createModal.fillForm": "جزئیات را پر کنید",
- "creds.createModal.selectType": "نوع را انتخاب کنید",
- "creds.createModal.title": "ایجاد اعتبارنامه",
- "creds.edit.title": "ویرایش اعتبارنامه",
"creds.empty": "هنوز هیچ اعتبارنامه‌ای تنظیم نشده است",
"creds.errors.createFailed": "ایجاد اعتبارنامه ممکن نشد. لطفاً دوباره تلاش کنید.",
"creds.errors.multiOrgShareDisabled": "اشتراک‌گذاری یک اعتبارنامه در چند فضای کاری هنوز در دسترس نیست. ابتدا اشتراک‌گذاری‌های دیگر آن را حذف کنید.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "بارگذاری فایل ناموفق بود",
"creds.file.uploadSuccess": "فایل با موفقیت بارگذاری شد",
"creds.file.uploading": "در حال بارگذاری...",
- "creds.form.addPair": "افزودن جفت کلید-مقدار",
- "creds.form.back": "بازگشت",
"creds.form.cancel": "لغو",
"creds.form.connectionRequired": "لطفاً یک اتصال OAuth را انتخاب کنید",
"creds.form.description": "توضیحات",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "از فرمت‌های JSON، PEM و سایر فرمت‌های فایل اعتبارنامه پشتیبانی می‌کند",
"creds.form.uploadHint": "برای بارگذاری فایل کلیک کنید یا فایل را بکشید",
"creds.form.valuePlaceholder": "مقدار را وارد کنید",
- "creds.form.values": "جفت‌های کلید-مقدار",
"creds.oauth.noConnections": "هیچ اتصال OAuth موجود نیست. لطفاً ابتدا یک حساب متصل کنید.",
"creds.orgSetupRequired": "پروفایل انجمن هنوز تنظیم نشده است. لطفاً تنظیمات پروفایل انجمن فضای کاری را برای مدیریت اعتبارنامه‌ها تکمیل کنید.",
"creds.owner.fromPersonal": "از حساب شخصی شما",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "هرگز",
"creds.table.preview": "پیش‌نمایش",
"creds.table.type": "نوع",
- "creds.typeDesc.file": "فایل‌های اعتبارنامه مانند حساب‌های سرویس یا گواهی‌ها را بارگذاری کنید",
- "creds.typeDesc.kv-env": "کلیدهای API و توکن‌ها را به عنوان متغیرهای محیطی ذخیره کنید",
- "creds.typeDesc.kv-header": "مقادیر مجوز را به عنوان هدرهای HTTP ذخیره کنید",
- "creds.typeDesc.oauth": "به یک اتصال OAuth موجود لینک دهید",
"creds.types.all": "همه",
"creds.types.file": "فایل",
"creds.types.kv-env": "محیط",
diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json
index ca2c220d41f..ec1fa2dd46a 100644
--- a/locales/fr-FR/setting.json
+++ b/locales/fr-FR/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Modifier",
"creds.actions.view": "Voir",
"creds.create": "Nouvelle information d'identification",
- "creds.createModal.fillForm": "Remplir les détails",
- "creds.createModal.selectType": "Sélectionner le type",
- "creds.createModal.title": "Créer une information d'identification",
- "creds.edit.title": "Modifier l'information d'identification",
"creds.empty": "Aucune information d'identification configurée pour le moment",
"creds.errors.createFailed": "Échec de la création de l'identifiant. Veuillez réessayer.",
"creds.errors.multiOrgShareDisabled": "Le partage d'un identifiant dans plusieurs espaces de travail n'est pas encore disponible. Retirez d'abord son autre partage.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Échec du téléchargement du fichier",
"creds.file.uploadSuccess": "Fichier téléchargé avec succès",
"creds.file.uploading": "Téléchargement en cours...",
- "creds.form.addPair": "Ajouter une paire clé-valeur",
- "creds.form.back": "Retour",
"creds.form.cancel": "Annuler",
"creds.form.connectionRequired": "Veuillez sélectionner une connexion OAuth",
"creds.form.description": "Description",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Prend en charge les formats de fichiers JSON, PEM et autres fichiers d'identification",
"creds.form.uploadHint": "Cliquez ou glissez un fichier pour le télécharger",
"creds.form.valuePlaceholder": "Entrer une valeur",
- "creds.form.values": "Paires clé-valeur",
"creds.oauth.noConnections": "Aucune connexion OAuth disponible. Veuillez d'abord connecter un compte.",
"creds.orgSetupRequired": "Profil Communautaire non encore configuré. Veuillez compléter la configuration du Profil Communautaire de l'espace de travail pour gérer les identifiants.",
"creds.owner.fromPersonal": "Depuis votre compte personnel",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Jamais",
"creds.table.preview": "Aperçu",
"creds.table.type": "Type",
- "creds.typeDesc.file": "Téléchargez des fichiers d'identification comme des comptes de service ou des certificats",
- "creds.typeDesc.kv-env": "Stockez des clés API et des jetons en tant que variables d'environnement",
- "creds.typeDesc.kv-header": "Stockez des valeurs d'autorisation en tant qu'en-têtes HTTP",
- "creds.typeDesc.oauth": "Liez à une connexion OAuth existante",
"creds.types.all": "Tous",
"creds.types.file": "Fichier",
"creds.types.kv-env": "Environnement",
diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json
index 71cc4a054d9..94780caf1f7 100644
--- a/locales/it-IT/setting.json
+++ b/locales/it-IT/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Modifica",
"creds.actions.view": "Visualizza",
"creds.create": "Nuova Credenziale",
- "creds.createModal.fillForm": "Compila i Dettagli",
- "creds.createModal.selectType": "Seleziona Tipo",
- "creds.createModal.title": "Crea Credenziale",
- "creds.edit.title": "Modifica Credenziale",
"creds.empty": "Nessuna credenziale configurata",
"creds.errors.createFailed": "Impossibile creare la credenziale. Riprova.",
"creds.errors.multiOrgShareDisabled": "La condivisione di una credenziale in più spazi di lavoro non è ancora disponibile. Rimuovi prima le altre condivisioni.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Caricamento del file fallito",
"creds.file.uploadSuccess": "File caricato con successo",
"creds.file.uploading": "Caricamento in corso...",
- "creds.form.addPair": "Aggiungi Coppia Chiave-Valore",
- "creds.form.back": "Indietro",
"creds.form.cancel": "Annulla",
"creds.form.connectionRequired": "Seleziona una connessione OAuth",
"creds.form.description": "Descrizione",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Supporta formati di file JSON, PEM e altri file di credenziali",
"creds.form.uploadHint": "Clicca o trascina il file per caricarlo",
"creds.form.valuePlaceholder": "Inserisci valore",
- "creds.form.values": "Coppie Chiave-Valore",
"creds.oauth.noConnections": "Nessuna connessione OAuth disponibile. Connetti prima un account.",
"creds.orgSetupRequired": "Profilo della comunità non ancora configurato. Completa la configurazione del profilo della comunità del workspace per gestire le credenziali.",
"creds.owner.fromPersonal": "Dal tuo account personale",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Mai",
"creds.table.preview": "Anteprima",
"creds.table.type": "Tipo",
- "creds.typeDesc.file": "Carica file di credenziali come account di servizio o certificati",
- "creds.typeDesc.kv-env": "Memorizza chiavi API e token come variabili d'ambiente",
- "creds.typeDesc.kv-header": "Memorizza valori di autorizzazione come intestazioni HTTP",
- "creds.typeDesc.oauth": "Collega a una connessione OAuth esistente",
"creds.types.all": "Tutti",
"creds.types.file": "File",
"creds.types.kv-env": "Ambiente",
diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json
index e43aaa2af15..713455fa625 100644
--- a/locales/ja-JP/setting.json
+++ b/locales/ja-JP/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "編集",
"creds.actions.view": "表示",
"creds.create": "新しい資格情報",
- "creds.createModal.fillForm": "詳細を入力",
- "creds.createModal.selectType": "タイプを選択",
- "creds.createModal.title": "資格情報を作成",
- "creds.edit.title": "資格情報を編集",
"creds.empty": "まだ資格情報が設定されていません",
"creds.errors.createFailed": "認証情報の作成に失敗しました。もう一度お試しください。",
"creds.errors.multiOrgShareDisabled": "1つの認証情報を複数のワークスペースに共有する機能はまだ利用できません。先に他の共有を解除してください。",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "ファイルのアップロードに失敗しました",
"creds.file.uploadSuccess": "ファイルが正常にアップロードされました",
"creds.file.uploading": "アップロード中...",
- "creds.form.addPair": "キーと値のペアを追加",
- "creds.form.back": "戻る",
"creds.form.cancel": "キャンセル",
"creds.form.connectionRequired": "OAuth接続を選択してください",
"creds.form.description": "説明",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "JSON、PEM、その他の資格情報ファイル形式をサポート",
"creds.form.uploadHint": "クリックまたはドラッグしてファイルをアップロード",
"creds.form.valuePlaceholder": "値を入力",
- "creds.form.values": "キーと値のペア",
"creds.oauth.noConnections": "利用可能なOAuth接続がありません。まずアカウントを接続してください。",
"creds.orgSetupRequired": "コミュニティプロファイルがまだ設定されていません。資格情報を管理するには、ワークスペースのコミュニティプロファイル設定を完了してください。",
"creds.owner.fromPersonal": "個人アカウントから",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "未使用",
"creds.table.preview": "プレビュー",
"creds.table.type": "タイプ",
- "creds.typeDesc.file": "サービスアカウントや証明書などの資格情報ファイルをアップロード",
- "creds.typeDesc.kv-env": "APIキーやトークンを環境変数として保存",
- "creds.typeDesc.kv-header": "認証値をHTTPヘッダーとして保存",
- "creds.typeDesc.oauth": "既存のOAuth接続にリンク",
"creds.types.all": "すべて",
"creds.types.file": "ファイル",
"creds.types.kv-env": "環境",
diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json
index 65a59fb2ed7..a369303676c 100644
--- a/locales/ko-KR/setting.json
+++ b/locales/ko-KR/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "편집",
"creds.actions.view": "보기",
"creds.create": "새 자격 증명",
- "creds.createModal.fillForm": "세부 정보 입력",
- "creds.createModal.selectType": "유형 선택",
- "creds.createModal.title": "자격 증명 생성",
- "creds.edit.title": "자격 증명 편집",
"creds.empty": "구성된 자격 증명이 없습니다",
"creds.errors.createFailed": "자격 증명을 생성하지 못했습니다. 다시 시도하세요.",
"creds.errors.multiOrgShareDisabled": "하나의 자격 증명을 여러 워크스페이스에 공유하는 기능은 아직 사용할 수 없습니다. 먼저 다른 공유를 제거하세요.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "파일 업로드 실패",
"creds.file.uploadSuccess": "파일 업로드 성공",
"creds.file.uploading": "업로드 중...",
- "creds.form.addPair": "키-값 쌍 추가",
- "creds.form.back": "뒤로",
"creds.form.cancel": "취소",
"creds.form.connectionRequired": "OAuth 연결을 선택하세요",
"creds.form.description": "설명",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "JSON, PEM 및 기타 자격 증명 파일 형식을 지원합니다",
"creds.form.uploadHint": "클릭하거나 파일을 드래그하여 업로드하세요",
"creds.form.valuePlaceholder": "값 입력",
- "creds.form.values": "키-값 쌍",
"creds.oauth.noConnections": "사용 가능한 OAuth 연결이 없습니다. 먼저 계정을 연결하세요.",
"creds.orgSetupRequired": "커뮤니티 프로필이 아직 설정되지 않았습니다. 자격 증명을 관리하려면 워크스페이스 커뮤니티 프로필 설정을 완료하세요.",
"creds.owner.fromPersonal": "개인 계정에서",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "사용 안 함",
"creds.table.preview": "미리보기",
"creds.table.type": "유형",
- "creds.typeDesc.file": "서비스 계정 또는 인증서와 같은 자격 증명 파일 업로드",
- "creds.typeDesc.kv-env": "API 키와 토큰을 환경 변수로 저장",
- "creds.typeDesc.kv-header": "HTTP 헤더로 인증 값을 저장",
- "creds.typeDesc.oauth": "기존 OAuth 연결에 연결",
"creds.types.all": "전체",
"creds.types.file": "파일",
"creds.types.kv-env": "환경 변수",
diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json
index efc56b3ef18..fee72f1e0c8 100644
--- a/locales/nl-NL/setting.json
+++ b/locales/nl-NL/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Bewerken",
"creds.actions.view": "Bekijken",
"creds.create": "Nieuwe Referentie",
- "creds.createModal.fillForm": "Vul Gegevens In",
- "creds.createModal.selectType": "Selecteer Type",
- "creds.createModal.title": "Referentie Aanmaken",
- "creds.edit.title": "Referentie Bewerken",
"creds.empty": "Nog geen referenties geconfigureerd",
"creds.errors.createFailed": "Kan de referentie niet aanmaken. Probeer het opnieuw.",
"creds.errors.multiOrgShareDisabled": "Het delen van één referentie in meerdere werkruimten is nog niet beschikbaar. Verwijder eerst de andere deling.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Bestandsupload mislukt",
"creds.file.uploadSuccess": "Bestand succesvol geüpload",
"creds.file.uploading": "Bezig met uploaden...",
- "creds.form.addPair": "Sleutel-Waarde Paar Toevoegen",
- "creds.form.back": "Terug",
"creds.form.cancel": "Annuleren",
"creds.form.connectionRequired": "Selecteer een OAuth-verbinding",
"creds.form.description": "Beschrijving",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Ondersteunt JSON-, PEM- en andere referentiebestandsformaten",
"creds.form.uploadHint": "Klik of sleep bestand om te uploaden",
"creds.form.valuePlaceholder": "Voer waarde in",
- "creds.form.values": "Sleutel-Waarde Paren",
"creds.oauth.noConnections": "Geen OAuth-verbindingen beschikbaar. Koppel eerst een account.",
"creds.orgSetupRequired": "Communityprofiel nog niet ingesteld. Voltooi de Communityprofielinstelling van de werkruimte om referenties te beheren.",
"creds.owner.fromPersonal": "Vanuit je persoonlijke account",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Nooit",
"creds.table.preview": "Voorbeeld",
"creds.table.type": "Type",
- "creds.typeDesc.file": "Upload referentiebestanden zoals serviceaccounts of certificaten",
- "creds.typeDesc.kv-env": "Sla API-sleutels en tokens op als omgevingsvariabelen",
- "creds.typeDesc.kv-header": "Sla autorisatiewaarden op als HTTP-headers",
- "creds.typeDesc.oauth": "Koppel aan een bestaande OAuth-verbinding",
"creds.types.all": "Alle",
"creds.types.file": "Bestand",
"creds.types.kv-env": "Omgeving",
diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json
index a78e77bc29a..0078f1fc040 100644
--- a/locales/pl-PL/setting.json
+++ b/locales/pl-PL/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Edytuj",
"creds.actions.view": "Wyświetl",
"creds.create": "Nowe poświadczenie",
- "creds.createModal.fillForm": "Wypełnij szczegóły",
- "creds.createModal.selectType": "Wybierz typ",
- "creds.createModal.title": "Utwórz poświadczenie",
- "creds.edit.title": "Edytuj poświadczenie",
"creds.empty": "Brak skonfigurowanych poświadczeń",
"creds.errors.createFailed": "Nie udało się utworzyć poświadczenia. Spróbuj ponownie.",
"creds.errors.multiOrgShareDisabled": "Udostępnianie jednego poświadczenia w kilku przestrzeniach roboczych nie jest jeszcze dostępne. Najpierw usuń jego inne udostępnienie.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Przesyłanie pliku nie powiodło się",
"creds.file.uploadSuccess": "Plik przesłany pomyślnie",
"creds.file.uploading": "Przesyłanie...",
- "creds.form.addPair": "Dodaj parę klucz-wartość",
- "creds.form.back": "Wstecz",
"creds.form.cancel": "Anuluj",
"creds.form.connectionRequired": "Proszę wybrać połączenie OAuth",
"creds.form.description": "Opis",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Obsługuje formaty plików JSON, PEM i inne formaty poświadczeń",
"creds.form.uploadHint": "Kliknij lub przeciągnij plik, aby go przesłać",
"creds.form.valuePlaceholder": "Wprowadź wartość",
- "creds.form.values": "Pary klucz-wartość",
"creds.oauth.noConnections": "Brak dostępnych połączeń OAuth. Najpierw połącz konto.",
"creds.orgSetupRequired": "Profil społeczności nie został jeszcze skonfigurowany. Proszę ukończyć konfigurację profilu społeczności w przestrzeni roboczej, aby zarządzać poświadczeniami.",
"creds.owner.fromPersonal": "Z Twojego konta osobistego",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Nigdy",
"creds.table.preview": "Podgląd",
"creds.table.type": "Typ",
- "creds.typeDesc.file": "Prześlij pliki poświadczeń, takie jak konta usługowe lub certyfikaty",
- "creds.typeDesc.kv-env": "Przechowuj klucze API i tokeny jako zmienne środowiskowe",
- "creds.typeDesc.kv-header": "Przechowuj wartości autoryzacyjne jako nagłówki HTTP",
- "creds.typeDesc.oauth": "Połącz z istniejącym połączeniem OAuth",
"creds.types.all": "Wszystkie",
"creds.types.file": "Plik",
"creds.types.kv-env": "Środowisko",
diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json
index 00d547d34b3..32b59d0b6fc 100644
--- a/locales/pt-BR/setting.json
+++ b/locales/pt-BR/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Editar",
"creds.actions.view": "Visualizar",
"creds.create": "Nova Credencial",
- "creds.createModal.fillForm": "Preencher Detalhes",
- "creds.createModal.selectType": "Selecionar Tipo",
- "creds.createModal.title": "Criar Credencial",
- "creds.edit.title": "Editar Credencial",
"creds.empty": "Nenhuma credencial configurada ainda",
"creds.errors.createFailed": "Não foi possível criar a credencial. Tente novamente.",
"creds.errors.multiOrgShareDisabled": "Compartilhar uma credencial em vários espaços de trabalho ainda não está disponível. Remova o outro compartilhamento primeiro.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Falha no envio do arquivo",
"creds.file.uploadSuccess": "Arquivo enviado com sucesso",
"creds.file.uploading": "Enviando...",
- "creds.form.addPair": "Adicionar Par Chave-Valor",
- "creds.form.back": "Voltar",
"creds.form.cancel": "Cancelar",
"creds.form.connectionRequired": "Por favor, selecione uma conexão OAuth",
"creds.form.description": "Descrição",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Suporta formatos de arquivo JSON, PEM e outros formatos de credenciais",
"creds.form.uploadHint": "Clique ou arraste o arquivo para enviar",
"creds.form.valuePlaceholder": "Insira o valor",
- "creds.form.values": "Pares Chave-Valor",
"creds.oauth.noConnections": "Nenhuma conexão OAuth disponível. Por favor, conecte uma conta primeiro.",
"creds.orgSetupRequired": "Perfil da Comunidade ainda não configurado. Conclua a configuração do Perfil da Comunidade do workspace para gerenciar credenciais.",
"creds.owner.fromPersonal": "Da sua conta pessoal",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Nunca",
"creds.table.preview": "Pré-visualizar",
"creds.table.type": "Tipo",
- "creds.typeDesc.file": "Envie arquivos de credenciais como contas de serviço ou certificados",
- "creds.typeDesc.kv-env": "Armazene chaves de API e tokens como variáveis de ambiente",
- "creds.typeDesc.kv-header": "Armazene valores de autorização como cabeçalhos HTTP",
- "creds.typeDesc.oauth": "Vincule a uma conexão OAuth existente",
"creds.types.all": "Todos",
"creds.types.file": "Arquivo",
"creds.types.kv-env": "Ambiente",
diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json
index 8fbcc6c522e..96efaac856f 100644
--- a/locales/ru-RU/setting.json
+++ b/locales/ru-RU/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Редактировать",
"creds.actions.view": "Просмотреть",
"creds.create": "Новые учетные данные",
- "creds.createModal.fillForm": "Заполните данные",
- "creds.createModal.selectType": "Выберите тип",
- "creds.createModal.title": "Создать учетные данные",
- "creds.edit.title": "Редактировать учетные данные",
"creds.empty": "Учетные данные еще не настроены",
"creds.errors.createFailed": "Не удалось создать учетные данные. Попробуйте еще раз.",
"creds.errors.multiOrgShareDisabled": "Делиться одними учетными данными в нескольких рабочих пространствах пока нельзя. Сначала отключите другой доступ.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Ошибка загрузки файла",
"creds.file.uploadSuccess": "Файл успешно загружен",
"creds.file.uploading": "Загрузка...",
- "creds.form.addPair": "Добавить пару ключ-значение",
- "creds.form.back": "Назад",
"creds.form.cancel": "Отмена",
"creds.form.connectionRequired": "Пожалуйста, выберите подключение OAuth",
"creds.form.description": "Описание",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Поддерживаются форматы файлов JSON, PEM и другие форматы учетных данных",
"creds.form.uploadHint": "Нажмите или перетащите файл для загрузки",
"creds.form.valuePlaceholder": "Введите значение",
- "creds.form.values": "Пары ключ-значение",
"creds.oauth.noConnections": "Нет доступных подключений OAuth. Пожалуйста, сначала подключите учетную запись.",
"creds.orgSetupRequired": "Профиль сообщества еще не настроен. Пожалуйста, завершите настройку профиля сообщества рабочего пространства, чтобы управлять учетными данными.",
"creds.owner.fromPersonal": "Из вашей личной учетной записи",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Никогда",
"creds.table.preview": "Предпросмотр",
"creds.table.type": "Тип",
- "creds.typeDesc.file": "Загрузите файлы учетных данных, такие как учетные записи сервисов или сертификаты",
- "creds.typeDesc.kv-env": "Сохраните API-ключи и токены в виде переменных окружения",
- "creds.typeDesc.kv-header": "Сохраните значения авторизации в виде HTTP-заголовков",
- "creds.typeDesc.oauth": "Свяжите с существующим подключением OAuth",
"creds.types.all": "Все",
"creds.types.file": "Файл",
"creds.types.kv-env": "Окружение",
diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json
index cdcb36c57f8..8bb26eaa00f 100644
--- a/locales/tr-TR/setting.json
+++ b/locales/tr-TR/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Düzenle",
"creds.actions.view": "Görüntüle",
"creds.create": "Yeni Kimlik Bilgisi",
- "creds.createModal.fillForm": "Bilgileri Doldurun",
- "creds.createModal.selectType": "Tür Seçin",
- "creds.createModal.title": "Kimlik Bilgisi Oluştur",
- "creds.edit.title": "Kimlik Bilgisini Düzenle",
"creds.empty": "Henüz yapılandırılmış kimlik bilgisi yok",
"creds.errors.createFailed": "Kimlik bilgisi oluşturulamadı. Lütfen tekrar deneyin.",
"creds.errors.multiOrgShareDisabled": "Bir kimlik bilgisini birden fazla çalışma alanıyla paylaşma henüz kullanılamıyor. Önce diğer paylaşımı kaldırın.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Dosya yükleme başarısız oldu",
"creds.file.uploadSuccess": "Dosya başarıyla yüklendi",
"creds.file.uploading": "Yükleniyor...",
- "creds.form.addPair": "Anahtar-Değer Çifti Ekle",
- "creds.form.back": "Geri",
"creds.form.cancel": "İptal",
"creds.form.connectionRequired": "Lütfen bir OAuth bağlantısı seçin",
"creds.form.description": "Açıklama",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "JSON, PEM ve diğer kimlik bilgisi dosya formatlarını destekler",
"creds.form.uploadHint": "Yüklemek için dosyayı tıklayın veya sürükleyin",
"creds.form.valuePlaceholder": "Değer girin",
- "creds.form.values": "Anahtar-Değer Çiftleri",
"creds.oauth.noConnections": "Mevcut OAuth bağlantısı yok. Lütfen önce bir hesap bağlayın.",
"creds.orgSetupRequired": "Topluluk Profili henüz ayarlanmadı. Kimlik bilgilerini yönetmek için lütfen çalışma alanı Topluluk Profili ayarlarını tamamlayın.",
"creds.owner.fromPersonal": "Kişisel hesabınızdan",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Hiçbir Zaman",
"creds.table.preview": "Önizleme",
"creds.table.type": "Tür",
- "creds.typeDesc.file": "Hizmet hesapları veya sertifikalar gibi kimlik bilgisi dosyalarını yükleyin",
- "creds.typeDesc.kv-env": "API anahtarlarını ve belirteçlerini ortam değişkenleri olarak saklayın",
- "creds.typeDesc.kv-header": "Yetkilendirme değerlerini HTTP başlıkları olarak saklayın",
- "creds.typeDesc.oauth": "Mevcut bir OAuth bağlantısına bağlanın",
"creds.types.all": "Tümü",
"creds.types.file": "Dosya",
"creds.types.kv-env": "Ortam",
diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json
index 69600c473f4..ffe71db20e1 100644
--- a/locales/vi-VN/setting.json
+++ b/locales/vi-VN/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "Chỉnh sửa",
"creds.actions.view": "Xem",
"creds.create": "Thông Tin Xác Thực Mới",
- "creds.createModal.fillForm": "Điền Thông Tin",
- "creds.createModal.selectType": "Chọn Loại",
- "creds.createModal.title": "Tạo Thông Tin Xác Thực",
- "creds.edit.title": "Chỉnh Sửa Thông Tin Xác Thực",
"creds.empty": "Chưa có thông tin xác thực nào được cấu hình",
"creds.errors.createFailed": "Không thể tạo thông tin xác thực. Vui lòng thử lại.",
"creds.errors.multiOrgShareDisabled": "Chia sẻ một thông tin xác thực vào nhiều không gian làm việc chưa được hỗ trợ. Hãy xóa chia sẻ khác của nó trước.",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "Tải tệp lên thất bại",
"creds.file.uploadSuccess": "Tệp đã được tải lên thành công",
"creds.file.uploading": "Đang tải lên...",
- "creds.form.addPair": "Thêm Cặp Khóa-Giá Trị",
- "creds.form.back": "Quay lại",
"creds.form.cancel": "Hủy",
"creds.form.connectionRequired": "Vui lòng chọn một kết nối OAuth",
"creds.form.description": "Mô tả",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "Hỗ trợ các định dạng tệp JSON, PEM và các định dạng tệp thông tin xác thực khác",
"creds.form.uploadHint": "Nhấp hoặc kéo tệp để tải lên",
"creds.form.valuePlaceholder": "Nhập giá trị",
- "creds.form.values": "Cặp Khóa-Giá Trị",
"creds.oauth.noConnections": "Không có kết nối OAuth nào. Vui lòng kết nối một tài khoản trước.",
"creds.orgSetupRequired": "Hồ sơ Cộng đồng chưa được thiết lập. Vui lòng hoàn thành thiết lập Hồ sơ Cộng đồng của không gian làm việc để quản lý thông tin đăng nhập.",
"creds.owner.fromPersonal": "Từ tài khoản cá nhân của bạn",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "Chưa bao giờ",
"creds.table.preview": "Xem trước",
"creds.table.type": "Loại",
- "creds.typeDesc.file": "Tải lên các tệp thông tin xác thực như tài khoản dịch vụ hoặc chứng chỉ",
- "creds.typeDesc.kv-env": "Lưu trữ khóa API và token dưới dạng biến môi trường",
- "creds.typeDesc.kv-header": "Lưu trữ giá trị xác thực dưới dạng tiêu đề HTTP",
- "creds.typeDesc.oauth": "Liên kết với một kết nối OAuth hiện có",
"creds.types.all": "Tất cả",
"creds.types.file": "Tệp",
"creds.types.kv-env": "Môi trường",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 0cc4a270f87..01eb40f4da7 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -469,10 +469,10 @@
"creds.actions.edit": "编辑",
"creds.actions.view": "查看",
"creds.create": "新建凭证",
- "creds.createModal.fillForm": "填写详情",
- "creds.createModal.selectType": "选择类型",
- "creds.createModal.title": "创建凭证",
- "creds.edit.title": "编辑凭证",
+ "creds.createModal.titles.file": "新建凭证文件",
+ "creds.createModal.titles.kv-env": "新建环境变量",
+ "creds.createModal.titles.kv-header": "新建 HTTP 请求头",
+ "creds.createModal.titles.oauth": "新建 OAuth 凭证",
"creds.empty": "暂无凭证配置",
"creds.errors.createFailed": "创建凭证失败,请重试。",
"creds.errors.multiOrgShareDisabled": "暂不支持把同一个凭证共享到多个工作区,请先取消它在其他工作区的共享。",
@@ -483,19 +483,23 @@
"creds.file.uploadFailed": "文件上传失败",
"creds.file.uploadSuccess": "文件上传成功",
"creds.file.uploading": "上传中...",
- "creds.form.addPair": "添加键值对",
- "creds.form.back": "返回",
+ "creds.form.addEnvVar": "添加变量",
+ "creds.form.addHeader": "添加请求头",
"creds.form.cancel": "取消",
"creds.form.connectionRequired": "请选择一个 OAuth 连接",
"creds.form.description": "描述",
"creds.form.descriptionPlaceholder": "可选的凭证描述",
+ "creds.form.envVars": "环境变量",
"creds.form.file": "凭证文件",
"creds.form.fileRequired": "请上传文件",
+ "creds.form.headers": "请求头",
"creds.form.key": "标识符",
+ "creds.form.keyDesc": "智能体通过标识符找到这个凭证,只能包含字母、数字、连字符和下划线。",
"creds.form.keyPattern": "标识符只能包含字母、数字、下划线和连字符",
"creds.form.keyRequired": "请输入标识符",
"creds.form.name": "显示名称",
"creds.form.nameRequired": "请输入显示名称",
+ "creds.form.removePair": "移除",
"creds.form.save": "保存",
"creds.form.selectConnection": "选择 OAuth 连接",
"creds.form.selectConnectionPlaceholder": "选择已连接的账户",
@@ -504,11 +508,13 @@
"creds.form.uploadDesc": "支持 JSON、PEM 等凭证文件格式",
"creds.form.uploadHint": "点击或拖拽文件上传",
"creds.form.valuePlaceholder": "输入值",
- "creds.form.values": "键值对",
+ "creds.form.valuesDesc.kv-env": "智能体使用这个凭证时,它们会被设置为环境变量。",
+ "creds.form.valuesDesc.kv-header": "智能体使用这个凭证时,它们会作为 HTTP 请求头发送。",
"creds.oauth.noConnections": "暂无可用的 OAuth 连接,请先连接账户。",
"creds.orgSetupRequired": "社区资料尚未设置,请先完成工作区的社区资料设置,再管理凭证。",
"creds.owner.fromPersonal": "来自个人账号",
"creds.owner.sharedBy": "由 {{name}} 共享",
+ "creds.searchPlaceholder": "搜索保险库",
"creds.share.alreadyShared": "已共享",
"creds.share.badge": "已共享到 {{count}} 个工作区",
"creds.share.confirm": "共享",
@@ -536,10 +542,6 @@
"creds.table.neverUsed": "从未使用",
"creds.table.preview": "预览",
"creds.table.type": "类型",
- "creds.typeDesc.file": "上传服务账户或证书等凭证文件",
- "creds.typeDesc.kv-env": "将 API 密钥和令牌存储为环境变量",
- "creds.typeDesc.kv-header": "将授权值存储为 HTTP 请求头",
- "creds.typeDesc.oauth": "关联已有的 OAuth 连接",
"creds.types.all": "全部",
"creds.types.file": "文件",
"creds.types.kv-env": "环境变量",
diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json
index 54052a7f3dc..cd9ed2248a3 100644
--- a/locales/zh-TW/setting.json
+++ b/locales/zh-TW/setting.json
@@ -306,10 +306,6 @@
"creds.actions.edit": "編輯",
"creds.actions.view": "檢視",
"creds.create": "新增憑證",
- "creds.createModal.fillForm": "填寫詳細資料",
- "creds.createModal.selectType": "選擇類型",
- "creds.createModal.title": "建立憑證",
- "creds.edit.title": "編輯憑證",
"creds.empty": "尚未配置任何憑證",
"creds.errors.createFailed": "無法建立憑證。請再試一次。",
"creds.errors.multiOrgShareDisabled": "目前尚未支援將同一組憑證分享至多個工作區。請先移除它的其他分享。",
@@ -320,8 +316,6 @@
"creds.file.uploadFailed": "檔案上傳失敗",
"creds.file.uploadSuccess": "檔案上傳成功",
"creds.file.uploading": "上傳中...",
- "creds.form.addPair": "新增鍵值對",
- "creds.form.back": "返回",
"creds.form.cancel": "取消",
"creds.form.connectionRequired": "請選擇 OAuth 連線",
"creds.form.description": "描述",
@@ -341,7 +335,6 @@
"creds.form.uploadDesc": "支援 JSON、PEM 及其他憑證檔案格式",
"creds.form.uploadHint": "點擊或拖曳檔案以上傳",
"creds.form.valuePlaceholder": "輸入值",
- "creds.form.values": "鍵值對",
"creds.oauth.noConnections": "沒有可用的 OAuth 連線,請先連接帳戶。",
"creds.orgSetupRequired": "尚未設定社群檔案。請完成工作區的社群檔案設定以管理憑證。",
"creds.owner.fromPersonal": "來自您的個人帳戶",
@@ -373,10 +366,6 @@
"creds.table.neverUsed": "從未使用",
"creds.table.preview": "預覽",
"creds.table.type": "類型",
- "creds.typeDesc.file": "上傳憑證檔案,例如服務帳戶或憑證",
- "creds.typeDesc.kv-env": "將 API 金鑰和令牌存儲為環境變數",
- "creds.typeDesc.kv-header": "將授權值存儲為 HTTP 標頭",
- "creds.typeDesc.oauth": "連接到現有的 OAuth 連線",
"creds.types.all": "全部",
"creds.types.file": "檔案",
"creds.types.kv-env": "環境",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 4aa12f3299e..de20823a800 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -764,10 +764,10 @@ export default {
'creds.actions.edit': 'Edit',
'creds.actions.view': 'View',
'creds.create': 'New Credential',
- 'creds.createModal.fillForm': 'Fill Details',
- 'creds.createModal.selectType': 'Select Type',
- 'creds.createModal.title': 'Create Credential',
- 'creds.edit.title': 'Edit Credential',
+ 'creds.createModal.titles.file': 'New credential file',
+ 'creds.createModal.titles.kv-env': 'New environment variable',
+ 'creds.createModal.titles.kv-header': 'New HTTP header',
+ 'creds.createModal.titles.oauth': 'New OAuth credential',
'creds.empty': 'No credentials configured yet',
'creds.errors.createFailed': 'Failed to create the credential. Please try again.',
'creds.errors.multiOrgShareDisabled':
@@ -782,10 +782,22 @@ export default {
'creds.file.uploadFailed': 'File upload failed',
'creds.file.uploadSuccess': 'File uploaded successfully',
'creds.file.uploading': 'Uploading...',
+ 'creds.form.addEnvVar': 'Add variable',
+ 'creds.form.addHeader': 'Add header',
+ 'creds.form.envVars': 'Environment variables',
+ 'creds.form.headers': 'Headers',
+ 'creds.form.keyDesc':
+ 'Agents find this credential by its identifier. Letters, numbers, hyphens and underscores only.',
+ 'creds.form.removePair': 'Remove',
+ 'creds.form.valuesDesc.kv-env':
+ 'Set as environment variables when an agent uses this credential.',
+ 'creds.form.valuesDesc.kv-header':
+ 'Sent as HTTP request headers when an agent uses this credential.',
'creds.orgSetupRequired':
'Community Profile not set up yet. Please complete the workspace Community Profile setup to manage credentials.',
'creds.owner.fromPersonal': 'From your personal account',
'creds.owner.sharedBy': 'Shared by {{name}}',
+ 'creds.searchPlaceholder': 'Search the vault',
'creds.share.alreadyShared': 'Shared',
'creds.share.badge': 'Shared to {{count}} workspaces',
'creds.share.confirm': 'Share',
@@ -812,8 +824,6 @@ export default {
'creds.viewerHint': "Viewers can't create credentials",
'creds.visibility.publish': 'Publish to Workspace',
'creds.visibility.publishConfirmTitle': 'Publish this credential to the workspace?',
- 'creds.form.addPair': 'Add Key-Value Pair',
- 'creds.form.back': 'Back',
'creds.form.cancel': 'Cancel',
'creds.form.connectionRequired': 'Please select an OAuth connection',
'creds.form.description': 'Description',
@@ -833,7 +843,6 @@ export default {
'creds.form.uploadDesc': 'Supports JSON, PEM, and other credential file formats',
'creds.form.uploadHint': 'Click or drag file to upload',
'creds.form.valuePlaceholder': 'Enter value',
- 'creds.form.values': 'Key-Value Pairs',
'creds.oauth.noConnections': 'No OAuth connections available. Please connect an account first.',
'creds.table.actions': 'Actions',
'creds.table.key': 'Identifier',
@@ -842,13 +851,9 @@ export default {
'creds.table.neverUsed': 'Never',
'creds.table.preview': 'Preview',
'creds.table.type': 'Type',
- 'creds.typeDesc.file': 'Upload credential files like service accounts or certificates',
- 'creds.typeDesc.kv-env': 'Store API keys and tokens as environment variables',
- 'creds.typeDesc.kv-header': 'Store authorization values as HTTP headers',
- 'creds.typeDesc.oauth': 'Link to an existing OAuth connection',
'creds.types.all': 'All',
'creds.types.file': 'File',
- 'creds.types.kv-env': 'Environment',
+ 'creds.types.kv-env': 'Environment variable',
'creds.types.kv-header': 'Header',
'creds.types.oauth': 'OAuth',
'creds.view.error': 'Failed to load credential',
diff --git a/src/features/EnvironmentsAndCreds/PersonalVault.tsx b/src/features/EnvironmentsAndCreds/PersonalVault.tsx
index 271855d9ea2..4c26004fb06 100644
--- a/src/features/EnvironmentsAndCreds/PersonalVault.tsx
+++ b/src/features/EnvironmentsAndCreds/PersonalVault.tsx
@@ -1,14 +1,20 @@
'use client';
-import { Button, Flexbox, Icon, Tooltip } from '@lobehub/ui';
-import { Plus } from 'lucide-react';
+import { type CredType } from '@lobechat/types';
+import { Block, Flexbox, Tooltip } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { memo, type ReactNode, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import CreateCredButton from '@/features/Settings/creds/features/CreateCredButton';
import { createCreateCredModal } from '@/features/Settings/creds/features/CreateCredModal';
+import { type CredFilter } from '@/features/Settings/creds/features/credFilter';
import CredsList from '@/features/Settings/creds/features/CredsList';
import { personalCredsApi } from '@/features/Settings/creds/features/useCredsApi';
+import VaultFilterBar from '@/features/Settings/creds/features/VaultFilterBar';
import { usePermission } from '@/hooks/usePermission';
+import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
+
+import { vaultStyles } from './vaultStyles';
interface PersonalVaultProps {
/** The page tabs, at the left of the header row. */
@@ -17,18 +23,22 @@ interface PersonalVaultProps {
/**
* The vault tab of the personal Environments & Vault page: every credential
- * here is the caller's own, so there is nothing to filter.
+ * here is the caller's own, so the header only searches and filters by type.
*/
const PersonalVault = memo<PersonalVaultProps>(({ headerLeading }) => {
- const { t } = useTranslation('setting');
+ const { isAuthenticated } = useMarketAuth();
const { allowed: canManageCredentials, reason } = usePermission('manage_provider_key');
const [refreshKey, setRefreshKey] = useState(0);
+ const [filter, setFilter] = useState<CredFilter>({});
+ // Same query and options as CredsList, so the tab counts read its cache.
+ const { data } = personalCredsApi.query.list.useQuery(undefined, { enabled: isAuthenticated });
- const handleCreate = () => {
+ const handleCreate = (type: CredType) => {
if (!canManageCredentials) return;
createCreateCredModal({
credsApi: personalCredsApi,
onSuccess: () => setRefreshKey((k) => k + 1),
+ type,
});
};
@@ -37,18 +47,17 @@ const PersonalVault = memo<PersonalVaultProps>(({ headerLeading }) => {
<Flexbox horizontal align={'center'} gap={16} justify={'space-between'} wrap={'wrap'}>
{headerLeading}
<Tooltip title={reason}>
- <Button
- disabled={!canManageCredentials}
- icon={<Icon icon={Plus} />}
- style={{ flex: 'none' }}
- type={'primary'}
- onClick={handleCreate}
- >
- {t('creds.create')}
- </Button>
+ <span>
+ <CreateCredButton disabled={!canManageCredentials} onCreate={handleCreate} />
+ </span>
</Tooltip>
</Flexbox>
- <CredsList key={refreshKey} />
+ {isAuthenticated && (
+ <VaultFilterBar creds={data?.data ?? []} value={filter} onChange={setFilter} />
+ )}
+ <Block className={stylex.props(vaultStyles.container).className} variant={'outlined'}>
+ <CredsList filter={filter} key={refreshKey} />
+ </Block>
</Flexbox>
);
});
diff --git a/src/features/EnvironmentsAndCreds/WorkspaceVault.tsx b/src/features/EnvironmentsAndCreds/WorkspaceVault.tsx
index 318395799a6..8f02eff3330 100644
--- a/src/features/EnvironmentsAndCreds/WorkspaceVault.tsx
+++ b/src/features/EnvironmentsAndCreds/WorkspaceVault.tsx
@@ -1,29 +1,27 @@
'use client';
-import { Block, Button, Empty, Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { type CredType } from '@lobechat/types';
+import { Block, Empty, Flexbox, Tooltip } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
-import { Plus } from 'lucide-react';
import { memo, type ReactNode, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useIsWorkspaceViewer } from '@/business/client/hooks/useIsWorkspaceViewer';
-import VisibilityFilter, { type VisibilityFilterValue } from '@/components/VisibilityFilter';
+import VisibilityFilter, {
+ matchesVisibilityFilter,
+ type VisibilityFilterValue,
+} from '@/components/VisibilityFilter';
+import CreateCredButton from '@/features/Settings/creds/features/CreateCredButton';
import { createCreateCredModal } from '@/features/Settings/creds/features/CreateCredModal';
+import { type CredFilter } from '@/features/Settings/creds/features/credFilter';
import MarketSignInGate from '@/features/Settings/creds/features/MarketSignInGate';
import { type CredsApi } from '@/features/Settings/creds/features/useCredsApi';
+import VaultFilterBar from '@/features/Settings/creds/features/VaultFilterBar';
import WorkspaceCredsList from '@/features/Settings/creds/features/WorkspaceCredsList';
import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
import { lambdaClient, lambdaQuery } from '@/libs/trpc/client';
-import { densityTokens } from '@/styles/density.stylex';
-
-const styles = stylex.create({
- container: {
- overflow: 'hidden',
- width: '100%',
- paddingBlock: '4px',
- paddingInline: densityTokens['--lobe-density-card-padding'],
- },
-});
+
+import { vaultStyles } from './vaultStyles';
type Visibility = 'private' | 'public';
@@ -77,10 +75,11 @@ const WorkspaceVault = memo<WorkspaceVaultProps>(({ headerLeading }) => {
const { isAuthenticated } = useMarketAuth();
const isViewer = useIsWorkspaceViewer();
const [visibilityFilter, setVisibilityFilter] = useState<VisibilityFilterValue>('all');
+ const [filter, setFilter] = useState<CredFilter>({});
// Shares its query key with the list inside WorkspaceCredsList, so
// `refetch` here refreshes the list.
- const { error, isLoading, refetch } = credsApi.query.list.useQuery(undefined, {
+ const { data, error, isLoading, refetch } = credsApi.query.list.useQuery(undefined, {
enabled: isAuthenticated,
// No retry for NOT_FOUND — the org won't materialise on its own.
// Cap retries for other errors (500s, network) so failures surface instead of looping.
@@ -96,51 +95,57 @@ const WorkspaceVault = memo<WorkspaceVaultProps>(({ headerLeading }) => {
// New credentials are private, which any non-viewer member may create.
const canCreate = !isViewer;
- const handleCreate = () => {
+ const handleCreate = (type: CredType) => {
if (!canCreate) return;
- createCreateCredModal({ credsApi, onSuccess: () => refetch() });
+ createCreateCredModal({ credsApi, onSuccess: () => refetch(), type });
};
- const createButton = (
- <Button
- disabled={!canCreate}
- icon={<Icon icon={Plus} />}
- type={'primary'}
- onClick={handleCreate}
- >
- {t('creds.create')}
- </Button>
- );
+ const createButton = <CreateCredButton disabled={!canCreate} onCreate={handleCreate} />;
return (
<Flexbox gap={16}>
<Flexbox horizontal align={'center'} gap={16} justify={'space-between'} wrap={'wrap'}>
{headerLeading}
- {isAuthenticated && !orgMissing && (
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
- <VisibilityFilter value={visibilityFilter} onChange={setVisibilityFilter} />
- {
- // Disabled buttons swallow hover events, so the tooltip needs the
- // span wrapper to fire (see the usePermission docstring pattern).
- isViewer ? (
- <Tooltip title={t('creds.viewerHint')}>
- <span>{createButton}</span>
- </Tooltip>
- ) : (
- createButton
- )
- }
- </Flexbox>
- )}
+ {isAuthenticated &&
+ !orgMissing &&
+ // Disabled buttons swallow hover events, so the tooltip needs the
+ // span wrapper to fire (see the usePermission docstring pattern).
+ (isViewer ? (
+ <Tooltip title={t('creds.viewerHint')}>
+ <span>{createButton}</span>
+ </Tooltip>
+ ) : (
+ createButton
+ ))}
</Flexbox>
- <Block className={stylex.props(styles.container).className} variant={'outlined'}>
+ {isAuthenticated && !orgMissing && (
+ <VaultFilterBar
+ // Counts follow the visibility filter, like the list below.
+ value={filter}
+ creds={(data?.data ?? []).filter((cred) =>
+ matchesVisibilityFilter(cred.visibility === 'private', visibilityFilter),
+ )}
+ onChange={setFilter}
+ >
+ {/* A fixed box: in a wrapping row the Select would otherwise stretch
+ to the full row width and drop to a line of its own. */}
+ <div style={{ flex: 'none', width: 140 }}>
+ <VisibilityFilter value={visibilityFilter} onChange={setVisibilityFilter} />
+ </div>
+ </VaultFilterBar>
+ )}
+ <Block className={stylex.props(vaultStyles.container).className} variant={'outlined'}>
<MarketSignInGate>
{orgMissing ? (
<Flexbox align={'center'} justify={'center'} style={{ padding: 48 }}>
<Empty description={t('creds.orgSetupRequired')} />
</Flexbox>
) : (
- <WorkspaceCredsList credsApi={credsApi} visibilityFilter={visibilityFilter} />
+ <WorkspaceCredsList
+ credsApi={credsApi}
+ filter={filter}
+ visibilityFilter={visibilityFilter}
+ />
)}
</MarketSignInGate>
</Block>
diff --git a/src/features/EnvironmentsAndCreds/vaultStyles.ts b/src/features/EnvironmentsAndCreds/vaultStyles.ts
new file mode 100644
index 00000000000..c37017310da
--- /dev/null
+++ b/src/features/EnvironmentsAndCreds/vaultStyles.ts
@@ -0,0 +1,13 @@
+import * as stylex from '@stylexjs/stylex';
+
+import { densityTokens } from '@/styles/density.stylex';
+
+export const vaultStyles = stylex.create({
+ /** The outlined card both vault tabs list their credentials in. */
+ container: {
+ overflow: 'hidden',
+ width: '100%',
+ paddingBlock: '4px',
+ paddingInline: densityTokens['--lobe-density-card-padding'],
+ },
+});
diff --git a/src/features/Settings/creds/features/CreateCredButton.tsx b/src/features/Settings/creds/features/CreateCredButton.tsx
new file mode 100644
index 00000000000..4c467e9495d
--- /dev/null
+++ b/src/features/Settings/creds/features/CreateCredButton.tsx
@@ -0,0 +1,51 @@
+'use client';
+
+import { type CredType } from '@lobechat/types';
+import { Button, DropdownMenu, Icon } from '@lobehub/ui';
+import { ChevronDown } from 'lucide-react';
+import { type FC } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { CRED_TYPE_ICONS, CRED_TYPES } from './credTypes';
+
+interface CreateCredButtonProps {
+ disabled?: boolean;
+ onCreate: (type: CredType) => void;
+ size?: 'large';
+}
+
+/**
+ * "New credential" opens a compact menu of credential types (icon + name);
+ * picking one opens that type's form directly, so creating a credential takes
+ * no separate type step. Each form explains its type in its own field hints.
+ */
+const CreateCredButton: FC<CreateCredButtonProps> = ({ disabled, onCreate, size }) => {
+ const { t } = useTranslation('setting');
+
+ const button = (
+ // `data-no-highlight` keeps the open-menu trigger highlight (a grey fill)
+ // off the primary button, which would leave its white label unreadable.
+ <Button data-no-highlight disabled={disabled} size={size} type={'primary'}>
+ {t('creds.create')}
+ <Icon icon={ChevronDown} size={14} />
+ </Button>
+ );
+
+ if (disabled) return button;
+
+ return (
+ <DropdownMenu
+ placement={'bottomRight'}
+ items={CRED_TYPES.map((type) => ({
+ icon: <Icon icon={CRED_TYPE_ICONS[type]} />,
+ key: type,
+ label: t(`creds.types.${type}`),
+ onClick: () => onCreate(type),
+ }))}
+ >
+ {button}
+ </DropdownMenu>
+ );
+};
+
+export default CreateCredButton;
diff --git a/src/features/Settings/creds/features/CreateCredModal/Content.tsx b/src/features/Settings/creds/features/CreateCredModal/Content.tsx
index 2e93e95ae20..a86d2ad295e 100644
--- a/src/features/Settings/creds/features/CreateCredModal/Content.tsx
+++ b/src/features/Settings/creds/features/CreateCredModal/Content.tsx
@@ -1,84 +1,46 @@
'use client';
import { type CredType } from '@lobechat/types';
-import { Steps, useModalContext } from '@lobehub/ui';
-import * as stylex from '@stylexjs/stylex';
-import { type FC, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { useModalContext } from '@lobehub/ui';
+import { type FC } from 'react';
import { type CredsApi } from '../useCredsApi';
-import CredTypeSelector from './CredTypeSelector';
import FileCredForm from './FileCredForm';
import KVCredForm from './KVCredForm';
import OAuthCredForm from './OAuthCredForm';
-const styles = stylex.create({ steps: { marginBlockEnd: '24px' } });
-
export interface CreateCredModalContentProps {
credsApi: CredsApi;
onSuccess?: () => void;
+ /** Picked from the "New credential" menu before the modal opens. */
+ type: CredType;
}
-const CreateCredModalContent: FC<CreateCredModalContentProps> = ({ credsApi, onSuccess }) => {
- const { t } = useTranslation('setting');
+const CreateCredModalContent: FC<CreateCredModalContentProps> = ({ credsApi, onSuccess, type }) => {
const { close } = useModalContext();
- const [step, setStep] = useState(0);
- const [credType, setCredType] = useState<CredType | null>(null);
-
- const handleTypeSelect = (type: CredType) => {
- setCredType(type);
- setStep(1);
- };
-
- const handleBack = () => {
- setStep(0);
- setCredType(null);
- };
const handleSuccess = () => {
onSuccess?.();
close();
};
- const renderForm = () => {
- switch (credType) {
- case 'kv-env':
- case 'kv-header': {
- return (
- <KVCredForm
- credsApi={credsApi}
- type={credType}
- onBack={handleBack}
- onSuccess={handleSuccess}
- />
- );
- }
- case 'oauth': {
- return <OAuthCredForm credsApi={credsApi} onBack={handleBack} onSuccess={handleSuccess} />;
- }
- case 'file': {
- return <FileCredForm credsApi={credsApi} onBack={handleBack} onSuccess={handleSuccess} />;
- }
- default: {
- return null;
- }
+ switch (type) {
+ case 'kv-env':
+ case 'kv-header': {
+ return (
+ <KVCredForm credsApi={credsApi} type={type} onCancel={close} onSuccess={handleSuccess} />
+ );
}
- };
-
- return (
- <>
- <Steps
- className={stylex.props(styles.steps).className}
- current={step}
- items={[
- { title: t('creds.createModal.selectType') },
- { title: t('creds.createModal.fillForm') },
- ]}
- />
-
- {step === 0 ? <CredTypeSelector onSelect={handleTypeSelect} /> : renderForm()}
- </>
- );
+ case 'oauth': {
+ return <OAuthCredForm credsApi={credsApi} onCancel={close} onSuccess={handleSuccess} />;
+ }
+ case 'file': {
+ return <FileCredForm credsApi={credsApi} onCancel={close} onSuccess={handleSuccess} />;
+ }
+ default: {
+ return null;
+ }
+ }
};
export default CreateCredModalContent;
diff --git a/src/features/Settings/creds/features/CreateCredModal/CredTypeSelector.tsx b/src/features/Settings/creds/features/CreateCredModal/CredTypeSelector.tsx
deleted file mode 100644
index 845a3d38c06..00000000000
--- a/src/features/Settings/creds/features/CreateCredModal/CredTypeSelector.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-'use client';
-
-import { type CredType } from '@lobechat/types';
-import { Block, Flexbox } from '@lobehub/ui';
-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
-import * as stylex from '@stylexjs/stylex';
-import { File, Globe, Key, TerminalSquare } from 'lucide-react';
-import { type FC } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { densityTokens } from '@/styles/density.stylex';
-
-const styles = stylex.create({
- card: {
- cursor: 'pointer',
- borderRadius: cssVar.borderRadiusLG,
- transition: 'all 0.2s',
- borderColor: { 'default': null, ':hover': cssVar.colorPrimary },
- boxShadow: { 'default': null, ':hover': '0 2px 8px rgb(0 0 0 / 10%)' },
- },
- cardDisabled: { cursor: 'not-allowed', opacity: 0.5 },
- description: { fontSize: '12px', color: cssVar.colorTextSecondary, textAlign: 'center' },
- grid: {
- display: 'grid',
- gridTemplateColumns: 'repeat(2, 1fr)',
- gap: densityTokens['--lobe-density-section-gap'],
- },
- icon: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- width: '48px',
- height: '48px',
- marginBlockEnd: '12px',
- borderRadius: '12px',
- backgroundColor: cssVar.colorFillSecondary,
- backgroundImage: 'none',
- },
- title: { marginBlockEnd: '4px', fontWeight: 500 },
-});
-
-interface CredTypeSelectorProps {
- disabled?: boolean;
- onSelect: (type: CredType) => void;
-}
-
-const typeConfigs: Array<{
- description: string;
- icon: React.ReactNode;
- type: CredType;
-}> = [
- {
- description: 'creds.typeDesc.kv-env',
- icon: <TerminalSquare size={24} />,
- type: 'kv-env',
- },
- {
- description: 'creds.typeDesc.kv-header',
- icon: <Globe size={24} />,
- type: 'kv-header',
- },
- {
- description: 'creds.typeDesc.oauth',
- icon: <Key size={24} />,
- type: 'oauth',
- },
- {
- description: 'creds.typeDesc.file',
- icon: <File size={24} />,
- type: 'file',
- },
-];
-
-const CredTypeSelector: FC<CredTypeSelectorProps> = ({ disabled, onSelect }) => {
- const { t } = useTranslation('setting');
-
- return (
- <div {...stylex.props(styles.grid)}>
- {typeConfigs.map(({ type, icon, description }) => (
- <Block
- className={stylex.props(styles.card, disabled && styles.cardDisabled).className}
- key={type}
- padding={12}
- variant={'outlined'}
- onClick={() => {
- if (disabled) return;
- onSelect(type);
- }}
- >
- <Flexbox align="center">
- <div {...stylex.props(styles.icon)}>{icon}</div>
- <div {...stylex.props(styles.title)}>{t(`creds.types.${type}`)}</div>
- <div {...stylex.props(styles.description)}>{t(description as any)}</div>
- </Flexbox>
- </Block>
- ))}
- </div>
- );
-};
-
-export default CredTypeSelector;
diff --git a/src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx
index f1f724cf216..5e17b215b1b 100644
--- a/src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx
+++ b/src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx
@@ -2,22 +2,18 @@
import { Button, Input, TextArea, toast, Upload } from '@lobehub/ui';
import { Form, useForm } from '@lobehub/ui/form';
-import * as stylex from '@stylexjs/stylex';
import { useMutation } from '@tanstack/react-query';
import { type FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { credErrorKey } from '../credError';
+import CredFormFooter from '../CredFormFooter';
import { createExtras, type CredsApi } from '../useCredsApi';
-const styles = stylex.create({
- footer: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginBlockStart: '24px' },
-});
-
interface FileCredFormProps {
credsApi: CredsApi;
disabled?: boolean;
- onBack: () => void;
+ onCancel: () => void;
onSuccess: () => void;
}
@@ -27,7 +23,7 @@ interface FormValues {
name: string;
}
-const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onBack, onSuccess }) => {
+const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onCancel, onSuccess }) => {
const { t } = useTranslation(['setting', 'common']);
const form = useForm<FormValues>({ onSubmit: (values) => handleSubmit(values) });
const [fileHashId, setFileHashId] = useState<string | null>(null);
@@ -132,7 +128,12 @@ const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onBack, onSuc
)}
</Form.Field>
+ <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
+ <Input disabled={disabled} placeholder="e.g., GCP Service Account" />
+ </Form.Field>
+
<Form.Field
+ desc={t('creds.form.keyDesc')}
label={t('creds.form.key')}
name="key"
required={t('creds.form.keyRequired')}
@@ -143,10 +144,6 @@ const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onBack, onSuc
<Input disabled={disabled} placeholder="e.g., gcp-service-account" />
</Form.Field>
- <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
- <Input disabled={disabled} placeholder="e.g., GCP Service Account" />
- </Form.Field>
-
<Form.Field label={t('creds.form.description')} name="description">
<TextArea
disabled={disabled}
@@ -155,8 +152,8 @@ const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onBack, onSuc
/>
</Form.Field>
- <div {...stylex.props(styles.footer)}>
- <Button onClick={onBack}>{t('creds.form.back')}</Button>
+ <CredFormFooter>
+ <Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
<Button
disabled={!fileHashId || disabled}
htmlType="submit"
@@ -165,7 +162,7 @@ const FileCredForm: FC<FileCredFormProps> = ({ credsApi, disabled, onBack, onSuc
>
{t('creds.form.submit')}
</Button>
- </div>
+ </CredFormFooter>
</Form>
);
};
diff --git a/src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx
index 8a09c240130..4254a73a09a 100644
--- a/src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx
+++ b/src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx
@@ -1,25 +1,20 @@
'use client';
-import { Button, Flexbox, Input, InputPassword, TextArea, toast } from '@lobehub/ui';
+import { Button, Input, TextArea, toast } from '@lobehub/ui';
import { Form, useForm } from '@lobehub/ui/form';
-import * as stylex from '@stylexjs/stylex';
import { useMutation } from '@tanstack/react-query';
-import { Minus, Plus } from 'lucide-react';
import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
import { credErrorKey } from '../credError';
+import CredFormFooter from '../CredFormFooter';
+import KVPairsField from '../KVPairsField';
import { createExtras, type CredsApi } from '../useCredsApi';
-const styles = stylex.create({
- footer: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginBlockStart: '24px' },
- kvPair: { display: 'flex', gap: '8px', alignItems: 'flex-start' },
-});
-
interface KVCredFormProps {
credsApi: CredsApi;
disabled?: boolean;
- onBack: () => void;
+ onCancel: () => void;
onSuccess: () => void;
type: 'kv-env' | 'kv-header';
}
@@ -31,7 +26,7 @@ interface FormValues {
name: string;
}
-const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onBack, onSuccess }) => {
+const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onCancel, onSuccess }) => {
const { t } = useTranslation('setting');
const form = useForm<FormValues>({
initialValues: { kvPairs: [{ key: '', value: '' }] } as FormValues,
@@ -78,7 +73,15 @@ const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onBack, onS
return (
<Form form={form} layout="vertical">
+ <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
+ <Input
+ disabled={disabled}
+ placeholder={type === 'kv-env' ? 'OpenAI API Key' : 'Internal API Token'}
+ />
+ </Form.Field>
+
<Form.Field
+ desc={t('creds.form.keyDesc')}
label={t('creds.form.key')}
name="key"
required={t('creds.form.keyRequired')}
@@ -86,60 +89,10 @@ const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onBack, onS
value && !/^[\w-]+$/.test(value) ? t('creds.form.keyPattern') : undefined
}
>
- <Input disabled={disabled} placeholder="e.g., openai" />
+ <Input disabled={disabled} placeholder={type === 'kv-env' ? 'openai' : 'internal-api'} />
</Form.Field>
- <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
- <Input disabled={disabled} placeholder="e.g., OpenAI API Key" />
- </Form.Field>
-
- <Form.Field label={t('creds.form.values')}>
- <Form.List name="kvPairs">
- {({ fields, add, remove }) => (
- <Flexbox gap={8}>
- {fields.map(({ key, index }) => (
- <div {...stylex.props(styles.kvPair)} key={key}>
- <div style={{ flex: 1 }}>
- <Form.Field bare name={`kvPairs.${index}.key`}>
- <Input
- disabled={disabled}
- placeholder={type === 'kv-env' ? 'ENV_VAR_NAME' : 'Header-Name'}
- />
- </Form.Field>
- </div>
- <div style={{ flex: 2 }}>
- <Form.Field bare name={`kvPairs.${index}.value`}>
- <InputPassword
- autoComplete="new-password"
- disabled={disabled}
- placeholder={t('creds.form.valuePlaceholder')}
- />
- </Form.Field>
- </div>
- {fields.length > 1 && (
- <Button
- disabled={disabled}
- icon={Minus}
- size="small"
- type="text"
- onClick={() => remove(index)}
- />
- )}
- </div>
- ))}
- <Button
- block
- disabled={disabled}
- icon={Plus}
- type="dashed"
- onClick={() => add({ key: '', value: '' })}
- >
- {t('creds.form.addPair')}
- </Button>
- </Flexbox>
- )}
- </Form.List>
- </Form.Field>
+ <KVPairsField disabled={disabled} type={type} />
<Form.Field label={t('creds.form.description')} name="description">
<TextArea
@@ -149,8 +102,8 @@ const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onBack, onS
/>
</Form.Field>
- <div {...stylex.props(styles.footer)}>
- <Button onClick={onBack}>{t('creds.form.back')}</Button>
+ <CredFormFooter>
+ <Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
<Button
disabled={disabled}
htmlType="submit"
@@ -159,7 +112,7 @@ const KVCredForm: FC<KVCredFormProps> = ({ credsApi, type, disabled, onBack, onS
>
{t('creds.form.submit')}
</Button>
- </div>
+ </CredFormFooter>
</Form>
);
};
diff --git a/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx
index 3811d57c488..b799243ca8f 100644
--- a/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx
+++ b/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx
@@ -9,11 +9,11 @@ import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
import { credErrorKey } from '../credError';
+import CredFormFooter from '../CredFormFooter';
import { createExtras, type CredsApi } from '../useCredsApi';
const styles = stylex.create({
connectionOption: { display: 'flex', gap: '8px', alignItems: 'center' },
- footer: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginBlockStart: '24px' },
provider: { fontWeight: 500 },
username: { color: cssVar.colorTextSecondary },
});
@@ -21,7 +21,7 @@ const styles = stylex.create({
interface OAuthCredFormProps {
credsApi: CredsApi;
disabled?: boolean;
- onBack: () => void;
+ onCancel: () => void;
onSuccess: () => void;
}
@@ -32,7 +32,7 @@ interface FormValues {
oauthConnectionId: number;
}
-const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onSuccess }) => {
+const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onCancel, onSuccess }) => {
const { t } = useTranslation('setting');
const form = useForm<FormValues>({ onSubmit: (values) => handleSubmit(values) });
@@ -96,9 +96,9 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onS
return (
<Flexbox gap={16}>
<Empty description={t('creds.oauth.noConnections')} />
- <div {...stylex.props(styles.footer)}>
- <Button onClick={onBack}>{t('creds.form.back')}</Button>
- </div>
+ <CredFormFooter>
+ <Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
+ </CredFormFooter>
</Flexbox>
);
}
@@ -117,7 +117,12 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onS
/>
</Form.Field>
+ <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
+ <Input disabled={disabled} placeholder="e.g., GitHub Connection" />
+ </Form.Field>
+
<Form.Field
+ desc={t('creds.form.keyDesc')}
label={t('creds.form.key')}
name="key"
required={t('creds.form.keyRequired')}
@@ -128,10 +133,6 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onS
<Input disabled={disabled} placeholder="e.g., github-oauth" />
</Form.Field>
- <Form.Field label={t('creds.form.name')} name="name" required={t('creds.form.nameRequired')}>
- <Input disabled={disabled} placeholder="e.g., GitHub Connection" />
- </Form.Field>
-
<Form.Field label={t('creds.form.description')} name="description">
<TextArea
disabled={disabled}
@@ -140,8 +141,8 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onS
/>
</Form.Field>
- <div {...stylex.props(styles.footer)}>
- <Button onClick={onBack}>{t('creds.form.back')}</Button>
+ <CredFormFooter>
+ <Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
<Button
disabled={disabled}
htmlType="submit"
@@ -150,7 +151,7 @@ const OAuthCredForm: FC<OAuthCredFormProps> = ({ credsApi, disabled, onBack, onS
>
{t('creds.form.submit')}
</Button>
- </div>
+ </CredFormFooter>
</Form>
);
};
diff --git a/src/features/Settings/creds/features/CreateCredModal/index.tsx b/src/features/Settings/creds/features/CreateCredModal/index.tsx
index fb9c5211661..c08c591dcce 100644
--- a/src/features/Settings/creds/features/CreateCredModal/index.tsx
+++ b/src/features/Settings/creds/features/CreateCredModal/index.tsx
@@ -3,6 +3,7 @@
import { createModal, type ModalInstance } from '@lobehub/ui';
import { t } from 'i18next';
+import CredModalTitle from '../CredModalTitle';
import CreateCredModalContent, { type CreateCredModalContentProps } from './Content';
export const createCreateCredModal = (props: CreateCredModalContentProps): ModalInstance =>
@@ -13,6 +14,11 @@ export const createCreateCredModal = (props: CreateCredModalContentProps): Modal
styles: {
content: { paddingBlock: 16, paddingInline: 24 },
},
- title: t('creds.createModal.title', { ns: 'setting' }),
- width: 'min(90vw, 640px)',
+ title: (
+ <CredModalTitle
+ title={t(`creds.createModal.titles.${props.type}`, { ns: 'setting' })}
+ type={props.type}
+ />
+ ),
+ width: 'min(90vw, 560px)',
});
diff --git a/src/features/Settings/creds/features/CredFormFooter.tsx b/src/features/Settings/creds/features/CredFormFooter.tsx
new file mode 100644
index 00000000000..0921c1dc442
--- /dev/null
+++ b/src/features/Settings/creds/features/CredFormFooter.tsx
@@ -0,0 +1,33 @@
+'use client';
+
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { type FC, type ReactNode } from 'react';
+
+/** The modals pad their content by this much inline; the footer rule spans it. */
+const MODAL_PADDING_INLINE = '24px';
+
+const styles = stylex.create({
+ footer: {
+ display: 'flex',
+ gap: '8px',
+ justifyContent: 'flex-end',
+ marginBlockStart: '24px',
+ marginInline: `calc(-1 * ${MODAL_PADDING_INLINE})`,
+ paddingBlockStart: '16px',
+ paddingInline: MODAL_PADDING_INLINE,
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+});
+
+/**
+ * The action row of a credential form: a full-width rule above Cancel and the
+ * primary action, set apart from the fields like the footer of a dialog.
+ */
+const CredFormFooter: FC<{ children: ReactNode }> = ({ children }) => (
+ <div {...stylex.props(styles.footer)}>{children}</div>
+);
+
+export default CredFormFooter;
diff --git a/src/features/Settings/creds/features/CredItem.tsx b/src/features/Settings/creds/features/CredItem.tsx
index 6f24fce500a..95547811325 100644
--- a/src/features/Settings/creds/features/CredItem.tsx
+++ b/src/features/Settings/creds/features/CredItem.tsx
@@ -2,32 +2,23 @@
import { type UserCredSummary } from '@lobechat/types';
import {
+ ActionIcon,
Avatar,
- Button,
confirmModal,
type DropdownItem,
DropdownMenu,
Flexbox,
Icon,
stopPropagation,
- Tag,
} from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
-import {
- Eye,
- File,
- Globe,
- Key,
- MoreHorizontalIcon,
- Pencil,
- TerminalSquare,
- Trash2,
-} from 'lucide-react';
+import { Eye, MoreHorizontalIcon, Pencil, Trash2 } from 'lucide-react';
import { type FC, memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useDensity } from '@/styles/density';
+import { CRED_TYPE_ICONS } from './credTypes';
import { styles } from './style';
interface CredItemProps {
@@ -43,29 +34,15 @@ interface CredItemProps {
onDelete?: (id: number) => void;
onEdit?: (cred: UserCredSummary) => void;
onView?: (cred: UserCredSummary) => void;
- /** Tags shown after the type tag (owner, sharing state). */
+ /** Tags shown after the name (owner, sharing state). */
tags?: React.ReactNode;
/** Inline marker right after the name, e.g. the private lock in the workspace list. */
titleSuffix?: React.ReactNode;
}
-const typeIcons: Record<string, React.ReactNode> = {
- 'file': <File size={20} />,
- 'kv-env': <TerminalSquare size={20} />,
- 'kv-header': <Globe size={20} />,
- 'oauth': <Key size={20} />,
-};
-
-const typeColors: Record<string, string> = {
- 'file': 'purple',
- 'kv-env': 'blue',
- 'kv-header': 'cyan',
- 'oauth': 'green',
-};
-
const CredItem: FC<CredItemProps> = memo(
({ canManage, cred, extraMenuItems = [], onEdit, onDelete, onView, tags, titleSuffix }) => {
- const { t } = useTranslation('setting');
+ const { t } = useTranslation(['setting', 'common']);
const { compact, tokens } = useDensity();
const handleDelete = () => {
@@ -127,7 +104,7 @@ const CredItem: FC<CredItemProps> = memo(
// `display: flex` collapses the inline span's line box so the svg sits
// dead-center in the 48px container instead of on the text baseline.
<span style={{ color: 'var(--lobe-color-text-secondary)', display: 'flex' }}>
- {typeIcons[cred.type]}
+ <Icon icon={CRED_TYPE_ICONS[cred.type]} size={20} />
</span>
);
};
@@ -147,35 +124,25 @@ const CredItem: FC<CredItemProps> = memo(
style={{ flex: 1, overflow: 'hidden' }}
>
<div {...stylex.props(styles.icon, compact && styles.iconCompact)}>{renderAvatar()}</div>
- <Flexbox gap={compact ? 2 : 4} style={{ overflow: 'hidden' }}>
+ <Flexbox gap={compact ? 2 : 4} style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}>
<Flexbox horizontal align="center" gap={8}>
<span {...stylex.props(styles.title, compact && styles.titleCompact)}>
{cred.name}
</span>
{titleSuffix}
- <Tag color={typeColors[cred.type]}>{t(`creds.types.${cred.type}`)}</Tag>
{tags}
</Flexbox>
- <Flexbox
- horizontal
- align="center"
- gap={8}
- style={{ lineHeight: compact ? '18px' : undefined }}
- >
- <code {...stylex.props(styles.key)}>{cred.key}</code>
- {cred.description && (
- <>
- <span style={{ color: 'var(--lobe-color-text-quaternary)' }}>·</span>
- <span {...stylex.props(styles.description)}>{cred.description}</span>
- </>
- )}
- </Flexbox>
+ {cred.description && (
+ <span {...stylex.props(styles.description, compact && styles.descriptionCompact)}>
+ {cred.description}
+ </span>
+ )}
</Flexbox>
</Flexbox>
<Flexbox horizontal align="center" gap={8} onClick={stopPropagation}>
{menuItems.length > 0 && (
<DropdownMenu items={menuItems} placement="bottomRight">
- <Button icon={MoreHorizontalIcon} />
+ <ActionIcon icon={MoreHorizontalIcon} title={t('more', { ns: 'common' })} />
</DropdownMenu>
)}
</Flexbox>
diff --git a/src/features/Settings/creds/features/CredModalTitle.tsx b/src/features/Settings/creds/features/CredModalTitle.tsx
new file mode 100644
index 00000000000..17cc6daf465
--- /dev/null
+++ b/src/features/Settings/creds/features/CredModalTitle.tsx
@@ -0,0 +1,54 @@
+'use client';
+
+import { type CredType } from '@lobechat/types';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { type FC } from 'react';
+
+import { CRED_TYPE_ICONS } from './credTypes';
+
+const styles = stylex.create({
+ icon: {
+ display: 'flex',
+ flexShrink: 0,
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '32px',
+ height: '32px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ color: cssVar.colorTextSecondary,
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+ title: {
+ overflow: 'hidden',
+ minWidth: 0,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+});
+
+interface CredModalTitleProps {
+ title: string;
+ type: CredType;
+}
+
+/**
+ * The header of the create, edit and view modals: the credential type's icon
+ * beside the title, so the modal says which kind of secret it holds before
+ * any field does.
+ */
+const CredModalTitle: FC<CredModalTitleProps> = ({ title, type }) => (
+ <Flexbox horizontal align={'center'} gap={12} style={{ minWidth: 0 }}>
+ <span {...stylex.props(styles.icon)}>
+ <Icon icon={CRED_TYPE_ICONS[type]} size={16} />
+ </span>
+ <span {...stylex.props(styles.title)}>{title}</span>
+ </Flexbox>
+);
+
+export default CredModalTitle;
diff --git a/src/features/Settings/creds/features/CredsList.tsx b/src/features/Settings/creds/features/CredsList.tsx
index 00cb108e464..151d4824891 100644
--- a/src/features/Settings/creds/features/CredsList.tsx
+++ b/src/features/Settings/creds/features/CredsList.tsx
@@ -14,6 +14,7 @@ import { CredsListSkeleton } from '@/components/Skeleton/Settings/tabs/Creds';
import { usePermission } from '@/hooks/usePermission';
import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
+import { type CredFilter, filterCreds } from './credFilter';
import CredItem from './CredItem';
import { createEditCredModal } from './EditCredModal';
import MarketSignInGate from './MarketSignInGate';
@@ -26,13 +27,18 @@ const styles = stylex.create({
empty: { paddingBlock: '48px', paddingInline: '0' },
});
+interface CredsListProps {
+ /** The vault toolbar's search and type filter; every row when omitted. */
+ filter?: CredFilter;
+}
+
/**
* The caller's personal credentials, on the personal settings page. Each row
* can be shared into the caller's workspaces (see {@link openShareCredModal});
* the workspace page lists workspace credentials through `WorkspaceCredsList`.
*/
-const CredsList: FC = () => {
- const { t } = useTranslation('setting');
+const CredsList: FC<CredsListProps> = ({ filter = {} }) => {
+ const { t } = useTranslation(['setting', 'common']);
const { isAuthenticated } = useMarketAuth();
const { allowed: canManageCredentials } = usePermission('manage_provider_key');
const workspaces = useWorkspaces();
@@ -42,6 +48,7 @@ const CredsList: FC = () => {
});
const credentials = data?.data ?? [];
+ const visibleCredentials = filterCreds(credentials, filter);
const deleteMutation = useMutation({
mutationFn: async (id: number) => {
@@ -93,7 +100,13 @@ const CredsList: FC = () => {
onRetry={() => refetch()}
>
<Flexbox gap={0}>
- {credentials.map((cred) => (
+ {visibleCredentials.length === 0 && (
+ <Empty
+ className={stylex.props(styles.empty).className}
+ description={t('visibilityFilter.empty', { ns: 'common' })}
+ />
+ )}
+ {visibleCredentials.map((cred) => (
<CredItem
canManage={canManageCredentials}
cred={cred}
diff --git a/src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx b/src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx
index 9190f890592..d29a38df746 100644
--- a/src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx
+++ b/src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx
@@ -1,24 +1,19 @@
'use client';
import { type UserCredSummary } from '@lobechat/types';
-import { Button, Flexbox, Input, InputPassword, Spin, Text, TextArea } from '@lobehub/ui';
+import { Button, Flexbox, Input, Spin, TextArea } from '@lobehub/ui';
import { Form, useForm } from '@lobehub/ui/form';
-import * as stylex from '@stylexjs/stylex';
import { useMutation } from '@tanstack/react-query';
-import { Minus, Plus } from 'lucide-react';
import { type FC, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { usePermission } from '@/hooks/usePermission';
+import CredFormFooter from '../CredFormFooter';
+import KVPairsField from '../KVPairsField';
import { type CredsApi } from '../useCredsApi';
import { buildKVUpdateInput } from './kvUpdateInput';
-const styles = stylex.create({
- footer: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginBlockStart: '24px' },
- kvPair: { display: 'flex', gap: '8px', alignItems: 'flex-start' },
-});
-
interface EditKVFormProps {
cred: UserCredSummary;
credsApi: CredsApi;
@@ -125,58 +120,11 @@ const EditKVForm: FC<EditKVFormProps> = ({ cred, credsApi, onCancel, onSuccess,
<Input disabled={!canManageCredentials} />
</Form.Field>
- <Form.Field label={t('creds.form.values')}>
- {writeOnly && (
- <Text fontSize={12} style={{ display: 'block', marginBlockEnd: 8 }} type={'secondary'}>
- {t('creds.writeOnly.editHint')}
- </Text>
- )}
- <Form.List name="kvPairs">
- {({ fields, add, remove }) => (
- <Flexbox gap={8}>
- {fields.map(({ key, index }) => (
- <div {...stylex.props(styles.kvPair)} key={key}>
- <div style={{ flex: 1 }}>
- <Form.Field bare name={`kvPairs.${index}.key`}>
- <Input
- disabled={!canManageCredentials}
- placeholder={cred.type === 'kv-env' ? 'ENV_VAR_NAME' : 'Header-Name'}
- />
- </Form.Field>
- </div>
- <div style={{ flex: 2 }}>
- <Form.Field bare name={`kvPairs.${index}.value`}>
- <InputPassword
- autoComplete="new-password"
- disabled={!canManageCredentials}
- placeholder={t('creds.form.valuePlaceholder')}
- />
- </Form.Field>
- </div>
- {fields.length > 1 && (
- <Button
- disabled={!canManageCredentials}
- icon={Minus}
- size="small"
- type="text"
- onClick={() => remove(index)}
- />
- )}
- </div>
- ))}
- <Button
- block
- disabled={!canManageCredentials}
- icon={Plus}
- type="dashed"
- onClick={() => add({ key: '', value: '' })}
- >
- {t('creds.form.addPair')}
- </Button>
- </Flexbox>
- )}
- </Form.List>
- </Form.Field>
+ <KVPairsField
+ disabled={!canManageCredentials}
+ hint={writeOnly ? t('creds.writeOnly.editHint') : undefined}
+ type={cred.type as 'kv-env' | 'kv-header'}
+ />
<Form.Field label={t('creds.form.description')} name="description">
<TextArea
@@ -186,7 +134,7 @@ const EditKVForm: FC<EditKVFormProps> = ({ cred, credsApi, onCancel, onSuccess,
/>
</Form.Field>
- <div {...stylex.props(styles.footer)}>
+ <CredFormFooter>
<Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
<Button
disabled={!canManageCredentials}
@@ -196,7 +144,7 @@ const EditKVForm: FC<EditKVFormProps> = ({ cred, credsApi, onCancel, onSuccess,
>
{t('creds.form.save')}
</Button>
- </div>
+ </CredFormFooter>
</Form>
);
};
diff --git a/src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx b/src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx
index 117581e238a..09a8aaab190 100644
--- a/src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx
+++ b/src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx
@@ -3,19 +3,15 @@
import { type UserCredSummary } from '@lobechat/types';
import { Button, Input, TextArea } from '@lobehub/ui';
import { Form, useForm } from '@lobehub/ui/form';
-import * as stylex from '@stylexjs/stylex';
import { useMutation } from '@tanstack/react-query';
import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
import { usePermission } from '@/hooks/usePermission';
+import CredFormFooter from '../CredFormFooter';
import { type CredsApi } from '../useCredsApi';
-const styles = stylex.create({
- footer: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginBlockStart: '24px' },
-});
-
interface EditMetaFormProps {
cred: UserCredSummary;
credsApi: CredsApi;
@@ -74,7 +70,7 @@ const EditMetaForm: FC<EditMetaFormProps> = ({ cred, credsApi, onCancel, onSucce
/>
</Form.Field>
- <div {...stylex.props(styles.footer)}>
+ <CredFormFooter>
<Button onClick={onCancel}>{t('creds.form.cancel')}</Button>
<Button
disabled={!canManageCredentials}
@@ -84,7 +80,7 @@ const EditMetaForm: FC<EditMetaFormProps> = ({ cred, credsApi, onCancel, onSucce
>
{t('creds.form.save')}
</Button>
- </div>
+ </CredFormFooter>
</Form>
);
};
diff --git a/src/features/Settings/creds/features/EditCredModal/index.tsx b/src/features/Settings/creds/features/EditCredModal/index.tsx
index c6064f6798e..8f5f8eba6ad 100644
--- a/src/features/Settings/creds/features/EditCredModal/index.tsx
+++ b/src/features/Settings/creds/features/EditCredModal/index.tsx
@@ -1,8 +1,8 @@
'use client';
import { createModal, type ModalInstance } from '@lobehub/ui';
-import { t } from 'i18next';
+import CredModalTitle from '../CredModalTitle';
import EditCredModalContent, { type EditCredModalContentProps } from './Content';
export const createEditCredModal = (props: EditCredModalContentProps): ModalInstance =>
@@ -13,6 +13,6 @@ export const createEditCredModal = (props: EditCredModalContentProps): ModalInst
styles: {
content: { paddingBlock: 16, paddingInline: 24 },
},
- title: t('creds.edit.title', { ns: 'setting' }),
+ title: <CredModalTitle title={props.cred.name} type={props.cred.type} />,
width: 'min(90vw, 560px)',
});
diff --git a/src/features/Settings/creds/features/KVPairsField.tsx b/src/features/Settings/creds/features/KVPairsField.tsx
new file mode 100644
index 00000000000..81ad4531bea
--- /dev/null
+++ b/src/features/Settings/creds/features/KVPairsField.tsx
@@ -0,0 +1,93 @@
+'use client';
+
+import { ActionIcon, Button, Flexbox, Input, InputPassword } from '@lobehub/ui';
+import { Form } from '@lobehub/ui/form';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { Plus, Trash2 } from 'lucide-react';
+import { type FC, type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const styles = stylex.create({
+ name: { flex: '2', minWidth: 0 },
+ pair: { display: 'flex', gap: '8px', alignItems: 'flex-start' },
+ // Keeps the inputs aligned whether or not a row has its remove button.
+ remove: { flexShrink: 0, width: '32px', height: '32px' },
+ value: { flex: '3', minWidth: 0 },
+});
+
+interface KVPairsFieldProps {
+ disabled?: boolean;
+ /** Shown above the rows, e.g. the write-only replacement hint. */
+ hint?: ReactNode;
+ type: 'kv-env' | 'kv-header';
+}
+
+/**
+ * The variables of an environment credential, or the headers of a header
+ * credential: one name / secret value row each, under a label that names
+ * which of the two they are and how agents receive them.
+ */
+const KVPairsField: FC<KVPairsFieldProps> = ({ disabled, hint, type }) => {
+ const { t } = useTranslation('setting');
+
+ return (
+ <Form.Field
+ desc={hint ?? t(`creds.form.valuesDesc.${type}`)}
+ label={type === 'kv-env' ? t('creds.form.envVars') : t('creds.form.headers')}
+ >
+ <Form.List name="kvPairs">
+ {({ fields, add, remove }) => (
+ <Flexbox gap={8}>
+ {fields.map(({ key, index }) => (
+ <div {...stylex.props(styles.pair)} key={key}>
+ <div {...stylex.props(styles.name)}>
+ <Form.Field bare name={`kvPairs.${index}.key`}>
+ <Input
+ disabled={disabled}
+ placeholder={type === 'kv-env' ? 'OPENAI_API_KEY' : 'Authorization'}
+ style={{ fontFamily: cssVar.fontFamilyCode }}
+ />
+ </Form.Field>
+ </div>
+ <div {...stylex.props(styles.value)}>
+ <Form.Field bare name={`kvPairs.${index}.value`}>
+ <InputPassword
+ autoComplete="new-password"
+ disabled={disabled}
+ placeholder={t('creds.form.valuePlaceholder')}
+ />
+ </Form.Field>
+ </div>
+ <span {...stylex.props(styles.remove)}>
+ {fields.length > 1 && (
+ <ActionIcon
+ disabled={disabled}
+ icon={Trash2}
+ size={{ blockSize: 32, size: 16 }}
+ title={t('creds.form.removePair')}
+ onClick={() => remove(index)}
+ />
+ )}
+ </span>
+ </div>
+ ))}
+ <div>
+ <Button
+ disabled={disabled}
+ icon={Plus}
+ size={'small'}
+ type={'text'}
+ onClick={() => add({ key: '', value: '' })}
+ >
+ {type === 'kv-env' ? t('creds.form.addEnvVar') : t('creds.form.addHeader')}
+ </Button>
+ </div>
+ </Flexbox>
+ )}
+ </Form.List>
+ </Form.Field>
+ );
+};
+
+export default KVPairsField;
diff --git a/src/features/Settings/creds/features/VaultFilterBar.tsx b/src/features/Settings/creds/features/VaultFilterBar.tsx
new file mode 100644
index 00000000000..3baf56241d0
--- /dev/null
+++ b/src/features/Settings/creds/features/VaultFilterBar.tsx
@@ -0,0 +1,75 @@
+'use client';
+
+import { type UserCredSummary } from '@lobechat/types';
+import { Flexbox, SearchBar, Segmented } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { type FC, type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { countCredsByType, type CredFilter, type CredTypeFilterValue } from './credFilter';
+import { CRED_TYPES } from './credTypes';
+
+const styles = stylex.create({
+ count: { marginInlineStart: '6px', color: cssVar.colorTextTertiary },
+});
+
+interface VaultFilterBarProps {
+ /** More filters after the search box, e.g. the workspace visibility filter. */
+ children?: ReactNode;
+ /** The rows the tabs count, already narrowed by any other page filter. */
+ creds: UserCredSummary[];
+ onChange: (filter: CredFilter) => void;
+ value: CredFilter;
+}
+
+/**
+ * The vault's filter row, under the tabs and the create button: one tab per
+ * credential type with its count on the left, the search box (and any extra
+ * filters) on the right.
+ */
+const VaultFilterBar: FC<VaultFilterBarProps> = ({ children, creds, onChange, value }) => {
+ const { t } = useTranslation('setting');
+ const counts = countCredsByType(creds, value.keyword);
+
+ return (
+ <Flexbox horizontal align={'center'} gap={8} justify={'space-between'} wrap={'wrap'}>
+ <Segmented
+ value={value.type ?? 'all'}
+ options={(['all', ...CRED_TYPES] as CredTypeFilterValue[]).map((option) => ({
+ label: (
+ <span>
+ {t(`creds.types.${option}`)}
+ <span {...stylex.props(styles.count)}>{counts[option]}</span>
+ </span>
+ ),
+ value: option,
+ }))}
+ onChange={(next) => onChange({ ...value, type: next as CredTypeFilterValue })}
+ />
+ {/* Takes the rest of the row and shrinks the search box before wrapping,
+ so the tabs, search and visibility filter share one line at settings
+ widths; a very narrow pane still wraps each control onto its own line. */}
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={8}
+ justify={'flex-end'}
+ style={{ flex: '1 1 auto' }}
+ wrap={'wrap'}
+ >
+ <SearchBar
+ allowClear
+ placeholder={t('creds.searchPlaceholder')}
+ style={{ flex: '1 1 140px', maxWidth: 240, minWidth: 140 }}
+ value={value.keyword ?? ''}
+ variant={'filled'}
+ onChange={(e) => onChange({ ...value, keyword: e.target.value })}
+ />
+ {children}
+ </Flexbox>
+ </Flexbox>
+ );
+};
+
+export default VaultFilterBar;
diff --git a/src/features/Settings/creds/features/ViewCredModal/Content.tsx b/src/features/Settings/creds/features/ViewCredModal/Content.tsx
index e5b15e274f5..3aea656c933 100644
--- a/src/features/Settings/creds/features/ViewCredModal/Content.tsx
+++ b/src/features/Settings/creds/features/ViewCredModal/Content.tsx
@@ -94,7 +94,7 @@ const KVRow: FC<KVRowProps> = ({ keyName, value }) => {
className={stylex.props(!visible && styles.maskedValue).className}
style={{
flex: 1,
- fontFamily: 'var(--lobe-font-family-code)',
+ fontFamily: cssVar.fontFamilyCode,
fontSize: 13,
wordBreak: 'break-all',
}}
diff --git a/src/features/Settings/creds/features/ViewCredModal/index.tsx b/src/features/Settings/creds/features/ViewCredModal/index.tsx
index 202ac11f396..9107f55042f 100644
--- a/src/features/Settings/creds/features/ViewCredModal/index.tsx
+++ b/src/features/Settings/creds/features/ViewCredModal/index.tsx
@@ -3,6 +3,7 @@
import { createModal, type ModalInstance } from '@lobehub/ui';
import { t } from 'i18next';
+import CredModalTitle from '../CredModalTitle';
import ViewCredModalContent, { type ViewCredModalContentProps } from './Content';
export const createViewCredModal = (props: ViewCredModalContentProps): ModalInstance =>
@@ -13,6 +14,11 @@ export const createViewCredModal = (props: ViewCredModalContentProps): ModalInst
styles: {
content: { paddingBlock: 16, paddingInline: 24 },
},
- title: t('creds.view.title', { name: props.cred.name, ns: 'setting' }),
+ title: (
+ <CredModalTitle
+ title={t('creds.view.title', { name: props.cred.name, ns: 'setting' })}
+ type={props.cred.type}
+ />
+ ),
width: 'min(90vw, 600px)',
});
diff --git a/src/features/Settings/creds/features/WorkspaceCredsList.tsx b/src/features/Settings/creds/features/WorkspaceCredsList.tsx
index 67af8740c59..32b00712563 100644
--- a/src/features/Settings/creds/features/WorkspaceCredsList.tsx
+++ b/src/features/Settings/creds/features/WorkspaceCredsList.tsx
@@ -17,6 +17,7 @@ import { lambdaClient } from '@/libs/trpc/client';
import { isOwnCredRow, isWriteOnlyCredRow, workspaceCredRowAccess } from './credAccess';
import { credErrorKey } from './credError';
+import { type CredFilter, filterCreds } from './credFilter';
import CredItem from './CredItem';
import { createEditCredModal } from './EditCredModal';
import { type CredsApi } from './useCredsApi';
@@ -27,6 +28,8 @@ type Visibility = 'private' | 'public';
interface WorkspaceCredsListProps {
/** The workspace binding (`workspaceCreds`), with `setVisibility`. */
credsApi: CredsApi;
+ /** The vault toolbar's search and type filter; every row when omitted. */
+ filter?: CredFilter;
/** Narrow the list to private or shared credentials; every row when omitted. */
visibilityFilter?: VisibilityFilterValue;
}
@@ -40,6 +43,7 @@ interface WorkspaceCredsListProps {
*/
const WorkspaceCredsList: FC<WorkspaceCredsListProps> = ({
credsApi,
+ filter = {},
visibilityFilter = 'all',
}) => {
const { t } = useTranslation(['setting', 'common']);
@@ -49,7 +53,7 @@ const WorkspaceCredsList: FC<WorkspaceCredsListProps> = ({
const { data, error, isLoading, refetch } = credsApi.query.list.useQuery();
const credentials = data?.data ?? [];
- const visibleCredentials = credentials.filter((cred) =>
+ const visibleCredentials = filterCreds(credentials, filter).filter((cred) =>
matchesVisibilityFilter(cred.visibility === 'private', visibilityFilter),
);
diff --git a/src/features/Settings/creds/features/credFilter.test.ts b/src/features/Settings/creds/features/credFilter.test.ts
new file mode 100644
index 00000000000..60f279e0ec7
--- /dev/null
+++ b/src/features/Settings/creds/features/credFilter.test.ts
@@ -0,0 +1,55 @@
+import { describe, expect, it } from 'vitest';
+
+import { countCredsByType, filterCreds, isCredFilterActive } from './credFilter';
+
+const creds = [
+ { description: 'Used by the coder agent', key: 'openai', name: 'OpenAI API Key', type: 'kv-env' },
+ { description: undefined, key: 'github', name: 'GitHub (me)', type: 'oauth' },
+ { description: 'GCP service account', key: 'gcp-sa', name: 'GCP', type: 'file' },
+] as const;
+
+describe('filterCreds', () => {
+ it('returns every row without a filter', () => {
+ expect(filterCreds([...creds], {})).toHaveLength(3);
+ expect(filterCreds([...creds], { keyword: ' ', type: 'all' })).toHaveLength(3);
+ });
+
+ it('matches the keyword against name, key and description, ignoring case', () => {
+ expect(filterCreds([...creds], { keyword: 'OPENAI' }).map((c) => c.key)).toEqual(['openai']);
+ expect(filterCreds([...creds], { keyword: 'gcp-sa' }).map((c) => c.key)).toEqual(['gcp-sa']);
+ expect(filterCreds([...creds], { keyword: 'coder' }).map((c) => c.key)).toEqual(['openai']);
+ });
+
+ it('narrows by type and combines with the keyword', () => {
+ expect(filterCreds([...creds], { type: 'oauth' }).map((c) => c.key)).toEqual(['github']);
+ expect(filterCreds([...creds], { keyword: 'openai', type: 'file' })).toEqual([]);
+ });
+});
+
+describe('isCredFilterActive', () => {
+ it('is active only when a keyword or a specific type is set', () => {
+ expect(isCredFilterActive({})).toBe(false);
+ expect(isCredFilterActive({ keyword: ' ', type: 'all' })).toBe(false);
+ expect(isCredFilterActive({ keyword: 'a' })).toBe(true);
+ expect(isCredFilterActive({ type: 'file' })).toBe(true);
+ });
+});
+
+describe('countCredsByType', () => {
+ it('counts every type, including empty ones, after the keyword', () => {
+ expect(countCredsByType([...creds])).toEqual({
+ 'all': 3,
+ 'file': 1,
+ 'kv-env': 1,
+ 'kv-header': 0,
+ 'oauth': 1,
+ });
+ expect(countCredsByType([...creds], 'gcp')).toEqual({
+ 'all': 1,
+ 'file': 1,
+ 'kv-env': 0,
+ 'kv-header': 0,
+ 'oauth': 0,
+ });
+ });
+});
diff --git a/src/features/Settings/creds/features/credFilter.ts b/src/features/Settings/creds/features/credFilter.ts
new file mode 100644
index 00000000000..b6ff5d71131
--- /dev/null
+++ b/src/features/Settings/creds/features/credFilter.ts
@@ -0,0 +1,50 @@
+import { type CredType, type UserCredSummary } from '@lobechat/types';
+
+import { CRED_TYPES } from './credTypes';
+
+export type CredTypeFilterValue = CredType | 'all';
+
+export interface CredFilter {
+ /** Matched case-insensitively against the name, key and description. */
+ keyword?: string;
+ type?: CredTypeFilterValue;
+}
+
+export const isCredFilterActive = ({ keyword, type }: CredFilter) =>
+ !!keyword?.trim() || (!!type && type !== 'all');
+
+/** The rows the vault toolbar's search box and type filter leave. */
+export const filterCreds = <
+ T extends Pick<UserCredSummary, 'description' | 'key' | 'name' | 'type'>,
+>(
+ creds: T[],
+ { keyword, type }: CredFilter,
+): T[] => {
+ const needle = keyword?.trim().toLowerCase();
+
+ return creds.filter((cred) => {
+ if (type && type !== 'all' && cred.type !== type) return false;
+ if (!needle) return true;
+
+ return [cred.name, cred.key, cred.description].some((text) =>
+ text?.toLowerCase().includes(needle),
+ );
+ });
+};
+
+/**
+ * How many rows each type tab would show: the search keyword applies, the
+ * selected type does not, so switching tabs never changes the counts.
+ */
+export const countCredsByType = <
+ T extends Pick<UserCredSummary, 'description' | 'key' | 'name' | 'type'>,
+>(
+ creds: T[],
+ keyword?: string,
+): Record<CredTypeFilterValue, number> => {
+ const matched = filterCreds(creds, { keyword });
+ const counts = { all: matched.length } as Record<CredTypeFilterValue, number>;
+ for (const type of CRED_TYPES) counts[type] = 0;
+ for (const cred of matched) counts[cred.type] += 1;
+ return counts;
+};
diff --git a/src/features/Settings/creds/features/credTypes.ts b/src/features/Settings/creds/features/credTypes.ts
new file mode 100644
index 00000000000..008e98674bc
--- /dev/null
+++ b/src/features/Settings/creds/features/credTypes.ts
@@ -0,0 +1,12 @@
+import { type CredType } from '@lobechat/types';
+import { File, Globe, Key, type LucideIcon, TerminalSquare } from 'lucide-react';
+
+/** Every credential type, in the order the create menu and the type filter list them. */
+export const CRED_TYPES: CredType[] = ['kv-env', 'kv-header', 'oauth', 'file'];
+
+export const CRED_TYPE_ICONS: Record<CredType, LucideIcon> = {
+ 'file': File,
+ 'kv-env': TerminalSquare,
+ 'kv-header': Globe,
+ 'oauth': Key,
+};
diff --git a/src/features/Settings/creds/features/style.ts b/src/features/Settings/creds/features/style.ts
index 01147221e55..0192e1e52fd 100644
--- a/src/features/Settings/creds/features/style.ts
+++ b/src/features/Settings/creds/features/style.ts
@@ -19,6 +19,7 @@ export const styles = stylex.create({
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
},
+ descriptionCompact: { lineHeight: '18px' },
icon: {
display: 'flex',
flexShrink: 0,
@@ -35,15 +36,13 @@ export const styles = stylex.create({
height: '36px',
borderRadius: '10px',
},
- key: {
- fontFamily: 'monospace',
- fontSize: '12px',
- color: cssVar.colorTextSecondary,
- },
title: {
+ overflow: 'hidden',
fontSize: '15px',
fontWeight: 500,
color: cssVar.colorText,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
},
titleCompact: {
fontSize: '14px',
diff --git a/src/features/Settings/creds/index.tsx b/src/features/Settings/creds/index.tsx
index fe82259568d..14839a3cce4 100644
--- a/src/features/Settings/creds/index.tsx
+++ b/src/features/Settings/creds/index.tsx
@@ -1,13 +1,13 @@
'use client';
-import { Button, Flexbox, Icon, Tooltip } from '@lobehub/ui';
-import { Plus } from 'lucide-react';
+import { type CredType } from '@lobechat/types';
+import { Flexbox, Tooltip } from '@lobehub/ui';
import { useState } from 'react';
-import { useTranslation } from 'react-i18next';
import { usePermission } from '@/hooks/usePermission';
import SettingsPageActions from '../features/SettingsPageActions';
+import CreateCredButton from './features/CreateCredButton';
import { createCreateCredModal } from './features/CreateCredModal';
import CredsList from './features/CredsList';
import { personalCredsApi } from './features/useCredsApi';
@@ -17,29 +17,27 @@ interface PageProps {
}
const Page = ({ mobile }: PageProps) => {
- const { t } = useTranslation('setting');
const { allowed: canManageCredentials, reason } = usePermission('manage_provider_key');
const [refreshKey, setRefreshKey] = useState(0);
- const handleCreate = () => {
+ const handleCreate = (type: CredType) => {
if (!canManageCredentials) return;
createCreateCredModal({
credsApi: personalCredsApi,
onSuccess: () => setRefreshKey((k) => k + 1),
+ type,
});
};
const createButton = (
<Tooltip title={reason}>
- <Button
- disabled={!canManageCredentials}
- icon={<Icon icon={Plus} />}
- size={mobile ? 'large' : undefined}
- type={'primary'}
- onClick={handleCreate}
- >
- {t('creds.create')}
- </Button>
+ <span>
+ <CreateCredButton
+ disabled={!canManageCredentials}
+ size={mobile ? 'large' : undefined}
+ onCreate={handleCreate}
+ />
+ </span>
</Tooltip>
);