dashboard: structure rearrangement and polish related code
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
8970f5380c
commit
6c70c94e44
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -25,7 +25,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import com.taobao.csp.sentinel.dashboard.discovery.AppInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.view.vo.MachineInfoVo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.vo.MachineInfoVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -24,6 +24,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
|||
import com.taobao.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.AuthorityRuleEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.rule.RuleRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -24,6 +24,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
|||
import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.rule.InMemDegradeRuleStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -23,6 +23,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
|||
import com.taobao.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -56,8 +57,8 @@ public class FlowControllerV1 {
|
|||
|
||||
@GetMapping("/rules")
|
||||
public Result<List<FlowRuleEntity>> apiQueryMachineRules(@RequestParam String app,
|
||||
@RequestParam String ip,
|
||||
@RequestParam Integer port) {
|
||||
@RequestParam String ip,
|
||||
@RequestParam Integer port) {
|
||||
if (StringUtil.isEmpty(app)) {
|
||||
return Result.ofFail(-1, "app can't be null or empty");
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
|||
import com.taobao.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineDiscovery;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.metric.MetricsRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -36,7 +37,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
|
||||
import com.taobao.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.view.vo.MetricVo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.vo.MetricVo;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -30,6 +30,7 @@ import com.taobao.csp.sentinel.dashboard.datasource.entity.SentinelVersion;
|
|||
import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.AppManagement;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.rule.RuleRepository;
|
||||
import com.taobao.csp.sentinel.dashboard.util.VersionUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -123,6 +124,7 @@ public class ParamFlowRuleController {
|
|||
return unsupportedVersion();
|
||||
}
|
||||
entity.setId(null);
|
||||
entity.getRule().setResource(entity.getResource().trim());
|
||||
Date date = new Date();
|
||||
entity.setGmtCreate(date);
|
||||
entity.setGmtModified(date);
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -23,7 +23,8 @@ import com.alibaba.csp.sentinel.command.vo.NodeVo;
|
|||
|
||||
import com.taobao.csp.sentinel.dashboard.domain.ResourceTreeNode;
|
||||
import com.taobao.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.taobao.csp.sentinel.dashboard.view.vo.ResourceVo;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.vo.ResourceVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -23,6 +23,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
|||
import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity;
|
||||
import com.taobao.csp.sentinel.dashboard.discovery.MachineInfo;
|
||||
import com.taobao.csp.sentinel.dashboard.client.SentinelApiClient;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.repository.rule.InMemSystemRuleStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view.cluster;
|
||||
package com.taobao.csp.sentinel.dashboard.controller.cluster;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
|
@ -24,7 +24,7 @@ import com.taobao.csp.sentinel.dashboard.domain.cluster.ClusterAppFullAssignRequ
|
|||
import com.taobao.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.cluster.ClusterAppSingleServerAssignRequest;
|
||||
import com.taobao.csp.sentinel.dashboard.service.ClusterAssignService;
|
||||
import com.taobao.csp.sentinel.dashboard.view.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view.cluster;
|
||||
package com.taobao.csp.sentinel.dashboard.controller.cluster;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
@ -37,7 +37,7 @@ import com.taobao.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalSt
|
|||
import com.taobao.csp.sentinel.dashboard.service.ClusterConfigService;
|
||||
import com.taobao.csp.sentinel.dashboard.util.ClusterEntityUtils;
|
||||
import com.taobao.csp.sentinel.dashboard.util.VersionUtils;
|
||||
import com.taobao.csp.sentinel.dashboard.view.Result;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.controller.v2;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -24,6 +24,7 @@ import com.taobao.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
|
|||
import com.taobao.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter;
|
||||
import com.taobao.csp.sentinel.dashboard.rule.DynamicRuleProvider;
|
||||
import com.taobao.csp.sentinel.dashboard.rule.DynamicRulePublisher;
|
||||
import com.taobao.csp.sentinel.dashboard.domain.Result;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
package com.taobao.csp.sentinel.dashboard.domain;
|
||||
|
||||
/**
|
||||
* @author leyou
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view.vo;
|
||||
package com.taobao.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view.vo;
|
||||
package com.taobao.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view.vo;
|
||||
package com.taobao.csp.sentinel.dashboard.domain.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.taobao.csp.sentinel.dashboard.view;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
public class HealthCheck {
|
||||
/**
|
||||
* 健康检查
|
||||
*/
|
||||
@GetMapping("/health")
|
||||
public
|
||||
@ResponseBody
|
||||
String checkPreload() {
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue