0
0

新增加了项目管理页面

This commit is contained in:
xubing
2025-11-18 14:03:22 +08:00
parent 64a411e463
commit 53e9307157
12 changed files with 974 additions and 45 deletions

View File

@@ -7,14 +7,14 @@ class ContainerConfigView extends BaseView_1.BaseView {
render(data) {
const container = data?.container;
const configs = data?.configs || [];
// 生成配置列表的 HTML - 添加删除按钮
// 生成配置列表的 HTML - 添加文件名编辑功能
const configsHtml = configs.map((config) => `
<tr>
<td>
<span class="editable" onclick="editConfigName('${config.id}', '${config.name}')">🔧 ${config.name}</span>
</td>
<td>
<span class="clickable" onclick="openConfigFile('${config.id}')">${config.fileName}</span>
<span class="editable" onclick="editFileName('${config.id}', '${config.fileName}')">📄 ${config.fileName}</span>
</td>
<td>
<button class="btn-delete" onclick="deleteConfig('${config.id}')">删除</button>
@@ -38,9 +38,9 @@ class ContainerConfigView extends BaseView_1.BaseView {
<table class="table">
<thead>
<tr>
<th width="40%">配置</th>
<th width="30%">配置</th>
<th width="40%">文件</th>
<th width="20%">操作</th>
<th width="30%">操作</th>
</tr>
</thead>
<tbody>
@@ -58,7 +58,7 @@ class ContainerConfigView extends BaseView_1.BaseView {
<h3>📝 编辑配置文件</h3>
<textarea id="configContent" placeholder="在此编辑配置文件内容..."></textarea>
<div style="margin-top: 15px;">
<button class="btn-primary" onclick="saveConfigFile()">💾 保存</button>
<button class="btn-primary" onclick="saveConfigFile()">💾 保存到文件系统</button>
<button class="back-btn" onclick="closeEditor()">取消</button>
</div>
</div>
@@ -84,6 +84,23 @@ class ContainerConfigView extends BaseView_1.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';
@@ -110,7 +127,6 @@ class ContainerConfigView extends BaseView_1.BaseView {
);
}
// 新增:删除配置函数
function deleteConfig(configId) {
showConfirmDialog(
'确认删除',
@@ -232,6 +248,20 @@ class ContainerConfigView extends BaseView_1.BaseView {
document.getElementById('configContent').value = message.content;
}
});
// 修改:点击文件名时打开编辑器
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);
}
}
}
});
</script>
</body>
</html>`;