zen-gitsync 2.0.6 → 2.0.7
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/src/components/CommitForm.vue +354 -159
- package/src/ui/client/src/components/GitStatus.vue +517 -134
- package/src/ui/client/src/components/LogList.vue +831 -222
- package/src/ui/client/src/stores/gitLogStore.ts +12 -4
- package/src/ui/client/src/stores/gitStore.ts +42 -1
- package/src/ui/client/stats.html +1 -1
- package/src/ui/client/vite.config.ts +2 -0
- package/src/ui/public/assets/index-B1vQ6PC_.js +20 -0
- package/src/ui/public/assets/index-CC5qWyQ-.css +1 -0
- package/src/ui/public/assets/{vendor-BcSuWc8z.js → vendor-BmPvvgTD.js} +7 -7
- package/src/ui/public/index.html +3 -3
- package/src/ui/server/index.js +297 -46
- package/src/ui/public/assets/index-DaPynzAr.js +0 -10
- package/src/ui/public/assets/index-qfIezZmd.css +0 -1
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, onMounted, computed, watch } from 'vue'
|
|
3
|
-
import {
|
|
2
|
+
import { ref, onMounted, computed, watch, onBeforeUnmount, nextTick } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
ElTable,
|
|
5
|
+
ElTableColumn,
|
|
6
|
+
ElTag,
|
|
7
|
+
ElButton,
|
|
8
|
+
ElSlider,
|
|
9
|
+
ElDialog,
|
|
10
|
+
ElSelect,
|
|
11
|
+
ElOption,
|
|
12
|
+
ElDatePicker,
|
|
13
|
+
ElInput,
|
|
14
|
+
ElBadge,
|
|
15
|
+
ElMessage,
|
|
16
|
+
ElMessageBox
|
|
17
|
+
} from 'element-plus'
|
|
4
18
|
import { RefreshRight, ZoomIn, ZoomOut, Filter, Document, TrendCharts, List, More } from '@element-plus/icons-vue'
|
|
5
19
|
import 'element-plus/dist/index.css'
|
|
6
20
|
import { createGitgraph } from '@gitgraph/js'
|
|
@@ -33,6 +47,12 @@ const totalCommits = ref(0)
|
|
|
33
47
|
const showGraphView = ref(false)
|
|
34
48
|
const graphContainer = ref<HTMLElement | null>(null)
|
|
35
49
|
|
|
50
|
+
// 添加分页相关变量
|
|
51
|
+
const currentPage = ref(1)
|
|
52
|
+
const hasMoreData = ref(true)
|
|
53
|
+
const isLoadingMore = ref(false)
|
|
54
|
+
const loadTimerInterval = ref<number | null>(null)
|
|
55
|
+
|
|
36
56
|
// 添加提交详情弹窗相关变量
|
|
37
57
|
const commitDetailVisible = ref(false)
|
|
38
58
|
const selectedCommit = ref<LogItem | null>(null)
|
|
@@ -52,68 +72,25 @@ const logRefreshed = ref(false)
|
|
|
52
72
|
|
|
53
73
|
// 添加筛选相关变量
|
|
54
74
|
const filterVisible = ref(false)
|
|
55
|
-
const authorFilter = ref(
|
|
75
|
+
const authorFilter = ref<string[]>([])
|
|
56
76
|
const messageFilter = ref('')
|
|
57
77
|
const dateRangeFilter = ref<any>(null)
|
|
58
|
-
const availableAuthors =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
return Array.from(authors).sort()
|
|
67
|
-
})
|
|
78
|
+
const availableAuthors = ref<string[]>([])
|
|
79
|
+
|
|
80
|
+
// 添加右键菜单相关变量
|
|
81
|
+
const contextMenuVisible = ref(false)
|
|
82
|
+
const contextMenuTop = ref(0)
|
|
83
|
+
const contextMenuLeft = ref(0)
|
|
84
|
+
const selectedContextCommit = ref<LogItem | null>(null)
|
|
68
85
|
|
|
69
86
|
// 应用筛选后的日志
|
|
70
87
|
const filteredLogs = computed(() => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return logs.value.filter(log => {
|
|
76
|
-
// 作者筛选
|
|
77
|
-
if (authorFilter.value && log.author !== authorFilter.value) {
|
|
78
|
-
return false
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// 提交信息关键词筛选
|
|
82
|
-
if (messageFilter.value && !log.message.toLowerCase().includes(messageFilter.value.toLowerCase())) {
|
|
83
|
-
return false
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 日期范围筛选
|
|
87
|
-
if (dateRangeFilter.value && dateRangeFilter.value.length === 2) {
|
|
88
|
-
const logDate = new Date(log.date)
|
|
89
|
-
const [startDateStr, endDateStr] = dateRangeFilter.value
|
|
90
|
-
|
|
91
|
-
// 转换日期字符串为Date对象
|
|
92
|
-
const startDate = new Date(startDateStr)
|
|
93
|
-
const endDate = new Date(endDateStr)
|
|
94
|
-
|
|
95
|
-
// 设置时间为一天的开始和结束,确保包含完整日期
|
|
96
|
-
startDate.setHours(0, 0, 0, 0)
|
|
97
|
-
endDate.setHours(23, 59, 59, 999)
|
|
98
|
-
|
|
99
|
-
if (logDate < startDate || logDate > endDate) {
|
|
100
|
-
return false
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return true
|
|
105
|
-
})
|
|
88
|
+
// 不再在前端进行筛选,直接使用加载的日志
|
|
89
|
+
return logs.value;
|
|
106
90
|
})
|
|
107
91
|
|
|
108
|
-
// 重置筛选条件
|
|
109
|
-
function resetFilters() {
|
|
110
|
-
authorFilter.value = ''
|
|
111
|
-
messageFilter.value = ''
|
|
112
|
-
dateRangeFilter.value = null
|
|
113
|
-
}
|
|
114
|
-
|
|
115
92
|
// 加载提交历史
|
|
116
|
-
async function loadLog(all = false) {
|
|
93
|
+
async function loadLog(all = false, page = 1) {
|
|
117
94
|
// 从gitStore获取仓库状态
|
|
118
95
|
const gitStore = useGitStore()
|
|
119
96
|
|
|
@@ -124,57 +101,81 @@ async function loadLog(all = false) {
|
|
|
124
101
|
}
|
|
125
102
|
|
|
126
103
|
try {
|
|
127
|
-
|
|
104
|
+
// 设置加载状态
|
|
105
|
+
if (page > 1) {
|
|
106
|
+
isLoadingMore.value = true
|
|
107
|
+
} else {
|
|
108
|
+
localLoading.value = true
|
|
109
|
+
}
|
|
128
110
|
|
|
129
|
-
|
|
130
|
-
localLoading.value = true
|
|
111
|
+
console.log(`加载提交历史: page=${page}, all=${all}`)
|
|
131
112
|
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
113
|
+
// 构建查询参数
|
|
114
|
+
const queryParams = new URLSearchParams()
|
|
115
|
+
queryParams.append('page', page.toString())
|
|
116
|
+
queryParams.append('all', all.toString())
|
|
136
117
|
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
// 添加筛选参数
|
|
119
|
+
if (authorFilter.value.length > 0) {
|
|
120
|
+
queryParams.append('author', authorFilter.value.join(','))
|
|
121
|
+
}
|
|
139
122
|
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
if (messageFilter.value) {
|
|
124
|
+
queryParams.append('message', messageFilter.value)
|
|
125
|
+
}
|
|
142
126
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
totalCommits.value = data.log.length
|
|
160
|
-
} else {
|
|
161
|
-
console.error('未知的日志数据格式:', data)
|
|
162
|
-
errorMessage.value = '日志数据格式错误'
|
|
127
|
+
if (dateRangeFilter.value && Array.isArray(dateRangeFilter.value) && dateRangeFilter.value.length === 2) {
|
|
128
|
+
queryParams.append('dateFrom', dateRangeFilter.value[0])
|
|
129
|
+
queryParams.append('dateTo', dateRangeFilter.value[1])
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 添加时间戳防止缓存
|
|
133
|
+
queryParams.append('_t', Date.now().toString())
|
|
134
|
+
|
|
135
|
+
const response = await fetch(`/api/log?${queryParams.toString()}`)
|
|
136
|
+
const result = await response.json()
|
|
137
|
+
|
|
138
|
+
// 确保result有正确的数据结构
|
|
139
|
+
if (!result || !result.data || !Array.isArray(result.data)) {
|
|
140
|
+
console.error('API返回的数据格式不正确:', result)
|
|
141
|
+
errorMessage.value = '加载提交历史失败: 服务器返回数据格式不正确'
|
|
163
142
|
return
|
|
164
143
|
}
|
|
165
144
|
|
|
166
|
-
|
|
145
|
+
const isLoadMore = page > 1
|
|
146
|
+
|
|
147
|
+
// 处理结果
|
|
148
|
+
// 如果是加载更多,追加数据,否则替换数据
|
|
149
|
+
if (isLoadMore) {
|
|
150
|
+
result.data.forEach((item: LogItem) => logsData.push(item))
|
|
151
|
+
} else {
|
|
152
|
+
logsData.length = 0
|
|
153
|
+
result.data.forEach((item: LogItem) => logsData.push(item))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 强制重新渲染列表
|
|
167
157
|
logs.value = [...logsData]
|
|
168
158
|
|
|
169
|
-
|
|
159
|
+
// 更新当前页码
|
|
160
|
+
currentPage.value = page
|
|
170
161
|
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
setTimeout(() => { logRefreshed.value = false }, 2000)
|
|
162
|
+
// 更新总数和分页标记
|
|
163
|
+
totalCommits.value = result.total || logsData.length
|
|
164
|
+
hasMoreData.value = result.hasMore === true
|
|
175
165
|
|
|
176
|
-
|
|
177
|
-
|
|
166
|
+
if (!hasMoreData.value) {
|
|
167
|
+
console.log('已加载所有提交记录')
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 设置刷新提示状态(仅在初次加载时)
|
|
171
|
+
if (!isLoadMore) {
|
|
172
|
+
logRefreshed.value = true
|
|
173
|
+
// 2秒后隐藏提示
|
|
174
|
+
setTimeout(() => { logRefreshed.value = false }, 2000)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 加载完数据后渲染图表(仅在初次加载时)
|
|
178
|
+
if (!isLoadMore && showGraphView.value) {
|
|
178
179
|
setTimeout(renderGraph, 0)
|
|
179
180
|
}
|
|
180
181
|
|
|
@@ -182,9 +183,18 @@ async function loadLog(all = false) {
|
|
|
182
183
|
} catch (error) {
|
|
183
184
|
errorMessage.value = '加载提交历史失败: ' + (error instanceof Error ? error.message : String(error))
|
|
184
185
|
console.error('加载日志失败:', error)
|
|
186
|
+
|
|
187
|
+
// 如果加载更多失败,标记没有更多数据
|
|
188
|
+
if (page > 1) {
|
|
189
|
+
hasMoreData.value = false
|
|
190
|
+
}
|
|
185
191
|
} finally {
|
|
186
|
-
//
|
|
187
|
-
|
|
192
|
+
// 重置加载状态
|
|
193
|
+
if (page > 1) {
|
|
194
|
+
isLoadingMore.value = false
|
|
195
|
+
} else {
|
|
196
|
+
localLoading.value = false
|
|
197
|
+
}
|
|
188
198
|
}
|
|
189
199
|
}
|
|
190
200
|
|
|
@@ -294,6 +304,59 @@ function getBranchTagType(ref: string) {
|
|
|
294
304
|
return 'info'
|
|
295
305
|
}
|
|
296
306
|
|
|
307
|
+
// 添加对表格实例的引用
|
|
308
|
+
const tableRef = ref<InstanceType<typeof ElTable> | null>(null)
|
|
309
|
+
const tableBodyWrapper = ref<HTMLElement | null>(null)
|
|
310
|
+
|
|
311
|
+
// 监听表格滚动事件的处理函数
|
|
312
|
+
function handleTableScroll(event: Event) {
|
|
313
|
+
if (showGraphView.value || !hasMoreData.value || isLoadingMore.value || isLoading.value) {
|
|
314
|
+
return
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const target = event.target as HTMLElement
|
|
318
|
+
const { scrollTop, scrollHeight, clientHeight } = target
|
|
319
|
+
const scrollDistance = scrollHeight - scrollTop - clientHeight
|
|
320
|
+
|
|
321
|
+
// 调试信息
|
|
322
|
+
console.log('表格滚动:', {
|
|
323
|
+
scrollTop,
|
|
324
|
+
scrollHeight,
|
|
325
|
+
clientHeight,
|
|
326
|
+
scrollDistance
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
// 当滚动到距离底部20px时触发加载
|
|
330
|
+
if (scrollDistance <= 20) {
|
|
331
|
+
console.log('已滚动到底部,加载更多数据')
|
|
332
|
+
loadMoreLogs()
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// 设置表格滚动监听
|
|
337
|
+
function setupTableScrollListener() {
|
|
338
|
+
if (!tableRef.value) return
|
|
339
|
+
|
|
340
|
+
// 获取表格的body-wrapper
|
|
341
|
+
tableBodyWrapper.value = tableRef.value.$el.querySelector('.el-table__body-wrapper')
|
|
342
|
+
|
|
343
|
+
if (tableBodyWrapper.value) {
|
|
344
|
+
console.log('添加表格滚动监听')
|
|
345
|
+
tableBodyWrapper.value.addEventListener('scroll', handleTableScroll, true)
|
|
346
|
+
} else {
|
|
347
|
+
console.error('未找到表格的body-wrapper元素')
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// 移除表格滚动监听
|
|
352
|
+
function removeTableScrollListener() {
|
|
353
|
+
if (tableBodyWrapper.value) {
|
|
354
|
+
console.log('移除表格滚动监听')
|
|
355
|
+
tableBodyWrapper.value.removeEventListener('scroll', handleTableScroll, true)
|
|
356
|
+
tableBodyWrapper.value = null
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
297
360
|
onMounted(() => {
|
|
298
361
|
// 检查gitLogStore中是否已有数据
|
|
299
362
|
if (gitStore.isGitRepo) {
|
|
@@ -320,9 +383,30 @@ onMounted(() => {
|
|
|
320
383
|
console.log('初始加载日志数据')
|
|
321
384
|
loadLog()
|
|
322
385
|
}
|
|
386
|
+
|
|
387
|
+
// 加载所有可能的作者列表
|
|
388
|
+
fetchAllAuthors()
|
|
323
389
|
} else {
|
|
324
390
|
errorMessage.value = '当前目录不是Git仓库'
|
|
325
391
|
}
|
|
392
|
+
|
|
393
|
+
// 在下一个tick中设置表格滚动监听
|
|
394
|
+
nextTick(() => {
|
|
395
|
+
setTimeout(() => {
|
|
396
|
+
setupTableScrollListener()
|
|
397
|
+
}, 500) // 给表格足够的时间来渲染
|
|
398
|
+
})
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
onBeforeUnmount(() => {
|
|
402
|
+
// 清除表格滚动监听
|
|
403
|
+
removeTableScrollListener()
|
|
404
|
+
|
|
405
|
+
// 清除定时器
|
|
406
|
+
if (loadTimerInterval.value !== null) {
|
|
407
|
+
window.clearInterval(loadTimerInterval.value)
|
|
408
|
+
loadTimerInterval.value = null
|
|
409
|
+
}
|
|
326
410
|
})
|
|
327
411
|
|
|
328
412
|
// 简化刷新函数,只需调用loadLog即可
|
|
@@ -331,36 +415,49 @@ const refreshLog = () => {
|
|
|
331
415
|
errorMessage.value = '当前目录不是Git仓库'
|
|
332
416
|
return
|
|
333
417
|
}
|
|
334
|
-
|
|
418
|
+
// 重置页码,重新加载第一页
|
|
419
|
+
currentPage.value = 1
|
|
420
|
+
hasMoreData.value = true
|
|
421
|
+
loadLog(showAllCommits.value, 1)
|
|
335
422
|
}
|
|
336
423
|
|
|
337
424
|
// 监听store中的日志变化
|
|
338
425
|
watch(() => gitLogStore.log, (newLogs) => {
|
|
339
426
|
console.log('监听到gitLogStore.log变化,更新图表数据')
|
|
340
427
|
|
|
341
|
-
// 清空logsData
|
|
342
|
-
logsData.length = 0
|
|
343
|
-
|
|
344
|
-
// 重新填充数据
|
|
345
|
-
newLogs.forEach((item: LogItem) => logsData.push(item))
|
|
346
|
-
|
|
347
|
-
// 更新计数器
|
|
348
|
-
totalCommits.value = newLogs.length
|
|
349
|
-
|
|
350
|
-
// 尝试解决logs.value赋值问题
|
|
351
428
|
try {
|
|
352
|
-
//
|
|
429
|
+
// 清空logsData
|
|
430
|
+
logsData.length = 0
|
|
431
|
+
|
|
432
|
+
// 重新填充数据,使用类型断言
|
|
433
|
+
if (Array.isArray(newLogs)) {
|
|
434
|
+
// @ts-ignore - 忽略类型校验
|
|
435
|
+
newLogs.forEach(item => item && logsData.push(item))
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// 更新计数器
|
|
439
|
+
totalCommits.value = logsData.length
|
|
440
|
+
|
|
441
|
+
// 重置当前页为第1页
|
|
442
|
+
currentPage.value = 1
|
|
443
|
+
|
|
444
|
+
// 确保引用更新,触发UI重渲染
|
|
445
|
+
// @ts-ignore - 忽略类型校验
|
|
353
446
|
logs.value = [...logsData]
|
|
447
|
+
|
|
448
|
+
// 设置刷新提示
|
|
449
|
+
logRefreshed.value = true
|
|
450
|
+
setTimeout(() => { logRefreshed.value = false }, 2000)
|
|
451
|
+
|
|
452
|
+
console.log(`数据更新完成,共${logs.value.length}条记录,准备渲染图表`)
|
|
453
|
+
|
|
454
|
+
if (showGraphView.value && logsData.length > 0) {
|
|
455
|
+
setTimeout(renderGraph, 0)
|
|
456
|
+
}
|
|
354
457
|
} catch (error) {
|
|
355
|
-
console.
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
console.log(`数据更新完成,准备渲染图表(${logsData.length}条记录)`)
|
|
359
|
-
|
|
360
|
-
if (showGraphView.value && logsData.length > 0) {
|
|
361
|
-
setTimeout(renderGraph, 0)
|
|
458
|
+
console.error('更新日志数据失败:', error)
|
|
362
459
|
}
|
|
363
|
-
})
|
|
460
|
+
}, { immediate: true })
|
|
364
461
|
|
|
365
462
|
// 暴露方法给父组件
|
|
366
463
|
defineExpose({
|
|
@@ -417,7 +514,9 @@ function fitGraphToContainer() {
|
|
|
417
514
|
}
|
|
418
515
|
|
|
419
516
|
// 查看提交详情
|
|
420
|
-
async function viewCommitDetail(commit: LogItem) {
|
|
517
|
+
async function viewCommitDetail(commit: LogItem | null) {
|
|
518
|
+
if (!commit) return
|
|
519
|
+
|
|
421
520
|
selectedCommit.value = commit
|
|
422
521
|
commitDetailVisible.value = true
|
|
423
522
|
isLoadingCommitDetail.value = true
|
|
@@ -547,6 +646,188 @@ function formatCommitMessage(message: string) {
|
|
|
547
646
|
// 返回格式化后的提交信息,保留换行符
|
|
548
647
|
return message.trim();
|
|
549
648
|
}
|
|
649
|
+
|
|
650
|
+
// 加载更多日志
|
|
651
|
+
function loadMoreLogs() {
|
|
652
|
+
if (!hasMoreData.value || isLoadingMore.value || isLoading.value) return
|
|
653
|
+
|
|
654
|
+
console.log(`加载更多日志,页码: ${currentPage.value + 1}`)
|
|
655
|
+
loadLog(showAllCommits.value, currentPage.value + 1)
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// 重置筛选条件并重新加载数据
|
|
659
|
+
function resetFilters() {
|
|
660
|
+
authorFilter.value = []
|
|
661
|
+
messageFilter.value = ''
|
|
662
|
+
dateRangeFilter.value = null
|
|
663
|
+
|
|
664
|
+
// 重置筛选后重新加载数据
|
|
665
|
+
currentPage.value = 1
|
|
666
|
+
loadLog(showAllCommits.value, 1)
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// 应用筛选条件
|
|
670
|
+
function applyFilters() {
|
|
671
|
+
// 应用筛选时重置到第一页
|
|
672
|
+
currentPage.value = 1
|
|
673
|
+
loadLog(showAllCommits.value, 1)
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// 添加获取所有作者的函数
|
|
677
|
+
async function fetchAllAuthors() {
|
|
678
|
+
try {
|
|
679
|
+
console.log('获取所有可用作者...')
|
|
680
|
+
const response = await fetch('/api/authors')
|
|
681
|
+
const result = await response.json()
|
|
682
|
+
|
|
683
|
+
if (result.success && Array.isArray(result.authors)) {
|
|
684
|
+
// 更新可用作者列表
|
|
685
|
+
availableAuthors.value = result.authors.sort()
|
|
686
|
+
console.log(`获取到${availableAuthors.value.length}位作者`)
|
|
687
|
+
} else {
|
|
688
|
+
// 如果获取作者列表失败,但正常获取了日志
|
|
689
|
+
// 从当前加载的日志中提取作者列表作为备选
|
|
690
|
+
console.warn('从API获取作者列表失败,将从现有日志中提取作者列表')
|
|
691
|
+
extractAuthorsFromLogs()
|
|
692
|
+
}
|
|
693
|
+
} catch (error) {
|
|
694
|
+
console.error('获取作者列表失败:', error)
|
|
695
|
+
// 从当前加载的日志中提取作者列表作为备选
|
|
696
|
+
extractAuthorsFromLogs()
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// 从已加载的日志中提取作者列表
|
|
701
|
+
function extractAuthorsFromLogs() {
|
|
702
|
+
const authors = new Set<string>()
|
|
703
|
+
logs.value.forEach(log => {
|
|
704
|
+
if (log.author) {
|
|
705
|
+
authors.add(log.author)
|
|
706
|
+
}
|
|
707
|
+
})
|
|
708
|
+
availableAuthors.value = Array.from(authors).sort()
|
|
709
|
+
console.log(`从现有日志中提取了${availableAuthors.value.length}位作者`)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// 处理右键菜单事件
|
|
713
|
+
function handleContextMenu(row: LogItem, column: any, event: MouseEvent) {
|
|
714
|
+
console.log('handleContextMenu', row, column, event)
|
|
715
|
+
// 阻止默认右键菜单
|
|
716
|
+
event.preventDefault()
|
|
717
|
+
|
|
718
|
+
// 设置右键菜单位置
|
|
719
|
+
contextMenuTop.value = event.clientY
|
|
720
|
+
contextMenuLeft.value = event.clientX
|
|
721
|
+
|
|
722
|
+
// 设置选中的提交
|
|
723
|
+
selectedContextCommit.value = row
|
|
724
|
+
|
|
725
|
+
// 显示右键菜单
|
|
726
|
+
contextMenuVisible.value = true
|
|
727
|
+
|
|
728
|
+
// 点击其他地方时隐藏菜单
|
|
729
|
+
const hideContextMenu = () => {
|
|
730
|
+
contextMenuVisible.value = false
|
|
731
|
+
document.removeEventListener('click', hideContextMenu)
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// 添加点击监听器
|
|
735
|
+
setTimeout(() => {
|
|
736
|
+
document.addEventListener('click', hideContextMenu)
|
|
737
|
+
}, 0)
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// 撤销提交 (Revert)
|
|
741
|
+
async function revertCommit(commit: LogItem | null) {
|
|
742
|
+
if (!commit) return
|
|
743
|
+
|
|
744
|
+
try {
|
|
745
|
+
// 询问确认
|
|
746
|
+
await ElMessageBox.confirm(
|
|
747
|
+
`确定要撤销提交 ${commit.hash.substring(0, 7)} 吗?这将创建一个新的提交来撤销这次提交的更改。`,
|
|
748
|
+
'撤销提交确认',
|
|
749
|
+
{
|
|
750
|
+
confirmButtonText: '确认',
|
|
751
|
+
cancelButtonText: '取消',
|
|
752
|
+
type: 'warning'
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
// 发送请求
|
|
757
|
+
const response = await fetch('/api/revert-commit', {
|
|
758
|
+
method: 'POST',
|
|
759
|
+
headers: {
|
|
760
|
+
'Content-Type': 'application/json'
|
|
761
|
+
},
|
|
762
|
+
body: JSON.stringify({ hash: commit.hash })
|
|
763
|
+
})
|
|
764
|
+
|
|
765
|
+
const result = await response.json()
|
|
766
|
+
|
|
767
|
+
if (result.success) {
|
|
768
|
+
ElMessage.success(result.message || '已成功撤销提交')
|
|
769
|
+
// 刷新日志
|
|
770
|
+
refreshLog()
|
|
771
|
+
// 刷新Git状态
|
|
772
|
+
gitLogStore.fetchStatus()
|
|
773
|
+
// 添加: 刷新分支状态
|
|
774
|
+
gitStore.getBranchStatus()
|
|
775
|
+
} else {
|
|
776
|
+
ElMessage.error(result.error || '撤销提交失败')
|
|
777
|
+
}
|
|
778
|
+
} catch (error: any) {
|
|
779
|
+
if (error !== 'cancel') {
|
|
780
|
+
console.error('撤销提交出错:', error)
|
|
781
|
+
ElMessage.error('撤销提交失败: ' + (error.message || error))
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// Cherry-pick提交
|
|
787
|
+
async function cherryPickCommit(commit: LogItem | null) {
|
|
788
|
+
if (!commit) return
|
|
789
|
+
|
|
790
|
+
try {
|
|
791
|
+
// 询问确认
|
|
792
|
+
await ElMessageBox.confirm(
|
|
793
|
+
`确定要将提交 ${commit.hash.substring(0, 7)} Cherry-Pick 到当前分支吗?`,
|
|
794
|
+
'Cherry-Pick确认',
|
|
795
|
+
{
|
|
796
|
+
confirmButtonText: '确认',
|
|
797
|
+
cancelButtonText: '取消',
|
|
798
|
+
type: 'warning'
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
// 发送请求
|
|
803
|
+
const response = await fetch('/api/cherry-pick-commit', {
|
|
804
|
+
method: 'POST',
|
|
805
|
+
headers: {
|
|
806
|
+
'Content-Type': 'application/json'
|
|
807
|
+
},
|
|
808
|
+
body: JSON.stringify({ hash: commit.hash })
|
|
809
|
+
})
|
|
810
|
+
|
|
811
|
+
const result = await response.json()
|
|
812
|
+
|
|
813
|
+
if (result.success) {
|
|
814
|
+
ElMessage.success(result.message || '已成功Cherry-Pick提交')
|
|
815
|
+
// 刷新日志
|
|
816
|
+
refreshLog()
|
|
817
|
+
// 刷新Git状态
|
|
818
|
+
gitLogStore.fetchStatus()
|
|
819
|
+
// 添加: 刷新分支状态
|
|
820
|
+
gitStore.getBranchStatus()
|
|
821
|
+
} else {
|
|
822
|
+
ElMessage.error(result.error || 'Cherry-Pick提交失败')
|
|
823
|
+
}
|
|
824
|
+
} catch (error: any) {
|
|
825
|
+
if (error !== 'cancel') {
|
|
826
|
+
console.error('Cherry-Pick提交出错:', error)
|
|
827
|
+
ElMessage.error('Cherry-Pick提交失败: ' + (error.message || error))
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
550
831
|
</script>
|
|
551
832
|
|
|
552
833
|
<template>
|
|
@@ -558,8 +839,38 @@ function formatCommitMessage(message: string) {
|
|
|
558
839
|
|
|
559
840
|
<!-- 固定头部区域 -->
|
|
560
841
|
<div class="log-header">
|
|
561
|
-
<
|
|
842
|
+
<div class="header-left">
|
|
843
|
+
<h2>提交历史</h2>
|
|
844
|
+
<!-- <el-tag type="info" effect="plain" size="small" class="record-count" v-if="!showGraphView">
|
|
845
|
+
<template #icon>
|
|
846
|
+
<el-icon><Document /></el-icon>
|
|
847
|
+
</template>
|
|
848
|
+
{{ filteredLogs.length }}/{{ logs.length }}
|
|
849
|
+
<el-tag v-if="!showAllCommits" type="warning" size="small" effect="plain" style="margin-left: 5px">
|
|
850
|
+
分页加载 (每页100条)
|
|
851
|
+
</el-tag>
|
|
852
|
+
<el-tag v-else type="success" size="small" effect="plain" style="margin-left: 5px">
|
|
853
|
+
全部
|
|
854
|
+
</el-tag>
|
|
855
|
+
</el-tag> -->
|
|
856
|
+
</div>
|
|
857
|
+
|
|
562
858
|
<div class="log-actions">
|
|
859
|
+
<!-- 筛选按钮移到这里 -->
|
|
860
|
+
<el-button
|
|
861
|
+
v-if="!showGraphView"
|
|
862
|
+
:type="filterVisible ? 'primary' : 'default'"
|
|
863
|
+
size="small"
|
|
864
|
+
@click="filterVisible = !filterVisible"
|
|
865
|
+
>
|
|
866
|
+
<template #icon>
|
|
867
|
+
<el-icon><Filter /></el-icon>
|
|
868
|
+
</template>
|
|
869
|
+
筛选
|
|
870
|
+
<el-badge v-if="filteredLogs.length !== logs.length" :value="filteredLogs.length" class="filter-badge" />
|
|
871
|
+
</el-button>
|
|
872
|
+
|
|
873
|
+
<!-- 原有的按钮 -->
|
|
563
874
|
<el-button
|
|
564
875
|
type="primary"
|
|
565
876
|
size="small"
|
|
@@ -579,7 +890,7 @@ function formatCommitMessage(message: string) {
|
|
|
579
890
|
<template #icon>
|
|
580
891
|
<el-icon><component :is="showAllCommits ? List : More" /></el-icon>
|
|
581
892
|
</template>
|
|
582
|
-
{{ showAllCommits ? '
|
|
893
|
+
{{ showAllCommits ? '显示分页加载 (每页100条)' : '显示所有提交' }}
|
|
583
894
|
</el-button>
|
|
584
895
|
<el-button
|
|
585
896
|
circle
|
|
@@ -593,14 +904,70 @@ function formatCommitMessage(message: string) {
|
|
|
593
904
|
</div>
|
|
594
905
|
</div>
|
|
595
906
|
|
|
907
|
+
<!-- 筛选面板放在头部下方,但在内容区域之前 -->
|
|
908
|
+
<div v-if="filterVisible && !showGraphView" class="filter-panel-header">
|
|
909
|
+
<div class="filter-form">
|
|
910
|
+
<div class="filter-item">
|
|
911
|
+
<div class="filter-label">作者:</div>
|
|
912
|
+
<el-select
|
|
913
|
+
v-model="authorFilter"
|
|
914
|
+
placeholder="选择作者"
|
|
915
|
+
multiple
|
|
916
|
+
clearable
|
|
917
|
+
filterable
|
|
918
|
+
class="filter-input"
|
|
919
|
+
size="small"
|
|
920
|
+
>
|
|
921
|
+
<el-option
|
|
922
|
+
v-for="author in availableAuthors"
|
|
923
|
+
:key="author"
|
|
924
|
+
:label="author"
|
|
925
|
+
:value="author"
|
|
926
|
+
/>
|
|
927
|
+
</el-select>
|
|
928
|
+
</div>
|
|
929
|
+
|
|
930
|
+
<div class="filter-item">
|
|
931
|
+
<div class="filter-label">提交信息包含:</div>
|
|
932
|
+
<el-input
|
|
933
|
+
v-model="messageFilter"
|
|
934
|
+
placeholder="关键词"
|
|
935
|
+
clearable
|
|
936
|
+
class="filter-input"
|
|
937
|
+
size="small"
|
|
938
|
+
/>
|
|
939
|
+
</div>
|
|
940
|
+
|
|
941
|
+
<div class="filter-item">
|
|
942
|
+
<div class="filter-label">日期范围:</div>
|
|
943
|
+
<el-date-picker
|
|
944
|
+
v-model="dateRangeFilter"
|
|
945
|
+
type="daterange"
|
|
946
|
+
range-separator="至"
|
|
947
|
+
start-placeholder="开始日期"
|
|
948
|
+
end-placeholder="结束日期"
|
|
949
|
+
format="YYYY-MM-DD"
|
|
950
|
+
value-format="YYYY-MM-DD"
|
|
951
|
+
class="filter-input date-range"
|
|
952
|
+
size="small"
|
|
953
|
+
/>
|
|
954
|
+
</div>
|
|
955
|
+
|
|
956
|
+
<div class="filter-actions">
|
|
957
|
+
<el-button type="primary" size="small" @click="applyFilters">应用筛选</el-button>
|
|
958
|
+
<el-button type="info" size="small" @click="resetFilters">重置</el-button>
|
|
959
|
+
</div>
|
|
960
|
+
</div>
|
|
961
|
+
</div>
|
|
962
|
+
|
|
596
963
|
<!-- 内容区域,添加上边距以避免被固定头部遮挡 -->
|
|
597
|
-
<div class="content-area">
|
|
964
|
+
<div class="content-area" :class="{'with-filter': filterVisible && !showGraphView}">
|
|
598
965
|
<div v-if="errorMessage">{{ errorMessage }}</div>
|
|
599
966
|
<div v-else>
|
|
600
967
|
<!-- 图表视图 -->
|
|
601
968
|
<div v-if="showGraphView" class="graph-view">
|
|
602
969
|
<div class="commit-count" v-if="logsData.length > 0">
|
|
603
|
-
显示 {{ logsData.length }} 条提交记录 {{ showAllCommits ? '(全部)' : '(
|
|
970
|
+
显示 {{ logsData.length }} 条提交记录 {{ showAllCommits ? '(全部)' : '(分页加载,每页100条)' }}
|
|
604
971
|
</div>
|
|
605
972
|
|
|
606
973
|
<!-- 添加缩放控制 -->
|
|
@@ -653,92 +1020,8 @@ function formatCommitMessage(message: string) {
|
|
|
653
1020
|
</div>
|
|
654
1021
|
|
|
655
1022
|
<!-- 表格视图 -->
|
|
656
|
-
<div v-else>
|
|
657
|
-
|
|
658
|
-
<div class="history-stats">
|
|
659
|
-
<el-tag type="info" effect="plain" size="large" class="record-count">
|
|
660
|
-
<template #icon>
|
|
661
|
-
<el-icon><Document /></el-icon>
|
|
662
|
-
</template>
|
|
663
|
-
显示 {{ filteredLogs.length }}/{{ logs.length }} 条记录
|
|
664
|
-
<el-tag v-if="!showAllCommits" type="warning" size="small" effect="plain" style="margin-left: 5px">
|
|
665
|
-
最近30条
|
|
666
|
-
</el-tag>
|
|
667
|
-
<el-tag v-else type="success" size="small" effect="plain" style="margin-left: 5px">
|
|
668
|
-
全部
|
|
669
|
-
</el-tag>
|
|
670
|
-
</el-tag>
|
|
671
|
-
</div>
|
|
672
|
-
|
|
673
|
-
<div class="filter-actions">
|
|
674
|
-
<el-button
|
|
675
|
-
:type="filterVisible ? 'primary' : 'default'"
|
|
676
|
-
size="default"
|
|
677
|
-
@click="filterVisible = !filterVisible"
|
|
678
|
-
>
|
|
679
|
-
<template #icon>
|
|
680
|
-
<el-icon>
|
|
681
|
-
<Filter />
|
|
682
|
-
</el-icon>
|
|
683
|
-
</template>
|
|
684
|
-
筛选
|
|
685
|
-
<el-badge v-if="filteredLogs.length !== logs.length" :value="filteredLogs.length" class="filter-badge" />
|
|
686
|
-
</el-button>
|
|
687
|
-
</div>
|
|
688
|
-
</div>
|
|
689
|
-
|
|
690
|
-
<!-- 筛选条件面板 -->
|
|
691
|
-
<div v-if="filterVisible" class="filter-panel">
|
|
692
|
-
<div class="filter-form">
|
|
693
|
-
<div class="filter-item">
|
|
694
|
-
<div class="filter-label">作者:</div>
|
|
695
|
-
<el-select
|
|
696
|
-
v-model="authorFilter"
|
|
697
|
-
placeholder="选择作者"
|
|
698
|
-
clearable
|
|
699
|
-
filterable
|
|
700
|
-
class="filter-input"
|
|
701
|
-
>
|
|
702
|
-
<el-option
|
|
703
|
-
v-for="author in availableAuthors"
|
|
704
|
-
:key="author"
|
|
705
|
-
:label="author"
|
|
706
|
-
:value="author"
|
|
707
|
-
/>
|
|
708
|
-
</el-select>
|
|
709
|
-
</div>
|
|
710
|
-
|
|
711
|
-
<div class="filter-item">
|
|
712
|
-
<div class="filter-label">提交信息包含:</div>
|
|
713
|
-
<el-input
|
|
714
|
-
v-model="messageFilter"
|
|
715
|
-
placeholder="关键词"
|
|
716
|
-
clearable
|
|
717
|
-
class="filter-input"
|
|
718
|
-
/>
|
|
719
|
-
</div>
|
|
720
|
-
|
|
721
|
-
<div class="filter-item">
|
|
722
|
-
<div class="filter-label">日期范围:</div>
|
|
723
|
-
<el-date-picker
|
|
724
|
-
v-model="dateRangeFilter"
|
|
725
|
-
type="daterange"
|
|
726
|
-
range-separator="至"
|
|
727
|
-
start-placeholder="开始日期"
|
|
728
|
-
end-placeholder="结束日期"
|
|
729
|
-
format="YYYY-MM-DD"
|
|
730
|
-
value-format="YYYY-MM-DD"
|
|
731
|
-
class="filter-input date-range"
|
|
732
|
-
/>
|
|
733
|
-
</div>
|
|
734
|
-
|
|
735
|
-
<div class="filter-actions">
|
|
736
|
-
<el-button type="info" size="small" @click="resetFilters">重置</el-button>
|
|
737
|
-
</div>
|
|
738
|
-
</div>
|
|
739
|
-
</div>
|
|
740
|
-
|
|
741
|
-
<el-table :data="filteredLogs" style="width: 100%" stripe border v-loading="isLoading">
|
|
1023
|
+
<div v-else class="table-view-container">
|
|
1024
|
+
<el-table ref="tableRef" :data="filteredLogs" stripe border v-loading="isLoading" class="log-table" :empty-text="isLoading ? '加载中...' : '没有匹配的提交记录'" height="500" @row-contextmenu="handleContextMenu" >
|
|
742
1025
|
<el-table-column label="提交哈希" width="100" resizable>
|
|
743
1026
|
<template #default="scope">
|
|
744
1027
|
<span class="commit-hash" @click="viewCommitDetail(scope.row)">{{ scope.row.hash.substring(0, 7) }}</span>
|
|
@@ -769,6 +1052,26 @@ function formatCommitMessage(message: string) {
|
|
|
769
1052
|
</el-table-column>
|
|
770
1053
|
<el-table-column prop="message" label="提交信息" min-width="250" />
|
|
771
1054
|
</el-table>
|
|
1055
|
+
|
|
1056
|
+
<!-- 添加底部加载状态和加载更多按钮 -->
|
|
1057
|
+
<div v-if="!showAllCommits" class="load-more-container">
|
|
1058
|
+
<!-- 显示加载状态和页码信息 -->
|
|
1059
|
+
<div class="pagination-info">
|
|
1060
|
+
<span>第 {{ currentPage }} 页 {{ totalCommits > 0 ? `/ 共 ${Math.ceil(totalCommits / 100) || 1} 页` : '' }} (总计 {{ totalCommits }} 条记录)</span>
|
|
1061
|
+
</div>
|
|
1062
|
+
|
|
1063
|
+
<div v-if="isLoadingMore" class="loading-more">
|
|
1064
|
+
<div class="loading-spinner"></div>
|
|
1065
|
+
<span>加载更多...</span>
|
|
1066
|
+
</div>
|
|
1067
|
+
<div v-else-if="hasMoreData" class="load-more-button" @click="loadMoreLogs">
|
|
1068
|
+
<span>加载更多</span>
|
|
1069
|
+
</div>
|
|
1070
|
+
<div v-else class="no-more-data">
|
|
1071
|
+
<span>没有更多数据了</span>
|
|
1072
|
+
<span v-if="logs.length > 0" class="total-loaded">(已加载 {{ logs.length }} 条记录)</span>
|
|
1073
|
+
</div>
|
|
1074
|
+
</div>
|
|
772
1075
|
</div>
|
|
773
1076
|
</div>
|
|
774
1077
|
</div>
|
|
@@ -828,11 +1131,7 @@ function formatCommitMessage(message: string) {
|
|
|
828
1131
|
</div>
|
|
829
1132
|
</div>
|
|
830
1133
|
</div>
|
|
831
|
-
|
|
832
|
-
</div>
|
|
833
|
-
</template>
|
|
834
|
-
|
|
835
|
-
<style scoped>
|
|
1134
|
+
</el-dialog> </div> <!-- 添加右键菜单 --> <div v-show="contextMenuVisible" class="context-menu" :style="{ top: contextMenuTop + 'px', left: contextMenuLeft + 'px' }" > <div class="context-menu-item" @click="viewCommitDetail(selectedContextCommit)"> <i class="el-icon-view"></i> 查看详情 </div> <div class="context-menu-item" @click="revertCommit(selectedContextCommit)"> <i class="el-icon-delete"></i> 撤销提交 (Revert) </div> <div class="context-menu-item" @click="cherryPickCommit(selectedContextCommit)"> <i class="el-icon-edit"></i> Cherry-Pick 到当前分支 </div> </div></template><style scoped>
|
|
836
1135
|
.card {
|
|
837
1136
|
background-color: white;
|
|
838
1137
|
border-radius: 8px;
|
|
@@ -857,6 +1156,13 @@ function formatCommitMessage(message: string) {
|
|
|
857
1156
|
top: 0;
|
|
858
1157
|
z-index: 100;
|
|
859
1158
|
height: 36px;
|
|
1159
|
+
flex-shrink: 0; /* 防止头部被压缩 */
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
.header-left {
|
|
1163
|
+
display: flex;
|
|
1164
|
+
align-items: center;
|
|
1165
|
+
gap: 8px;
|
|
860
1166
|
}
|
|
861
1167
|
|
|
862
1168
|
.log-header h2 {
|
|
@@ -871,11 +1177,23 @@ function formatCommitMessage(message: string) {
|
|
|
871
1177
|
}
|
|
872
1178
|
|
|
873
1179
|
.content-area {
|
|
874
|
-
padding: 0
|
|
875
|
-
overflow-y: auto;
|
|
1180
|
+
padding: 10px 0;
|
|
876
1181
|
flex: 1;
|
|
877
1182
|
min-height: 100px;
|
|
878
1183
|
height: calc(100% - 52px);
|
|
1184
|
+
display: flex;
|
|
1185
|
+
flex-direction: column;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.content-area.with-filter {
|
|
1189
|
+
height: calc(100% - 52px - 60px); /* 减去header高度和filter高度 */
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/* 确保内容区域内的直接子元素占满高度 */
|
|
1193
|
+
.content-area > div {
|
|
1194
|
+
flex: 1;
|
|
1195
|
+
display: flex;
|
|
1196
|
+
flex-direction: column;
|
|
879
1197
|
}
|
|
880
1198
|
|
|
881
1199
|
/* 优化表格区域 */
|
|
@@ -909,10 +1227,18 @@ function formatCommitMessage(message: string) {
|
|
|
909
1227
|
text-align: right;
|
|
910
1228
|
}
|
|
911
1229
|
|
|
1230
|
+
.graph-view {
|
|
1231
|
+
width: 100%;
|
|
1232
|
+
flex: 1;
|
|
1233
|
+
display: flex;
|
|
1234
|
+
flex-direction: column;
|
|
1235
|
+
overflow-y: auto;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
912
1238
|
.graph-container {
|
|
913
1239
|
width: 100%;
|
|
914
|
-
|
|
915
|
-
|
|
1240
|
+
flex: 1;
|
|
1241
|
+
min-height: 500px;
|
|
916
1242
|
border: 1px solid #ebeef5;
|
|
917
1243
|
border-radius: 4px;
|
|
918
1244
|
padding: 10px;
|
|
@@ -925,10 +1251,6 @@ function formatCommitMessage(message: string) {
|
|
|
925
1251
|
transition: transform 0.2s ease;
|
|
926
1252
|
}
|
|
927
1253
|
|
|
928
|
-
.graph-view {
|
|
929
|
-
width: 100%;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
1254
|
.graph-controls {
|
|
933
1255
|
display: flex;
|
|
934
1256
|
justify-content: space-between;
|
|
@@ -1190,6 +1512,17 @@ function formatCommitMessage(message: string) {
|
|
|
1190
1512
|
align-items: center;
|
|
1191
1513
|
margin-bottom: 15px;
|
|
1192
1514
|
padding: 0;
|
|
1515
|
+
position: sticky;
|
|
1516
|
+
top: 52px; /* 与 log-header 的高度匹配 */
|
|
1517
|
+
z-index: 90;
|
|
1518
|
+
background-color: white;
|
|
1519
|
+
padding: 5px 0;
|
|
1520
|
+
transition: box-shadow 0.3s ease, background-color 0.3s ease, padding 0.2s ease;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/* 当滚动时添加微妙的阴影效果 */
|
|
1524
|
+
.content-area:not(:hover) .history-controls:not(:hover) {
|
|
1525
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
1193
1526
|
}
|
|
1194
1527
|
|
|
1195
1528
|
.history-stats {
|
|
@@ -1220,6 +1553,19 @@ function formatCommitMessage(message: string) {
|
|
|
1220
1553
|
margin-bottom: 15px;
|
|
1221
1554
|
border: 1px solid #e4e7ed;
|
|
1222
1555
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
|
|
1556
|
+
position: sticky;
|
|
1557
|
+
top: 98px; /* history-controls的高度(36px) + padding(10px) + log-header的高度(52px) */
|
|
1558
|
+
z-index: 89; /* 比history-controls低一点 */
|
|
1559
|
+
transition: box-shadow 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/* 当滚动时增强视觉效果 */
|
|
1563
|
+
.content-area:not(:hover) .filter-panel:not(:hover) {
|
|
1564
|
+
box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
.filter-panel:hover {
|
|
1568
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
1223
1569
|
}
|
|
1224
1570
|
|
|
1225
1571
|
.filter-form {
|
|
@@ -1254,9 +1600,272 @@ function formatCommitMessage(message: string) {
|
|
|
1254
1600
|
align-items: center;
|
|
1255
1601
|
gap: 10px;
|
|
1256
1602
|
}
|
|
1603
|
+
|
|
1604
|
+
/* 表格样式 */
|
|
1605
|
+
.log-table {
|
|
1606
|
+
transition: margin-top 0.3s ease;
|
|
1607
|
+
min-height: 200px; /* 确保表格有最小高度 */
|
|
1608
|
+
height: 100%; /* 填充可用空间 */
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/* 为带筛选面板的表格添加顶部边距 */
|
|
1612
|
+
.log-table.has-filter {
|
|
1613
|
+
margin-top: 10px;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/* 当控件固定时增加表格上边距 */
|
|
1617
|
+
.log-table.has-sticky-controls {
|
|
1618
|
+
margin-top: 52px !important; /* controls 高度 + 一些额外空间 */
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
/* 当筛选面板固定时再增加表格上边距 */
|
|
1622
|
+
.log-table.has-sticky-filter {
|
|
1623
|
+
margin-top: 140px !important; /* 筛选面板高度 + controls 高度 + 一些额外空间 */
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/* 表格为空时的样式 */
|
|
1627
|
+
.el-table__empty-block {
|
|
1628
|
+
min-height: 200px;
|
|
1629
|
+
justify-content: center;
|
|
1630
|
+
align-items: center;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/* 确保表格容器占满可用空间 */
|
|
1634
|
+
.content-area > div:not(.graph-view) {
|
|
1635
|
+
display: flex;
|
|
1636
|
+
flex-direction: column;
|
|
1637
|
+
height: 100%;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/* 表格视图容器 */
|
|
1641
|
+
.table-view-container {
|
|
1642
|
+
display: flex;
|
|
1643
|
+
flex-direction: column;
|
|
1644
|
+
flex: 1;
|
|
1645
|
+
height: 100%;
|
|
1646
|
+
overflow-y: auto;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
.log-table {
|
|
1650
|
+
width: 100%;
|
|
1651
|
+
flex: 1;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/* 表格容器样式 */
|
|
1655
|
+
.table-view-container .el-table {
|
|
1656
|
+
flex: 1;
|
|
1657
|
+
width: 100%;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
.table-view-container .el-table__inner-wrapper {
|
|
1661
|
+
width: 100%;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.table-view-container .el-table__body-wrapper {
|
|
1665
|
+
width: 100%;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
.filter-panel.filter-sticky {
|
|
1669
|
+
background-color: rgba(245, 247, 250, 0.97);
|
|
1670
|
+
backdrop-filter: blur(4px);
|
|
1671
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
|
|
1672
|
+
border-top: none;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.history-controls.controls-sticky {
|
|
1676
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
1677
|
+
background-color: rgba(255, 255, 255, 0.98);
|
|
1678
|
+
backdrop-filter: blur(4px);
|
|
1679
|
+
padding: 8px 0;
|
|
1680
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/* 筛选面板头部样式 */
|
|
1684
|
+
.filter-panel-header {
|
|
1685
|
+
background-color: #f5f7fa;
|
|
1686
|
+
padding: 10px 16px;
|
|
1687
|
+
border-bottom: 1px solid #e4e7ed;
|
|
1688
|
+
position: sticky;
|
|
1689
|
+
top: 36px; /* 紧贴log-header下方 */
|
|
1690
|
+
z-index: 99;
|
|
1691
|
+
transition: all 0.3s ease;
|
|
1692
|
+
flex-shrink: 0;
|
|
1693
|
+
margin-bottom: 0; /* 移除底部边距 */
|
|
1694
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
.filter-panel-header .filter-form {
|
|
1698
|
+
display: flex;
|
|
1699
|
+
flex-wrap: wrap;
|
|
1700
|
+
gap: 10px;
|
|
1701
|
+
align-items: flex-end;
|
|
1702
|
+
justify-content: flex-start;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
.filter-panel-header .filter-item {
|
|
1706
|
+
margin-right: 12px;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
.filter-panel-header .filter-label {
|
|
1710
|
+
font-size: 12px;
|
|
1711
|
+
color: #606266;
|
|
1712
|
+
margin-bottom: 4px;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
.filter-panel-header .filter-input {
|
|
1716
|
+
width: 180px;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
.filter-panel-header .filter-input.date-range {
|
|
1720
|
+
width: 320px;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
.content-area.with-filter {
|
|
1724
|
+
height: calc(100% - 52px - 60px); /* 减去header高度和filter高度 */
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/* 记录计数标签 */
|
|
1728
|
+
.record-count {
|
|
1729
|
+
display: flex;
|
|
1730
|
+
align-items: center;
|
|
1731
|
+
height: 24px;
|
|
1732
|
+
padding-left: 8px;
|
|
1733
|
+
padding-right: 8px;
|
|
1734
|
+
margin-left: 8px;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
.record-count :deep(.el-icon) {
|
|
1738
|
+
margin-right: 4px;
|
|
1739
|
+
font-size: 12px;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
/* 表格视图容器简化 */
|
|
1743
|
+
.table-view-container {
|
|
1744
|
+
display: flex;
|
|
1745
|
+
flex-direction: column;
|
|
1746
|
+
flex: 1;
|
|
1747
|
+
min-height: 400px; /* 确保至少有一定高度 */
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
.log-table {
|
|
1751
|
+
width: 100%;
|
|
1752
|
+
height: 100%;
|
|
1753
|
+
min-height: 300px;
|
|
1754
|
+
flex: 1;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
/* 重置或移除不再需要的样式 */
|
|
1758
|
+
.history-controls,
|
|
1759
|
+
.filter-panel {
|
|
1760
|
+
display: none; /* 隐藏原来的筛选组件 */
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
.log-table.has-filter,
|
|
1764
|
+
.log-table.has-sticky-controls,
|
|
1765
|
+
.log-table.has-sticky-filter {
|
|
1766
|
+
margin-top: 0 !important; /* 重置原来的边距 */
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/* 添加底部加载更多相关样式 */
|
|
1770
|
+
.load-more-container {
|
|
1771
|
+
display: flex;
|
|
1772
|
+
flex-direction: column;
|
|
1773
|
+
align-items: center;
|
|
1774
|
+
padding: 15px 0;
|
|
1775
|
+
border-top: 1px dashed #ebeef5;
|
|
1776
|
+
gap: 10px;
|
|
1777
|
+
display: none;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.pagination-info {
|
|
1781
|
+
font-size: 13px;
|
|
1782
|
+
color: #909399;
|
|
1783
|
+
margin-bottom: 5px;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.loading-more {
|
|
1787
|
+
display: flex;
|
|
1788
|
+
align-items: center;
|
|
1789
|
+
color: #909399;
|
|
1790
|
+
font-size: 14px;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
.loading-spinner {
|
|
1794
|
+
width: 20px;
|
|
1795
|
+
height: 20px;
|
|
1796
|
+
margin-right: 10px;
|
|
1797
|
+
border: 2px solid #dcdfe6;
|
|
1798
|
+
border-top-color: #409eff;
|
|
1799
|
+
border-radius: 50%;
|
|
1800
|
+
animation: spinner 1s linear infinite;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
@keyframes spinner {
|
|
1804
|
+
to {transform: rotate(360deg);}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.load-more-button {
|
|
1808
|
+
cursor: pointer;
|
|
1809
|
+
color: #409eff;
|
|
1810
|
+
font-size: 14px;
|
|
1811
|
+
padding: 6px 16px;
|
|
1812
|
+
border: 1px solid #d9ecff;
|
|
1813
|
+
background-color: #ecf5ff;
|
|
1814
|
+
border-radius: 4px;
|
|
1815
|
+
transition: all 0.3s;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
.load-more-button:hover {
|
|
1819
|
+
background-color: #d9ecff;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
.no-more-data {
|
|
1823
|
+
color: #909399;
|
|
1824
|
+
font-size: 14px;
|
|
1825
|
+
font-style: italic;
|
|
1826
|
+
display: flex;
|
|
1827
|
+
flex-direction: column;
|
|
1828
|
+
align-items: center;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
.total-loaded {
|
|
1832
|
+
font-size: 12px;
|
|
1833
|
+
margin-top: 5px;
|
|
1834
|
+
color: #c0c4cc;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/* 右键菜单样式 */
|
|
1838
|
+
.context-menu {
|
|
1839
|
+
position: fixed;
|
|
1840
|
+
background: white;
|
|
1841
|
+
border: 1px solid #dcdfe6;
|
|
1842
|
+
border-radius: 4px;
|
|
1843
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
1844
|
+
padding: 8px 0;
|
|
1845
|
+
z-index: 3000;
|
|
1846
|
+
min-width: 180px;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
.context-menu-item {
|
|
1850
|
+
padding: 8px 16px;
|
|
1851
|
+
cursor: pointer;
|
|
1852
|
+
font-size: 14px;
|
|
1853
|
+
display: flex;
|
|
1854
|
+
align-items: center;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
.context-menu-item:hover {
|
|
1858
|
+
background-color: #f5f7fa;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
.context-menu-item i {
|
|
1862
|
+
margin-right: 8px;
|
|
1863
|
+
}
|
|
1257
1864
|
</style>
|
|
1258
1865
|
|
|
1259
1866
|
/* 添加表格列调整样式 */
|
|
1867
|
+
<style>
|
|
1260
1868
|
.el-table .el-table__cell .cell {
|
|
1261
1869
|
word-break: break-all;
|
|
1262
|
-
}
|
|
1870
|
+
}
|
|
1871
|
+
</style>
|