feat: 操作审计语义动作标注落库并支持按语义动作筛选
- OperationDescription 新增 actionOf:捕获时由 method/resourceType/path 推导 语义动作键(login/logout/auth + create/update/delete/view + 子动作段 publish/restore/enable 等,activation 归并为 enable),AuditRecorder 落库 spec.action(AuditLogSpec 新增字段) - OperationAuditPlugin 注册 spec.action 索引,AuditLogFilters 白名单放行 fieldSelector=spec.action=...,查询与导出端点共用 - 前端 audit.ts:describeOperation 优先用落库 action(历史记录无标注仍由 method/path 现场推导,同样适用),导出 deriveAction 与 SEMANTIC_ACTIONS (键→中文标签,与后端同一套映射),展示短语统一由动作键推导 - 列表筛选栏新增「语义动作」下拉(7→8 列),buildQuery/重置/watch 接线 - 测试:后端 +10 例(actionOf 全分支、describeAction、落库断言、索引注册、 查询筛选)共 81 例;前端 +8 例(deriveAction、标注优先、选项完备性)共 39 例; gradle build 全绿 - 文档同步:设计文档 V2 行标记已实现(4.1 字段表/4.2 筛选/5 索引/7 局限)、 技术方案 D3 索引表与 5.2 节、两级 README 功能一览与已知局限
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
isSuccessful,
|
||||
localDateTimeToInstant,
|
||||
methodBadgeClass,
|
||||
SEMANTIC_ACTIONS,
|
||||
} from '@/utils/audit'
|
||||
import AuditLogDetail from './AuditLogDetail.vue'
|
||||
|
||||
@@ -51,6 +52,7 @@ const size = ref(20)
|
||||
const filterUsername = ref('')
|
||||
const filterResourceType = ref('')
|
||||
const filterMethod = ref('')
|
||||
const filterAction = ref('')
|
||||
const filterResult = ref('')
|
||||
const filterKeyword = ref('')
|
||||
const filterStartTime = ref('')
|
||||
@@ -64,6 +66,7 @@ const hasActiveFilter = computed(
|
||||
filterUsername.value ||
|
||||
filterResourceType.value ||
|
||||
filterMethod.value ||
|
||||
filterAction.value ||
|
||||
filterResult.value ||
|
||||
filterKeyword.value ||
|
||||
filterStartTime.value ||
|
||||
@@ -84,6 +87,10 @@ function buildQuery(): string {
|
||||
if (filterMethod.value) {
|
||||
params.append('fieldSelector', `spec.method=${filterMethod.value}`)
|
||||
}
|
||||
// 语义动作筛选(spec.action,捕获时标注落库;历史记录无标注不会被筛出)
|
||||
if (filterAction.value) {
|
||||
params.append('fieldSelector', `spec.action=${filterAction.value}`)
|
||||
}
|
||||
if (filterResult.value) {
|
||||
params.set('result', filterResult.value)
|
||||
}
|
||||
@@ -162,13 +169,14 @@ function resetFilter() {
|
||||
filterUsername.value = ''
|
||||
filterResourceType.value = ''
|
||||
filterMethod.value = ''
|
||||
filterAction.value = ''
|
||||
filterResult.value = ''
|
||||
filterKeyword.value = ''
|
||||
filterStartTime.value = ''
|
||||
filterEndTime.value = ''
|
||||
}
|
||||
|
||||
watch([filterUsername, filterResourceType, filterMethod, filterResult], () => {
|
||||
watch([filterUsername, filterResourceType, filterMethod, filterAction, filterResult], () => {
|
||||
page.value = 1
|
||||
fetchLogs()
|
||||
})
|
||||
@@ -246,6 +254,15 @@ onMounted(fetchLogs)
|
||||
<option value="PATCH">PATCH</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>语义动作</span>
|
||||
<select v-model="filterAction">
|
||||
<option value="">全部</option>
|
||||
<option v-for="a in SEMANTIC_ACTIONS" :key="a.value" :value="a.value">
|
||||
{{ a.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>结果</span>
|
||||
<select v-model="filterResult">
|
||||
@@ -407,8 +424,8 @@ onMounted(fetchLogs)
|
||||
}
|
||||
.filter-grid {
|
||||
display: grid;
|
||||
/* 7 个筛选字段 + 自动宽度的操作按钮,全部排成一行 */
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr)) auto;
|
||||
/* 8 个筛选字段 + 自动宽度的操作按钮,全部排成一行 */
|
||||
grid-template-columns: repeat(8, minmax(0, 1fr)) auto;
|
||||
gap: 0.75rem 1rem;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user