0
0

git到的代码可删除

This commit is contained in:
xubing
2025-11-25 14:52:39 +08:00
parent 056f98fd25
commit 719fb43c33
3 changed files with 91 additions and 23 deletions

View File

@@ -112,6 +112,18 @@ export class ConfigView extends BaseView {
.branch-item:hover {
background: var(--vscode-list-hoverBackground);
}
.btn-delete {
background: var(--vscode-inputValidation-errorBackground);
color: white;
padding: 4px 8px;
border: none;
border-radius: 2px;
cursor: pointer;
}
.btn-delete:hover {
background: var(--vscode-inputValidation-errorBackground);
opacity: 0.8;
}
</style>
</head>
<body>
@@ -237,6 +249,7 @@ export class ConfigView extends BaseView {
'确认删除',
'确定删除这个配置文件吗?',
function() {
console.log('🗑️ 删除配置文件:', configId);
vscode.postMessage({
type: 'deleteConfig',
configId: configId
@@ -244,6 +257,28 @@ export class ConfigView extends BaseView {
},
function() {
// 用户取消删除
console.log('❌ 用户取消删除配置文件');
}
);
}
// Git 仓库删除功能 - 修复版本
function deleteGitRepo(repoId) {
console.log('🗑️ 尝试删除 Git 仓库:', repoId);
showConfirmDialog(
'确认删除 Git 仓库',
'确定删除这个 Git 仓库吗?这将删除本地克隆的代码文件夹。',
function() {
console.log('✅ 用户确认删除 Git 仓库:', repoId);
vscode.postMessage({
type: 'deleteGitRepo',
repoId: repoId
});
},
function() {
// 用户取消删除
console.log('❌ 用户取消删除 Git 仓库');
}
);
}
@@ -353,16 +388,6 @@ export class ConfigView extends BaseView {
});
}
function deleteGitRepo(repoId) {
if (confirm('确定删除这个 Git 仓库吗?')) {
console.log('🗑️ 删除仓库:', repoId);
vscode.postMessage({
type: 'deleteGitRepo',
repoId: repoId
});
}
}
// 动态渲染分支选择区域
function renderBranchSelection(branches, repoUrl) {
const container = document.getElementById('branchSelectionContainer');
@@ -489,9 +514,18 @@ export class ConfigView extends BaseView {
}
});
// 初始化
// 初始化 - 添加调试信息(修复语法错误)
document.addEventListener('DOMContentLoaded', function() {
console.log('📄 ConfigView 页面加载完成');
console.log('🔍 检查 Git 仓库删除按钮绑定');
// 检查所有删除按钮
const deleteButtons = document.querySelectorAll('.btn-delete');
console.log('找到删除按钮数量:', deleteButtons.length);
deleteButtons.forEach(function(btn, index) {
console.log('删除按钮 ' + index + ':', btn);
});
});
</script>
</body>