Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "Failed to download RDP file",
"ConnectFailed": "Connection failed",
"CredentialServiceUnavailable": "The credential service (such as OpenBao) is unavailable. Check the service status and try again.",
"PersonalCredentialNotFound": "The selected personal credential could not be found. Select another credential or enter one manually.",
"AclFailed": "The current asset is restricted by ACL policies and cannot be accessed via the client. Please use the Web console to connect.",
"MethodDisabled": "This connection method is disabled",
"ClientNotFound": "Desktop client not found. Please install or configure the client path.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/es.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Monitor": {
"Unavailable": "La sesión ha finalizado o no se puede supervisar.",

Check warning on line 3 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"supervisar" should be "supervisor".

Check warning on line 3 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"supervisar" should be "supervisor".
"PauseSent": "Se ha enviado la tarea de pausa",
"ResumeSent": "Se ha enviado la tarea de reanudación"
},
Expand All @@ -14,13 +14,13 @@
"Play": "Reproducir",
"Pause": "Pausar",
"Restart": "Reiniciar",
"HistoryCommands": "Historial de comandos",

Check warning on line 17 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 17 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Historial" should be "Historical".

Check warning on line 17 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 17 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Historial" should be "Historical".
"Playlist": "Lista de reproducción",
"SearchCommands": "Buscar comandos...",

Check warning on line 19 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 19 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".
"NoCommands": "No hay registros de comandos",

Check warning on line 20 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 20 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".
"NoCommandsHint": "Esta sesión no tiene comandos grabados",

Check warning on line 21 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 21 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".
"CommandsFailed": "No se pudieron cargar los comandos",

Check warning on line 22 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 22 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".
"CommandsFailedHint": "El historial de comandos no está disponible temporalmente",

Check warning on line 23 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 23 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"historial" should be "historical".

Check warning on line 23 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"comandos" should be "commandos".

Check warning on line 23 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"historial" should be "historical".
"Loading": "Cargando...",
"HideRail": "Ocultar panel",
"ShowRail": "Mostrar panel",
Expand All @@ -34,7 +34,7 @@
"UnsupportedHint": "Este tipo de grabación no es compatible con el reproductor en línea.",
"Reload": "Volver a cargar",
"DesktopBlocked": "Solo en el navegador",
"DesktopBlockedHint": "La reproducción de sesiones solo está disponible en un navegador web. Copie el enlace y ábralo allí.",

Check warning on line 37 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Copie" should be "Copied" or "Copier" or "Copies" or "Copy".

Check warning on line 37 in i18n/locales/es.json

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Copie" should be "Copied" or "Copier" or "Copies" or "Copy".
"ShortcutsTitle": "Atajos de teclado",
"ShortcutPlayPause": "pausar / reanudar",
"ShortcutFullscreen": "alternar el modo de pantalla completa",
Expand Down Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "No se pudo descargar el archivo RDP",
"ConnectFailed": "Error de conexión",
"CredentialServiceUnavailable": "El servicio de credenciales (por ejemplo, OpenBao) no está disponible. Compruebe su estado e inténtelo de nuevo.",
"PersonalCredentialNotFound": "No se encontró la credencial personal seleccionada. Seleccione otra o introdúzcala manualmente.",
"AclFailed": "El activo actual está restringido por políticas de ACL y no se puede acceder a él mediante el cliente. Use la consola web para conectarse.",
"MethodDisabled": "Este método de conexión está deshabilitado",
"ClientNotFound": "No se encontró el cliente de escritorio. Instale o configure su ruta.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "RDP ファイルのダウンロードに失敗しました",
"ConnectFailed": "接続に失敗しました",
"CredentialServiceUnavailable": "認証情報サービス(OpenBao など)を利用できません。サービスの状態を確認してから再試行してください。",
"PersonalCredentialNotFound": "選択した個人認証情報が見つかりません。別の認証情報を選択するか、手動で入力してください。",
"AclFailed": "現在のアセットは ACL ポリシーによって制限されているため、クライアントからアクセスできません。Web コンソールから接続してください。",
"MethodDisabled": "この接続方法は無効になっています",
"ClientNotFound": "デスクトップクライアントが見つかりません。クライアントをインストールするか、パスを設定してください。",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "RDP 파일을 다운로드하지 못했습니다",
"ConnectFailed": "연결 실패",
"CredentialServiceUnavailable": "자격 증명 서비스(예: OpenBao)를 사용할 수 없습니다. 서비스 상태를 확인한 후 다시 시도하세요.",
"PersonalCredentialNotFound": "선택한 개인 자격 증명을 찾을 수 없습니다. 다른 자격 증명을 선택하거나 직접 입력하세요.",
"AclFailed": "현재 자산은 ACL 정책으로 제한되어 클라이언트에서 접근할 수 없습니다. 웹 콘솔에서 연결하세요.",
"MethodDisabled": "이 연결 방식은 비활성화되어 있습니다",
"ClientNotFound": "데스크톱 클라이언트를 찾을 수 없습니다. 클라이언트를 설치하거나 경로를 설정하세요.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "Falha ao baixar o arquivo RDP",
"ConnectFailed": "Falha na conexão",
"CredentialServiceUnavailable": "O serviço de credenciais (como o OpenBao) não está disponível. Verifique o status do serviço e tente novamente.",
"PersonalCredentialNotFound": "A credencial pessoal selecionada não foi encontrada. Selecione outra ou insira uma manualmente.",
"AclFailed": "O ativo atual está restrito por políticas de ACL e não pode ser acessado pelo cliente. Use o console Web para se conectar.",
"MethodDisabled": "Este método de conexão está desativado",
"ClientNotFound": "Cliente de desktop não encontrado. Instale ou configure o caminho do cliente.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "Не удалось скачать файл RDP",
"ConnectFailed": "Ошибка подключения",
"CredentialServiceUnavailable": "Сервис учетных данных (например, OpenBao) недоступен. Проверьте его состояние и повторите попытку.",
"PersonalCredentialNotFound": "Выбранные личные учетные данные не найдены. Выберите другие или введите их вручную.",
"AclFailed": "Доступ к текущему ресурсу ограничен политиками ACL, поэтому подключение через клиент недоступно. Используйте веб-консоль.",
"MethodDisabled": "Этот способ подключения отключён",
"ClientNotFound": "Настольный клиент не найден. Установите его или настройте путь к приложению.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "Không thể tải tệp RDP",
"ConnectFailed": "Kết nối thất bại",
"CredentialServiceUnavailable": "Dịch vụ thông tin xác thực (ví dụ: OpenBao) không khả dụng. Hãy kiểm tra trạng thái dịch vụ rồi thử lại.",
"PersonalCredentialNotFound": "Không tìm thấy thông tin xác thực cá nhân đã chọn. Hãy chọn thông tin khác hoặc nhập thủ công.",
"AclFailed": "Tài sản hiện tại bị giới hạn bởi chính sách ACL và không thể truy cập bằng máy khách. Hãy dùng bảng điều khiển web để kết nối.",
"MethodDisabled": "Phương thức kết nối này đã bị tắt",
"ClientNotFound": "Không tìm thấy máy khách máy tính. Vui lòng cài đặt hoặc cấu hình đường dẫn.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,7 @@
"DownloadRdpFailed": "下载 RDP 文件失败",
"ConnectFailed": "连接失败",
"CredentialServiceUnavailable": "凭据服务(如 OpenBao)不可用,请检查服务状态后重试。",
"PersonalCredentialNotFound": "未找到所选的个人凭据,请重新选择或手动输入。",
"AclFailed": "当前资产受到 ACL 访问限制,无法通过客户端连接,请前往 Web 端进行访问",
"MethodDisabled": "该连接方式已被管理员禁用",
"ClientNotFound": "未找到桌面客户端,请安装或在设置中配置路径",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/zh_hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@
"DownloadRdpFailed": "下載 RDP 檔案失敗",
"ConnectFailed": "連線失敗",
"CredentialServiceUnavailable": "憑據服務(例如 OpenBao)無法使用,請檢查服務狀態後重試。",
"PersonalCredentialNotFound": "找不到所選的個人憑據,請重新選擇或手動輸入。",
"AclFailed": "當前資產受到 ACL 訪問限制,無法透過客戶端連線,請前往 Web 端進行訪問",
"MethodDisabled": "該連線方式已被管理員停用",
"ClientNotFound": "未找到桌面客戶端,請安裝或在設定中配置路徑",
Expand Down
6 changes: 5 additions & 1 deletion ui/composables/useAssetAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,10 @@ export const useAssetAction = () => {
: undefined;
const savePersonalCredential = !!ephemeral?.savePersonalCredential;
const useSavedPersonalCredential = isManual && !!personalCredentialId && !savePersonalCredential;
const manualAccountSecretType = _accounts.find((account) => account.alias === "@INPUT")?.secret_type;
const personalCredentialSecretType = personalCredentialId
? ephemeral?.personalCredentialSecretType || manualAccountSecretType || "password"
: manualAccountSecretType || ephemeral?.personalCredentialSecretType || "password";
const connectionBody: ConnectionBody = {
asset: assetId,
protocol,
Expand All @@ -881,7 +885,7 @@ export const useAssetAction = () => {
...(isManual && savePersonalCredential
? {
save_personal_credential: true,
input_secret_type: ephemeral.personalCredentialSecretType || "password",
input_secret_type: personalCredentialSecretType,
...(personalCredentialVersion !== undefined
? { personal_credential_version: personalCredentialVersion }
: {})
Expand Down
14 changes: 14 additions & 0 deletions ui/composables/useErrorToast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,18 @@ describe("error toast", () => {
expect(toastAdd).toHaveBeenCalledTimes(2);
expect(toastAdd.mock.calls.map(([toast]) => toast.id)).toEqual(["login-failed", "login-failed"]);
});

it("localizes a missing personal credential without exposing the API error type", () => {
vi.stubGlobal("useI18n", () => ({
t: (key: string) =>
key === "ConnectError.PersonalCredentialNotFound" ? "未找到所选的个人凭据,请重新选择或手动输入。" : key
}));
const { addErrorToast } = useErrorToast();

addErrorToast({ title: "连接失败", description: "ApiRequestError: Personal credential not found" });

expect(toastAdd).toHaveBeenCalledWith(
expect.objectContaining({ description: "未找到所选的个人凭据,请重新选择或手动输入。" })
);
});
});
13 changes: 12 additions & 1 deletion ui/composables/useErrorToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ function resolveErrorDescription(error: unknown) {
return normalizeToastText(error);
}

function localizeErrorDescription(description: string, translate: (key: string) => string) {
const apiMessage = description.replace(/^ApiRequestError:\s*/i, "").trim();
if (/^Personal credential not found\.?$/i.test(apiMessage)) {
return translate("ConnectError.PersonalCredentialNotFound");
}
return description;
}

function hasCopyAction(actions: ErrorToastAction[] = []) {
return actions.some((action) => {
const label = normalizeToastText(action?.label).toLowerCase();
Expand All @@ -67,7 +75,10 @@ export function useErrorToast() {
const toast = useToast();

const addErrorToast = (options: ErrorToastOptions) => {
const description = normalizeErrorText(options.description ?? resolveErrorDescription(options.error));
const description = localizeErrorDescription(
normalizeErrorText(options.description ?? resolveErrorDescription(options.error)),
t
);
const actions = [...(options.actions ?? [])];
const copyText = [options.title, description].filter(Boolean).join("\n");

Expand Down
Loading