feat(systemResource): 增加系统资源大屏显示

master
钟良源 1 week ago
parent c229615e66
commit 2b5b6b3894

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

@ -0,0 +1,38 @@
import React, { useRef, useState, useEffect } from 'react';
const SystemResource = () => {
const iframeRef = useRef(null);
// 根据当前访问的 hostname 动态生成服务器 URL
const getServerUrl = () => {
const currentHostname = window.location.hostname;
// 如果是 localhost 或 127.0.0.1,使用固定的 IP
if (currentHostname === 'localhost' || currentHostname === '127.0.0.1') {
return 'http://192.168.5.119:5001/';
}
// 否则使用当前的 IP 加 5001 端口
return `http://${currentHostname}:5001/`;
};
const [serverUrl, setServerUrl] = useState(getServerUrl());
// 监听 URL 变化(如果需要动态更新)
useEffect(() => {
const handleLocationChange = () => {
setServerUrl(getServerUrl());
};
// 监听 popstate 事件(浏览器前进后退)
window.addEventListener('popstate', handleLocationChange);
return () => {
window.removeEventListener('popstate', handleLocationChange);
};
}, []);
return <iframe width="100%" height="100%" frameBorder={0} src={serverUrl} ref={iframeRef} />;
};
export default SystemResource;

@ -111,7 +111,14 @@ export const menuData2 = [
icon: '/ideContainer/icon/envConfig.png',
activeIcon: '/ideContainer/icon/envConfig_active.png',
children: null
},
{
title: '系统资源',
path: 'systemResource',
key: 'systemResource',
parentKey: 'systemResource',
icon: '/ideContainer/icon/sysResource.png',
activeIcon: '/ideContainer/icon/sysResource_active.png',
children: null
}
];
// export const tempEnvData =
];

@ -31,6 +31,7 @@ import ComponentCoding from '@/pages/componentDevelopment/componentCoding';
import ComponentDeployment from '@/pages/componentDevelopment/componentDeployment';
import ComponentTest from '@/pages/componentDevelopment/componentTest';
import ComponentEnv from '@/pages/componentDevelopment/componentEnv';
import SystemResource from '@/pages/componentDevelopment/systemResource';
import { getUserToken } from '@/api/user';
import { Message } from '@arco-design/web-react';
import { queryEventItemBySceneId, queryEventItemBySceneIdOld } from '@/api/event';
@ -51,7 +52,8 @@ const ComponentReview = () => <div style={{ height: '100%', width: '100%' }}>组
const ALL_PATHS = [
'compFlow', 'complexFlow', 'appFlow', 'compList', 'appInstance', 'event', 'globalVar', 'appCompList',
'myComponents', 'matchingComponents', 'componentReview', 'componentList',
'componentCoding', 'componentDeployment', 'componentTest', 'envConfig'
'componentCoding', 'componentDeployment', 'componentTest', 'envConfig',
'systemResource'
];
function IDEContainer() {
@ -380,6 +382,8 @@ function IDEContainer() {
return <ComponentTest />;
case 'envConfig':
return <ComponentEnv />;
case 'systemResource':
return <SystemResource />;
default:
return <div></div>;
}

Loading…
Cancel
Save