From da7948b6ad9f873a3e6e088b2825a52726c39a03 Mon Sep 17 00:00:00 2001 From: YuMao Date: Tue, 8 Oct 2024 14:05:48 +0800 Subject: [PATCH] fix: bind "workingDir" tip msg --- daemon/src/entity/commands/docker/docker_pull.ts | 3 +-- daemon/src/entity/commands/docker/docker_start.ts | 8 ++------ daemon/src/service/docker_process_service.ts | 10 +++++++++- .../src/widgets/instance/dialogs/InstanceDetail.vue | 4 +++- languages/de_DE.json | 4 +++- languages/en_US.json | 4 +++- languages/es_ES.json | 4 +++- languages/fr_FR.json | 4 +++- languages/ja_JP.json | 4 +++- languages/ko_KR.json | 4 +++- languages/pt_BR.json | 4 +++- languages/ru_RU.json | 4 +++- languages/tr_TR.json | 4 +++- languages/zh_CN.json | 4 +++- 14 files changed, 45 insertions(+), 20 deletions(-) diff --git a/daemon/src/entity/commands/docker/docker_pull.ts b/daemon/src/entity/commands/docker/docker_pull.ts index 8cfaf1e3..3f1bda09 100644 --- a/daemon/src/entity/commands/docker/docker_pull.ts +++ b/daemon/src/entity/commands/docker/docker_pull.ts @@ -1,8 +1,7 @@ -import Docker from "dockerode"; import Instance from "../../instance/instance"; import InstanceCommand from "../base/command"; import { t } from "i18next"; -import { DefaultDocker } from "../../../service/docker_service" +import { DefaultDocker } from "../../../service/docker_service"; export async function checkImage(name: string) { const docker = new DefaultDocker(); diff --git a/daemon/src/entity/commands/docker/docker_start.ts b/daemon/src/entity/commands/docker/docker_start.ts index 777b4883..911982bf 100755 --- a/daemon/src/entity/commands/docker/docker_start.ts +++ b/daemon/src/entity/commands/docker/docker_start.ts @@ -3,7 +3,6 @@ import Instance from "../../instance/instance"; import InstanceCommand from "../base/command"; import logger from "../../../service/log"; import fs from "fs-extra"; -import { t } from "i18next"; import DockerPullCommand from "./docker_pull"; import { DockerProcessAdapter, @@ -18,7 +17,7 @@ export default class DockerStartCommand extends InstanceCommand { async exec(instance: Instance, source = "Unknown") { if (!instance.config.cwd || !instance.config.ie || !instance.config.oe) - throw new StartupDockerProcessError($t("TXT_CODE_instance.dirEmpty")); + throw new StartupDockerProcessError($t("TXT_CODE_a6424dcc")); if (!fs.existsSync(instance.absoluteCwdPath())) throw new StartupDockerProcessError($t("TXT_CODE_instance.dirNoE")); @@ -30,16 +29,13 @@ export default class DockerStartCommand extends InstanceCommand { } // Docker docks to the process adapter - const isTty = instance.config.terminalOption.pty; - const workingDir = instance.config.docker.workingDir ?? "/workspace/"; const processAdapter = new DockerProcessAdapter(new SetupDockerContainer(instance)); await processAdapter.start({ - isTty, + isTty: instance.config.terminalOption.pty, w: instance.config.terminalOption.ptyWindowCol, h: instance.config.terminalOption.ptyWindowCol }); - instance.println("CONTAINER", t("TXT_CODE_e76e49e9") + workingDir); instance.started(processAdapter); logger.info( $t("TXT_CODE_instance.successful", { diff --git a/daemon/src/service/docker_process_service.ts b/daemon/src/service/docker_process_service.ts index 64cbee7e..2811a4a1 100644 --- a/daemon/src/service/docker_process_service.ts +++ b/daemon/src/service/docker_process_service.ts @@ -118,6 +118,14 @@ export class SetupDockerContainer extends AsyncTask { const isTty = instance.config.terminalOption.pty; const workingDir = instance.config.docker.workingDir ?? ""; + if (workingDir) { + instance.println( + "CONTAINER", + $t("TXT_CODE_e76e49e9") + instance.config.cwd + " --> " + workingDir + "\n" + ); + } else { + instance.println("CONTAINER", $t("TXT_CODE_ffa884f9")); + } // output startup log logger.info("----------------"); @@ -130,7 +138,7 @@ export class SetupDockerContainer extends AsyncTask { logger.info(`OPEN_PORT: ${JSON.stringify(publicPortArray)}`); logger.info( `BINDS: ${JSON.stringify([ - workingDir ? `${cwd}->${workingDir}` : "", + workingDir ? `${cwd} --> ${workingDir}` : "", ...extraBinds ])}` ); diff --git a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue index ea29c1f0..4c33499e 100644 --- a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue +++ b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue @@ -39,8 +39,11 @@ const props = defineProps<{ // eslint-disable-next-line no-unused-vars enum TabSettings { + // eslint-disable-next-line no-unused-vars Basic = "Basic", + // eslint-disable-next-line no-unused-vars Docker = "Docker", + // eslint-disable-next-line no-unused-vars Advanced = "Advanced" } @@ -160,7 +163,6 @@ const rules: Record = { { required: true, validator: async (_rule: Rule, value: string) => { - if (value === "") throw new Error(t("TXT_CODE_4e810102")); if (value.includes("\n")) throw new Error(t("TXT_CODE_bbbda29")); }, trigger: "change" diff --git a/languages/de_DE.json b/languages/de_DE.json index 4248871e..f0160bb7 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Dieser Fehler bedeutet normalerweise, dass die Webseite keine direkte Verbindung zum Backend-Prozess herstellen kann. \nWenn Sie Portweiterleitung, Mapping, Reverse-Proxy haben, überprüfen Sie bitte die Konfiguration!", "TXT_CODE_46c48969": "Anscheinend versuchen Sie, HTTPS zu verwenden, aber wir können über das WSS-Protokoll keine Verbindung zum Daemon herstellen. \nBitte versuchen Sie, über das WSS://-Protokoll eine Verbindung zum Daemon herzustellen.", "TXT_CODE_9b3ce825": "Beschreibung des Reverse-Proxys", - "TXT_CODE_d4c8fb3b": "Zugehörige Dokumente:" + "TXT_CODE_d4c8fb3b": "Zugehörige Dokumente:", + "TXT_CODE_a6424dcc": "Das Arbeitsverzeichnis oder der Startbefehl darf nicht leer sein", + "TXT_CODE_ffa884f9": "Warnung: Das Arbeitsverzeichnis ist nicht im Container gemountet und der Container kann nicht auf Dateien im Arbeitsverzeichnis der Instanz zugreifen" } diff --git a/languages/en_US.json b/languages/en_US.json index 58bf0ec8..4be46766 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -1948,5 +1948,7 @@ "TXT_CODE_9b3ce825": "Reverse proxy description", "TXT_CODE_10cc2794": "Network architecture description", "TXT_CODE_46c48969": "It looks like you are trying to use HTTPS, but we cannot connect to the daemon using the WSS protocol. Please try to connect to the daemon using the WSS:// protocol.", - "TXT_CODE_2fb14927": "This error usually means that the web page cannot connect directly to the backend process. If you have port forwarding, mapping, reverse proxy, please check the configuration!" + "TXT_CODE_2fb14927": "This error usually means that the web page cannot connect directly to the backend process. If you have port forwarding, mapping, reverse proxy, please check the configuration!", + "TXT_CODE_a6424dcc": "The working directory or startup command cannot be empty", + "TXT_CODE_ffa884f9": "Warning: The working directory is not mounted to the container, and the container will not be able to access files in the instance's working directory" } diff --git a/languages/es_ES.json b/languages/es_ES.json index dd63b6a5..bdf46602 100644 --- a/languages/es_ES.json +++ b/languages/es_ES.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Este error generalmente significa que la página web no puede conectarse directamente al proceso backend. \nSi tiene reenvío de puertos, mapeo o proxy inverso, verifique la configuración.", "TXT_CODE_46c48969": "Parece que está intentando utilizar HTTPS, pero no podemos conectarnos al demonio mediante el protocolo WSS. \nIntente conectarse al demonio utilizando el protocolo WSS://.", "TXT_CODE_9b3ce825": "Descripción del proxy inverso", - "TXT_CODE_d4c8fb3b": "Documentos relacionados:" + "TXT_CODE_d4c8fb3b": "Documentos relacionados:", + "TXT_CODE_a6424dcc": "El directorio de trabajo o el comando de inicio no pueden estar vacíos", + "TXT_CODE_ffa884f9": "Advertencia: el directorio de trabajo no está montado en el contenedor y el contenedor no podrá acceder a los archivos en el directorio de trabajo de la instancia." } diff --git a/languages/fr_FR.json b/languages/fr_FR.json index 7c5fafa0..80c80517 100644 --- a/languages/fr_FR.json +++ b/languages/fr_FR.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Cette erreur signifie généralement que la page Web ne peut pas se connecter directement au processus backend. \nSi vous disposez d'une redirection de port, d'un mappage, d'un proxy inverse, veuillez vérifier la configuration !", "TXT_CODE_46c48969": "Il semble que vous essayez d'utiliser HTTPS, mais nous ne parvenons pas à nous connecter au démon à l'aide du protocole WSS. \nVeuillez essayer de vous connecter au démon en utilisant le protocole WSS://.", "TXT_CODE_9b3ce825": "Description du proxy inverse", - "TXT_CODE_d4c8fb3b": "Documents associés :" + "TXT_CODE_d4c8fb3b": "Documents associés :", + "TXT_CODE_a6424dcc": "Le répertoire de travail ou la commande de démarrage ne peut pas être vide", + "TXT_CODE_ffa884f9": "Avertissement : Le répertoire de travail n'est pas monté sur le conteneur et le conteneur ne pourra pas accéder aux fichiers du répertoire de travail de l'instance." } diff --git a/languages/ja_JP.json b/languages/ja_JP.json index 4f719f0b..27b79c35 100644 --- a/languages/ja_JP.json +++ b/languages/ja_JP.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "このエラーは通常、Web ページがバックエンド プロセスに直接接続できないことを意味します。\nポートフォワーディング、マッピング、リバースプロキシを使用している場合は、設定を確認してください。", "TXT_CODE_46c48969": "HTTPS を使用しようとしているようですが、WSS プロトコルを使用してデーモンに接続できません。 \nWSS:// プロトコルを使用してデーモンへの接続を試行してください。", "TXT_CODE_9b3ce825": "リバースプロキシの説明", - "TXT_CODE_d4c8fb3b": "関連文書:" + "TXT_CODE_d4c8fb3b": "関連文書:", + "TXT_CODE_a6424dcc": "作業ディレクトリまたは起動コマンドを空にすることはできません", + "TXT_CODE_ffa884f9": "警告: 作業ディレクトリがコンテナにマウントされていないため、コンテナはインスタンスの作業ディレクトリ内のファイルにアクセスできません" } diff --git a/languages/ko_KR.json b/languages/ko_KR.json index d1eefbbb..c78b3069 100644 --- a/languages/ko_KR.json +++ b/languages/ko_KR.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "이 오류는 일반적으로 웹페이지가 백엔드 프로세스에 직접 연결할 수 없음을 의미합니다. \n포트포워딩, 매핑, 리버스프록시가 있는 경우 구성을 확인해주세요!", "TXT_CODE_46c48969": "HTTPS를 사용하려는 것 같지만 WSS 프로토콜을 사용하여 데몬에 연결할 수 없습니다. \nWSS:// 프로토콜을 사용하여 데몬에 연결해 보십시오.", "TXT_CODE_9b3ce825": "역방향 프록시 설명", - "TXT_CODE_d4c8fb3b": "관련 문서:" + "TXT_CODE_d4c8fb3b": "관련 문서:", + "TXT_CODE_a6424dcc": "작업 디렉터리 또는 시작 명령은 비워둘 수 없습니다.", + "TXT_CODE_ffa884f9": "경고: 작업 디렉터리가 컨테이너에 마운트되지 않았으므로 컨테이너는 인스턴스의 작업 디렉터리에 있는 파일에 액세스할 수 없습니다." } diff --git a/languages/pt_BR.json b/languages/pt_BR.json index 3bf4ead8..c17f9bfe 100644 --- a/languages/pt_BR.json +++ b/languages/pt_BR.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Este erro geralmente significa que a página da web não pode se conectar diretamente ao processo de back-end. \nSe você possui encaminhamento de porta, mapeamento, proxy reverso, verifique a configuração!", "TXT_CODE_46c48969": "Parece que você está tentando usar HTTPS, mas não conseguimos nos conectar ao daemon usando o protocolo WSS. \nTente se conectar ao daemon usando o protocolo WSS://.", "TXT_CODE_9b3ce825": "Descrição do proxy reverso", - "TXT_CODE_d4c8fb3b": "Documentos relacionados:" + "TXT_CODE_d4c8fb3b": "Documentos relacionados:", + "TXT_CODE_a6424dcc": "O diretório de trabalho ou comando de inicialização não pode estar vazio", + "TXT_CODE_ffa884f9": "Aviso: o diretório de trabalho não está montado no contêiner e o contêiner não poderá acessar arquivos no diretório de trabalho da instância" } diff --git a/languages/ru_RU.json b/languages/ru_RU.json index e4fad89f..fc6e9fb3 100644 --- a/languages/ru_RU.json +++ b/languages/ru_RU.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Эта ошибка обычно означает, что веб-страница не может напрямую подключиться к серверному процессу. \nЕсли у вас есть переадресация портов, сопоставление, обратный прокси-сервер, проверьте конфигурацию!", "TXT_CODE_46c48969": "Похоже, вы пытаетесь использовать HTTPS, но мы не можем подключиться к демону по протоколу WSS. \nПопробуйте подключиться к демону по протоколу WSS://.", "TXT_CODE_9b3ce825": "Описание обратного прокси", - "TXT_CODE_d4c8fb3b": "Сопутствующие документы:" + "TXT_CODE_d4c8fb3b": "Сопутствующие документы:", + "TXT_CODE_a6424dcc": "Рабочий каталог или команда запуска не могут быть пустыми.", + "TXT_CODE_ffa884f9": "Предупреждение. Рабочий каталог не подключен к контейнеру, и контейнер не сможет получить доступ к файлам в рабочем каталоге экземпляра." } diff --git a/languages/tr_TR.json b/languages/tr_TR.json index 76511c4b..d31afed0 100644 --- a/languages/tr_TR.json +++ b/languages/tr_TR.json @@ -1948,5 +1948,7 @@ "TXT_CODE_2fb14927": "Bu hata genellikle web sayfasının doğrudan arka uç işlemine bağlanamadığı anlamına gelir. \nBağlantı noktası yönlendirme, eşleme, ters proxy'niz varsa lütfen yapılandırmayı kontrol edin!", "TXT_CODE_46c48969": "Görünüşe göre HTTPS kullanmaya çalışıyorsunuz ancak arka plan programına WSS protokolünü kullanarak bağlanamıyoruz. \nLütfen WSS:// protokolünü kullanarak arka plan programına bağlanmayı deneyin.", "TXT_CODE_9b3ce825": "Ters proxy açıklaması", - "TXT_CODE_d4c8fb3b": "İlgili belgeler:" + "TXT_CODE_d4c8fb3b": "İlgili belgeler:", + "TXT_CODE_a6424dcc": "Çalışma dizini veya başlatma komutu boş olamaz", + "TXT_CODE_ffa884f9": "Uyarı: Çalışma dizini kapsayıcıya bağlanmamıştır ve kapsayıcı, örneğin çalışma dizinindeki dosyalara erişemeyecektir." } diff --git a/languages/zh_CN.json b/languages/zh_CN.json index 970a8f73..478ef975 100644 --- a/languages/zh_CN.json +++ b/languages/zh_CN.json @@ -1948,5 +1948,7 @@ "TXT_CODE_9b3ce825": "反向代理说明", "TXT_CODE_10cc2794": "网络架构说明", "TXT_CODE_46c48969": "看起来您正在尝试使用 HTTPS,但是我们无法使用 WSS 协议连接到守护进程,请尝试使用 WSS:// 协议连接到守护进程。", - "TXT_CODE_2fb14927": "此错误通常意味着网页无法直接连接到后端进程,如果您有端口转发,映射,反向代理,请检查配置!" + "TXT_CODE_2fb14927": "此错误通常意味着网页无法直接连接到后端进程,如果您有端口转发,映射,反向代理,请检查配置!", + "TXT_CODE_a6424dcc": "工作目录和启动命令不可为空", + "TXT_CODE_ffa884f9": "警告:工作目录没有挂载到容器中,容器将无法访问到实例工作目录中的文件" }