0
0

修复显示bug和项目回读bug

This commit is contained in:
xubing
2025-11-21 16:07:48 +08:00
parent 6d3d020f8a
commit 925024bce1
17 changed files with 193 additions and 243 deletions

View File

@@ -16,7 +16,7 @@ export class AircraftView extends BaseView {
const aircraftsHtml = aircrafts.map(aircraft => `
<tr>
<td>
<span class="aircraft-name" data-aircraft-id="${aircraft.id}">✈️ ${aircraft.name}</span>
<span class="aircraft-name" data-aircraft-id="${aircraft.id}">🛸 ${aircraft.name}</span>
</td>
<td>
<span class="clickable" onclick="openAircraftConfig('${aircraft.id}', '${aircraft.projectId}')">配置容器</span>
@@ -90,7 +90,7 @@ export class AircraftView extends BaseView {
</head>
<body>
<div class="header">
<h2>飞行器配置</h2>
<h2>🚀飞行器配置</h2>
<button class="back-btn" onclick="goBackToProjects()">← 返回项目</button>
</div>

View File

@@ -7,14 +7,14 @@ export class ConfigView extends BaseView {
const container = data?.container;
const configs = data?.configs || [];
// 生成配置列表的 HTML - 添加文件名编辑功能
// 生成配置列表的 HTML - 移除文件名编辑功能
const configsHtml = configs.map((config: ConfigViewData) => `
<tr>
<td>
<span class="editable" onclick="editConfigName('${config.id}', '${config.name}')">🔧 ${config.name}</span>
</td>
<td>
<span class="editable" onclick="editFileName('${config.id}', '${config.fileName}')">📄 ${config.fileName}</span>
<span class="clickable" onclick="openConfigFile('${config.id}')">📄 ${config.fileName}</span>
</td>
<td>
<button class="btn-delete" onclick="deleteConfig('${config.id}')">删除</button>
@@ -85,23 +85,6 @@ export class ConfigView extends BaseView {
);
}
function editFileName(configId, currentFileName) {
showPromptDialog(
'修改文件名',
'请输入新的文件名(包含扩展名):',
currentFileName,
function(newFileName) {
if (newFileName && newFileName !== currentFileName) {
vscode.postMessage({
type: 'updateConfigFileName',
configId: configId,
fileName: newFileName
});
}
}
);
}
function openConfigFile(configId) {
currentConfigId = configId;
document.getElementById('configEditor').style.display = 'block';
@@ -250,19 +233,7 @@ export class ConfigView extends BaseView {
}
});
// 修改:点击文件名时打开编辑器
document.addEventListener('click', function(event) {
if (event.target.classList.contains('editable') && event.target.textContent.includes('📄')) {
const row = event.target.closest('tr');
if (row) {
const configNameCell = row.querySelector('td:first-child .editable');
if (configNameCell) {
const configId = configNameCell.onclick.toString().match(/'([^']+)'/)[1];
openConfigFile(configId);
}
}
}
});
// 移除原来的复杂点击事件处理,现在文件名直接调用 openConfigFile
</script>
</body>
</html>`;

View File

@@ -5,6 +5,7 @@ import { AircraftConfigData, ContainerViewData } from '../types/ViewTypes';
export class ContainerView extends BaseView {
render(data?: AircraftConfigData): string {
const project = data?.project;
const aircraft = data?.aircraft; // 新增:获取飞行器数据
const containers = data?.containers || [];
// 生成容器列表的 HTML
@@ -32,7 +33,7 @@ export class ContainerView extends BaseView {
</head>
<body>
<div class="header">
<h2>📋 容器管理 - <span style="color: var(--vscode-textLink-foreground);">${project?.name || '未知项目'}</span></h2>
<h2>📋 容器管理 - <span style="color: var(--vscode-textLink-foreground);">${aircraft?.name || '未知飞行器'}</span></h2>
<button class="back-btn" onclick="goBackToAircrafts()">← 返回飞行器管理</button>
</div>