fix: bind "workingDir" tip msg

This commit is contained in:
YuMao 2024-10-08 14:05:48 +08:00
parent ce94503b96
commit da7948b6ad
14 changed files with 45 additions and 20 deletions

View File

@ -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();

View File

@ -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", {

View File

@ -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}` : "<No WorkSpace>",
workingDir ? `${cwd} --> ${workingDir}` : "<Working directory not mounted>",
...extraBinds
])}`
);

View File

@ -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<string, any> = {
{
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"

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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": "警告: 作業ディレクトリがコンテナにマウントされていないため、コンテナはインスタンスの作業ディレクトリ内のファイルにアクセスできません"
}

View File

@ -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": "경고: 작업 디렉터리가 컨테이너에 마운트되지 않았으므로 컨테이너는 인스턴스의 작업 디렉터리에 있는 파일에 액세스할 수 없습니다."
}

View File

@ -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"
}

View File

@ -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": "Предупреждение. Рабочий каталог не подключен к контейнеру, и контейнер не сможет получить доступ к файлам в рабочем каталоге экземпляра."
}

View File

@ -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."
}

View File

@ -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": "警告:工作目录没有挂载到容器中,容器将无法访问到实例工作目录中的文件"
}