Merge remote-tracking branch 'origin/develop' into develop

develop
Hoshi 2024-10-14 17:17:50 +08:00
commit 97a678f8f8
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -37,6 +38,9 @@ public class ApiController {
@RequestParam(value = "limit", required = false, defaultValue = "5") Integer limit, @RequestParam(value = "limit", required = false, defaultValue = "5") Integer limit,
@Value(Common.REQ_CONTEXT) RequestContext context, @Value(Common.REQ_CONTEXT) RequestContext context,
HttpServletRequest request) { HttpServletRequest request) {
if (StringUtils.isEmpty(type)) {
throw new IllegalArgumentException("type is null!");
}
LineChartResult chart = switch (type) { LineChartResult chart = switch (type) {
case "hostCpu" -> this.topService.topOfHostCpu(vendorId, limit); case "hostCpu" -> this.topService.topOfHostCpu(vendorId, limit);
case "hostMem" -> this.topService.topOfHostMem(vendorId, limit); case "hostMem" -> this.topService.topOfHostMem(vendorId, limit);