Skip to content

Commit

Permalink
feat: 操作记录列表新增其他模块优化
Browse files Browse the repository at this point in the history
  • Loading branch information
LidolLxf committed Jan 13, 2025
1 parent 40eb97a commit 054880b
Show file tree
Hide file tree
Showing 7 changed files with 3,749 additions and 3,779 deletions.
1 change: 0 additions & 1 deletion cmd/config-server/service/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func (s *Service) ListAudits(ctx context.Context, req *pbcs.ListAuditsReq) (
AppId: req.AppId,
StartTime: req.StartTime,
EndTime: req.EndTime,
Operate: req.Operate,
Start: req.Start,
Limit: req.Limit,
All: req.All,
Expand Down
26 changes: 11 additions & 15 deletions internal/dal/dao/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type audit struct {
idGen IDGenInterface
}

// DecoratorV3 return audit decorator for to record audit.
// Decorator return audit decorator for to record audit.
func (au *audit) Decorator(kit *kit.Kit, bizID uint32, a *table.AuditField) AuditPrepare {
return initAuditBuilder(kit, bizID, a, au)
}
Expand Down Expand Up @@ -212,19 +212,6 @@ func (au *audit) createQuery(kit *kit.Kit, req *pbds.ListAuditsReq) (gen.IAuditD
result = result.Where(audit.CreatedAt.Lt(endTime))
}

// 仅看上线操作
if req.Operate == string(enumor.Publish) {
result = result.Where(audit.Action.Eq(req.Operate))
}

// 仅看失败操作
if req.Operate == string(enumor.Failure) {
result = result.Where(
audit.WithContext(kit.Ctx).Where(audit.Status.Eq(req.Operate)).
Or(client.ReleaseChangeStatus.Eq(string(table.Failed))),
)
}

if req.Name != "" {
result = result.Where(app.Name.Like("%" + req.Name + "%"))
}
Expand All @@ -242,7 +229,16 @@ func (au *audit) createQuery(kit *kit.Kit, req *pbds.ListAuditsReq) (gen.IAuditD
}

if len(req.Status) != 0 {
result = result.Where(audit.Status.In(req.Status...))
auditStatus := audit.WithContext(kit.Ctx).Where(audit.Status.In(req.Status...))
// 失败状态的数据需要特殊处理,在clients表
for _, v := range req.Status {
if v == string(enumor.Failure) {
auditStatus.Or(client.ReleaseChangeStatus.Eq(string(table.Failed)))
// 前端可能传两个failure过来
break
}
}
result = result.Where(auditStatus)
}

if req.Operator != "" {
Expand Down
4 changes: 0 additions & 4 deletions internal/dal/dao/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import (

// Publish defines all the publish operation related operations.
type Publish interface {
// Publish publish an app's release with its strategy.
// once an app's strategy along with its release id is published,
// all its released config items are effected immediately.

SubmitWithTx(kit *kit.Kit, tx *gen.QueryTx, opt *types.PublishOption) (id uint32, err error)

UpsertPublishWithTx(kit *kit.Kit, tx *gen.QueryTx, opt *types.PublishOption, stg *table.Strategy) error
Expand Down
4,872 changes: 2,431 additions & 2,441 deletions pkg/protocol/config-server/config_service.pb.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pkg/protocol/config-server/config_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3587,7 +3587,7 @@ message ListAuditsReq {
uint32 app_id = 2;
string start_time = 3;
string end_time = 4;
string operate = 5;
uint32 id = 5;
string operate_way = 6;
uint32 start = 7;
uint32 limit = 8;
Expand All @@ -3598,7 +3598,6 @@ message ListAuditsReq {
string res_instance = 13;
string status = 14;
string operator = 15;
uint32 id = 16;
}

message ListAuditsResp {
Expand Down
2,619 changes: 1,305 additions & 1,314 deletions pkg/protocol/data-service/data_service.pb.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pkg/protocol/data-service/data_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ message ListAuditsReq {
uint32 app_id = 2;
string start_time = 3;
string end_time = 4;
string operate = 5;
uint32 id = 5;
repeated string operate_way = 6;
uint32 start = 7;
uint32 limit = 8;
Expand All @@ -1867,7 +1867,6 @@ message ListAuditsReq {
string res_instance = 13;
repeated string status = 14;
string operator = 15;
uint32 id = 16;
}

message ListAuditsResp {
Expand Down

0 comments on commit 054880b

Please sign in to comment.