zen-gitsync 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ui/client/components.d.ts +1 -0
- package/src/ui/client/package.json +1 -0
- package/src/ui/client/src/App.vue +368 -219
- package/src/ui/client/src/components/CommitForm.vue +777 -442
- package/src/ui/client/src/components/GitStatus.vue +89 -86
- package/src/ui/client/src/components/LogList.vue +393 -85
- package/src/ui/client/src/main.ts +3 -0
- package/src/ui/client/src/stores/gitLogStore.ts +464 -0
- package/src/ui/client/src/stores/gitStore.ts +301 -0
- package/src/ui/client/stats.html +1 -1
- package/src/ui/public/assets/index-CALk9kKc.js +9 -0
- package/src/ui/public/assets/index-D3zIiSNw.css +1 -0
- package/src/ui/public/assets/vendor-BfXVsoKv.js +45 -0
- package/src/ui/public/index.html +3 -3
- package/src/ui/server/index.js +197 -8
- package/src/ui/public/assets/index-BHmYZROy.css +0 -1
- package/src/ui/public/assets/index-kfMX1bxz.js +0 -9
- package/src/ui/public/assets/vendor-DxvF30ca.js +0 -41
|
@@ -4,18 +4,21 @@ import GitStatus from './components/GitStatus.vue'
|
|
|
4
4
|
import CommitForm from './components/CommitForm.vue'
|
|
5
5
|
import LogList from './components/LogList.vue'
|
|
6
6
|
import { ElMessage } from 'element-plus'
|
|
7
|
-
import { Plus } from '@element-plus/icons-vue'
|
|
7
|
+
import { Plus, Setting } from '@element-plus/icons-vue'
|
|
8
8
|
import logo from './assets/logo.svg'
|
|
9
|
+
import { useGitStore } from './stores/gitStore'
|
|
9
10
|
|
|
10
11
|
const configInfo = ref('')
|
|
11
12
|
// 添加组件实例类型
|
|
12
13
|
const logListRef = ref<InstanceType<typeof LogList> | null>(null)
|
|
13
14
|
const gitStatusRef = ref<InstanceType<typeof GitStatus> | null>(null)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
// 使用Git Store
|
|
17
|
+
const gitStore = useGitStore()
|
|
18
|
+
|
|
19
|
+
// 添加初始化完成状态
|
|
20
|
+
const initCompleted = ref(false)
|
|
21
|
+
const currentDirectory = ref('')
|
|
19
22
|
|
|
20
23
|
// 加载配置
|
|
21
24
|
async function loadConfig() {
|
|
@@ -28,211 +31,139 @@ async function loadConfig() {
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
//
|
|
32
|
-
async function
|
|
34
|
+
// 加载当前目录信息
|
|
35
|
+
async function loadCurrentDirectory() {
|
|
33
36
|
try {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error('获取分支信息失败:', error)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 获取所有分支
|
|
45
|
-
async function getAllBranches() {
|
|
46
|
-
try {
|
|
47
|
-
const response = await fetch('/api/branches')
|
|
48
|
-
const data = await response.json()
|
|
49
|
-
if (data.branches && Array.isArray(data.branches)) {
|
|
50
|
-
allBranches.value = data.branches
|
|
51
|
-
}
|
|
37
|
+
const responseDir = await fetch('/api/current_directory')
|
|
38
|
+
const dirData = await responseDir.json()
|
|
39
|
+
currentDirectory.value = dirData.directory || '未知目录'
|
|
40
|
+
return dirData
|
|
52
41
|
} catch (error) {
|
|
53
|
-
console.error('
|
|
42
|
+
console.error('获取当前目录失败:', error)
|
|
43
|
+
return { directory: '未知目录', isGitRepo: false }
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log('切换到分支:', branch)
|
|
47
|
+
onMounted(async () => {
|
|
48
|
+
console.log('---------- 页面初始化开始 ----------')
|
|
60
49
|
|
|
61
50
|
try {
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
body: JSON.stringify({ branch })
|
|
69
|
-
})
|
|
51
|
+
// 并行加载配置和目录信息
|
|
52
|
+
const [_, dirData] = await Promise.all([
|
|
53
|
+
loadConfig(),
|
|
54
|
+
loadCurrentDirectory()
|
|
55
|
+
])
|
|
70
56
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
gitStatusRef.value.refreshStatus()
|
|
84
|
-
}
|
|
57
|
+
// 设置Git仓库状态
|
|
58
|
+
gitStore.isGitRepo = dirData.isGitRepo === true
|
|
59
|
+
gitStore.lastCheckedTime = Date.now()
|
|
60
|
+
|
|
61
|
+
// 只有是Git仓库的情况下才加载Git相关信息
|
|
62
|
+
if (gitStore.isGitRepo) {
|
|
63
|
+
// 只获取分支和用户信息,不重复获取日志
|
|
64
|
+
await Promise.all([
|
|
65
|
+
gitStore.getCurrentBranch(),
|
|
66
|
+
gitStore.getAllBranches(),
|
|
67
|
+
gitStore.getUserInfo()
|
|
68
|
+
])
|
|
85
69
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
logListRef.value.refreshLog()
|
|
89
|
-
}
|
|
70
|
+
// 日志信息通过LogList组件直接加载即可,避免重复调用
|
|
71
|
+
// 移除 gitLogStore.fetchLog() 调用
|
|
90
72
|
} else {
|
|
91
|
-
ElMessage(
|
|
92
|
-
message: `切换分支失败: ${result.error}`,
|
|
93
|
-
type: 'error'
|
|
94
|
-
})
|
|
95
|
-
// 恢复选择框为当前分支
|
|
96
|
-
currentBranch.value = currentBranch.value
|
|
73
|
+
ElMessage.warning('当前目录不是Git仓库,部分功能将不可用')
|
|
97
74
|
}
|
|
98
75
|
} catch (error) {
|
|
99
|
-
|
|
100
|
-
message: `切换分支失败: ${(error as Error).message}`,
|
|
101
|
-
type: 'error'
|
|
102
|
-
})
|
|
103
|
-
// 恢复选择框为当前分支
|
|
104
|
-
currentBranch.value = currentBranch.value
|
|
76
|
+
console.error('初始化失败:', error)
|
|
105
77
|
} finally {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// 获取Git用户信息
|
|
111
|
-
async function getUserInfo() {
|
|
112
|
-
try {
|
|
113
|
-
const response = await fetch('/api/user-info')
|
|
114
|
-
const data = await response.json()
|
|
115
|
-
if (data.name && data.email) {
|
|
116
|
-
userName.value = data.name
|
|
117
|
-
userEmail.value = data.email
|
|
118
|
-
}
|
|
119
|
-
} catch (error) {
|
|
120
|
-
console.error('获取用户信息失败:', error)
|
|
78
|
+
// 标记初始化完成
|
|
79
|
+
initCompleted.value = true
|
|
80
|
+
console.log('---------- 页面初始化完成 ----------')
|
|
121
81
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
onMounted(() => {
|
|
125
|
-
loadConfig()
|
|
126
|
-
getCurrentBranch() // 初始加载分支信息
|
|
127
|
-
getAllBranches() // 加载所有分支
|
|
128
|
-
getUserInfo() // 初始加载用户信息
|
|
129
82
|
})
|
|
130
83
|
|
|
131
|
-
// 处理提交成功事件
|
|
132
|
-
function handleCommitSuccess() {
|
|
133
|
-
// 刷新提交历史
|
|
134
|
-
if (logListRef.value) {
|
|
135
|
-
logListRef.value.refreshLog()
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// 刷新Git状态
|
|
139
|
-
if (gitStatusRef.value) {
|
|
140
|
-
gitStatusRef.value.refreshStatus()
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// 处理推送成功事件
|
|
145
|
-
function handlePushSuccess() {
|
|
146
|
-
// 刷新提交历史
|
|
147
|
-
if (logListRef.value) {
|
|
148
|
-
logListRef.value.refreshLog()
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 刷新Git状态
|
|
152
|
-
if (gitStatusRef.value) {
|
|
153
|
-
gitStatusRef.value.refreshStatus()
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// 刷新分支信息
|
|
157
|
-
getCurrentBranch()
|
|
158
|
-
}
|
|
159
|
-
|
|
160
84
|
const createBranchDialogVisible = ref(false)
|
|
161
85
|
const newBranchName = ref('')
|
|
162
86
|
const selectedBaseBranch = ref('')
|
|
163
|
-
const isCreatingBranch = ref(false)
|
|
164
87
|
|
|
165
88
|
// 创建新分支
|
|
166
89
|
async function createNewBranch() {
|
|
167
|
-
|
|
168
|
-
ElMessage({
|
|
169
|
-
message: '分支名称不能为空',
|
|
170
|
-
type: 'warning'
|
|
171
|
-
})
|
|
172
|
-
return
|
|
173
|
-
}
|
|
90
|
+
const success = await gitStore.createBranch(newBranchName.value, selectedBaseBranch.value)
|
|
174
91
|
|
|
175
|
-
|
|
176
|
-
|
|
92
|
+
if (success) {
|
|
93
|
+
// 关闭对话框
|
|
94
|
+
createBranchDialogVisible.value = false
|
|
177
95
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
headers: {
|
|
181
|
-
'Content-Type': 'application/json'
|
|
182
|
-
},
|
|
183
|
-
body: JSON.stringify({
|
|
184
|
-
newBranchName: newBranchName.value,
|
|
185
|
-
baseBranch: selectedBaseBranch.value || currentBranch.value
|
|
186
|
-
})
|
|
187
|
-
})
|
|
96
|
+
// 重置表单
|
|
97
|
+
newBranchName.value = ''
|
|
188
98
|
|
|
189
|
-
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
createBranchDialogVisible.value = false
|
|
198
|
-
|
|
199
|
-
// 重置表单
|
|
200
|
-
newBranchName.value = ''
|
|
201
|
-
|
|
202
|
-
// 刷新状态
|
|
203
|
-
getCurrentBranch()
|
|
204
|
-
getAllBranches()
|
|
205
|
-
|
|
206
|
-
// 刷新Git状态
|
|
207
|
-
if (gitStatusRef.value) {
|
|
208
|
-
gitStatusRef.value.refreshStatus()
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// 刷新提交历史
|
|
212
|
-
if (logListRef.value) {
|
|
213
|
-
logListRef.value.refreshLog()
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
ElMessage({
|
|
217
|
-
message: `创建分支失败: ${result.error}`,
|
|
218
|
-
type: 'error'
|
|
219
|
-
})
|
|
99
|
+
// 刷新Git状态
|
|
100
|
+
if (gitStatusRef.value) {
|
|
101
|
+
gitStatusRef.value.refreshStatus()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 刷新提交历史
|
|
105
|
+
if (logListRef.value) {
|
|
106
|
+
logListRef.value.refreshLog()
|
|
220
107
|
}
|
|
221
|
-
} catch (error) {
|
|
222
|
-
ElMessage({
|
|
223
|
-
message: `创建分支失败: ${(error as Error).message}`,
|
|
224
|
-
type: 'error'
|
|
225
|
-
})
|
|
226
|
-
} finally {
|
|
227
|
-
isCreatingBranch.value = false
|
|
228
108
|
}
|
|
229
109
|
}
|
|
230
110
|
|
|
231
111
|
// 打开创建分支对话框
|
|
232
112
|
function openCreateBranchDialog() {
|
|
233
|
-
selectedBaseBranch.value = currentBranch
|
|
113
|
+
selectedBaseBranch.value = gitStore.currentBranch
|
|
234
114
|
createBranchDialogVisible.value = true
|
|
235
115
|
}
|
|
116
|
+
|
|
117
|
+
// 切换分支
|
|
118
|
+
async function handleBranchChange(branch: string) {
|
|
119
|
+
const success = await gitStore.changeBranch(branch)
|
|
120
|
+
|
|
121
|
+
if (success) {
|
|
122
|
+
// 刷新Git状态
|
|
123
|
+
if (gitStatusRef.value) {
|
|
124
|
+
gitStatusRef.value.refreshStatus()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 刷新提交历史
|
|
128
|
+
if (logListRef.value) {
|
|
129
|
+
logListRef.value.refreshLog()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 添加用户设置相关状态
|
|
135
|
+
const userSettingsDialogVisible = ref(false)
|
|
136
|
+
const tempUserName = ref('')
|
|
137
|
+
const tempUserEmail = ref('')
|
|
138
|
+
|
|
139
|
+
// 打开用户设置对话框
|
|
140
|
+
function openUserSettingsDialog() {
|
|
141
|
+
tempUserName.value = gitStore.userName
|
|
142
|
+
tempUserEmail.value = gitStore.userEmail
|
|
143
|
+
userSettingsDialogVisible.value = true
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 保存用户设置
|
|
147
|
+
async function saveUserSettings() {
|
|
148
|
+
if (!tempUserName.value || !tempUserEmail.value) {
|
|
149
|
+
ElMessage.warning('用户名和邮箱不能为空')
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const success = await gitStore.restoreUserConfig(tempUserName.value, tempUserEmail.value)
|
|
154
|
+
if (success) {
|
|
155
|
+
userSettingsDialogVisible.value = false
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 清除用户配置
|
|
160
|
+
async function clearUserSettings() {
|
|
161
|
+
const success = await gitStore.clearUserConfig()
|
|
162
|
+
if (success) {
|
|
163
|
+
tempUserName.value = ''
|
|
164
|
+
tempUserEmail.value = ''
|
|
165
|
+
}
|
|
166
|
+
}
|
|
236
167
|
</script>
|
|
237
168
|
|
|
238
169
|
<template>
|
|
@@ -242,29 +173,96 @@ function openCreateBranchDialog() {
|
|
|
242
173
|
<h1>Zen GitSync UI</h1>
|
|
243
174
|
</div>
|
|
244
175
|
<div class="header-info">
|
|
245
|
-
<div id="user-info" v-if="userName && userEmail">
|
|
176
|
+
<div id="user-info" v-if="gitStore.userName && gitStore.userEmail">
|
|
246
177
|
<span class="user-label">用户:</span>
|
|
247
|
-
<span class="user-name">{{ userName }}</span>
|
|
248
|
-
<span class="user-email"><{{ userEmail }}></span>
|
|
178
|
+
<span class="user-name">{{ gitStore.userName }}</span>
|
|
179
|
+
<span class="user-email"><{{ gitStore.userEmail }}></span>
|
|
180
|
+
<el-button
|
|
181
|
+
type="primary"
|
|
182
|
+
size="small"
|
|
183
|
+
@click="openUserSettingsDialog"
|
|
184
|
+
class="user-settings-btn"
|
|
185
|
+
circle
|
|
186
|
+
>
|
|
187
|
+
<el-icon><Setting /></el-icon>
|
|
188
|
+
</el-button>
|
|
189
|
+
</div>
|
|
190
|
+
<div id="user-info" v-else>
|
|
191
|
+
<span class="user-label">用户: </span>
|
|
192
|
+
<span class="user-warning">未配置</span>
|
|
193
|
+
<el-button
|
|
194
|
+
type="primary"
|
|
195
|
+
size="small"
|
|
196
|
+
@click="openUserSettingsDialog"
|
|
197
|
+
class="user-settings-btn"
|
|
198
|
+
circle
|
|
199
|
+
>
|
|
200
|
+
<el-icon><Setting /></el-icon>
|
|
201
|
+
</el-button>
|
|
249
202
|
</div>
|
|
250
203
|
<!-- <div id="config-info">{{ configInfo }}</div> -->
|
|
251
204
|
</div>
|
|
252
205
|
</header>
|
|
253
206
|
|
|
254
207
|
<div class="container">
|
|
255
|
-
<div class="
|
|
208
|
+
<div v-if="!initCompleted" class="loading-container">
|
|
209
|
+
<el-card class="loading-card">
|
|
210
|
+
<div class="loading-spinner">
|
|
211
|
+
<el-icon class="is-loading"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"></path></svg></el-icon>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="loading-text">加载中...</div>
|
|
214
|
+
</el-card>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div v-else class="layout-container">
|
|
256
218
|
<!-- 左侧Git状态 -->
|
|
257
219
|
<div class="left-panel">
|
|
258
|
-
<GitStatus
|
|
220
|
+
<GitStatus
|
|
221
|
+
ref="gitStatusRef"
|
|
222
|
+
:initial-directory="currentDirectory"
|
|
223
|
+
/>
|
|
259
224
|
</div>
|
|
260
225
|
|
|
261
226
|
<!-- 右侧提交表单和历史 -->
|
|
262
|
-
<div class="right-panel">
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
227
|
+
<div class="right-panel" v-if="gitStore.isGitRepo">
|
|
228
|
+
<!-- 当用户未配置时显示配置提示 -->
|
|
229
|
+
<div v-if="!gitStore.userName || !gitStore.userEmail" class="card">
|
|
230
|
+
<h2>Git用户未配置</h2>
|
|
231
|
+
<p>请先配置Git用户信息才能进行提交操作。</p>
|
|
232
|
+
<div class="tips">
|
|
233
|
+
<h3>您可以通过以下方式配置:</h3>
|
|
234
|
+
<ol>
|
|
235
|
+
<li>点击右上角的设置按钮,配置用户名和邮箱</li>
|
|
236
|
+
<li>或者使用命令行配置:</li>
|
|
237
|
+
<div class="code-block">
|
|
238
|
+
git config --global user.name "您的用户名"<br>
|
|
239
|
+
git config --global user.email "您的邮箱"
|
|
240
|
+
</div>
|
|
241
|
+
</ol>
|
|
242
|
+
<el-button
|
|
243
|
+
type="primary"
|
|
244
|
+
@click="openUserSettingsDialog"
|
|
245
|
+
>
|
|
246
|
+
立即配置
|
|
247
|
+
</el-button>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
<!-- 用户已配置显示提交表单 -->
|
|
251
|
+
<template v-else>
|
|
252
|
+
<CommitForm />
|
|
253
|
+
<LogList ref="logListRef" />
|
|
254
|
+
</template>
|
|
255
|
+
</div>
|
|
256
|
+
<div class="right-panel" v-else>
|
|
257
|
+
<div class="card">
|
|
258
|
+
<h2>Git仓库初始化</h2>
|
|
259
|
+
<p>当前目录不是Git仓库,请先初始化Git仓库或切换到Git仓库目录。</p>
|
|
260
|
+
<!-- 实用提示 -->
|
|
261
|
+
<div class="tips">
|
|
262
|
+
<h3>可以使用以下命令初始化仓库:</h3>
|
|
263
|
+
<div class="code-block">git init</div>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
268
266
|
</div>
|
|
269
267
|
|
|
270
268
|
<!-- 创建分支对话框 -->
|
|
@@ -281,7 +279,7 @@ function openCreateBranchDialog() {
|
|
|
281
279
|
<el-form-item label="基于分支">
|
|
282
280
|
<el-select v-model="selectedBaseBranch" placeholder="选择基础分支" style="width: 100%;">
|
|
283
281
|
<el-option
|
|
284
|
-
v-for="branch in allBranches"
|
|
282
|
+
v-for="branch in gitStore.allBranches"
|
|
285
283
|
:key="branch"
|
|
286
284
|
:label="branch"
|
|
287
285
|
:value="branch"
|
|
@@ -295,7 +293,7 @@ function openCreateBranchDialog() {
|
|
|
295
293
|
<el-button
|
|
296
294
|
type="primary"
|
|
297
295
|
@click="createNewBranch"
|
|
298
|
-
:loading="isCreatingBranch"
|
|
296
|
+
:loading="gitStore.isCreatingBranch"
|
|
299
297
|
>
|
|
300
298
|
创建
|
|
301
299
|
</el-button>
|
|
@@ -307,35 +305,81 @@ function openCreateBranchDialog() {
|
|
|
307
305
|
</div>
|
|
308
306
|
|
|
309
307
|
<footer class="main-footer">
|
|
310
|
-
<div class="branch-info" v-if="currentBranch">
|
|
311
|
-
<
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
308
|
+
<div class="branch-info" v-if="gitStore.currentBranch">
|
|
309
|
+
<div class="branch-wrapper">
|
|
310
|
+
<span class="branch-label">当前分支:</span>
|
|
311
|
+
<el-select
|
|
312
|
+
v-model="gitStore.currentBranch"
|
|
313
|
+
size="small"
|
|
314
|
+
@change="handleBranchChange"
|
|
315
|
+
:loading="gitStore.isChangingBranch"
|
|
316
|
+
class="branch-select"
|
|
317
|
+
>
|
|
318
|
+
<el-option
|
|
319
|
+
v-for="branch in gitStore.allBranches"
|
|
320
|
+
:key="branch"
|
|
321
|
+
:label="branch"
|
|
322
|
+
:value="branch"
|
|
323
|
+
/>
|
|
324
|
+
</el-select>
|
|
325
|
+
<el-button
|
|
326
|
+
type="primary"
|
|
327
|
+
size="small"
|
|
328
|
+
@click="openCreateBranchDialog"
|
|
329
|
+
class="create-branch-btn"
|
|
330
|
+
>
|
|
331
|
+
<el-icon><Plus /></el-icon>
|
|
332
|
+
新建分支
|
|
333
|
+
</el-button>
|
|
334
|
+
</div>
|
|
334
335
|
</div>
|
|
335
336
|
<div class="footer-right">
|
|
336
337
|
<!-- <span>Zen GitSync © 2024</span> -->
|
|
337
338
|
</div>
|
|
338
339
|
</footer>
|
|
340
|
+
|
|
341
|
+
<!-- 用户设置对话框 -->
|
|
342
|
+
<el-dialog
|
|
343
|
+
v-model="userSettingsDialogVisible"
|
|
344
|
+
title="Git用户设置"
|
|
345
|
+
width="30%"
|
|
346
|
+
destroy-on-close
|
|
347
|
+
>
|
|
348
|
+
<el-form>
|
|
349
|
+
<el-form-item label="用户名">
|
|
350
|
+
<el-input v-model="tempUserName" placeholder="请输入Git用户名" />
|
|
351
|
+
</el-form-item>
|
|
352
|
+
<el-form-item label="邮箱">
|
|
353
|
+
<el-input v-model="tempUserEmail" placeholder="请输入Git邮箱" />
|
|
354
|
+
</el-form-item>
|
|
355
|
+
<el-form-item>
|
|
356
|
+
<el-alert
|
|
357
|
+
type="info"
|
|
358
|
+
:closable="false"
|
|
359
|
+
show-icon
|
|
360
|
+
>
|
|
361
|
+
这些设置将影响全局Git配置,对所有Git仓库生效。
|
|
362
|
+
</el-alert>
|
|
363
|
+
</el-form-item>
|
|
364
|
+
</el-form>
|
|
365
|
+
<template #footer>
|
|
366
|
+
<span class="dialog-footer">
|
|
367
|
+
<el-button
|
|
368
|
+
type="danger"
|
|
369
|
+
@click="clearUserSettings"
|
|
370
|
+
>
|
|
371
|
+
清除配置
|
|
372
|
+
</el-button>
|
|
373
|
+
<el-button @click="userSettingsDialogVisible = false">取消</el-button>
|
|
374
|
+
<el-button
|
|
375
|
+
type="primary"
|
|
376
|
+
@click="saveUserSettings"
|
|
377
|
+
>
|
|
378
|
+
保存
|
|
379
|
+
</el-button>
|
|
380
|
+
</span>
|
|
381
|
+
</template>
|
|
382
|
+
</el-dialog>
|
|
339
383
|
</template>
|
|
340
384
|
|
|
341
385
|
<style>
|
|
@@ -488,10 +532,10 @@ h1 {
|
|
|
488
532
|
font-size: 12px;
|
|
489
533
|
}
|
|
490
534
|
/* 添加分支选择框样式 */
|
|
491
|
-
.branch-select {
|
|
535
|
+
/* .branch-select {
|
|
492
536
|
width: 150px;
|
|
493
537
|
margin-left: 5px;
|
|
494
|
-
}
|
|
538
|
+
} */
|
|
495
539
|
|
|
496
540
|
/* 调整下拉选择框在深色背景下的样式 */
|
|
497
541
|
.branch-select :deep(.el-input__inner) {
|
|
@@ -503,6 +547,63 @@ h1 {
|
|
|
503
547
|
.branch-select :deep(.el-input__suffix) {
|
|
504
548
|
color: white;
|
|
505
549
|
}
|
|
550
|
+
|
|
551
|
+
.tips {
|
|
552
|
+
margin-top: 20px;
|
|
553
|
+
padding: 15px;
|
|
554
|
+
background-color: #f5f7fa;
|
|
555
|
+
border-radius: 5px;
|
|
556
|
+
border-left: 4px solid #409eff;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.tips h3 {
|
|
560
|
+
margin-top: 0;
|
|
561
|
+
font-size: 16px;
|
|
562
|
+
margin-bottom: 10px;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.code-block {
|
|
566
|
+
background-color: #2d2d2d;
|
|
567
|
+
color: #f8f8f2;
|
|
568
|
+
font-family: monospace;
|
|
569
|
+
padding: 10px 15px;
|
|
570
|
+
border-radius: 4px;
|
|
571
|
+
margin-bottom: 10px;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/* 添加加载中样式 */
|
|
575
|
+
.loading-container {
|
|
576
|
+
display: flex;
|
|
577
|
+
justify-content: center;
|
|
578
|
+
align-items: center;
|
|
579
|
+
min-height: 400px;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.loading-card {
|
|
583
|
+
width: 300px;
|
|
584
|
+
text-align: center;
|
|
585
|
+
padding: 30px;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.loading-spinner {
|
|
589
|
+
font-size: 48px;
|
|
590
|
+
margin-bottom: 20px;
|
|
591
|
+
color: #409eff;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.loading-text {
|
|
595
|
+
font-size: 18px;
|
|
596
|
+
color: #606266;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.user-settings-btn {
|
|
600
|
+
margin-left: 10px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.user-warning {
|
|
604
|
+
color: #E6A23C;
|
|
605
|
+
font-weight: bold;
|
|
606
|
+
}
|
|
506
607
|
</style>
|
|
507
608
|
|
|
508
609
|
<style scoped>
|
|
@@ -525,15 +626,63 @@ h1 {
|
|
|
525
626
|
left: 0;
|
|
526
627
|
right: 0;
|
|
527
628
|
z-index: 100;
|
|
629
|
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
|
528
630
|
}
|
|
529
631
|
|
|
530
632
|
.branch-info {
|
|
531
633
|
display: flex;
|
|
532
634
|
align-items: center;
|
|
635
|
+
gap: 10px;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.branch-wrapper {
|
|
639
|
+
display: flex;
|
|
640
|
+
align-items: center;
|
|
641
|
+
background-color: rgba(255, 255, 255, 0.15);
|
|
642
|
+
border-radius: 4px;
|
|
643
|
+
padding: 8px 12px;
|
|
644
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
645
|
+
transition: all 0.3s;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.branch-wrapper:hover {
|
|
649
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.branch-label {
|
|
653
|
+
font-weight: bold;
|
|
654
|
+
margin-right: 10px;
|
|
655
|
+
color: #ffffff;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.branch-select {
|
|
659
|
+
width: 200px;
|
|
660
|
+
margin-right: 10px;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.create-branch-btn {
|
|
664
|
+
background-color: #2ea44f;
|
|
665
|
+
border-color: #2ea44f;
|
|
666
|
+
transition: all 0.3s;
|
|
667
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.create-branch-btn:hover {
|
|
671
|
+
background-color: #3bbc63;
|
|
672
|
+
border-color: #3bbc63;
|
|
673
|
+
transform: translateY(-2px);
|
|
674
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
533
675
|
}
|
|
534
676
|
|
|
535
677
|
.footer-right {
|
|
536
|
-
|
|
537
|
-
|
|
678
|
+
display: flex;
|
|
679
|
+
align-items: center;
|
|
680
|
+
gap: 10px;
|
|
681
|
+
color: rgba(255, 255, 255, 0.9);
|
|
682
|
+
font-size: 13px;
|
|
683
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
684
|
+
padding: 8px 12px;
|
|
685
|
+
border-radius: 4px;
|
|
686
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
538
687
|
}
|
|
539
688
|
</style>
|