diff --git a/frontend/components.d.ts b/frontend/components.d.ts index a2da61da..12e2c4d3 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -42,7 +42,9 @@ declare module 'vue' { BetweenMenus: typeof import('./src/components/BetweenMenus.vue')['default'] CardOperator: typeof import('./src/components/CardOperator.vue')['default'] CardPanel: typeof import('./src/components/CardPanel.vue')['default'] + copy: typeof import('./src/components/ActionButton copy.vue')['default'] DataStatistic: typeof import('./src/components/DataStatistic.vue')['default'] + IconBtn: typeof import('./src/components/IconBtn.vue')['default'] InnerCard: typeof import('./src/components/InnerCard.vue')['default'] InputDialogProvider: typeof import('./src/components/InputDialogProvider.vue')['default'] LayoutCard: typeof import('./src/components/LayoutCard.vue')['default'] diff --git a/frontend/src/components/IconBtn.vue b/frontend/src/components/IconBtn.vue new file mode 100644 index 00000000..1a6ea71c --- /dev/null +++ b/frontend/src/components/IconBtn.vue @@ -0,0 +1,38 @@ + + + + + + + {{ title }} + + + + + + + diff --git a/frontend/src/hooks/useTerminal.ts b/frontend/src/hooks/useTerminal.ts index f5cc60c9..114d4bd5 100644 --- a/frontend/src/hooks/useTerminal.ts +++ b/frontend/src/hooks/useTerminal.ts @@ -116,17 +116,19 @@ export function useTerminal() { disableStdin: false, cursorStyle: "underline", cursorBlink: true, - fontSize: isPhone.value ? 10 : 13, + fontSize: 14, theme: { background: "#1e1e1e" }, allowProposedApi: true, - rendererType: "canvas" + rendererType: "canvas", + rows: 40, + cols: 160 }); const fitAddon = new FitAddon(); - term.loadAddon(fitAddon); + // term.loadAddon(fitAddon); term.open(element); - fitAddon.fit(); + // fitAddon.fit(); termFitAddon.value = fitAddon; term.onData((data) => { @@ -145,21 +147,20 @@ export function useTerminal() { }; events.on("stdout", (v: StdoutData) => { - // console.debug("stdout:", v.text); terminal.value?.write(v.text); }); - const handleTerminalSizeChange = () => { - termFitAddon.value?.fit(); - }; + // const handleTerminalSizeChange = () => { + // termFitAddon.value?.fit(); + // }; onMounted(() => { - window.addEventListener("resize", handleTerminalSizeChange); + // window.addEventListener("resize", handleTerminalSizeChange); }); onUnmounted(() => { events.removeAllListeners(); - window.removeEventListener("resize", handleTerminalSizeChange); + // window.removeEventListener("resize", handleTerminalSizeChange); socket.close(); }); diff --git a/frontend/src/widgets/instance/Terminal.vue b/frontend/src/widgets/instance/Terminal.vue index 00a1d3c7..486135cd 100644 --- a/frontend/src/widgets/instance/Terminal.vue +++ b/frontend/src/widgets/instance/Terminal.vue @@ -2,14 +2,15 @@ import CardPanel from "@/components/CardPanel.vue"; import { t } from "@/lang/i18n"; import type { LayoutCard } from "@/types"; -import { DownOutlined, PlaySquareOutlined } from "@ant-design/icons-vue"; +import { CodeOutlined, DownOutlined, PlaySquareOutlined } from "@ant-design/icons-vue"; import { arrayFilter } from "../../tools/array"; import { useRoute } from "vue-router"; import { useTerminal } from "../../hooks/useTerminal"; -import { onMounted, computed } from "vue"; +import { onMounted, computed, ref } from "vue"; import type { InstanceDetail } from "../../types/index"; import { useLayoutCardTools } from "@/hooks/useCardTools"; import { getRandomId } from "../../tools/randId"; +import IconBtn from "@/components/IconBtn.vue"; const props = defineProps<{ card: LayoutCard; @@ -20,6 +21,7 @@ const { getMetaOrRouteValue } = useLayoutCardTools(props.card); const instanceId = getMetaOrRouteValue("instanceId"); const daemonId = getMetaOrRouteValue("daemonId"); const terminalDomId = computed(() => `terminal-window-${getRandomId()}`); +const commandInputValue = ref(""); const quickOperations = arrayFilter([ // { @@ -84,15 +86,15 @@ onMounted(async () => { {{ card.title }} - - {{ item.title }} - + + @@ -102,26 +104,26 @@ onMounted(async () => { - - 操作 - - + + + - - - + + + + + + + + + + + + - @@ -129,17 +131,28 @@ onMounted(async () => {