mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-11 22:25:41 +08:00
Go: add show users plan quota (#16818)
### Summary ``` RAGFlow(admin)> show users plan quota 100; +---------+------------------------------------------+ | field | value | +---------+------------------------------------------+ | quota | 100 | | command | show_users_plan_quota | | error | 'Show users plan quota' is not supported | +---------+------------------------------------------+ ``` Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -2601,15 +2601,36 @@ commandLoop:
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
// SHOW USERS PLAN SUMMARY;
|
||||
func (p *Parser) parseAdminShowUsersPlan() (*Command, error) {
|
||||
p.nextToken() // consume PLAN
|
||||
|
||||
if p.curToken.Type != TokenSummary {
|
||||
return nil, fmt.Errorf("expected SUMMARY")
|
||||
}
|
||||
p.nextToken()
|
||||
var cmd *Command
|
||||
switch p.curToken.Type {
|
||||
case TokenSummary:
|
||||
p.nextToken()
|
||||
cmd = NewCommand("admin_show_users_plan_summary")
|
||||
case TokenQuota:
|
||||
p.nextToken()
|
||||
cmd = NewCommand("admin_show_users_plan_quota")
|
||||
|
||||
if p.curToken.Type != TokenNumber {
|
||||
return nil, fmt.Errorf("expected QUOTA")
|
||||
}
|
||||
quotaInt, err := p.parseNumber()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.nextToken()
|
||||
if quotaInt < 0 || quotaInt > 100 {
|
||||
return nil, fmt.Errorf("invalid quota value")
|
||||
}
|
||||
|
||||
cmd.Params["quota"] = quotaInt
|
||||
default:
|
||||
return nil, fmt.Errorf("expected SUMMARY or QUOTA")
|
||||
}
|
||||
|
||||
cmd := NewCommand("admin_show_users_plan_command")
|
||||
if p.curToken.Type == TokenSemicolon {
|
||||
p.nextToken()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user