mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-12 20:03:40 +08:00
Go CLI: add show users plan summary (#16463)
### Summary ``` RAGFlow(admin)> show users plan summary; +---------+----------------------------------------------------------------+ | field | value | +---------+----------------------------------------------------------------+ | command | show_users_plan_summary | | error | 'Show users plan summary' is implemented in enterprise edition | +---------+----------------------------------------------------------------+ ``` Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1706,6 +1706,21 @@ func (h *Handler) ListUsersQuota(c *gin.Context) {
|
||||
success(c, usersQuota, "")
|
||||
}
|
||||
|
||||
// ShowUsersPlanSummary handle show users plan summary
|
||||
func (h *Handler) ShowUsersPlanSummary(c *gin.Context) {
|
||||
usersPlanSummary, err := h.service.ShowUsersPlanSummary()
|
||||
if err != nil {
|
||||
if errors.Is(err, common.ErrUserNotFound) {
|
||||
errorResponse(c, "User not found", 404)
|
||||
return
|
||||
}
|
||||
errorResponse(c, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
|
||||
success(c, usersPlanSummary, "")
|
||||
}
|
||||
|
||||
// ShowUsersQuotaSummary handle show users quota summary
|
||||
func (h *Handler) ShowUsersQuotaSummary(c *gin.Context) {
|
||||
usersQuotaSummary, err := h.service.ShowUsersQuotaSummary()
|
||||
|
||||
@@ -904,6 +904,17 @@ func (s *Service) ListUsersQuota(pageIndex, pageSize, top int, quotaThreshold *i
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ShowUsersPlanSummary show users plan summary for enterprise edition
|
||||
func (s *Service) ShowUsersPlanSummary() (map[string]interface{}, error) {
|
||||
|
||||
result := map[string]interface{}{
|
||||
"command": "show_users_plan_summary",
|
||||
"error": "'Show users plan summary' is implemented in enterprise edition",
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ShowUsersQuotaSummary show users quota summary for enterprise edition
|
||||
func (s *Service) ShowUsersQuotaSummary() (map[string]interface{}, error) {
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ func (r *Router) Setup(engine *gin.Engine) {
|
||||
protected.GET("/users/documents", r.handler.ListUsersDocuments)
|
||||
protected.GET("/users/index", r.handler.ListUsersIndex)
|
||||
protected.GET("/users/quota", r.handler.ListUsersQuota)
|
||||
protected.GET("/users/plan/summary", r.handler.ShowUsersPlanSummary)
|
||||
protected.GET("/users/quota/summary", r.handler.ShowUsersQuotaSummary)
|
||||
protected.GET("/ingestion/tasks/summary", r.handler.ShowIngestionTasksSummary)
|
||||
protected.GET("/data/summary", r.handler.ShowDataSummary)
|
||||
|
||||
Reference in New Issue
Block a user