mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 16:47:47 +00:00
update time format of audit log (#12629)
fixes #11522 use the format: date-time as the format of audit op_time, then it could be rendered by FF and Chrome. Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
e14e6938da
commit
9ce29c9dc8
|
@ -1672,6 +1672,8 @@ definitions:
|
||||||
description: The operation against the repository in this log entry.
|
description: The operation against the repository in this log entry.
|
||||||
op_time:
|
op_time:
|
||||||
type: string
|
type: string
|
||||||
|
format: date-time
|
||||||
|
example: '2006-01-02T15:04:05'
|
||||||
description: The time when this operation is triggered.
|
description: The time when this operation is triggered.
|
||||||
Metadata:
|
Metadata:
|
||||||
type: object
|
type: object
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/goharbor/harbor/src/common/rbac"
|
"github.com/goharbor/harbor/src/common/rbac"
|
||||||
"github.com/goharbor/harbor/src/common/security"
|
"github.com/goharbor/harbor/src/common/security"
|
||||||
"github.com/goharbor/harbor/src/common/security/local"
|
"github.com/goharbor/harbor/src/common/security/local"
|
||||||
|
@ -78,7 +79,7 @@ func (a *auditlogAPI) ListAuditLogs(ctx context.Context, params auditlog.ListAud
|
||||||
ResourceType: log.ResourceType,
|
ResourceType: log.ResourceType,
|
||||||
Username: log.Username,
|
Username: log.Username,
|
||||||
Operation: log.Operation,
|
Operation: log.Operation,
|
||||||
OpTime: log.OpTime.String(),
|
OpTime: strfmt.DateTime(log.OpTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return operation.NewListAuditLogsOK().
|
return operation.NewListAuditLogsOK().
|
||||||
|
|
|
@ -3,6 +3,7 @@ package handler
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/goharbor/harbor/src/common/rbac"
|
"github.com/goharbor/harbor/src/common/rbac"
|
||||||
"github.com/goharbor/harbor/src/controller/project"
|
"github.com/goharbor/harbor/src/controller/project"
|
||||||
"github.com/goharbor/harbor/src/pkg/audit"
|
"github.com/goharbor/harbor/src/pkg/audit"
|
||||||
|
@ -54,7 +55,7 @@ func (a *projectAPI) GetLogs(ctx context.Context, params operation.GetLogsParams
|
||||||
ResourceType: log.ResourceType,
|
ResourceType: log.ResourceType,
|
||||||
Username: log.Username,
|
Username: log.Username,
|
||||||
Operation: log.Operation,
|
Operation: log.Operation,
|
||||||
OpTime: log.OpTime.String(),
|
OpTime: strfmt.DateTime(log.OpTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return operation.NewGetLogsOK().
|
return operation.NewGetLogsOK().
|
||||||
|
|
Loading…
Reference in New Issue
Block a user