mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
fix: 解决数据库 dashboard 跳转失败的问题
This commit is contained in:
parent
9a214885c3
commit
a6140aa647
@ -117,6 +117,8 @@ const initTerm = (formEl: FormInstance | undefined) => {
|
|||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
formEl.validate(async (valid) => {
|
formEl.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
terminalOpen.value = true;
|
terminalOpen.value = true;
|
||||||
let ifm = document.getElementById('terminal-exec') as HTMLInputElement | null;
|
let ifm = document.getElementById('terminal-exec') as HTMLInputElement | null;
|
||||||
term = new Terminal({
|
term = new Terminal({
|
||||||
@ -134,7 +136,7 @@ const initTerm = (formEl: FormInstance | undefined) => {
|
|||||||
if (ifm) {
|
if (ifm) {
|
||||||
term.open(ifm);
|
term.open(ifm);
|
||||||
terminalSocket = new WebSocket(
|
terminalSocket = new WebSocket(
|
||||||
`ws://localhost:9999/api/v1/containers/exec?containerid=${form.containerID}&cols=${term.cols}&rows=${term.rows}&user=${form.user}&command=${form.command}`,
|
`ws://${ipLocal}:9999/api/v1/containers/exec?containerid=${form.containerID}&cols=${term.cols}&rows=${term.rows}&user=${form.user}&command=${form.command}`,
|
||||||
);
|
);
|
||||||
terminalSocket.onopen = runRealTerminal;
|
terminalSocket.onopen = runRealTerminal;
|
||||||
terminalSocket.onmessage = onWSReceive;
|
terminalSocket.onmessage = onWSReceive;
|
||||||
|
@ -245,7 +245,9 @@ const goDashboard = async () => {
|
|||||||
phpVisiable.value = true;
|
phpVisiable.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.open('http://localhost:' + phpadminPort.value, '_blank');
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
|
window.open(`http://${ipLocal}:${phpadminPort.value}`, '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDashboardPort = async () => {
|
const loadDashboardPort = async () => {
|
||||||
|
@ -67,7 +67,9 @@ const goDashboard = async () => {
|
|||||||
commandVisiable.value = true;
|
commandVisiable.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.open('http://localhost:' + redisCommandPort.value, '_blank');
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
|
window.open(`http://${ipLocal}:${redisCommandPort.value}`, '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDashboardPort = async () => {
|
const loadDashboardPort = async () => {
|
||||||
|
@ -69,7 +69,8 @@ const closeRealTerminal = (ev: CloseEvent) => {
|
|||||||
|
|
||||||
const initTerm = () => {
|
const initTerm = () => {
|
||||||
let ifm = document.getElementById('terminal-exec') as HTMLInputElement | null;
|
let ifm = document.getElementById('terminal-exec') as HTMLInputElement | null;
|
||||||
console.log(ifm);
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
term = new Terminal({
|
term = new Terminal({
|
||||||
lineHeight: 1.2,
|
lineHeight: 1.2,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@ -85,7 +86,7 @@ const initTerm = () => {
|
|||||||
if (ifm) {
|
if (ifm) {
|
||||||
term.open(ifm);
|
term.open(ifm);
|
||||||
terminalSocket = new WebSocket(
|
terminalSocket = new WebSocket(
|
||||||
`ws://localhost:9999/api/v1/databases/redis/exec?cols=${term.cols}&rows=${term.rows}`,
|
`ws://${ipLocal}:9999/api/v1/databases/redis/exec?cols=${term.cols}&rows=${term.rows}`,
|
||||||
);
|
);
|
||||||
terminalSocket.onopen = runRealTerminal;
|
terminalSocket.onopen = runRealTerminal;
|
||||||
terminalSocket.onmessage = onWSReceive;
|
terminalSocket.onmessage = onWSReceive;
|
||||||
|
@ -55,7 +55,9 @@ const onerror = () => {};
|
|||||||
const onClose = () => {};
|
const onClose = () => {};
|
||||||
|
|
||||||
const initProcess = () => {
|
const initProcess = () => {
|
||||||
processSocket = new WebSocket(`ws://localhost:9999/api/v1/files/ws`);
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
|
processSocket = new WebSocket(`ws://${ipLocal}:9999/api/v1/files/ws`);
|
||||||
processSocket.onopen = onOpenProcess;
|
processSocket.onopen = onOpenProcess;
|
||||||
processSocket.onmessage = onMessage;
|
processSocket.onmessage = onMessage;
|
||||||
processSocket.onerror = onerror;
|
processSocket.onerror = onerror;
|
||||||
|
@ -59,6 +59,8 @@ const closeRealTerminal = (ev: CloseEvent) => {
|
|||||||
|
|
||||||
const initTerm = () => {
|
const initTerm = () => {
|
||||||
let ifm = document.getElementById('terminal' + props.terminalID) as HTMLInputElement | null;
|
let ifm = document.getElementById('terminal' + props.terminalID) as HTMLInputElement | null;
|
||||||
|
let href = window.location.href;
|
||||||
|
let ipLocal = href.split('//')[1].split(':')[0];
|
||||||
term = new Terminal({
|
term = new Terminal({
|
||||||
lineHeight: 1.2,
|
lineHeight: 1.2,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@ -75,11 +77,11 @@ const initTerm = () => {
|
|||||||
term.open(ifm);
|
term.open(ifm);
|
||||||
if (props.wsID === 0) {
|
if (props.wsID === 0) {
|
||||||
terminalSocket = new WebSocket(
|
terminalSocket = new WebSocket(
|
||||||
`ws://localhost:9999/api/v1/terminals/local?cols=${term.cols}&rows=${term.rows}`,
|
`ws://${ipLocal}:9999/api/v1/terminals/local?cols=${term.cols}&rows=${term.rows}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
terminalSocket = new WebSocket(
|
terminalSocket = new WebSocket(
|
||||||
`ws://localhost:9999/api/v1/terminals?id=${props.wsID}&cols=${term.cols}&rows=${term.rows}`,
|
`ws://${ipLocal}:9999/api/v1/terminals?id=${props.wsID}&cols=${term.cols}&rows=${term.rows}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
terminalSocket.onopen = runRealTerminal;
|
terminalSocket.onopen = runRealTerminal;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user