diff --git a/backend/stack.ts b/backend/stack.ts index 79a00db..5fe8b99 100644 --- a/backend/stack.ts +++ b/backend/stack.ts @@ -553,7 +553,7 @@ export class Stack { async startService(socket: DockgeSocket, serviceName: string) { const terminalName = getComposeTerminalName(socket.endpoint, this.name); - const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", ["compose", "up", "-d", serviceName], this.path); + const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "up", "-d", serviceName ], this.path); if (exitCode !== 0) { throw new Error(`Failed to start service ${serviceName}, please check logs for more information.`); } @@ -563,7 +563,7 @@ export class Stack { async stopService(socket: DockgeSocket, serviceName: string): Promise { const terminalName = getComposeTerminalName(socket.endpoint, this.name); - const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", ["compose", "stop", serviceName], this.path); + const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "stop", serviceName ], this.path); if (exitCode !== 0) { throw new Error(`Failed to stop service ${serviceName}, please check logs for more information.`); } @@ -573,7 +573,7 @@ export class Stack { async restartService(socket: DockgeSocket, serviceName: string): Promise { const terminalName = getComposeTerminalName(socket.endpoint, this.name); - const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", ["compose", "restart", serviceName], this.path); + const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "restart", serviceName ], this.path); if (exitCode !== 0) { throw new Error(`Failed to restart service ${serviceName}, please check logs for more information.`); } diff --git a/frontend/src/components/Container.vue b/frontend/src/components/Container.vue index 302e9cc..a4a6e26 100644 --- a/frontend/src/components/Container.vue +++ b/frontend/src/components/Container.vue @@ -21,24 +21,30 @@ Bash - - - @@ -292,7 +298,7 @@ export default defineComponent({ serviceCount() { return Object.keys(this.jsonObject.services).length; }, - + jsonObject() { return this.$parent.$parent.jsonConfig; }, diff --git a/frontend/src/components/StackList.vue b/frontend/src/components/StackList.vue index 96c81a1..62ab672 100644 --- a/frontend/src/components/StackList.vue +++ b/frontend/src/components/StackList.vue @@ -3,8 +3,10 @@
- @@ -31,10 +33,14 @@
- - + + {{ $t("selectedStackCount", [selectedStackCount]) }} @@ -45,9 +51,11 @@
{{ $t("addFirstStackMsg") }}
-
-
+
+
@@ -55,9 +63,11 @@ {{ $t("currentEndpoint") }} {{ agent.endpoint }}
- +
@@ -195,20 +205,20 @@ export default { // and the rest are sorted alphabetically result = [ ...result.reduce((acc, stack) => { - const endpoint = stack.endpoint || 'current'; + const endpoint = stack.endpoint || "current"; if (!acc.has(endpoint)) { acc.set(endpoint, []); } acc.get(endpoint).push(stack); return acc; }, new Map()).entries() - ].map(([endpoint, stacks]) => ({ + ].map(([ endpoint, stacks ]) => ({ endpoint, stacks })).sort((a, b) => { - if (a.endpoint === 'current' && b.endpoint !== 'current') { + if (a.endpoint === "current" && b.endpoint !== "current") { return -1; - } else if (a.endpoint !== 'current' && b.endpoint === 'current') { + } else if (a.endpoint !== "current" && b.endpoint === "current") { return 1; } return a.endpoint.localeCompare(b.endpoint); diff --git a/frontend/src/components/Terminal.vue b/frontend/src/components/Terminal.vue index 32fdbb5..8135d83 100644 --- a/frontend/src/components/Terminal.vue +++ b/frontend/src/components/Terminal.vue @@ -20,22 +20,24 @@ export default { props: { name: { type: String, - require: true, + required: true, }, endpoint: { type: String, - require: true, + required: true, }, // Require if mode is interactive stackName: { type: String, + default: "", }, // Require if mode is interactive serviceName: { type: String, + default: "", }, // Require if mode is interactive @@ -102,7 +104,7 @@ export default { this.terminal.focus(); // Add right-click context menu handler for paste - this.$refs.terminal.addEventListener('contextmenu', this.handleContextMenu); + this.$refs.terminal.addEventListener("contextmenu", this.handleContextMenu); // Add selection handler for copy to clipboard this.terminal.onSelectionChange(() => { @@ -143,7 +145,7 @@ export default { window.removeEventListener("resize", this.onResizeEvent); // Remove the resize event listener from the window object. this.$root.unbindTerminal(this.name); this.terminal.dispose(); - this.$refs.terminal?.removeEventListener('contextmenu', this.handleContextMenu); + this.$refs.terminal?.removeEventListener("contextmenu", this.handleContextMenu); }, methods: { @@ -206,7 +208,7 @@ export default { const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition); this.terminalInputBuffer = beforeCursor + afterCursor; this.cursorPosition--; - + // Redraw the line this.terminal.write("\b" + afterCursor + " \b".repeat(afterCursor.length + 1)); } @@ -216,7 +218,7 @@ export default { const beforeCursor = this.terminalInputBuffer.slice(0, this.cursorPosition); const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition + 1); this.terminalInputBuffer = beforeCursor + afterCursor; - + // Redraw the line from cursor position this.terminal.write(afterCursor + " \b".repeat(afterCursor.length + 1)); } @@ -312,19 +314,19 @@ export default { // For main terminal, insert text at current cursor position const beforeCursor = this.terminalInputBuffer.slice(0, this.cursorPosition); const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition); - + // Update the buffer with inserted text this.terminalInputBuffer = beforeCursor + text + afterCursor; - + // Clear the current line and rewrite it this.clearCurrentLine(); this.terminal.write(this.terminalInputBuffer); - + // Move cursor to the correct position (after the pasted text) this.cursorPosition += text.length; const backspaces = "\b".repeat(afterCursor.length); this.terminal.write(backspaces); - + } else if (this.mode === "interactive") { // For interactive terminal, send directly to server this.$root.emitAgent(this.endpoint, "terminalInput", this.name, text, (res) => { @@ -341,7 +343,7 @@ export default { handleContextMenu(event) { // Prevent default context menu event.preventDefault(); - + // Only handle paste for modes that support input if (this.mode === "mainTerminal" || this.mode === "interactive") { this.handlePaste(); diff --git a/frontend/src/components/settings/GlobalEnv.vue b/frontend/src/components/settings/GlobalEnv.vue index 9c3d568..2216ca5 100644 --- a/frontend/src/components/settings/GlobalEnv.vue +++ b/frontend/src/components/settings/GlobalEnv.vue @@ -57,7 +57,8 @@ export default { EditorView.focusChangeEffect.of(focusEffectHandler), ]; - return { editorFocus, extensionsEnv }; + return { editorFocus, + extensionsEnv }; }, computed: { diff --git a/frontend/src/lang/en.json b/frontend/src/lang/en.json index e521043..2a731a4 100644 --- a/frontend/src/lang/en.json +++ b/frontend/src/lang/en.json @@ -47,8 +47,10 @@ "deleteContainer": "Delete", "addContainer": "Add Container", "addNetwork": "Add Network", - "disableauth.message1": "Are you sure want to disable authentication?", - "disableauth.message2": "It is designed for scenarios where you intend to implement third-party authentication in front of Dockge such as Cloudflare Access, Authelia or other authentication mechanisms.", + "disableauth.message1": "Are you sure want to {disableAuth}?", + "disableauth.message2": "It is designed for scenarios {scenarios}", + "disableAuth": "disable authentication", + "scenarios": "where you intend to implement third-party authentication", "passwordNotMatchMsg": "The repeat password does not match.", "autoGet": "Auto Get", "add": "Add", @@ -139,8 +141,12 @@ "networkIO": "Network I/O", "blockIO": "Block I/O", "Console is not enabled": "Console is not enabled", - "ConsoleNotEnabledMSG1": "Console is a powerful tool that allows you to execute any commands such as docker, rm within the Dockge's container in this Web UI.", - "ConsoleNotEnabledMSG2": "It might be dangerous since this Dockge container is connecting to the host's Docker daemon. Also Dockge could be possibly taken down by commands like rm -rf" , - "ConsoleNotEnabledMSG3": "If you understand the risk, you can enable it by setting DOCKGE_ENABLE_CONSOLE=true in the environment variables.", + "ConsoleNotEnabledMSG1": "Console is a powerful tool that allows you to execute any commands such as {docker}, {rm} within the Dockge's container in this Web UI.", + "ConsoleNotEnabledMSG2": "It might be dangerous since this Dockge container is connecting to the host's Docker daemon. Also Dockge could be possibly taken down by commands like {rmRf}", + "ConsoleNotEnabledMSG3": "If you understand the risk, you can enable it by setting {envVar} in the environment variables.", + "dockerCode": "docker", + "rmCode": "rm", + "rmRfCode": "rm -rf", + "envVarCode": "DOCKGE_ENABLE_CONSOLE=true", "confirmLeaveStack": "You are currently editing a stack. Are you sure you want to leave?" } diff --git a/frontend/src/mixins/socket.ts b/frontend/src/mixins/socket.ts index 15a140a..3e7eed8 100644 --- a/frontend/src/mixins/socket.ts +++ b/frontend/src/mixins/socket.ts @@ -131,7 +131,7 @@ export default defineComponent({ methods: { endpointDisplayFunction(endpoint : string) { - for (const [k, v] of Object.entries(this.$data.agentList)) { + for (const [ k, v ] of Object.entries(this.$data.agentList)) { if (endpoint) { if (endpoint === v["endpoint"] && v["name"] !== "") { return v["name"]; diff --git a/frontend/src/pages/Compose.vue b/frontend/src/pages/Compose.vue index 41834bf..20cf9ec 100644 --- a/frontend/src/pages/Compose.vue +++ b/frontend/src/pages/Compose.vue @@ -63,8 +63,8 @@ @@ -98,8 +98,8 @@
@@ -282,11 +282,6 @@ let yamlErrorTimeout = null; let serviceStatusTimeout = null; let dockerStatsTimeout = null; -let prismjsSymbolDefinition = { - "symbol": { - pattern: /(?

{{ $t("Console is not enabled") }}

-

-

-

+ + + + + + + + + + + +
@@ -37,7 +50,7 @@ export default { }); }, methods: { - + } }; diff --git a/frontend/src/pages/ContainerTerminal.vue b/frontend/src/pages/ContainerTerminal.vue index 3b6127c..fbafd1c 100644 --- a/frontend/src/pages/ContainerTerminal.vue +++ b/frontend/src/pages/ContainerTerminal.vue @@ -1,7 +1,7 @@