现在代码上传逻辑存在问题
This commit is contained in:
@@ -6,7 +6,6 @@ const BaseView_1 = require("./BaseView");
|
||||
class AircraftView extends BaseView_1.BaseView {
|
||||
render(data) {
|
||||
const aircrafts = data?.aircrafts || [];
|
||||
console.log('AircraftView 渲染数据:', aircrafts);
|
||||
const aircraftsHtml = aircrafts.map(aircraft => `
|
||||
<tr>
|
||||
<td>
|
||||
@@ -60,7 +59,7 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0 auto; /* 确保按钮在容器内居中 */
|
||||
margin: 0 auto;
|
||||
}
|
||||
.btn-new:hover {
|
||||
background: var(--vscode-button-hoverBackground);
|
||||
@@ -74,7 +73,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
.aircraft-name:hover {
|
||||
background: var(--vscode-input-background);
|
||||
}
|
||||
/* 专门为新建按钮的容器添加样式 */
|
||||
.new-button-container {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
@@ -97,7 +95,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
</thead>
|
||||
<tbody>
|
||||
${aircraftsHtml}
|
||||
<!-- 修复:使用专门的容器类确保居中 -->
|
||||
<tr>
|
||||
<td colspan="3" class="new-button-container">
|
||||
<button class="btn-new" onclick="createNewAircraft()">+ 新建飞行器</button>
|
||||
@@ -186,86 +183,6 @@ class AircraftView extends BaseView_1.BaseView {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 对话框函数
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"AircraftView.js","sourceRoot":"","sources":["../../../src/panels/views/AircraftView.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,yCAAsC;AAGtC,MAAa,YAAa,SAAQ,mBAAQ;IACtC,MAAM,CAAC,IAAwC;QAC3C,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;QAExC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;QAE7C,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;;;oEAGY,QAAQ,CAAC,EAAE,QAAQ,QAAQ,CAAC,IAAI;;;2EAGzB,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,SAAS;;;0EAGrC,QAAQ,CAAC,EAAE;;;SAG5E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsER,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4KnB,CAAC;IACL,CAAC;CACJ;AA9QD,oCA8QC"}
|
||||
{"version":3,"file":"AircraftView.js","sourceRoot":"","sources":["../../../src/panels/views/AircraftView.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,yCAAsC;AAGtC,MAAa,YAAa,SAAQ,mBAAQ;IACtC,MAAM,CAAC,IAAwC;QAC3C,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;QAExC,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;;;oEAGY,QAAQ,CAAC,EAAE,QAAQ,QAAQ,CAAC,IAAI;;;2EAGzB,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,SAAS;;;0EAGrC,QAAQ,CAAC,EAAE;;;SAG5E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqER,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2FnB,CAAC;IACL,CAAC;CACJ;AA1LD,oCA0LC"}
|
||||
@@ -5,7 +5,10 @@ class BaseView {
|
||||
constructor(extensionUri) {
|
||||
this.extensionUri = extensionUri;
|
||||
}
|
||||
getStyles() {
|
||||
/**
|
||||
* 获取通用的样式和脚本
|
||||
*/
|
||||
getBaseStylesAndScripts() {
|
||||
return `
|
||||
<style>
|
||||
body {
|
||||
@@ -169,6 +172,94 @@ class BaseView {
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// 对话框工具函数
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
</script>
|
||||
`;
|
||||
}
|
||||
/**
|
||||
* 获取仓库选择对话框的脚本(仅ConfigView需要)
|
||||
*/
|
||||
getRepoSelectScript() {
|
||||
return `
|
||||
<script>
|
||||
(function () {
|
||||
// 避免在同一个 Webview 中重复注册
|
||||
if (window.__dcspRepoDialogInitialized) {
|
||||
@@ -201,7 +292,7 @@ class BaseView {
|
||||
|
||||
var noRepoTip = '';
|
||||
if (!hasRepos) {
|
||||
noRepoTip = '<div style="margin-top:8px; font-size:12px; color: var(--vscode-descriptionForeground);">当前配置中没有仓库,请先在“仓库配置”中添加。</div>';
|
||||
noRepoTip = '<div style="margin-top:8px; font-size:12px; color: var(--vscode-descriptionForeground);">当前配置中没有仓库,请先在"仓库配置"中添加。</div>';
|
||||
}
|
||||
|
||||
overlay.innerHTML =
|
||||
@@ -228,7 +319,6 @@ class BaseView {
|
||||
|
||||
if (cancelBtn) {
|
||||
cancelBtn.addEventListener('click', function () {
|
||||
// 通知后端取消,清理可能的状态(例如待上传的本地文件夹)
|
||||
if (typeof vscode !== 'undefined') {
|
||||
vscode.postMessage({
|
||||
type: 'repoSelectCanceled'
|
||||
@@ -271,6 +361,12 @@ class BaseView {
|
||||
</script>
|
||||
`;
|
||||
}
|
||||
/**
|
||||
* 获取样式(被子类覆盖)
|
||||
*/
|
||||
getStyles() {
|
||||
return this.getBaseStylesAndScripts();
|
||||
}
|
||||
}
|
||||
exports.BaseView = BaseView;
|
||||
//# sourceMappingURL=BaseView.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"BaseView.js","sourceRoot":"","sources":["../../../src/panels/views/BaseView.ts"],"names":[],"mappings":";;;AAEA,MAAsB,QAAQ;IAG1B,YAAY,YAAwB;QAChC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAIS,SAAS;QACf,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuQN,CAAC;IACN,CAAC;CACJ;AAnRD,4BAmRC"}
|
||||
{"version":3,"file":"BaseView.js","sourceRoot":"","sources":["../../../src/panels/views/BaseView.ts"],"names":[],"mappings":";;;AAGA,MAAsB,QAAQ;IAG1B,YAAY,YAAwB;QAChC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAID;;OAEG;IACO,uBAAuB;QAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmPN,CAAC;IACN,CAAC;IAED;;OAEG;IACO,mBAAmB;QACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqGN,CAAC;IACN,CAAC;IAED;;OAEG;IACO,SAAS;QACf,OAAO,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC1C,CAAC;CACJ;AArXD,4BAqXC"}
|
||||
@@ -11,7 +11,7 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
const moduleFolderFileTree = data?.moduleFolderFileTree || [];
|
||||
const moduleFolderLoading = data?.moduleFolderLoading || false;
|
||||
const gitBranches = data?.gitBranches || [];
|
||||
// 生成配置列表的 HTML - 包含配置文件和模块文件夹
|
||||
// 生成配置列表的 HTML
|
||||
const configsHtml = configs.map((config) => `
|
||||
<tr>
|
||||
<td>
|
||||
@@ -27,10 +27,9 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
// 生成模块文件夹的 HTML - 按类别分类显示
|
||||
// 生成模块文件夹的 HTML
|
||||
const moduleFoldersHtml = moduleFolders.map((folder) => {
|
||||
const icon = '📁';
|
||||
// 根据类型和上传状态确定类别显示
|
||||
let category = folder.type === 'git' ? 'git' : 'local';
|
||||
if (folder.uploaded) {
|
||||
category += '(已上传)';
|
||||
@@ -39,14 +38,12 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
return `
|
||||
<tr>
|
||||
<td>
|
||||
<!-- 左侧:📁 动力学仓库 / test,仅用于重命名 -->
|
||||
<span class="editable clickable" onclick="renameModuleFolder('${folder.id}', '${folder.name}')">
|
||||
${icon} ${folder.name}
|
||||
</span>
|
||||
</td>
|
||||
<td class="category-${folder.type}">${category}</td>
|
||||
<td>
|
||||
<!-- 右侧:文件/文件夹栏,只负责选择并打开文件,不再触发重命名 -->
|
||||
<span class="clickable"
|
||||
onclick="openTheModuleFolder('${folder.id}', '${folder.type}')">
|
||||
📄 ${fileName}
|
||||
@@ -59,7 +56,7 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
</tr>
|
||||
`;
|
||||
}).join('');
|
||||
// 生成分支选择的 HTML - 使用树状结构(首次渲染可以为空,后续通过 message 更新)
|
||||
// 生成分支选择的 HTML
|
||||
const branchesHtml = gitBranches.length > 0 ? this.generateBranchesTreeHtml(gitBranches) : '';
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
@@ -67,7 +64,8 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>配置管理</title>
|
||||
${this.getStyles()}
|
||||
${this.getBaseStylesAndScripts()}
|
||||
${this.getRepoSelectScript()}
|
||||
<style>
|
||||
.url-input-section {
|
||||
background: var(--vscode-panel-background);
|
||||
@@ -253,16 +251,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
color: var(--vscode-charts-orange);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.category-git(已上传) {
|
||||
color: var(--vscode-gitDecoration-addedResourceForeground);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.category-local(已上传) {
|
||||
color: var(--vscode-gitDecoration-addedResourceForeground);
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -319,12 +307,11 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
let currentConfigId = null;
|
||||
let selectedBranches = new Set();
|
||||
let branchTreeData = [];
|
||||
let selectedConfigs = new Set();
|
||||
|
||||
// 只负责“改名”的函数
|
||||
// 只负责"改名"的函数
|
||||
function renameModuleFolder(folderId, oldName) {
|
||||
showPromptDialog(
|
||||
'重命名模块文件夹',
|
||||
@@ -362,16 +349,14 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
|
||||
// 在 VSCode 中打开配置文件
|
||||
function openConfigFileInVSCode(configId) {
|
||||
console.log('📄 在 VSCode 中打开配置文件:', configId);
|
||||
vscode.postMessage({
|
||||
type: 'openConfigFileInVSCode',
|
||||
configId: configId
|
||||
});
|
||||
}
|
||||
|
||||
// 统一功能:打开模块文件夹(这里只负责打开,而不是改名)
|
||||
// 统一功能:打开模块文件夹
|
||||
function openTheModuleFolder(id, type) {
|
||||
console.log('📂 打开模块文件夹:', { id, type });
|
||||
vscode.postMessage({
|
||||
type: 'openTheModuleFolder',
|
||||
id: id,
|
||||
@@ -400,50 +385,40 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
'确认删除',
|
||||
'确定删除这个配置文件吗?',
|
||||
function() {
|
||||
console.log('🗑️ 删除配置文件:', configId);
|
||||
vscode.postMessage({
|
||||
type: 'deleteConfig',
|
||||
configId: configId
|
||||
});
|
||||
},
|
||||
function() {
|
||||
console.log('❌ 用户取消删除配置文件');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 删除模块文件夹功能
|
||||
function deleteModuleFolder(folderId) {
|
||||
console.log('🗑️ 尝试删除模块文件夹:', folderId);
|
||||
|
||||
showConfirmDialog(
|
||||
'确认删除模块文件夹',
|
||||
'确定删除这个模块文件夹吗?这将删除文件夹及其所有内容。',
|
||||
function() {
|
||||
console.log('✅ 用户确认删除模块文件夹:', folderId);
|
||||
vscode.postMessage({
|
||||
type: 'deleteModuleFolder',
|
||||
folderId: folderId
|
||||
});
|
||||
},
|
||||
function() {
|
||||
console.log('❌ 用户取消删除模块文件夹');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 上传模块文件夹功能(区分 local / git)
|
||||
// 上传模块文件夹功能
|
||||
function uploadModuleFolder(folderId, folderType) {
|
||||
console.log('📤 上传模块文件夹:', { folderId, folderType });
|
||||
|
||||
if (folderType === 'git') {
|
||||
// git 类型:先选仓库,然后后端根据是否改名/是否同仓库判断是更新原分支还是新分支上传
|
||||
vscode.postMessage({
|
||||
type: 'openRepoSelectForGitUpload',
|
||||
folderId: folderId
|
||||
});
|
||||
} else {
|
||||
// local 类型:走 local → git 的初始化上传逻辑
|
||||
vscode.postMessage({
|
||||
type: 'openRepoSelectForUpload',
|
||||
folderId: folderId
|
||||
@@ -455,9 +430,8 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
vscode.postMessage({ type: 'goBackToContainers' });
|
||||
}
|
||||
|
||||
// 🔁 通过弹窗获取仓库(用于克隆)
|
||||
// 通过弹窗获取仓库
|
||||
function openRepoSelect() {
|
||||
console.log('📦 请求仓库列表以选择 Git 仓库(用于克隆分支)');
|
||||
vscode.postMessage({
|
||||
type: 'openRepoSelect'
|
||||
});
|
||||
@@ -470,7 +444,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
} else {
|
||||
selectedBranches.delete(branchName);
|
||||
}
|
||||
console.log('选中的分支:', Array.from(selectedBranches));
|
||||
}
|
||||
|
||||
function cloneSelectedBranches() {
|
||||
@@ -479,8 +452,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🚀 开始克隆选中的分支:', Array.from(selectedBranches));
|
||||
|
||||
vscode.postMessage({
|
||||
type: 'cloneBranches',
|
||||
branches: Array.from(selectedBranches)
|
||||
@@ -515,7 +486,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
}
|
||||
|
||||
updateMergeButtonState();
|
||||
console.log('选中的配置文件:', Array.from(selectedConfigs));
|
||||
}
|
||||
|
||||
function updateMergeButtonState() {
|
||||
@@ -530,8 +500,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
alert('请至少选择两个配置文件进行合并');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🔄 开始合并选中的配置文件:', Array.from(selectedConfigs));
|
||||
|
||||
showMergeDialog();
|
||||
}
|
||||
@@ -723,94 +691,11 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
return html;
|
||||
}
|
||||
|
||||
// 对话框函数
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
|
||||
// 消息监听
|
||||
window.addEventListener('message', event => {
|
||||
const message = event.data;
|
||||
console.log('📨 前端收到后端消息:', message);
|
||||
|
||||
if (message.type === 'branchesFetched') {
|
||||
console.log('🌿 收到分支数据:', message.branches);
|
||||
console.log('🌳 收到分支树数据:', message.branchTree);
|
||||
branchTreeData = message.branchTree || [];
|
||||
renderBranchTree(branchTreeData);
|
||||
}
|
||||
@@ -818,8 +703,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
|
||||
// 初始化
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('📄 ConfigView 页面加载完成');
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
if (event.target.classList.contains('config-checkbox')) {
|
||||
const configId = event.target.getAttribute('data-id');
|
||||
@@ -912,18 +795,6 @@ class ConfigView extends BaseView_1.BaseView {
|
||||
});
|
||||
return html;
|
||||
}
|
||||
countLeafNodes(nodes) {
|
||||
let count = 0;
|
||||
nodes.forEach(node => {
|
||||
if (node.isLeaf) {
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
count += this.countLeafNodes(node.children);
|
||||
}
|
||||
});
|
||||
return count;
|
||||
}
|
||||
}
|
||||
exports.ConfigView = ConfigView;
|
||||
//# sourceMappingURL=ConfigView.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -6,9 +6,8 @@ const BaseView_1 = require("./BaseView");
|
||||
class ContainerView extends BaseView_1.BaseView {
|
||||
render(data) {
|
||||
const project = data?.project;
|
||||
const aircraft = data?.aircraft; // 新增:获取飞行器数据
|
||||
const aircraft = data?.aircraft;
|
||||
const containers = data?.containers || [];
|
||||
// 生成容器列表的 HTML
|
||||
const containersHtml = containers.map((container) => `
|
||||
<tr>
|
||||
<td>
|
||||
@@ -116,86 +115,6 @@ class ContainerView extends BaseView_1.BaseView {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 对话框函数(与之前相同)
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"ContainerView.js","sourceRoot":"","sources":["../../../src/panels/views/ContainerView.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,yCAAsC;AAGtC,MAAa,aAAc,SAAQ,mBAAQ;IACvC,MAAM,CAAC,IAAyB;QAC5B,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,aAAa;QAC9C,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;QAE1C,eAAe;QACf,MAAM,cAAc,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAA4B,EAAE,EAAE,CAAC;;;yEAGP,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC,IAAI,UAAU,SAAS,CAAC,IAAI;;;4EAGtD,SAAS,CAAC,EAAE;;;2EAGb,SAAS,CAAC,EAAE;;;SAG9E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;gFAI0D,QAAQ,EAAE,IAAI,IAAI,OAAO;;;;;;;;;;;;;cAa3F,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAyJpB,CAAC;IACL,CAAC;CACJ;AAvMD,sCAuMC"}
|
||||
{"version":3,"file":"ContainerView.js","sourceRoot":"","sources":["../../../src/panels/views/ContainerView.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,yCAAsC;AAGtC,MAAa,aAAc,SAAQ,mBAAQ;IACvC,MAAM,CAAC,IAAyB;QAC5B,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,CAAC;QAChC,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;QAE1C,MAAM,cAAc,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAA4B,EAAE,EAAE,CAAC;;;yEAGP,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC,IAAI,UAAU,SAAS,CAAC,IAAI;;;4EAGtD,SAAS,CAAC,EAAE;;;2EAGb,SAAS,CAAC,EAAE;;;SAG9E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;gFAI0D,QAAQ,EAAE,IAAI,IAAI,OAAO;;;;;;;;;;;;;cAa3F,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAyEpB,CAAC;IACL,CAAC;CACJ;AAtHD,sCAsHC"}
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ProjectView = void 0;
|
||||
// src/panels/views/ProjectView.ts
|
||||
const BaseView_1 = require("./BaseView");
|
||||
class ProjectView extends BaseView_1.BaseView {
|
||||
render(data) {
|
||||
@@ -135,13 +136,11 @@ class ProjectView extends BaseView_1.BaseView {
|
||||
|
||||
function configureProject(projectId, projectName, isConfigured) {
|
||||
if (isConfigured) {
|
||||
// 已配置的项目直接打开
|
||||
vscode.postMessage({
|
||||
type: 'openProject',
|
||||
projectId: projectId
|
||||
});
|
||||
} else {
|
||||
// 未配置的项目需要设置路径
|
||||
vscode.postMessage({
|
||||
type: 'configureProject',
|
||||
projectId: projectId,
|
||||
@@ -188,7 +187,7 @@ class ProjectView extends BaseView_1.BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
// 项目名称编辑功能 - 修复版本
|
||||
// 项目名称编辑功能
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.addEventListener('click', function(event) {
|
||||
if (event.target.classList.contains('project-name')) {
|
||||
@@ -219,86 +218,6 @@ class ProjectView extends BaseView_1.BaseView {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 对话框函数 - 只保留一份
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'confirmModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closeConfirmDialog(false)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closeConfirmDialog(true)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
window.confirmCallback = function(result) {
|
||||
if (result && onConfirm) {
|
||||
onConfirm();
|
||||
} else if (!result && onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
delete window.confirmCallback;
|
||||
};
|
||||
}
|
||||
|
||||
function closeConfirmDialog(result) {
|
||||
const modal = document.getElementById('confirmModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.confirmCallback) {
|
||||
window.confirmCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
function showPromptDialog(title, message, defaultValue, onConfirm) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'promptModal';
|
||||
|
||||
overlay.innerHTML = \`
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-title">\${title}</div>
|
||||
<div>\${message}</div>
|
||||
<input type="text" id="promptInput" value="\${defaultValue}" style="width: 100%; margin: 10px 0; padding: 6px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid var(--vscode-input-border);">
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-btn modal-btn-secondary" onclick="closePromptDialog(null)">取消</button>
|
||||
<button class="modal-btn modal-btn-primary" onclick="closePromptDialog(document.getElementById('promptInput').value)">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('promptInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
window.promptCallback = onConfirm;
|
||||
}
|
||||
|
||||
function closePromptDialog(result) {
|
||||
const modal = document.getElementById('promptModal');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
if (window.promptCallback) {
|
||||
window.promptCallback(result);
|
||||
}
|
||||
delete window.promptCallback;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"ProjectView.js","sourceRoot":"","sources":["../../../src/panels/views/ProjectView.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAGtC,MAAa,WAAY,SAAQ,mBAAQ;IACrC,MAAM,CAAC,IAA0E;QAC7E,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;QACtC,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,IAAI,GAAG,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAwB,EAAE,EAAE;YAC3D,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YAEhD,OAAO;;;kEAG+C,OAAO,CAAC,EAAE,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI;;0BAEjF,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;;;yEAItB,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC,IAAI,MAAM,YAAY;0BAC9F,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;;;;yEAIqB,OAAO,CAAC,EAAE;;;SAG1E,CAAA;QAAA,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEb,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyER,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiMlB,CAAC;IACL,CAAC;CACJ;AA/SD,kCA+SC"}
|
||||
{"version":3,"file":"ProjectView.js","sourceRoot":"","sources":["../../../src/panels/views/ProjectView.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,yCAAsC;AAGtC,MAAa,WAAY,SAAQ,mBAAQ;IACrC,MAAM,CAAC,IAA0E;QAC7E,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;QACtC,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,IAAI,GAAG,EAAE,CAAC;QAErD,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAwB,EAAE,EAAE;YAC3D,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YAEhD,OAAO;;;kEAG+C,OAAO,CAAC,EAAE,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI;;0BAEjF,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;;;yEAItB,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC,IAAI,MAAM,YAAY;0BAC9F,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;;;;yEAIqB,OAAO,CAAC,EAAE;;;SAG1E,CAAA;QAAA,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEb,OAAO;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyER,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+GlB,CAAC;IACL,CAAC;CACJ;AA7ND,kCA6NC"}
|
||||
Reference in New Issue
Block a user