feat: 添加请求参数验证中间件和设计令牌Hook
feat(validation): 为机房、机柜和设备路由添加Joi验证中间件 feat(hooks): 创建useDesignTokens Hook集中管理主题配置 feat(models): 为耗材模型添加乐观锁version字段和updatedAt索引 feat(3d): 增强3D场景和设备模型视觉效果与交互 refactor: 移除数据备份相关功能并优化代码结构 fix: 修复前端安全日志和密码加密工具 chore: 更新依赖并添加axios和joi库 docs: 更新注释和文档说明 style: 改进代码格式和命名一致性
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
||||
import { Layout, Select, Card, Spin, message, Typography, Descriptions, Tag, Button, Space, Empty, Modal, Form, Input, InputNumber, DatePicker, Checkbox, Switch } from 'antd';
|
||||
import { CloudServerOutlined, ReloadOutlined, ArrowLeftOutlined, InfoCircleOutlined, UpOutlined, DownOutlined, EditOutlined, SettingOutlined, FullscreenOutlined } from '@ant-design/icons';
|
||||
import { CloudServerOutlined, ReloadOutlined, ArrowLeftOutlined, InfoCircleOutlined, UpOutlined, DownOutlined, EditOutlined, SettingOutlined, FullscreenOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -17,7 +17,10 @@ const { Option } = Select;
|
||||
|
||||
const Rack3DVisualization = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
||||
// Scene 组件的 ref,用于调用重置视角方法
|
||||
const sceneRef = useRef(null);
|
||||
|
||||
// 使用 Scene3DContext 管理3D场景状态
|
||||
const {
|
||||
devices,
|
||||
@@ -465,16 +468,26 @@ const Rack3DVisualization = () => {
|
||||
<Option key={rack.rackId} value={rack.rackId}>{rack.name}</Option>
|
||||
))}
|
||||
</Select>
|
||||
<Button
|
||||
<Button
|
||||
type="primary"
|
||||
ghost
|
||||
icon={<ReloadOutlined />}
|
||||
icon={<ReloadOutlined />}
|
||||
onClick={() => { fetchRacks(); if(selectedRack) fetchDevices(selectedRack.rackId); }}
|
||||
style={{ borderRadius: '6px', borderColor: 'rgba(255,255,255,0.3)', color: 'rgba(255,255,255,0.9)' }}
|
||||
className="hover-bright"
|
||||
>
|
||||
刷新
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
ghost
|
||||
icon={<EyeOutlined />}
|
||||
onClick={() => { if(sceneRef.current) sceneRef.current.resetView(); }}
|
||||
style={{ borderRadius: '6px', borderColor: 'rgba(255,255,255,0.3)', color: 'rgba(255,255,255,0.9)' }}
|
||||
className="hover-bright"
|
||||
>
|
||||
重置视角
|
||||
</Button>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
@@ -546,9 +559,10 @@ const Rack3DVisualization = () => {
|
||||
</div>
|
||||
) : selectedRack ? (
|
||||
<>
|
||||
<Scene
|
||||
rack={selectedRack}
|
||||
devices={devices}
|
||||
<Scene
|
||||
ref={sceneRef}
|
||||
rack={selectedRack}
|
||||
devices={devices}
|
||||
selectedDeviceId={selectedDevice?.deviceId || selectedDevice?.id}
|
||||
onDeviceClick={handleDeviceClick}
|
||||
onDeviceLeave={handleDeviceLeave}
|
||||
|
||||
Reference in New Issue
Block a user