Selaa lähdekoodia

dashboard: structure rearrangement and polish related code

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 6 vuotta sitten
vanhempi
commit
6c70c94e44
18 muutettua tiedostoa jossa 35 lisäystä ja 57 poistoa
  1. +3
    -2
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/AppController.java
  2. +2
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/AuthorityRuleController.java
  3. +2
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/DegradeController.java
  4. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/DemoController.java
  5. +4
    -3
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/FlowControllerV1.java
  6. +2
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/MachineRegistryController.java
  7. +3
    -2
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/MetricController.java
  8. +3
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/ParamFlowRuleController.java
  9. +3
    -2
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/ResourceController.java
  10. +2
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/SystemController.java
  11. +2
    -2
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/cluster/ClusterAssignController.java
  12. +2
    -2
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/cluster/ClusterConfigController.java
  13. +2
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java
  14. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/Result.java
  15. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/MachineInfoVo.java
  16. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/MetricVo.java
  17. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/ResourceVo.java
  18. +0
    -33
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/HealthCheck.java

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/AppController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/AppController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/AuthorityRuleController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/AuthorityRuleController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/DegradeController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/DegradeController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/DemoController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/DemoController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/FlowControllerV1.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/FlowControllerV1.java Näytä tiedosto

@@ -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");
}

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/MachineRegistryController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/MachineRegistryController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/MetricController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/MetricController.java Näytä tiedosto

@@ -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

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/ParamFlowRuleController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/ParamFlowRuleController.java Näytä tiedosto

@@ -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);

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/ResourceController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/ResourceController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/SystemController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/SystemController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/cluster/ClusterAssignController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/cluster/ClusterAssignController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/cluster/ClusterConfigController.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/cluster/ClusterConfigController.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/FlowControllerV2.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/Result.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/Result.java Näytä tiedosto

@@ -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

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MachineInfoVo.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/MachineInfoVo.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MetricVo.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/MetricVo.java Näytä tiedosto

@@ -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;

sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/ResourceVo.java → sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/vo/ResourceVo.java Näytä tiedosto

@@ -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;

+ 0
- 33
sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/HealthCheck.java Näytä tiedosto

@@ -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…
Peruuta
Tallenna