application.properties
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/NacosSyncMain.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/NacosSyncMain.java
index 0df7e195..19e44a14 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/NacosSyncMain.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/NacosSyncMain.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.nacossync;
import org.springframework.boot.SpringApplication;
@@ -29,9 +30,9 @@
@EnableSwagger2
@SpringBootApplication(exclude = EurekaClientAutoConfiguration.class)
public class NacosSyncMain {
-
+
public static void main(String[] args) {
-
+
SpringApplication.run(NacosSyncMain.class, args);
}
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/ClusterApi.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/ClusterApi.java
index 616d36b6..95cfc16c 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/ClusterApi.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/ClusterApi.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.nacossync.api;
import com.alibaba.nacossync.constant.ClusterTypeEnum;
@@ -44,57 +45,54 @@
@Slf4j
@RestController
public class ClusterApi {
-
+
private final ClusterAddProcessor clusterAddProcessor;
-
+
private final ClusterDeleteProcessor clusterDeleteProcessor;
-
+
private final ClusterDetailQueryProcessor clusterDetailQueryProcessor;
-
+
private final ClusterListQueryProcessor clusterListQueryProcessor;
-
- public ClusterApi(
- ClusterAddProcessor clusterAddProcessor, ClusterDeleteProcessor clusterDeleteProcessor,
- ClusterDetailQueryProcessor clusterDetailQueryProcessor, ClusterListQueryProcessor clusterListQueryProcessor) {
+
+ public ClusterApi(ClusterAddProcessor clusterAddProcessor, ClusterDeleteProcessor clusterDeleteProcessor,
+ ClusterDetailQueryProcessor clusterDetailQueryProcessor,
+ ClusterListQueryProcessor clusterListQueryProcessor) {
this.clusterAddProcessor = clusterAddProcessor;
this.clusterDeleteProcessor = clusterDeleteProcessor;
this.clusterDetailQueryProcessor = clusterDetailQueryProcessor;
this.clusterListQueryProcessor = clusterListQueryProcessor;
}
-
+
@RequestMapping(path = "/v1/cluster/list", method = RequestMethod.GET)
public ClusterListQueryResult clusters(ClusterListQueryRequest clusterListQueryRequest) {
-
- return SkyWalkerTemplate.run(clusterListQueryProcessor, clusterListQueryRequest,
- new ClusterListQueryResult());
+
+ return SkyWalkerTemplate.run(clusterListQueryProcessor, clusterListQueryRequest, new ClusterListQueryResult());
}
-
+
@RequestMapping(path = "/v1/cluster/detail", method = RequestMethod.GET)
public ClusterDetailQueryResult getByTaskId(ClusterDetailQueryRequest clusterDetailQueryRequest) {
-
+
return SkyWalkerTemplate.run(clusterDetailQueryProcessor, clusterDetailQueryRequest,
new ClusterDetailQueryResult());
}
-
+
@RequestMapping(path = "/v1/cluster/delete", method = RequestMethod.DELETE)
public ClusterDeleteResult deleteCluster(ClusterDeleteRequest clusterDeleteRequest) {
-
- return SkyWalkerTemplate.run(clusterDeleteProcessor, clusterDeleteRequest,
- new ClusterDeleteResult());
-
+
+ return SkyWalkerTemplate.run(clusterDeleteProcessor, clusterDeleteRequest, new ClusterDeleteResult());
+
}
-
+
@RequestMapping(path = "/v1/cluster/add", method = RequestMethod.POST)
public ClusterAddResult clusterAdd(@RequestBody ClusterAddRequest clusterAddRequest) {
-
- return SkyWalkerTemplate
- .run(clusterAddProcessor, clusterAddRequest, new ClusterAddResult());
+
+ return SkyWalkerTemplate.run(clusterAddProcessor, clusterAddRequest, new ClusterAddResult());
}
-
+
@RequestMapping(path = "/v1/cluster/types", method = RequestMethod.GET)
public ClusterTypeResult getClusterType() {
-
+
return new ClusterTypeResult(ClusterTypeEnum.getClusterTypeCodes());
}
-
+
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/SystemConfigApi.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/SystemConfigApi.java
index 50c7cc4f..6b537223 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/SystemConfigApi.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/SystemConfigApi.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.nacossync.api;
import lombok.extern.slf4j.Slf4j;
@@ -42,34 +43,32 @@
@Slf4j
@RestController
public class SystemConfigApi {
-
+
@Autowired
private ConfigQueryProcessor configQueryProcessor;
-
+
@Autowired
private ConfigDeleteProcessor configDeleteProcessor;
-
+
@Autowired
private ConfigAddProcessor configAddProcessor;
-
+
@RequestMapping(path = "/v1/systemconfig/list", method = RequestMethod.GET)
public ConfigQueryResult tasks(ConfigQueryRequest configQueryRequest) {
-
- return SkyWalkerTemplate.run(configQueryProcessor, configQueryRequest,
- new ConfigQueryResult());
+
+ return SkyWalkerTemplate.run(configQueryProcessor, configQueryRequest, new ConfigQueryResult());
}
-
+
@RequestMapping(path = "/v1/systemconfig/delete", method = RequestMethod.DELETE)
public ConfigDeleteResult deleteTask(@RequestBody ConfigDeleteRequest configDeleteRequest) {
-
- return SkyWalkerTemplate.run(configDeleteProcessor, configDeleteRequest,
- new ConfigDeleteResult());
+
+ return SkyWalkerTemplate.run(configDeleteProcessor, configDeleteRequest, new ConfigDeleteResult());
}
-
+
@RequestMapping(path = "/v1/systemconfig/add", method = RequestMethod.POST)
public ConfigAddResult taskAdd(@RequestBody ConfigAddRequest configAddRequest) {
-
+
return SkyWalkerTemplate.run(configAddProcessor, configAddRequest, new ConfigAddResult());
}
-
+
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/TaskApi.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/TaskApi.java
index 6c9f98a4..1abcbf1e 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/api/TaskApi.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/api/TaskApi.java
@@ -10,8 +10,10 @@
* 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.alibaba.nacossync.api;
+import com.alibaba.nacossync.pojo.request.TaskAddAllRequest;
import com.alibaba.nacossync.pojo.request.TaskAddRequest;
import com.alibaba.nacossync.pojo.request.TaskDeleteInBatchRequest;
import com.alibaba.nacossync.pojo.request.TaskDeleteRequest;
@@ -23,6 +25,7 @@
import com.alibaba.nacossync.pojo.result.TaskDetailQueryResult;
import com.alibaba.nacossync.pojo.result.TaskListQueryResult;
import com.alibaba.nacossync.template.SkyWalkerTemplate;
+import com.alibaba.nacossync.template.processor.TaskAddAllProcessor;
import com.alibaba.nacossync.template.processor.TaskAddProcessor;
import com.alibaba.nacossync.template.processor.TaskDeleteInBatchProcessor;
import com.alibaba.nacossync.template.processor.TaskDeleteProcessor;
@@ -42,67 +45,83 @@
@Slf4j
@RestController
public class TaskApi {
-
+
private final TaskUpdateProcessor taskUpdateProcessor;
-
+
private final TaskAddProcessor taskAddProcessor;
-
+
+ private final TaskAddAllProcessor taskAddAllProcessor;
+
private final TaskDeleteProcessor taskDeleteProcessor;
-
+
private final TaskDeleteInBatchProcessor taskDeleteInBatchProcessor;
-
+
private final TaskListQueryProcessor taskListQueryProcessor;
-
+
private final TaskDetailProcessor taskDetailProcessor;
-
+
public TaskApi(TaskUpdateProcessor taskUpdateProcessor, TaskAddProcessor taskAddProcessor,
- TaskDeleteProcessor taskDeleteProcessor, TaskDeleteInBatchProcessor taskDeleteInBatchProcessor,
- TaskListQueryProcessor taskListQueryProcessor, TaskDetailProcessor taskDetailProcessor) {
+ TaskAddAllProcessor taskAddAllProcessor, TaskDeleteProcessor taskDeleteProcessor,
+ TaskDeleteInBatchProcessor taskDeleteInBatchProcessor, TaskListQueryProcessor taskListQueryProcessor,
+ TaskDetailProcessor taskDetailProcessor) {
this.taskUpdateProcessor = taskUpdateProcessor;
this.taskAddProcessor = taskAddProcessor;
+ this.taskAddAllProcessor = taskAddAllProcessor;
this.taskDeleteProcessor = taskDeleteProcessor;
this.taskDeleteInBatchProcessor = taskDeleteInBatchProcessor;
this.taskListQueryProcessor = taskListQueryProcessor;
this.taskDetailProcessor = taskDetailProcessor;
}
-
+
@RequestMapping(path = "/v1/task/list", method = RequestMethod.GET)
public TaskListQueryResult tasks(TaskListQueryRequest taskListQueryRequest) {
-
+
return SkyWalkerTemplate.run(taskListQueryProcessor, taskListQueryRequest, new TaskListQueryResult());
}
-
+
@RequestMapping(path = "/v1/task/detail", method = RequestMethod.GET)
public TaskDetailQueryResult getByTaskId(TaskDetailQueryRequest taskDetailQueryRequest) {
-
+
return SkyWalkerTemplate.run(taskDetailProcessor, taskDetailQueryRequest, new TaskDetailQueryResult());
}
-
+
@RequestMapping(path = "/v1/task/delete", method = RequestMethod.DELETE)
public BaseResult deleteTask(TaskDeleteRequest taskDeleteRequest) {
-
+
return SkyWalkerTemplate.run(taskDeleteProcessor, taskDeleteRequest, new BaseResult());
}
-
+
/**
- * @author yongchao9
* @param taskBatchDeleteRequest
* @return
+ * @author yongchao9
*/
@RequestMapping(path = "/v1/task/deleteInBatch", method = RequestMethod.DELETE)
public BaseResult batchDeleteTask(TaskDeleteInBatchRequest taskBatchDeleteRequest) {
return SkyWalkerTemplate.run(taskDeleteInBatchProcessor, taskBatchDeleteRequest, new BaseResult());
}
-
+
@RequestMapping(path = "/v1/task/add", method = RequestMethod.POST)
public BaseResult taskAdd(@RequestBody TaskAddRequest addTaskRequest) {
-
+
return SkyWalkerTemplate.run(taskAddProcessor, addTaskRequest, new TaskAddResult());
}
-
+
+ /**
+ * TODO 目前仅支持 Nacos 为源的同步类型,待完善更多类型支持.
+ *
+ * 支持从 sourceCluster 获取所有 service,然后生成同步到 destCluster 的任务。
+ *
+ */
+ @RequestMapping(path = "/v1/task/addAll", method = RequestMethod.POST)
+ public BaseResult taskAddAll(@RequestBody TaskAddAllRequest addAllRequest) {
+
+ return SkyWalkerTemplate.run(taskAddAllProcessor, addAllRequest, new TaskAddResult());
+ }
+
@RequestMapping(path = "/v1/task/update", method = RequestMethod.POST)
public BaseResult updateTask(@RequestBody TaskUpdateRequest taskUpdateRequest) {
-
+
return SkyWalkerTemplate.run(taskUpdateProcessor, taskUpdateRequest, new BaseResult());
}
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/constant/SkyWalkerConstants.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/constant/SkyWalkerConstants.java
index 72e26038..1b0ba30a 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/constant/SkyWalkerConstants.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/constant/SkyWalkerConstants.java
@@ -30,5 +30,10 @@ public class SkyWalkerConstants {
public static final String SOURCE_CLUSTERID_KEY = "sourceClusterId";
public static final String MANAGEMENT_PORT_KEY="management.port";
public static final String MANAGEMENT_CONTEXT_PATH_KEY="management.context-path";
+
+ public static final String SERVICE_NAME_PARAM="serviceNameParam";
+ public static final String GROUP_NAME_PARAM="groupNameParam";
+ public static final String PAGE_NO="pageNo";
+ public static final String PAGE_SIZE="pageSize";
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/AbstractNacosSync.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/AbstractNacosSync.java
new file mode 100644
index 00000000..bd8aab7c
--- /dev/null
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/AbstractNacosSync.java
@@ -0,0 +1,201 @@
+package com.alibaba.nacossync.extension.impl;
+
+import com.alibaba.nacos.api.exception.NacosException;
+import com.alibaba.nacos.api.naming.NamingService;
+import com.alibaba.nacos.api.naming.listener.EventListener;
+import com.alibaba.nacos.api.naming.listener.NamingEvent;
+import com.alibaba.nacos.api.naming.pojo.Instance;
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.alibaba.nacossync.constant.MetricsStatisticsType;
+import com.alibaba.nacossync.extension.SyncService;
+import com.alibaba.nacossync.extension.holder.NacosServerHolder;
+import com.alibaba.nacossync.monitor.MetricsManager;
+import com.alibaba.nacossync.pojo.model.TaskDO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import static com.alibaba.nacossync.util.NacosUtils.getGroupNameOrDefault;
+
+@Slf4j
+public abstract class AbstractNacosSync implements SyncService {
+
+ private final Map listenerMap = new ConcurrentHashMap<>();
+
+ private final Map> sourceInstanceSnapshot = new ConcurrentHashMap<>();
+
+ private final Map syncTaskTap = new ConcurrentHashMap<>();
+
+ private final ConcurrentHashMap allSyncTaskMap = new ConcurrentHashMap<>();
+
+ @Autowired
+ private MetricsManager metricsManager;
+
+ @Autowired
+ private NacosServerHolder nacosServerHolder;
+
+
+ /**
+ * 因为网络故障等原因,nacos sync的同步任务会失败,导致目标集群注册中心缺少同步实例, 为避免目标集群注册中心长时间缺少同步实例,每隔5分钟启动一个兜底工作线程执行一遍全部的同步任务。
+ */
+ @PostConstruct
+ public void startBasicSyncTaskThread() {
+ ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(r -> {
+ Thread t = new Thread(r);
+ t.setDaemon(true);
+ t.setName("com.alibaba.nacossync.basic.synctask");
+ return t;
+ });
+
+ executorService.scheduleWithFixedDelay(() -> {
+ if (allSyncTaskMap.size() == 0) {
+ return;
+ }
+
+ try {
+ for (TaskDO taskDO : allSyncTaskMap.values()) {
+ String taskId = taskDO.getTaskId();
+ NamingService sourceNamingService = nacosServerHolder.get(taskDO.getSourceClusterId());
+ try {
+ doSync(taskId, taskDO, sourceNamingService);
+ } catch (Exception e) {
+ log.error("basic sync task process fail, taskId:{}", taskId, e);
+ metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
+ }
+ }
+ } catch (Throwable e) {
+ log.warn("basic synctask thread error", e);
+ }
+ }, 0, 300, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public boolean delete(TaskDO taskDO) {
+ try {
+ NamingService sourceNamingService = nacosServerHolder.get(taskDO.getSourceClusterId());
+ //移除订阅
+ sourceNamingService.unsubscribe(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
+ listenerMap.remove(taskDO.getTaskId()));
+ sourceInstanceSnapshot.remove(taskDO.getTaskId());
+ allSyncTaskMap.remove(taskDO.getTaskId());
+
+ // 删除目标集群中同步的实例列表
+ deregisterInstance(taskDO);
+ } catch (Exception e) {
+ log.error("delete task from nacos to specify destination was failed, taskId:{}", taskDO.getTaskId(), e);
+ metricsManager.recordError(MetricsStatisticsType.DELETE_ERROR);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean sync(TaskDO taskDO) {
+ String taskId = taskDO.getTaskId();
+ try {
+ NamingService sourceNamingService = nacosServerHolder.get(taskDO.getSourceClusterId());
+ allSyncTaskMap.put(taskId, taskDO);
+ //防止暂停同步任务后,重新同步/或删除任务以后新建任务不会再接收到新的事件导致不能同步,所以每次订阅事件之前,先全量同步一次任务
+ doSync(taskId, taskDO, sourceNamingService);
+ this.listenerMap.putIfAbsent(taskId, event -> {
+ if (event instanceof NamingEvent) {
+ try {
+ doSync(taskId, taskDO, sourceNamingService);
+ } catch (Exception e) {
+ log.error("event process fail, taskId:{}", taskId, e);
+ metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
+ }
+ }
+ });
+ sourceNamingService.subscribe(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
+ listenerMap.get(taskId));
+ } catch (Exception e) {
+ log.error("sync task from nacos to specify destination was failed, taskId:{}", taskId, e);
+ metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
+ return false;
+ }
+ return true;
+ }
+
+ private void doSync(String taskId, TaskDO taskDO, NamingService sourceNamingService) throws NacosException {
+ if (syncTaskTap.putIfAbsent(taskId, 1) != null) {
+ log.info("任务Id:{}上一个同步任务尚未结束", taskId);
+ return;
+ }
+ try {
+ // 直接从本地保存的serviceInfoMap中取订阅的服务实例
+ List sourceInstances = sourceNamingService.getAllInstances(taskDO.getServiceName(),
+ getGroupNameOrDefault(taskDO.getGroupName()), new ArrayList<>(), true);
+ // 先删除不存在的
+ this.removeInvalidInstance(taskDO, sourceInstances);
+
+ // 同步实例
+ this.syncNewInstance(taskDO, sourceInstances);
+ } finally {
+ syncTaskTap.remove(taskId);
+ }
+ }
+
+ private void syncNewInstance(TaskDO taskDO, List sourceInstances) throws NacosException {
+ Set latestSyncInstance = new TreeSet<>();
+ //再次添加新实例
+ String taskId = taskDO.getTaskId();
+ Set instanceKeys = sourceInstanceSnapshot.get(taskId);
+ for (Instance instance : sourceInstances) {
+ if (needSync(instance.getMetadata())) {
+ String instanceKey = composeInstanceKey(instance.getIp(), instance.getPort());
+ if (CollectionUtils.isEmpty(instanceKeys) || !instanceKeys.contains(instanceKey)) {
+ register(taskDO, instance);
+ }
+ latestSyncInstance.add(instanceKey);
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(latestSyncInstance)) {
+ log.info("任务Id:{},已同步实例个数:{}", taskId, latestSyncInstance.size());
+ sourceInstanceSnapshot.put(taskId, latestSyncInstance);
+ } else {
+ // latestSyncInstance为空表示源集群中需要同步的所有实例(即非nacos-sync同步过来的实例)已经下线,清除本地持有快照
+ sourceInstanceSnapshot.remove(taskId);
+ }
+ }
+
+
+ private void removeInvalidInstance(TaskDO taskDO, List sourceInstances) throws NacosException {
+ String taskId = taskDO.getTaskId();
+ if (this.sourceInstanceSnapshot.containsKey(taskId)) {
+ Set oldInstanceKeys = this.sourceInstanceSnapshot.get(taskId);
+ Set newInstanceKeys = sourceInstances.stream()
+ .map(instance -> composeInstanceKey(instance.getIp(), instance.getPort()))
+ .collect(Collectors.toSet());
+ oldInstanceKeys.removeAll(newInstanceKeys);
+ if (CollectionUtils.isNotEmpty(oldInstanceKeys)) {
+ log.info("任务Id:{},移除无效同步实例:{}", taskId, oldInstanceKeys);
+ removeInvalidInstance(taskDO, oldInstanceKeys);
+ }
+ }
+ }
+
+ public abstract String composeInstanceKey(String ip, int port);
+
+ public abstract void register(TaskDO taskDO, Instance instance);
+
+ public abstract void deregisterInstance(TaskDO taskDO) throws Exception;
+
+ public abstract void removeInvalidInstance(TaskDO taskDO, Set invalidInstanceKeys);
+
+ public NacosServerHolder getNacosServerHolder() {
+ return nacosServerHolder;
+ }
+}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToEurekaServiceImpl.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToEurekaServiceImpl.java
index e502cfa8..408eca7a 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToEurekaServiceImpl.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToEurekaServiceImpl.java
@@ -10,203 +10,114 @@
* 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.alibaba.nacossync.extension.impl;
-import com.alibaba.nacos.api.naming.NamingService;
-import com.alibaba.nacos.api.naming.listener.Event;
-import com.alibaba.nacos.api.naming.listener.EventListener;
-import com.alibaba.nacos.api.naming.listener.NamingEvent;
import com.alibaba.nacos.api.naming.pojo.Instance;
+import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacossync.cache.SkyWalkerCacheServices;
import com.alibaba.nacossync.constant.ClusterTypeEnum;
-import com.alibaba.nacossync.constant.MetricsStatisticsType;
import com.alibaba.nacossync.constant.SkyWalkerConstants;
-import com.alibaba.nacossync.extension.SyncService;
import com.alibaba.nacossync.extension.annotation.NacosSyncService;
import com.alibaba.nacossync.extension.eureka.EurekaNamingService;
import com.alibaba.nacossync.extension.holder.EurekaServerHolder;
-import com.alibaba.nacossync.extension.holder.NacosServerHolder;
-import com.alibaba.nacossync.monitor.MetricsManager;
import com.alibaba.nacossync.pojo.model.TaskDO;
-import com.alibaba.nacossync.util.NacosUtils;
import com.netflix.appinfo.DataCenterInfo;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.appinfo.LeaseInfo;
import com.netflix.appinfo.MyDataCenterInfo;
+import lombok.extern.slf4j.Slf4j;
+
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import lombok.extern.slf4j.Slf4j;
/**
* @author zhanglong
*/
@Slf4j
@NacosSyncService(sourceCluster = ClusterTypeEnum.NACOS, destinationCluster = ClusterTypeEnum.EUREKA)
-public class NacosSyncToEurekaServiceImpl implements SyncService {
-
- private final Map nacosListenerMap = new ConcurrentHashMap<>();
-
- private final MetricsManager metricsManager;
- private final SkyWalkerCacheServices skyWalkerCacheServices;
- private final NacosServerHolder nacosServerHolder;
+public class NacosSyncToEurekaServiceImpl extends AbstractNacosSync {
+
+
private final EurekaServerHolder eurekaServerHolder;
-
- public NacosSyncToEurekaServiceImpl(MetricsManager metricsManager, SkyWalkerCacheServices skyWalkerCacheServices,
- NacosServerHolder nacosServerHolder, EurekaServerHolder eurekaServerHolder) {
- this.metricsManager = metricsManager;
- this.skyWalkerCacheServices = skyWalkerCacheServices;
- this.nacosServerHolder = nacosServerHolder;
+
+ private final SkyWalkerCacheServices skyWalkerCacheServices;
+
+ public NacosSyncToEurekaServiceImpl(EurekaServerHolder eurekaServerHolder,
+ SkyWalkerCacheServices skyWalkerCacheServices) {
this.eurekaServerHolder = eurekaServerHolder;
+ this.skyWalkerCacheServices = skyWalkerCacheServices;
}
-
+
+
@Override
- public boolean delete(TaskDO taskDO) {
- try {
- NamingService sourceNamingService =
- nacosServerHolder.get(taskDO.getSourceClusterId());
- EurekaNamingService destNamingService =
- eurekaServerHolder.get(taskDO.getDestClusterId());
-
- sourceNamingService.unsubscribe(taskDO.getServiceName(),
- NacosUtils.getGroupNameOrDefault(taskDO.getGroupName()), nacosListenerMap.get(taskDO.getTaskId()));
- // 删除目标集群中同步的实例列表
- List allInstances = destNamingService.getApplications(taskDO.getServiceName());
- if (allInstances != null) {
- for (InstanceInfo instance : allInstances) {
- if (needDelete(instance.getMetadata(), taskDO)) {
- destNamingService.deregisterInstance(instance);
- }
- }
- }
- } catch (Exception e) {
- log.error("delete task from nacos to eureka was failed, taskId:{}", taskDO.getTaskId(), e);
- metricsManager.recordError(MetricsStatisticsType.DELETE_ERROR);
- return false;
- }
- return true;
+ public String composeInstanceKey(String ip, int port) {
+ return ip + ":" + port;
}
-
+
@Override
- public boolean sync(TaskDO taskDO) {
- try {
- NamingService sourceNamingService =
- nacosServerHolder.get(taskDO.getSourceClusterId());
- EurekaNamingService destNamingService =
- eurekaServerHolder.get(taskDO.getDestClusterId());
-
- nacosListenerMap.putIfAbsent(taskDO.getTaskId(), event -> processNamingEvent(taskDO, sourceNamingService, destNamingService, event));
-
- sourceNamingService.subscribe(taskDO.getServiceName(),
- NacosUtils.getGroupNameOrDefault(taskDO.getGroupName()), nacosListenerMap.get(taskDO.getTaskId()));
- } catch (Exception e) {
- log.error("sync task from eureka to nacos was failed, taskId:{}", taskDO.getTaskId(), e);
- metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
- return false;
- }
- return true;
+ public void register(TaskDO taskDO, Instance instance) {
+ EurekaNamingService destNamingService = eurekaServerHolder.get(taskDO.getDestClusterId());
+ destNamingService.registerInstance(buildSyncInstance(instance, taskDO));
}
-
- private void processNamingEvent(TaskDO taskDO, NamingService sourceNamingService,
- EurekaNamingService destNamingService, Event event) {
- if (event instanceof NamingEvent) {
- try {
- Set instanceKeySet = new HashSet<>();
- List sourceInstances = sourceNamingService.getAllInstances(taskDO.getServiceName(),
- NacosUtils.getGroupNameOrDefault(taskDO.getGroupName()));
- // 先将新的注册一遍
- addAllNewInstance(taskDO, destNamingService, instanceKeySet, sourceInstances);
- // 再将不存在的删掉
- ifNecessaryDelete(taskDO, destNamingService, instanceKeySet);
- } catch (Exception e) {
- log.error("event process fail, taskId:{}", taskDO.getTaskId(), e);
- metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
- }
- }
- }
-
- private void ifNecessaryDelete(TaskDO taskDO, EurekaNamingService destNamingService, Set instanceKeySet) {
+
+ @Override
+ public void deregisterInstance(TaskDO taskDO) {
+ EurekaNamingService destNamingService = eurekaServerHolder.get(taskDO.getDestClusterId());
List allInstances = destNamingService.getApplications(taskDO.getServiceName());
if (allInstances != null) {
for (InstanceInfo instance : allInstances) {
- if (needDelete(instance.getMetadata(), taskDO) && !instanceKeySet.contains(
- composeInstanceKey(instance.getIPAddr(),
- instance.getPort()))) {
+ if (needDelete(instance.getMetadata(), taskDO)) {
destNamingService.deregisterInstance(instance);
}
-
}
}
}
-
- private void addAllNewInstance(TaskDO taskDO, EurekaNamingService destNamingService, Set instanceKeySet,
- List sourceInstances) {
- for (Instance instance : sourceInstances) {
- if (needSync(instance.getMetadata())) {
- destNamingService.registerInstance(buildSyncInstance(instance, taskDO));
- instanceKeySet.add(composeInstanceKey(instance.getIp(), instance.getPort()));
+
+ @Override
+ public void removeInvalidInstance(TaskDO taskDO, Set invalidInstanceKeys) {
+ EurekaNamingService destNamingService = eurekaServerHolder.get(taskDO.getDestClusterId());
+ List allInstances = destNamingService.getApplications(taskDO.getServiceName());
+ if (CollectionUtils.isNotEmpty(allInstances)) {
+ for (InstanceInfo instance : allInstances) {
+ if (needDelete(instance.getMetadata(), taskDO) && invalidInstanceKeys.contains(
+ composeInstanceKey(instance.getIPAddr(), instance.getPort()))) {
+ destNamingService.deregisterInstance(instance);
+ }
}
}
}
-
- private String composeInstanceKey(String ip, int port) {
- return ip + ":" + port;
- }
-
+
+
private InstanceInfo buildSyncInstance(Instance instance, TaskDO taskDO) {
DataCenterInfo dataCenterInfo = new MyDataCenterInfo(DataCenterInfo.Name.MyOwn);
final Map instanceMetadata = instance.getMetadata();
HashMap metadata = new HashMap<>(16);
metadata.put(SkyWalkerConstants.DEST_CLUSTERID_KEY, taskDO.getDestClusterId());
metadata.put(SkyWalkerConstants.SYNC_SOURCE_KEY,
- skyWalkerCacheServices.getClusterType(taskDO.getSourceClusterId()).getCode());
+ skyWalkerCacheServices.getClusterType(taskDO.getSourceClusterId()).getCode());
metadata.put(SkyWalkerConstants.SOURCE_CLUSTERID_KEY, taskDO.getSourceClusterId());
metadata.putAll(instanceMetadata);
String homePageUrl = obtainHomePageUrl(instance, instanceMetadata);
String serviceName = taskDO.getServiceName();
-
- return new InstanceInfo(
- instance.getIp() + ":" + serviceName + ":" + instance.getPort(),
- serviceName,
- null,
- instance.getIp(),
- null,
- new InstanceInfo.PortWrapper(true, instance.getPort()),
- null,
- homePageUrl + "/actuator/env",
- homePageUrl + "/actuator/info",
- homePageUrl + "/actuator/health",
- null,
- serviceName,
- serviceName,
- 1,
- dataCenterInfo,
- instance.getIp(),
- InstanceInfo.InstanceStatus.UP,
- InstanceInfo.InstanceStatus.UNKNOWN,
- null,
- new LeaseInfo(30, 90,
- 0L, 0L, 0L, 0L, 0L),
- false,
- metadata,
- System.currentTimeMillis(),
- System.currentTimeMillis(),
- null,
- null
- );
+
+ return new InstanceInfo(instance.getIp() + ":" + serviceName + ":" + instance.getPort(), serviceName, null,
+ instance.getIp(), null, new InstanceInfo.PortWrapper(true, instance.getPort()), null,
+ homePageUrl + "/actuator/env", homePageUrl + "/actuator/info", homePageUrl + "/actuator/health", null,
+ serviceName, serviceName, 1, dataCenterInfo, instance.getIp(), InstanceInfo.InstanceStatus.UP,
+ InstanceInfo.InstanceStatus.UNKNOWN, null, new LeaseInfo(30, 90, 0L, 0L, 0L, 0L, 0L), false, metadata,
+ System.currentTimeMillis(), System.currentTimeMillis(), null, null);
}
-
+
private String obtainHomePageUrl(Instance instance, Map instanceMetadata) {
- final String managementContextPath =
- obtainManagementContextPath(instanceMetadata);
+ final String managementContextPath = obtainManagementContextPath(instanceMetadata);
final String managementPort = instanceMetadata.getOrDefault(SkyWalkerConstants.MANAGEMENT_PORT_KEY,
- String.valueOf(instance.getPort()));
+ String.valueOf(instance.getPort()));
return String.format("http://%s:%s%s", instance.getIp(), managementPort, managementContextPath);
}
-
+
private String obtainManagementContextPath(Map instanceMetadata) {
final String path = instanceMetadata.getOrDefault(SkyWalkerConstants.MANAGEMENT_CONTEXT_PATH_KEY, "");
if (path.endsWith("/")) {
@@ -214,6 +125,6 @@ private String obtainManagementContextPath(Map instanceMetadata)
}
return path;
}
-
-
+
+
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToNacosServiceImpl.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToNacosServiceImpl.java
index a42aab35..4cc3b830 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToNacosServiceImpl.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/NacosSyncToNacosServiceImpl.java
@@ -10,41 +10,27 @@
* 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.alibaba.nacossync.extension.impl;
-import static com.alibaba.nacossync.util.NacosUtils.getGroupNameOrDefault;
+package com.alibaba.nacossync.extension.impl;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
-import com.alibaba.nacos.api.naming.listener.EventListener;
-import com.alibaba.nacos.api.naming.listener.NamingEvent;
import com.alibaba.nacos.api.naming.pojo.Instance;
-import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacossync.cache.SkyWalkerCacheServices;
import com.alibaba.nacossync.constant.ClusterTypeEnum;
-import com.alibaba.nacossync.constant.MetricsStatisticsType;
import com.alibaba.nacossync.constant.SkyWalkerConstants;
-import com.alibaba.nacossync.extension.SyncService;
import com.alibaba.nacossync.extension.annotation.NacosSyncService;
-import com.alibaba.nacossync.extension.holder.NacosServerHolder;
-import com.alibaba.nacossync.monitor.MetricsManager;
import com.alibaba.nacossync.pojo.model.TaskDO;
-import com.alibaba.nacossync.util.Collections;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import javax.annotation.PostConstruct;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
+
+import static com.alibaba.nacossync.util.NacosUtils.getGroupNameOrDefault;
/**
* @author yangyshdan
@@ -53,201 +39,59 @@
@Slf4j
@NacosSyncService(sourceCluster = ClusterTypeEnum.NACOS, destinationCluster = ClusterTypeEnum.NACOS)
-public class NacosSyncToNacosServiceImpl implements SyncService {
-
- private Map listenerMap = new ConcurrentHashMap<>();
-
- private final Map> sourceInstanceSnapshot = new ConcurrentHashMap<>();
-
- private final Map syncTaskTap = new ConcurrentHashMap<>();
-
- @Autowired
- private MetricsManager metricsManager;
-
+public class NacosSyncToNacosServiceImpl extends AbstractNacosSync {
+
+
@Autowired
private SkyWalkerCacheServices skyWalkerCacheServices;
-
- @Autowired
- private NacosServerHolder nacosServerHolder;
-
- private ConcurrentHashMap allSyncTaskMap = new ConcurrentHashMap();
-
- /**
- * 因为网络故障等原因,nacos sync的同步任务会失败,导致目标集群注册中心缺少同步实例, 为避免目标集群注册中心长时间缺少同步实例,每隔5分钟启动一个兜底工作线程执行一遍全部的同步任务。
- */
- @PostConstruct
- public void startBasicSyncTaskThread() {
- ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(r -> {
- Thread t = new Thread(r);
- t.setDaemon(true);
- t.setName("com.alibaba.nacossync.basic.synctask");
- return t;
- });
-
- executorService.scheduleWithFixedDelay(() -> {
- if (allSyncTaskMap.size() == 0) {
- return;
- }
-
- try {
- for (TaskDO taskDO : allSyncTaskMap.values()) {
- String taskId = taskDO.getTaskId();
- NamingService sourceNamingService =
- nacosServerHolder.get(taskDO.getSourceClusterId());
- NamingService destNamingService =
- nacosServerHolder.get(taskDO.getDestClusterId());
- try {
- doSync(taskId, taskDO, sourceNamingService, destNamingService);
- } catch (Exception e) {
- log.error("basic synctask process fail, taskId:{}", taskId, e);
- metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
- }
- }
- } catch (Throwable e) {
- log.warn("basic synctask thread error", e);
- }
- }, 0, 300, TimeUnit.SECONDS);
- }
-
+
+
@Override
- public boolean delete(TaskDO taskDO) {
- try {
- NamingService sourceNamingService =
- nacosServerHolder.get(taskDO.getSourceClusterId());
- NamingService destNamingService = nacosServerHolder.get(taskDO.getDestClusterId());
- //移除订阅
- sourceNamingService
- .unsubscribe(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
- listenerMap.remove(taskDO.getTaskId()));
- sourceInstanceSnapshot.remove(taskDO.getTaskId());
- allSyncTaskMap.remove(taskDO.getTaskId());
-
- // 删除目标集群中同步的实例列表
- List sourceInstances = sourceNamingService
- .getAllInstances(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
- new ArrayList<>(), false);
- for (Instance instance : sourceInstances) {
- if (needSync(instance.getMetadata())) {
- destNamingService
- .deregisterInstance(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
- instance.getIp(),
- instance.getPort());
- }
- }
- } catch (Exception e) {
- log.error("delete task from nacos to nacos was failed, taskId:{}", taskDO.getTaskId(), e);
- metricsManager.recordError(MetricsStatisticsType.DELETE_ERROR);
- return false;
- }
- return true;
+ public String composeInstanceKey(String ip, int port) {
+ return ip + ":" + port;
}
-
+
@Override
- public boolean sync(TaskDO taskDO) {
- String taskId = taskDO.getTaskId();
+ public void register(TaskDO taskDO, Instance instance) {
+ NamingService destNamingService = getNacosServerHolder().get(taskDO.getDestClusterId());
try {
- NamingService sourceNamingService =
- nacosServerHolder.get(taskDO.getSourceClusterId());
- NamingService destNamingService = nacosServerHolder.get(taskDO.getDestClusterId());
- allSyncTaskMap.put(taskId, taskDO);
- //防止暂停同步任务后,重新同步/或删除任务以后新建任务不会再接收到新的事件导致不能同步,所以每次订阅事件之前,先全量同步一次任务
- doSync(taskId, taskDO, sourceNamingService, destNamingService);
- this.listenerMap.putIfAbsent(taskId, event -> {
- if (event instanceof NamingEvent) {
- try {
- doSync(taskId, taskDO, sourceNamingService, destNamingService);
- } catch (Exception e) {
- log.error("event process fail, taskId:{}", taskId, e);
- metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
- }
- }
- });
- sourceNamingService.subscribe(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
- listenerMap.get(taskId));
- } catch (Exception e) {
- log.error("sync task from nacos to nacos was failed, taskId:{}", taskId, e);
- metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
- return false;
+ destNamingService.registerInstance(taskDO.getServiceName(), getGroupNameOrDefault(taskDO.getGroupName()),
+ buildSyncInstance(instance, taskDO));
+ } catch (NacosException e) {
+ log.error("Register instance={} to Nacos failed", taskDO.getServiceName(), e);
}
- return true;
}
-
- private void doSync(String taskId, TaskDO taskDO, NamingService sourceNamingService,
- NamingService destNamingService) throws NacosException {
- if (syncTaskTap.putIfAbsent(taskId, 1) != null) {
- log.info("任务Id:{}上一个同步任务尚未结束", taskId);
- return;
- }
- try {
- // 直接从本地保存的serviceInfoMap中取订阅的服务实例
- List sourceInstances = sourceNamingService.getAllInstances(taskDO.getServiceName(),
+
+ @Override
+ public void deregisterInstance(TaskDO taskDO) throws Exception {
+ NamingService destNamingService = getNacosServerHolder().get(taskDO.getDestClusterId());
+ List allInstances = destNamingService.getAllInstances(taskDO.getServiceName(),
getGroupNameOrDefault(taskDO.getGroupName()), new ArrayList<>(), true);
- // 先删除不存在的
- this.removeInvalidInstance(taskDO, destNamingService, sourceInstances);
- // 如果同步实例已经为空代表该服务所有实例已经下线,清除本地持有快照
- if (sourceInstances.isEmpty()) {
- sourceInstanceSnapshot.remove(taskId);
- return;
+ for (Instance instance : allInstances) {
+ if (needDelete(instance.getMetadata(), taskDO)) {
+ destNamingService.deregisterInstance(taskDO.getServiceName(),
+ getGroupNameOrDefault(taskDO.getGroupName()), instance.getIp(), instance.getPort());
}
- // 同步实例
- this.syncNewInstance(taskDO, destNamingService, sourceInstances);
- } finally {
- syncTaskTap.remove(taskId);
}
}
-
- private void syncNewInstance(TaskDO taskDO, NamingService destNamingService,
- List sourceInstances) throws NacosException {
- Set latestSyncInstance = new TreeSet<>();
- //再次添加新实例
- String taskId = taskDO.getTaskId();
- Set instanceKeys = sourceInstanceSnapshot.get(taskId);
- for (Instance instance : sourceInstances) {
- if (needSync(instance.getMetadata())) {
- String instanceKey = composeInstanceKey(instance);
- if (CollectionUtils.isEmpty(instanceKeys) || !instanceKeys.contains(instanceKey)) {
- destNamingService.registerInstance(taskDO.getServiceName(),
- getGroupNameOrDefault(taskDO.getGroupName()),
- buildSyncInstance(instance, taskDO));
- }
- latestSyncInstance.add(instanceKey);
-
- }
- }
- if (CollectionUtils.isNotEmpty(latestSyncInstance)) {
-
- log.info("任务Id:{},已同步实例个数:{}", taskId, latestSyncInstance.size());
- sourceInstanceSnapshot.put(taskId, latestSyncInstance);
- }
- }
-
-
- private void removeInvalidInstance(TaskDO taskDO, NamingService destNamingService,
- List sourceInstances) throws NacosException {
- String taskId = taskDO.getTaskId();
- if (this.sourceInstanceSnapshot.containsKey(taskId)) {
- Set oldInstanceKeys = this.sourceInstanceSnapshot.get(taskId);
- List newInstanceKeys = sourceInstances.stream().map(this::composeInstanceKey)
- .collect(Collectors.toList());
- Collection instanceKeys = Collections.subtract(oldInstanceKeys, newInstanceKeys);
- for (String instanceKey : instanceKeys) {
- log.info("任务Id:{},移除无效同步实例:{}", taskId, instanceKey);
- String[] split = instanceKey.split(":", -1);
- destNamingService
- .deregisterInstance(taskDO.getServiceName(),
- getGroupNameOrDefault(taskDO.getGroupName()), split[0],
- Integer.parseInt(split[1]));
-
+
+ @Override
+ public void removeInvalidInstance(TaskDO taskDO, Set invalidInstanceKeys) {
+ NamingService destNamingService = getNacosServerHolder().get(taskDO.getDestClusterId());
+
+ for (String instanceKey : invalidInstanceKeys) {
+ String[] split = instanceKey.split(":", -1);
+ try {
+ destNamingService.deregisterInstance(taskDO.getServiceName(),
+ getGroupNameOrDefault(taskDO.getGroupName()), split[0], Integer.parseInt(split[1]));
+ } catch (NacosException e) {
+ log.error("Remove instance={} from Nacos failed", taskDO.getServiceName(), e);
+
}
-
}
}
-
- private String composeInstanceKey(Instance instance) {
- return instance.getIp() + ":" + instance.getPort();
- }
-
-
+
+
private Instance buildSyncInstance(Instance instance, TaskDO taskDO) {
Instance temp = new Instance();
temp.setIp(instance.getIp());
@@ -258,15 +102,14 @@ private Instance buildSyncInstance(Instance instance, TaskDO taskDO) {
temp.setHealthy(instance.isHealthy());
temp.setWeight(instance.getWeight());
temp.setEphemeral(instance.isEphemeral());
- Map metaData = new HashMap<>();
- metaData.putAll(instance.getMetadata());
+ Map metaData = new HashMap<>(instance.getMetadata());
metaData.put(SkyWalkerConstants.DEST_CLUSTERID_KEY, taskDO.getDestClusterId());
metaData.put(SkyWalkerConstants.SYNC_SOURCE_KEY,
- skyWalkerCacheServices.getClusterType(taskDO.getSourceClusterId()).getCode());
+ skyWalkerCacheServices.getClusterType(taskDO.getSourceClusterId()).getCode());
metaData.put(SkyWalkerConstants.SOURCE_CLUSTERID_KEY, taskDO.getSourceClusterId());
temp.setMetadata(metaData);
return temp;
}
-
-
+
+
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/pojo/request/TaskAddAllRequest.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/pojo/request/TaskAddAllRequest.java
new file mode 100644
index 00000000..64f041bf
--- /dev/null
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/pojo/request/TaskAddAllRequest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.alibaba.nacossync.pojo.request;
+
+import lombok.Data;
+
+/**
+ * @author NacosSync
+ * @version $Id: TaskAddAllRequest.java, v 0.1 2022-03-23 AM12:13 NacosSync Exp $$
+ */
+@Data
+public class TaskAddAllRequest extends BaseRequest {
+
+ /**
+ * eg: b7bacb110199d5bb83b9757038fadeb0 .
+ */
+ private String sourceClusterId;
+
+ /**
+ * eg: bbdad57833a0e4f0981f6f3349005617 .
+ */
+ private String destClusterId;
+
+ /**
+ * whether to exclude subscriber.
+ */
+ private boolean excludeConsumer = true;
+
+}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/template/processor/TaskAddAllProcessor.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/template/processor/TaskAddAllProcessor.java
new file mode 100644
index 00000000..c02cb676
--- /dev/null
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/template/processor/TaskAddAllProcessor.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.alibaba.nacossync.template.processor;
+
+import com.alibaba.nacos.api.exception.NacosException;
+import com.alibaba.nacos.api.naming.CommonParams;
+import com.alibaba.nacos.api.naming.NamingService;
+import com.alibaba.nacos.client.naming.NacosNamingService;
+import com.alibaba.nacos.client.naming.net.NamingProxy;
+import com.alibaba.nacos.client.naming.utils.UtilAndComs;
+import com.alibaba.nacos.common.utils.HttpMethod;
+import com.alibaba.nacos.common.utils.JacksonUtils;
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.alibaba.nacossync.constant.TaskStatusEnum;
+import com.alibaba.nacossync.dao.ClusterAccessService;
+import com.alibaba.nacossync.dao.TaskAccessService;
+import com.alibaba.nacossync.exception.SkyWalkerException;
+import com.alibaba.nacossync.extension.SyncManagerService;
+import com.alibaba.nacossync.extension.holder.NacosServerHolder;
+import com.alibaba.nacossync.pojo.model.ClusterDO;
+import com.alibaba.nacossync.pojo.model.TaskDO;
+import com.alibaba.nacossync.pojo.request.TaskAddAllRequest;
+import com.alibaba.nacossync.pojo.request.TaskAddRequest;
+import com.alibaba.nacossync.pojo.result.TaskAddResult;
+import com.alibaba.nacossync.template.Processor;
+import com.alibaba.nacossync.util.SkyWalkerUtil;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ReflectionUtils;
+
+import javax.annotation.Nullable;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.alibaba.nacossync.constant.SkyWalkerConstants.GROUP_NAME_PARAM;
+import static com.alibaba.nacossync.constant.SkyWalkerConstants.PAGE_NO;
+import static com.alibaba.nacossync.constant.SkyWalkerConstants.PAGE_SIZE;
+import static com.alibaba.nacossync.constant.SkyWalkerConstants.SERVICE_NAME_PARAM;
+
+/**
+ * @author NacosSync
+ * @version $Id: TaskAddAllProcessor.java, v 0.1 2022-03-23 PM11:40 NacosSync Exp $$
+ */
+@Slf4j
+@Service
+public class TaskAddAllProcessor implements Processor {
+
+ private static final String CONSUMER_PREFIX = "consumers:";
+
+ private final NacosServerHolder nacosServerHolder;
+
+ private final SyncManagerService syncManagerService;
+
+ private final TaskAccessService taskAccessService;
+
+ private final ClusterAccessService clusterAccessService;
+
+ public TaskAddAllProcessor(NacosServerHolder nacosServerHolder, SyncManagerService syncManagerService,
+ TaskAccessService taskAccessService, ClusterAccessService clusterAccessService) {
+ this.nacosServerHolder = nacosServerHolder;
+ this.syncManagerService = syncManagerService;
+ this.taskAccessService = taskAccessService;
+ this.clusterAccessService = clusterAccessService;
+ }
+
+ @Override
+ public void process(TaskAddAllRequest addAllRequest, TaskAddResult taskAddResult, Object... others)
+ throws Exception {
+
+ ClusterDO destCluster = clusterAccessService.findByClusterId(addAllRequest.getDestClusterId());
+
+ ClusterDO sourceCluster = clusterAccessService.findByClusterId(addAllRequest.getSourceClusterId());
+
+ if (Objects.isNull(destCluster) || Objects.isNull(sourceCluster)) {
+ throw new SkyWalkerException("Please check if the source or target cluster exists.");
+ }
+
+ if (Objects.isNull(syncManagerService.getSyncService(sourceCluster.getClusterId(), destCluster.getClusterId()))) {
+ throw new SkyWalkerException("current sync type not supported.");
+ }
+ // TODO 目前仅支持 Nacos 为源的同步类型,待完善更多类型支持。
+ final NamingService sourceNamingService = nacosServerHolder.get(sourceCluster.getClusterId());
+ if (sourceNamingService == null) {
+ throw new SkyWalkerException("only support sync type that the source of the Nacos.");
+ }
+
+ final EnhanceNamingService enhanceNamingService = new EnhanceNamingService(sourceNamingService);
+ final CatalogServiceResult catalogServiceResult = enhanceNamingService.catalogServices(null, null);
+ if (catalogServiceResult == null || catalogServiceResult.getCount() <= 0) {
+ throw new SkyWalkerException("sourceCluster data empty");
+ }
+
+ for (ServiceView serviceView : catalogServiceResult.getServiceList()) {
+ // exclude subscriber
+ if (addAllRequest.isExcludeConsumer() && serviceView.getName().startsWith(CONSUMER_PREFIX)) {
+ continue;
+ }
+ TaskAddRequest taskAddRequest = new TaskAddRequest();
+ taskAddRequest.setSourceClusterId(sourceCluster.getClusterId());
+ taskAddRequest.setDestClusterId(destCluster.getClusterId());
+ taskAddRequest.setServiceName(serviceView.getName());
+ taskAddRequest.setGroupName(serviceView.getGroupName());
+ this.dealTask(addAllRequest, taskAddRequest);
+ }
+ }
+
+ private void dealTask(TaskAddAllRequest addAllRequest, TaskAddRequest taskAddRequest) throws Exception {
+
+ String taskId = SkyWalkerUtil.generateTaskId(taskAddRequest);
+ TaskDO taskDO = taskAccessService.findByTaskId(taskId);
+ if (null == taskDO) {
+ taskDO = new TaskDO();
+ taskDO.setTaskId(taskId);
+ taskDO.setDestClusterId(addAllRequest.getDestClusterId());
+ taskDO.setSourceClusterId(addAllRequest.getSourceClusterId());
+ taskDO.setServiceName(taskAddRequest.getServiceName());
+ taskDO.setVersion(taskAddRequest.getVersion());
+ taskDO.setGroupName(taskAddRequest.getGroupName());
+ taskDO.setNameSpace(taskAddRequest.getNameSpace());
+ taskDO.setTaskStatus(TaskStatusEnum.SYNC.getCode());
+ taskDO.setWorkerIp(SkyWalkerUtil.getLocalIp());
+ taskDO.setOperationId(SkyWalkerUtil.generateOperationId());
+
+ } else {
+ taskDO.setTaskStatus(TaskStatusEnum.SYNC.getCode());
+ taskDO.setOperationId(SkyWalkerUtil.generateOperationId());
+ }
+ taskAccessService.addTask(taskDO);
+ }
+
+ static class EnhanceNamingService {
+
+ protected NamingService delegate;
+
+ protected NamingProxy serverProxy;
+
+ protected EnhanceNamingService(NamingService namingService) {
+ if (!(namingService instanceof NacosNamingService)) {
+ throw new IllegalArgumentException(
+ "namingService only support instance of com.alibaba.nacos.client.naming.NacosNamingService.");
+ }
+ this.delegate = namingService;
+
+ // serverProxy
+ final Field serverProxyField = ReflectionUtils.findField(NacosNamingService.class, "serverProxy");
+ assert serverProxyField != null;
+ ReflectionUtils.makeAccessible(serverProxyField);
+ this.serverProxy = (NamingProxy) ReflectionUtils.getField(serverProxyField, delegate);
+ }
+
+ public CatalogServiceResult catalogServices(@Nullable String serviceName, @Nullable String group)
+ throws NacosException {
+ int pageNo = 1; // start with 1
+ int pageSize = 100;
+
+ final CatalogServiceResult result = catalogServices(serviceName, group, pageNo, pageSize);
+
+ CatalogServiceResult tmpResult = result;
+
+ while (Objects.nonNull(tmpResult) && tmpResult.serviceList.size() >= pageSize) {
+ pageNo++;
+ tmpResult = catalogServices(serviceName, group, pageNo, pageSize);
+
+ if (tmpResult != null) {
+ result.serviceList.addAll(tmpResult.serviceList);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @see com.alibaba.nacos.client.naming.core.HostReactor#getServiceInfoDirectlyFromServer(String, String)
+ */
+ public CatalogServiceResult catalogServices(@Nullable String serviceName, @Nullable String group, int pageNo,
+ int pageSize) throws NacosException {
+
+ // pageNo
+ // pageSize
+ // serviceNameParam
+ // groupNameParam
+ final Map params = new HashMap<>(8);
+ params.put(CommonParams.NAMESPACE_ID, serverProxy.getNamespaceId());
+ params.put(SERVICE_NAME_PARAM, serviceName);
+ params.put(GROUP_NAME_PARAM, group);
+ params.put(PAGE_NO, String.valueOf(pageNo));
+ params.put(PAGE_SIZE, String.valueOf(pageSize));
+
+ final String result = this.serverProxy.reqApi(UtilAndComs.nacosUrlBase + "/catalog/services", params,
+ HttpMethod.GET);
+ if (StringUtils.isNotEmpty(result)) {
+ return JacksonUtils.toObj(result, CatalogServiceResult.class);
+ }
+ return null;
+ }
+
+ }
+
+ /**
+ * Copy from Nacos Server.
+ */
+ @Data
+ static class ServiceView {
+
+ private String name;
+
+ private String groupName;
+
+ private int clusterCount;
+
+ private int ipCount;
+
+ private int healthyInstanceCount;
+
+ private String triggerFlag;
+
+ }
+
+ @Data
+ static class CatalogServiceResult {
+
+ /**
+ * count,not equal serviceList.size .
+ */
+ private int count;
+
+ private List serviceList;
+
+ }
+
+}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/timer/CleanExceedOperationIdTimer.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/timer/CleanExceedOperationIdTimer.java
index d4846486..1ffdc351 100644
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/timer/CleanExceedOperationIdTimer.java
+++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/timer/CleanExceedOperationIdTimer.java
@@ -16,22 +16,20 @@
*/
package com.alibaba.nacossync.timer;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
+import com.alibaba.nacossync.cache.SkyWalkerCacheServices;
+import com.alibaba.nacossync.dao.TaskAccessService;
+import com.alibaba.nacossync.pojo.FinishedTask;
+import com.alibaba.nacossync.pojo.model.TaskDO;
import lombok.extern.slf4j.Slf4j;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;
-import com.alibaba.nacossync.cache.SkyWalkerCacheServices;
-import com.alibaba.nacossync.dao.TaskAccessService;
-import com.alibaba.nacossync.pojo.FinishedTask;
-import com.alibaba.nacossync.pojo.model.TaskDO;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
/**
* @author NacosSync
@@ -71,7 +69,6 @@ public void run() {
Iterable taskDOS = taskAccessService.findAll();
Set operationIds = getDbOperations(taskDOS);
-
for (String operationId : finishedTaskMap.keySet()) {
if (!operationIds.contains(operationId)) {
@@ -88,7 +85,6 @@ public void run() {
private Set getDbOperations(Iterable taskDOS) {
Set operationIds = new HashSet<>();
-
taskDOS.forEach(taskDO -> operationIds.add(taskDO.getOperationId()));
return operationIds;
}
diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/util/Collections.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/util/Collections.java
deleted file mode 100644
index 832c764b..00000000
--- a/nacossync-worker/src/main/java/com/alibaba/nacossync/util/Collections.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.alibaba.nacossync.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-public abstract class Collections {
-
- public static Collection subtract(final Collection a, final Collection b) {
- ArrayList list = new ArrayList( a );
- for (Iterator it = b.iterator(); it.hasNext();) {
- list.remove(it.next());
- }
- return list;
- }
-
-
-
-}
diff --git a/nacossync-worker/src/main/resources/logback-spring.xml b/nacossync-worker/src/main/resources/logback-spring.xml
index 95e69991..7443448f 100644
--- a/nacossync-worker/src/main/resources/logback-spring.xml
+++ b/nacossync-worker/src/main/resources/logback-spring.xml
@@ -4,12 +4,13 @@
- ${LOG_HOME}/nacosSync.log
-
- ${LOG_HOME}/log-nacosSync-%d{yyyy-MM-dd}.%i.log
-
- 200MB
-
+ ${LOG_HOME}/nacos-sync.log
+
+ ${LOG_HOME}/log-nacos-sync-%d{yyyy-MM-dd}.%i.log
+ 200MB
+ 7
+ 2GB
+ true
true
@@ -25,7 +26,6 @@
-
diff --git a/nacossync-worker/src/main/resources/static/js/main.b73436b5.js b/nacossync-worker/src/main/resources/static/js/main.b73436b5.js
index 88be8351..c71dada4 100644
--- a/nacossync-worker/src/main/resources/static/js/main.b73436b5.js
+++ b/nacossync-worker/src/main/resources/static/js/main.b73436b5.js
@@ -325,4 +325,4 @@ var t;e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
* @author Feross Aboukhadijeh
* @license MIT
*/
-e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){"use strict";var r=n(90),a=n(20),o=n(463),i=n(464);function s(e){this.defaults=e,this.interceptors={request:new o,response:new o}}s.prototype.request=function(e){"string"==typeof e&&(e=a.merge({url:arguments[0]},arguments[1])),(e=a.merge(r,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[i,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},a.forEach(["delete","get","head","options"],function(n){s.prototype[n]=function(e,t){return this.request(a.merge(t||{},{method:n,url:e}))}}),a.forEach(["post","put","patch"],function(r){s.prototype[r]=function(e,t,n){return this.request(a.merge(n||{},{method:r,url:e,data:t}))}}),e.exports=s},function(e,t,n){"use strict";var a=n(20);e.exports=function(n,r){a.forEach(n,function(e,t){t!==r&&t.toUpperCase()===r.toUpperCase()&&(n[r]=e,delete n[t])})}},function(e,t,n){"use strict";var a=n(286);e.exports=function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(a("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,a){return e.config=t,n&&(e.code=n),e.request=r,e.response=a,e}},function(e,t,n){"use strict";var a=n(20);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var r,t=n?n(t):a.isURLSearchParams(t)?t.toString():(r=[],a.forEach(t,function(e,t){null!=e&&(a.isArray(e)?t+="[]":e=[e],a.forEach(e,function(e){a.isDate(e)?e=e.toISOString():a.isObject(e)&&(e=JSON.stringify(e)),r.push(o(t)+"="+o(e))}))}),r.join("&"));return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},function(e,t,n){"use strict";var a=n(20),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,r={};return e&&a.forEach(e.split("\n"),function(e){n=e.indexOf(":"),t=a.trim(e.substr(0,n)).toLowerCase(),n=a.trim(e.substr(n+1)),t&&(r[t]&&0<=o.indexOf(t)||(r[t]="set-cookie"===t?(r[t]||[]).concat([n]):r[t]?r[t]+", "+n:n))}),r}},function(e,t,n){"use strict";var r,a,o,i=n(20);function s(e){return a&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}e.exports=i.isStandardBrowserEnv()?(a=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a"),r=s(window.location.href),function(e){e=i.isString(e)?s(e):e;return e.protocol===r.protocol&&e.host===r.host}):function(){return!0}},function(e,t,n){"use strict";var s=n(20);e.exports=s.isStandardBrowserEnv()?{write:function(e,t,n,r,a,o){var i=[];i.push(e+"="+encodeURIComponent(t)),s.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),s.isString(r)&&i.push("path="+r),s.isString(a)&&i.push("domain="+a),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){e=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(20);function a(){this.handlers=[]}a.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},a.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},a.prototype.forEach=function(t){r.forEach(this.handlers,function(e){null!==e&&t(e)})},e.exports=a},function(e,t,n){"use strict";var r=n(20),a=n(465),o=n(287),i=n(90),s=n(466),l=n(467);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(t){return u(t),t.baseURL&&!s(t.url)&&(t.url=l(t.baseURL,t.url)),t.headers=t.headers||{},t.data=a(t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||i.adapter)(t).then(function(e){return u(t),e.data=a(e.data,e.headers,t.transformResponse),e},function(e){return o(e)||(u(t),e&&e.response&&(e.response.data=a(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(e,t,n){"use strict";var r=n(20);e.exports=function(t,n,e){return r.forEach(e,function(e){t=e(t,n)}),t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(288);function a(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new r(e),t(n.reason))})}a.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},a.source=function(){var t;return{token:new a(function(e){t=e}),cancel:t}},e.exports=a},function(e,t,n){"use strict";e.exports=function(t){return function(e){return t.apply(null,e)}}},function(e,t,n){"use strict";t.__esModule=!0,t.withContext=void 0;var h=d(n(3)),m=d(n(8)),o=d(n(4)),i=d(n(5)),r=d(n(6)),_=d(n(0)),l=d(n(11)),a=d(n(1)),y=d(n(27)),u=d(n(10)),s=n(7),g=d(n(289));function d(e){return e&&e.__esModule?e:{default:e}}var c,f=u.default.config,p=void 0,v={},r=(c=_.default.Component,(0,r.default)(b,c),b.prototype.componentWillUnmount=function(){var e,t=this.props.timeoutId;t in v&&(e=v[t],clearTimeout(e),delete v[t])},b.prototype.render=function(){var e=this.props,t=e.prefix,n=e.type,r=e.title,a=e.content,o=e.align,i=e.offset,s=e.hasMask,l=e.afterClose,u=e.animation,d=e.overlayProps,c=(e.timeoutId,e.className),f=e.style,p=(0,m.default)(e,["prefix","type","title","content","align","offset","hasMask","afterClose","animation","overlayProps","timeoutId","className","style"]),e=this.state.visible;return _.default.createElement(y.default,(0,h.default)({},d,{prefix:t,animation:u,visible:e,align:o,offset:i,hasMask:s,afterClose:l}),_.default.createElement(g.default,(0,h.default)({},p,{prefix:t,visible:!0,type:n,shape:"toast",title:r,style:f,className:t+"message-wrapper "+c,onClose:this.handleClose}),a))},r=n=b,n.contextTypes={prefix:a.default.string},n.propTypes={prefix:a.default.string,type:a.default.string,title:a.default.node,content:a.default.node,align:a.default.string,offset:a.default.array,hasMask:a.default.bool,afterClose:a.default.func,animation:a.default.oneOfType([a.default.object,a.default.bool]),overlayProps:a.default.object,onClose:a.default.func,timeoutId:a.default.string,style:a.default.object,className:a.default.string},n.defaultProps={prefix:"next-",align:"tc tc",offset:[0,30],hasMask:!1,animation:{in:"pulse",out:"zoomOut"},style:{},className:""},r);function b(){var e,t;(0,o.default)(this,b);for(var n=arguments.length,r=Array(n),a=0;a 16.8.0")},p.prototype.validate=function(e,t){this.validateCallback(e,t)},p.prototype.reset=function(e){var t=1e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=r.length)return n;var o=r[a],a=e(t&&t[o],n,r,a+1);if(!t){var i=isNaN(o)?{}:[];return i[o]=a,i}if(Array.isArray(t)){i=[].concat(t);return i[o]=a,i}return(0,l.default)({},t,(0,s.default)({},o,a))};t=function(){};void 0!==e&&e.env;n.warning=t}.call(this,a(284))},function(e,t,n){"use strict";t.__esModule=!0,t.cloneAndAddKey=function(e){if(e&&(0,a.isValidElement)(e)){var t=e.key||"error";return(0,a.cloneElement)(e,{key:t})}return e},t.scrollToFirstError=function(e){var t=e.errorsGroup,n=e.options,r=e.instance;if(t&&n.scrollToFirstError){var a,o=void 0,i=void 0;for(a in t)if(t.hasOwnProperty(a)){var s=u.default.findDOMNode(r[a]);if(!s)return;var l=s.offsetTop;(void 0===i||l ), use or
instead of.'),L.default.cloneElement(e,{className:n,size:c||S(a)})}return(0,k.isValidElement)(e)?e:L.default.createElement("span",{className:r+"btn-helper"},e)}),d=d,u=(0,b.default)({},T.obj.pickOthers(Object.keys(D.propTypes),y),{type:o,disabled:p,onClick:h,className:(0,x.default)(u)});return"button"!==d&&(delete u.type,u.disabled&&(delete u.onClick,u.href&&delete u.href)),L.default.createElement(d,(0,b.default)({},u,{dir:_?"rtl":void 0,onMouseUp:this.onMouseUp,ref:this.buttonRefHandler}),t,m)},r=n=D,n.propTypes=(0,b.default)({},s.default.propTypes,{prefix:a.default.string,rtl:a.default.bool,type:a.default.oneOf(["primary","secondary","normal"]),size:a.default.oneOf(["small","medium","large"]),icons:a.default.shape({loading:a.default.node}),iconSize:a.default.oneOfType([a.default.oneOf(["xxs","xs","small","medium","large","xl","xxl","xxxl","inherit"]),a.default.number]),htmlType:a.default.oneOf(["submit","reset","button"]),component:a.default.oneOf(["button","a","div","span"]),loading:a.default.bool,ghost:a.default.oneOf([!0,!1,"light","dark"]),text:a.default.bool,warning:a.default.bool,disabled:a.default.bool,onClick:a.default.func,className:a.default.string,onMouseUp:a.default.func,children:a.default.node}),n.defaultProps={prefix:"next-",type:"normal",size:"medium",icons:{},htmlType:"button",component:"button",loading:!1,ghost:!1,text:!1,warning:!1,disabled:!1,onClick:function(){}},r);function D(){var e,t;(0,o.default)(this,D);for(var n=arguments.length,r=Array(n),a=0;as&&!u&&(e=e.slice(0,s),r=S.default.createElement(m.default,{key:"_count",type:"primary",size:c,animation:!1},l(f,p))),0x ',"Tag"),"readonly"!==n&&"interactive"!==n||a.log.warning("Warning: [ shape="+n+" ] is deprecated at [ Tag ]"),"secondary"===r&&a.log.warning("Warning: [ type=secondary ] is deprecated at [ Tag ]"),["count","marked","value","onChange"].forEach(function(e){e in t&&a.log.warning("Warning: [ "+e+" ] is deprecated at [ Tag ]")}),("selected"in t||"defaultSelected"in t)&&a.log.warning("Warning: [ selected|defaultSelected ] is deprecated at [ Tag ], use [ checked|defaultChecked ] at [ Tag.Selectable ] instead of it"),"closed"in t&&a.log.warning("Warning: [ closed ] is deprecated at [ Tag ], use [ onClose ] at [ Tag.Closeable ] instead of it"),"onSelect"in t&&e("onSelect"," ","Tag"),"afterClose"in t&&a.log.warning("Warning: [ afterClose ] is deprecated at [ Tag ], use [ afterClose ] at [ Tag.Closeable ] instead of it"),t}});o.Group=r.default.config(i.default),o.Selectable=r.default.config(s.default),o.Closable=r.default.config(n.default),o.Closeable=o.Closable,t.default=o,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var o=f(n(3)),i=f(n(8)),r=f(n(4)),a=f(n(5)),s=f(n(6)),l=n(0),u=f(l),d=f(n(1)),c=f(n(9));function f(e){return e&&e.__esModule?e:{default:e}}var p,s=(p=l.Component,(0,s.default)(h,p),h.prototype.render=function(){var e=this.props,t=e.className,n=e.prefix,r=e.children,a=e.rtl,e=(0,i.default)(e,["className","prefix","children","rtl"]),t=(0,c.default)((n||"next-")+"tag-group",t);return u.default.createElement("div",(0,o.default)({className:t,dir:a?"rtl":void 0},e),r)},s=l=h,l.propTypes={prefix:d.default.string,className:d.default.any,children:d.default.node,rtl:d.default.bool},l.defaultProps={prefix:"next-",rtl:!1},s);function h(){return(0,r.default)(this,h),(0,a.default)(this,p.apply(this,arguments))}s.displayName="Group",t.default=s,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=h(n(3)),a=h(n(4)),o=h(n(5)),i=h(n(6)),s=n(0),l=h(s),u=h(n(1)),d=h(n(9)),c=n(13),f=n(7),p=h(n(94));function h(e){return e&&e.__esModule?e:{default:e}}var m,n=f.func.noop,_=f.func.bindCtx,i=(m=s.Component,(0,i.default)(y,m),y.getDerivedStateFromProps=function(e,t){return void 0!==e.checked&&e.checked!==t.checked?{checked:e.checked}:null},y.prototype.handleClick=function(e){if(e&&e.preventDefault(),this.props.disabled)return!1;var t=this.state.checked;this.setState({checked:!t}),this.props.onChange(!t,e)},y.prototype.render=function(){var e=f.obj.pickOthers(["checked","defaultChecked","onChange","className","_shape","closable"],this.props),t=("checked"in this.props?this.props:this.state).checked,n=(0,d.default)(this.props.className,{checked:t});return l.default.createElement(p.default,(0,r.default)({},e,{role:"checkbox",_shape:"checkable","aria-checked":t,className:n,onClick:this.handleClick}))},i=s=y,s.propTypes={checked:u.default.bool,defaultChecked:u.default.bool,onChange:u.default.func,disabled:u.default.bool,className:u.default.any},s.defaultProps={onChange:n},i);function y(e){(0,a.default)(this,y);var t=(0,o.default)(this,m.call(this,e));return t.state={checked:"checked"in e?e.checked:e.defaultChecked||!1},_(t,["handleClick"]),t}i.displayName="Selectable",t.default=(0,c.polyfill)(i),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var c=l(n(3)),f=l(n(8)),r=l(n(4)),a=l(n(5)),o=l(n(6)),i=n(0),p=l(i),s=l(n(1)),h=l(n(94));function l(e){return e&&e.__esModule?e:{default:e}}var u,o=(u=i.Component,(0,o.default)(d,u),d.prototype.render=function(){var e=this.props,t=e.disabled,n=e.className,r=e.closeArea,a=e.onClose,o=e.afterClose,i=e.onClick,s=e.type,l=e.size,u=e.children,d=e.rtl,e=(0,f.default)(e,["disabled","className","closeArea","onClose","afterClose","onClick","type","size","children","rtl"]);return p.default.createElement(h.default,(0,c.default)({},e,{rtl:d,disabled:t,className:n,closeArea:r,onClose:a,afterClose:o,onClick:i,type:s,size:l,closable:!0}),u)},o=i=d,i.propTypes={disabled:s.default.bool,className:s.default.any,closeArea:s.default.oneOf(["tag","tail"]),onClose:s.default.func,afterClose:s.default.func,onClick:s.default.func,type:s.default.oneOf(["normal","primary"]),size:s.default.oneOf(["small","medium","large"]),children:s.default.any,rtl:s.default.bool},i.defaultProps={disabled:!1,type:"normal"},o);function d(){return(0,r.default)(this,d),(0,a.default)(this,u.apply(this,arguments))}o.displayName="Closeable",t.default=o,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var a=f(n(3)),o=f(n(8)),i=f(n(4)),s=f(n(5)),r=f(n(6)),l=f(n(0)),u=f(n(1)),d=f(n(297)),c=f(n(14));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){e.preventDefault()}var h,r=(h=d.default,(0,r.default)(m,h),m.prototype.render=function(){var e=this.props,t=e.showToggle,n=(0,o.default)(e,["showToggle"]),r=this.state,e=r.hint,r=r.htmlType,e=t?l.default.createElement(c.default,{type:e,onClick:this.toggleEye,onMouseDown:p}):null;return l.default.createElement(d.default,(0,a.default)({},n,{extra:e,htmlType:r}))},r=n=m,n.getDerivedStateFromProps=d.default.getDerivedStateFromProps,n.propTypes=(0,a.default)({},d.default.propTypes,{showToggle:u.default.bool}),n.defaultProps=(0,a.default)({},d.default.defaultProps,{showToggle:!0}),r);function m(){var e,t;(0,i.default)(this,m);for(var n=arguments.length,r=Array(n),a=0;a , as child."),r.push(t),e.props.children&&(t.children=n(e.props.children)))}),r}(e.children):t},O.prototype.fetchInfoFromBinaryChildren=function(e){function o(e,t){return t=t||0,e.forEach(function(e){e.children?t=o(e.children,t):t+=1}),t}var r=!1,a=[],i=[];(function t(){var e=0e.clientHeight,e.scrollWidth,e.clientWidth,(e={})[a]=n,e=e,i||(e[r]=n),t||(e[r]=0,e[a]=0),+n&&(e.marginBottom=-n,e.paddingBottom=n,t&&(e[a]=n)),m.dom.setStyle(this.headerNode,e))},o.prototype.render=function(){var e=this.props,t=e.components,n=e.className,r=e.prefix,a=e.fixedHeader,o=e.lockType,i=e.dataSource,e=(e.maxBodyHeight,(0,u.default)(e,["components","className","prefix","fixedHeader","lockType","dataSource","maxBodyHeight"]));return a&&((t=(0,l.default)({},t)).Header||(t.Header=_.default),t.Body||(t.Body=y.default),t.Wrapper||(t.Wrapper=g.default),n=(0,h.default)(((a={})[r+"table-fixed"]=!0,a[r+"table-wrap-empty"]=!i.length,a[n]=n,a))),f.default.createElement(s,(0,l.default)({},e,{dataSource:i,lockType:o,components:t,className:n,prefix:r}))},o}(f.default.Component),e.FixedHeader=_.default,e.FixedBody=y.default,e.FixedWrapper=g.default,e.propTypes=(0,l.default)({hasHeader:a.default.bool,fixedHeader:a.default.bool,maxBodyHeight:a.default.oneOfType([a.default.number,a.default.string])},s.propTypes),e.defaultProps=(0,l.default)({},s.defaultProps,{hasHeader:!0,fixedHeader:!1,maxBodyHeight:200,components:{},refs:{},prefix:"next-"}),e.childContextTypes={fixedHeader:a.default.bool,getNode:a.default.func,onFixedScrollSync:a.default.func,getTableInstanceForFixed:a.default.func,maxBodyHeight:a.default.oneOfType([a.default.number,a.default.string])},t);return t.displayName="FixedTable",(0,o.statics)(t,s),t};var f=i(n(0)),a=i(n(1)),p=n(11),h=i(n(9)),m=n(7),_=i(n(64)),y=i(n(308)),g=i(n(65)),o=n(25);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(8)),f=o(n(3)),a=o(n(4)),s=o(n(5)),l=o(n(6));t.default=function(o){var e,t=(t=e=function(n){function r(e,t){(0,a.default)(this,r);var c=(0,s.default)(this,n.call(this,e,t));return c.addSelection=function(e){var t=c.props,n=t.prefix,r=t.rowSelection,t=t.size,r=r.columnProps&&r.columnProps()||{};e.find(function(e){return"selection"===e.key})||e.unshift((0,f.default)({key:"selection",title:c.renderSelectionHeader.bind(c),cell:c.renderSelectionBody.bind(c),width:"small"===t?34:50,className:n+"table-selection "+n+"table-prerow",__normalized:!0},r))},c.renderSelectionHeader=function(){var e=c.selectAllRow,t={},n=c.props,r=n.rowSelection,a=n.primaryKey,o=n.dataSource,i=n.entireDataSource,s=n.locale,l=c.state.selectedRowKeys,n=r.mode||"multiple",u=!!l.length,d=!1;c.flatDataSource(i||o).filter(function(e,t){return!r.getProps||!(r.getProps(e,t)||{}).disabled}).map(function(e){return e[a]}).forEach(function(e){-1===l.indexOf(e)?u=!1:d=!0}),t.onClick=b(function(e){e.stopPropagation()},t.onClick);o=r.titleProps&&r.titleProps()||{};return u&&(d=!1),["multiple"===n?p.default.createElement(h.default,(0,f.default)({key:"_total",indeterminate:d,"aria-label":s.selectAll,checked:u,onChange:e},t,o)):null,r.titleAddons&&r.titleAddons()]},c.renderSelectionBody=function(e,t,n){var r=c.props,a=r.rowSelection,o=r.primaryKey,i=c.state.selectedRowKeys,r=a.mode||"multiple",i=-1c.clientHeight;this.isLock()?(e=this.bodyLeftNode,t=this.bodyRightNode,r=this.getWrapperNode("right"),n=f?u:0,c=c.offsetHeight-u,f||(d[s]=0,d[l]=0),+u?(d.marginBottom=-u,d.paddingBottom=u):(d.marginBottom=-20,d.paddingBottom=20),c={"max-height":c},o||+u||(c[l]=0),+u&&(c[l]=-u),e&&_.dom.setStyle(e,c),t&&_.dom.setStyle(t,c),r&&+u&&_.dom.setStyle(r,a?"left":"right",n+"px")):(d.marginBottom=-u,d.paddingBottom=u,d[l]=0,f||(d[s]=0)),i&&_.dom.setStyle(i,d)},r.prototype.adjustHeaderSize=function(){var o=this;this.isLock()&&this.tableInc.groupChildren.forEach(function(e,t){var n=o.tableInc.groupChildren[t].length-1,r=o.getHeaderCellNode(t,n),a=o.getHeaderCellNode(t,0),n=o.getHeaderCellNode(t,0,"right"),t=o.getHeaderCellNode(t,0,"left");r&&n&&(r=r.offsetHeight,_.dom.setStyle(n,"height",r),setTimeout(function(){var e=o.tableRightInc.affixRef;return e&&e.getInstance()&&e.getInstance().updatePosition()})),a&&t&&(a=a.offsetHeight,_.dom.setStyle(t,"height",a),setTimeout(function(){var e=o.tableLeftInc.affixRef;return e&&e.getInstance()&&e.getInstance().updatePosition()}))})},r.prototype.adjustRowHeight=function(){var n=this;this.isLock()&&this.tableInc.props.dataSource.forEach(function(e,t){e=("object"===(void 0===e?"undefined":(0,a.default)(e))&&"__rowIndex"in e?e.__rowIndex:t)+(e.__expanded?"_expanded":"");n.setRowHeight(e,"left"),n.setRowHeight(e,"right")})},r.prototype.setRowHeight=function(e,t){var n=this.getRowNode(e,t),t=this.getRowNode(e),e=(w?t&&t.offsetHeight:t&&parseFloat(getComputedStyle(t).height))||"auto",t=(w?n&&n.offsetHeight:n&&parseFloat(getComputedStyle(n).height))||"auto";n&&e!==t&&_.dom.setStyle(n,"height",e)},r.prototype.getWrapperNode=function(e){e=e?e.charAt(0).toUpperCase()+e.substr(1):"";try{return(0,u.findDOMNode)(this["lock"+e+"El"])}catch(e){return null}},r.prototype.getRowNode=function(e,t){t=this["table"+(t=t?t.charAt(0).toUpperCase()+t.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(t.getRowRef(e))}catch(e){return null}},r.prototype.getHeaderCellNode=function(e,t,n){n=this["table"+(n=n?n.charAt(0).toUpperCase()+n.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(n.getHeaderCellRef(e,t))}catch(e){return null}},r.prototype.getCellNode=function(e,t,n){n=this["table"+(n=n?n.charAt(0).toUpperCase()+n.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(n.getCellRef(e,t))}catch(e){return null}},r.prototype.render=function(){var e=this.props,t=(e.children,e.columns,e.prefix),n=e.components,r=e.className,a=e.dataSource,o=e.tableWidth,i=(0,f.default)(e,["children","columns","prefix","components","className","dataSource","tableWidth"]),s=this.normalizeChildrenState(this.props),l=s.lockLeftChildren,u=s.lockRightChildren,d=s.children,e={left:this.getFlatenChildrenLength(l),right:this.getFlatenChildrenLength(u),origin:this.getFlatenChildrenLength(d)};if(this._notNeedAdjustLockLeft&&(l=[]),this._notNeedAdjustLockRight&&(u=[]),this.lockLeftChildren=l,this.lockRightChildren=u,this.isOriginLock()){(n=(0,p.default)({},n)).Body=n.Body||g.default,n.Header=n.Header||v.default,n.Wrapper=n.Wrapper||b.default,n.Row=n.Row||y.default;r=(0,m.default)(((s={})[t+"table-lock"]=!0,s[t+"table-wrap-empty"]=!a.length,s[r]=r,s)),u=[h.default.createElement(c,(0,p.default)({},i,{dataSource:a,key:"lock-left",columns:l,className:t+"table-lock-left",lengths:e,prefix:t,lockType:"left",components:n,ref:this.saveLockLeftRef,loading:!1,"aria-hidden":!0})),h.default.createElement(c,(0,p.default)({},i,{dataSource:a,key:"lock-right",columns:u,className:t+"table-lock-right",lengths:e,prefix:t,lockType:"right",components:n,ref:this.saveLockRightRef,loading:!1,"aria-hidden":!0}))];return h.default.createElement(c,(0,p.default)({},i,{tableWidth:o,dataSource:a,columns:d,prefix:t,lengths:e,wrapperContent:u,components:n,className:r}))}return h.default.createElement(c,this.props)},r}(h.default.Component),e.LockRow=y.default,e.LockBody=g.default,e.LockHeader=v.default,e.propTypes=(0,p.default)({scrollToCol:r.default.number,scrollToRow:r.default.number},c.propTypes),e.defaultProps=(0,p.default)({},c.defaultProps),e.childContextTypes={getTableInstance:r.default.func,getLockNode:r.default.func,onLockBodyScroll:r.default.func,onRowMouseEnter:r.default.func,onRowMouseLeave:r.default.func},t);return t.displayName="LockTable",(0,M.statics)(t,c),t};var l=n(0),h=c(l),u=n(11),r=c(n(1)),m=c(n(9)),d=c(n(96)),_=n(7),y=c(n(98)),g=c(n(309)),v=c(n(310)),b=c(n(65)),M=n(25);function c(e){return e&&e.__esModule?e:{default:e}}var w=_.env.ieVersion;function k(e){return function n(e){return e.map(function(e){var t=(0,p.default)({},e);return e.children&&(e.children=n(e.children)),t})}(e)}e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var l=s(n(8)),u=s(n(3)),a=s(n(4)),o=s(n(5)),i=s(n(6));t.default=function(s){var e,t=(t=e=function(n){function r(e,t){(0,a.default)(this,r);var d=(0,o.default)(this,n.call(this,e));return d.state={},d.updateOffsetArr=function(){var e=d.splitChildren||{},t=e.lockLeftChildren,n=e.lockRightChildren,r=e.originChildren,a=d.getFlatenChildren(t).length,e=d.getFlatenChildren(n).length,r=a+e+d.getFlatenChildren(r).length,a=0i.top-e.offset?(r?(a.position="absolute",a.top=o-(i.top-e.offset),n.position="relative"):(a.position="fixed",a.top=e.offset+t.top),u._setAffixStyle(a,!0),u._setContainerStyle(n)):e.bottom&&on&&(t.current=n),this.setState(t),this.props.onPageSizeChange(e)},H.prototype.renderPageTotal=function(){var e=this.props,t=e.prefix,n=e.total,r=e.totalRender,a=this.state,e=a.currentPageSize,a=a.current;return O.default.createElement("div",{className:t+"pagination-total"},r(n,[(a-1)*e+1,a*e]))},H.prototype.renderPageItem=function(e){var t=this.props,n=t.prefix,r=t.size,a=t.link,o=t.pageNumberRender,i=t.total,s=t.pageSize,l=t.locale,t=this.state.current,s=j(i,s),t=parseInt(e,10)===t,t={size:r,className:(0,N.default)(((r={})[n+"pagination-item"]=!0,r[n+"current"]=t,r)),onClick:t?m:this.onPageItemClick.bind(this,e)};return a&&(t.component="a",t.href=a.replace("{page}",e)),O.default.createElement(c.default,(0,E.default)({"aria-label":P.str.template(l.total,{current:e,total:s})},t,{key:e}),o(e))},H.prototype.renderPageFirst=function(e){var t=this.props,n=t.prefix,r=t.size,a=t.shape,t=t.locale,r={disabled:e<=1,size:r,className:(0,N.default)(((r={})[n+"pagination-item"]=!0,r[n+"prev"]=!0,r)),onClick:this.onPageItemClick.bind(this,e-1)},n=O.default.createElement(d.default,{type:"arrow-left",className:n+"pagination-icon-prev"});return O.default.createElement(c.default,(0,E.default)({},r,{"aria-label":P.str.template(t.labelPrev,{current:e})}),n,"arrow-only"===a||"arrow-prev-only"===a||"no-border"===a?"":t.prev)},H.prototype.renderPageLast=function(e,t){var n=this.props,r=n.prefix,a=n.size,o=n.shape,n=n.locale,a={disabled:t<=e,size:a,className:(0,N.default)(((a={})[r+"pagination-item"]=!0,a[r+"next"]=!0,a)),onClick:this.onPageItemClick.bind(this,e+1)},r=O.default.createElement(d.default,{type:"arrow-right",className:r+"pagination-icon-next"});return O.default.createElement(c.default,(0,E.default)({},a,{"aria-label":P.str.template(n.labelNext,{current:e})}),"arrow-only"===o||"no-border"===o?"":n.next,r)},H.prototype.renderPageEllipsis=function(e){var t=this.props.prefix;return O.default.createElement(d.default,{className:t+"pagination-ellipsis "+t+"pagination-icon-ellipsis",type:"ellipsis",key:"ellipsis-"+e})},H.prototype.renderPageJump=function(){var t=this,e=this.props,n=e.prefix,r=e.size,a=e.locale,e=this.state.inputValue;return[O.default.createElement("span",{className:n+"pagination-jump-text"},a.goTo),O.default.createElement(f.default,{className:n+"pagination-jump-input",type:"text","aria-label":a.inputAriaLabel,size:r,value:e,onChange:this.onInputChange.bind(this),onKeyDown:function(e){e.keyCode===P.KEYCODE.ENTER&&t.handleJump(e)}}),O.default.createElement("span",{className:n+"pagination-jump-text"},a.page),O.default.createElement(c.default,{className:n+"pagination-jump-go",size:r,onClick:this.handleJump},a.go)]},H.prototype.renderPageDisplay=function(e,t){var n=this.props,r=n.prefix,n=n.pageNumberRender;return O.default.createElement("span",{className:r+"pagination-display"},O.default.createElement("em",null,n(e)),"/",n(t))},H.prototype.renderPageList=function(e,t){var n=this.props,r=n.prefix,a=n.pageShowCount,o=[];if(t<=a)for(var i=1;i<=t;i++)o.push(this.renderPageItem(i));else{var s=a-3,n=parseInt(s/2,10),a=void 0,l=void 0;o.push(this.renderPageItem(1)),l=e+n,(a=e-n)<=1&&(l=(a=2)+s),2, or explicitly pass "'+d+'" as a prop to "'+a+'".'),n.initSelector(),n.initSubscription(),n}P(e,r);var t=e.prototype;return t.getChildContext=function(){var e=this.propsMode?null:this.subscription,t={};return t[p]=e||this.context[p],t},t.componentDidMount=function(){u&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},t.componentWillReceiveProps=function(e){this.selector.run(e)},t.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},t.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=re,this.store=null,this.selector.run=re,this.selector.shouldComponentUpdate=!1},t.getWrappedInstance=function(){return q()(c,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+s+"() call."),this.wrappedInstance},t.setWrappedInstance=function(e){this.wrappedInstance=e},t.initSelector=function(){var n,r,a,e=i(this.store.dispatch,o);this.selector=(n=e,r=this.store,a={run:function(e){try{var t=n(r.getState(),e);t===a.props&&!a.error||(a.shouldComponentUpdate=!0,a.props=t,a.error=null)}catch(e){a.shouldComponentUpdate=!0,a.error=e}}}),this.selector.run(this.props)},t.initSubscription=function(){var e;u&&(e=(this.propsMode?this.props:this.context)[p],this.subscription=new X(this.store,e,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription))},t.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(ne)):this.notifyNestedSubs()},t.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},t.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},t.addExtraProps=function(e){if(!(c||l||this.propsMode&&this.subscription))return e;e=U({},e);return c&&(e.ref=this.setWrappedInstance),l&&(e[l]=this.renderCount++),this.propsMode&&this.subscription&&(e[p]=this.subscription),e},t.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return Object(y.createElement)(n,this.addExtraProps(e.props))},e}(y.Component);return ee&&(e.prototype.UNSAFE_componentWillReceiveProps=e.prototype.componentWillReceiveProps,delete e.prototype.componentWillReceiveProps),e.WrappedComponent=n,e.displayName=a,e.childContextTypes=_,e.contextTypes=m,e.propTypes=m,$()(e,n)}}var oe=Object.prototype.hasOwnProperty;function ie(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function se(e,t){if(ie(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=0;a outside a "),this.isStatic()&&this.perform()},tt.prototype.componentDidMount=function(){this.isStatic()||this.perform()},tt.prototype.componentDidUpdate=function(e){var t=Re(e.to),n=Re(this.props.to);e=n,(t=t).pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&Ce(t.state,e.state)?xe()(!1,"You tried to redirect to the same route you're currently on: \""+n.pathname+n.search+'"'):this.perform()},tt.prototype.computeTo=function(e){var t=e.computedMatch,e=e.to;return t?"string"==typeof e?Ze(e,t.params):Xe({},e,{pathname:Ze(e.pathname,t.params)}):e},tt.prototype.perform=function(){var e=this.context.router.history,t=this.props.push,n=this.computeTo(this.props);t?e.push(n):e.replace(n)},tt.prototype.render=function(){return null},tt);function tt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,tt),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,et.apply(this,arguments))}E.propTypes={computedMatch:H.a.object,push:H.a.bool,from:H.a.string,to:H.a.oneOfType([H.a.string,H.a.object]).isRequired},E.defaultProps={push:!1},E.contextTypes={router:H.a.shape({history:H.a.shape({push:H.a.func.isRequired,replace:H.a.func.isRequired}).isRequired,staticContext:H.a.object}).isRequired};var nt=E,rt=Object.assign||function(e){for(var t=1;t may have only one child element"),this.unlisten=r.listen(function(){e.setState({match:e.computeMatch(r.location.pathname)})})},it.prototype.componentWillReceiveProps=function(e){xe()(this.props.history===e.history,"You cannot change ")},it.prototype.componentWillUnmount=function(){this.unlisten()},it.prototype.render=function(){var e=this.props.children;return e?_.a.Children.only(e):null},it);function it(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,it);for(var n=arguments.length,r=Array(n),a=0;a ignores the history prop. To use a custom history, use `import { Router }` instead of `import { HashRouter as Router }`.")},dt.prototype.render=function(){return _.a.createElement(st,{history:this.history,children:this.props.children})},dt);function dt(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,dt);for(var n=arguments.length,r=Array(n),a=0;a outside a ")},yt.prototype.componentWillReceiveProps=function(e){xe()(!(e.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),xe()(!(!e.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},yt.prototype.render=function(){var i=this.context.router.route,e=this.props.children,s=this.props.location||i.location,l=void 0,u=void 0;return _.a.Children.forEach(e,function(e){var t,n,r,a,o;null==l&&_.a.isValidElement(e)&&(t=(o=e.props).path,n=o.exact,r=o.strict,a=o.sensitive,o=o.from,u=e,l=mt(s.pathname,{path:t||o,exact:n,strict:r,sensitive:a},i.match))}),l?_.a.cloneElement(u,{location:s,computedMatch:l}):null},yt);function yt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,yt),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,_t.apply(this,arguments))}J.contextTypes={router:H.a.shape({route:H.a.object.isRequired}).isRequired},J.propTypes={children:H.a.node,location:H.a.object};var gt=J,vt=Object.assign||function(e){for(var t=1;t or withRouter() outside a ");t=t.route,r=(r||t.location).pathname;return mt(r,{path:a,strict:o,exact:i,sensitive:e},t.match)},kt.prototype.componentWillMount=function(){xe()(!(this.props.component&&this.props.render),"You should not use and in the same route; will be ignored"),xe()(!(this.props.component&&this.props.children&&!Mt(this.props.children)),"You should not use and in the same route; will be ignored"),xe()(!(this.props.render&&this.props.children&&!Mt(this.props.children)),"You should not use and in the same route; will be ignored")},kt.prototype.componentWillReceiveProps=function(e,t){xe()(!(e.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),xe()(!(!e.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(e,t.router)})},kt.prototype.render=function(){var e=this.state.match,t=this.props,n=t.children,r=t.component,a=t.render,o=this.context.router,i=o.history,t=o.route,o=o.staticContext,o={match:e,location:this.props.location||t.location,history:i,staticContext:o};return r?e?_.a.createElement(r,o):null:a?e?a(o):null:"function"==typeof n?n(o):n&&!Mt(n)?_.a.Children.only(n):null},kt);function kt(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,kt);for(var n=arguments.length,r=Array(n),a=0;a 16.8.0")},p.prototype.validate=function(e,t){this.validateCallback(e,t)},p.prototype.reset=function(e){var t=1e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=r.length)return n;var o=r[a],a=e(t&&t[o],n,r,a+1);if(!t){var i=isNaN(o)?{}:[];return i[o]=a,i}if(Array.isArray(t)){i=[].concat(t);return i[o]=a,i}return(0,l.default)({},t,(0,s.default)({},o,a))};t=function(){};void 0!==e&&e.env;n.warning=t}.call(this,a(284))},function(e,t,n){"use strict";t.__esModule=!0,t.cloneAndAddKey=function(e){if(e&&(0,a.isValidElement)(e)){var t=e.key||"error";return(0,a.cloneElement)(e,{key:t})}return e},t.scrollToFirstError=function(e){var t=e.errorsGroup,n=e.options,r=e.instance;if(t&&n.scrollToFirstError){var a,o=void 0,i=void 0;for(a in t)if(t.hasOwnProperty(a)){var s=u.default.findDOMNode(r[a]);if(!s)return;var l=s.offsetTop;(void 0===i||l ), use or
instead of.'),L.default.cloneElement(e,{className:n,size:c||S(a)})}return(0,k.isValidElement)(e)?e:L.default.createElement("span",{className:r+"btn-helper"},e)}),d=d,u=(0,b.default)({},T.obj.pickOthers(Object.keys(D.propTypes),y),{type:o,disabled:p,onClick:h,className:(0,x.default)(u)});return"button"!==d&&(delete u.type,u.disabled&&(delete u.onClick,u.href&&delete u.href)),L.default.createElement(d,(0,b.default)({},u,{dir:_?"rtl":void 0,onMouseUp:this.onMouseUp,ref:this.buttonRefHandler}),t,m)},r=n=D,n.propTypes=(0,b.default)({},s.default.propTypes,{prefix:a.default.string,rtl:a.default.bool,type:a.default.oneOf(["primary","secondary","normal"]),size:a.default.oneOf(["small","medium","large"]),icons:a.default.shape({loading:a.default.node}),iconSize:a.default.oneOfType([a.default.oneOf(["xxs","xs","small","medium","large","xl","xxl","xxxl","inherit"]),a.default.number]),htmlType:a.default.oneOf(["submit","reset","button"]),component:a.default.oneOf(["button","a","div","span"]),loading:a.default.bool,ghost:a.default.oneOf([!0,!1,"light","dark"]),text:a.default.bool,warning:a.default.bool,disabled:a.default.bool,onClick:a.default.func,className:a.default.string,onMouseUp:a.default.func,children:a.default.node}),n.defaultProps={prefix:"next-",type:"normal",size:"medium",icons:{},htmlType:"button",component:"button",loading:!1,ghost:!1,text:!1,warning:!1,disabled:!1,onClick:function(){}},r);function D(){var e,t;(0,o.default)(this,D);for(var n=arguments.length,r=Array(n),a=0;as&&!u&&(e=e.slice(0,s),r=S.default.createElement(m.default,{key:"_count",type:"primary",size:c,animation:!1},l(f,p))),0x ',"Tag"),"readonly"!==n&&"interactive"!==n||a.log.warning("Warning: [ shape="+n+" ] is deprecated at [ Tag ]"),"secondary"===r&&a.log.warning("Warning: [ type=secondary ] is deprecated at [ Tag ]"),["count","marked","value","onChange"].forEach(function(e){e in t&&a.log.warning("Warning: [ "+e+" ] is deprecated at [ Tag ]")}),("selected"in t||"defaultSelected"in t)&&a.log.warning("Warning: [ selected|defaultSelected ] is deprecated at [ Tag ], use [ checked|defaultChecked ] at [ Tag.Selectable ] instead of it"),"closed"in t&&a.log.warning("Warning: [ closed ] is deprecated at [ Tag ], use [ onClose ] at [ Tag.Closeable ] instead of it"),"onSelect"in t&&e("onSelect"," ","Tag"),"afterClose"in t&&a.log.warning("Warning: [ afterClose ] is deprecated at [ Tag ], use [ afterClose ] at [ Tag.Closeable ] instead of it"),t}});o.Group=r.default.config(i.default),o.Selectable=r.default.config(s.default),o.Closable=r.default.config(n.default),o.Closeable=o.Closable,t.default=o,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var o=f(n(3)),i=f(n(8)),r=f(n(4)),a=f(n(5)),s=f(n(6)),l=n(0),u=f(l),d=f(n(1)),c=f(n(9));function f(e){return e&&e.__esModule?e:{default:e}}var p,s=(p=l.Component,(0,s.default)(h,p),h.prototype.render=function(){var e=this.props,t=e.className,n=e.prefix,r=e.children,a=e.rtl,e=(0,i.default)(e,["className","prefix","children","rtl"]),t=(0,c.default)((n||"next-")+"tag-group",t);return u.default.createElement("div",(0,o.default)({className:t,dir:a?"rtl":void 0},e),r)},s=l=h,l.propTypes={prefix:d.default.string,className:d.default.any,children:d.default.node,rtl:d.default.bool},l.defaultProps={prefix:"next-",rtl:!1},s);function h(){return(0,r.default)(this,h),(0,a.default)(this,p.apply(this,arguments))}s.displayName="Group",t.default=s,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=h(n(3)),a=h(n(4)),o=h(n(5)),i=h(n(6)),s=n(0),l=h(s),u=h(n(1)),d=h(n(9)),c=n(13),f=n(7),p=h(n(94));function h(e){return e&&e.__esModule?e:{default:e}}var m,n=f.func.noop,_=f.func.bindCtx,i=(m=s.Component,(0,i.default)(y,m),y.getDerivedStateFromProps=function(e,t){return void 0!==e.checked&&e.checked!==t.checked?{checked:e.checked}:null},y.prototype.handleClick=function(e){if(e&&e.preventDefault(),this.props.disabled)return!1;var t=this.state.checked;this.setState({checked:!t}),this.props.onChange(!t,e)},y.prototype.render=function(){var e=f.obj.pickOthers(["checked","defaultChecked","onChange","className","_shape","closable"],this.props),t=("checked"in this.props?this.props:this.state).checked,n=(0,d.default)(this.props.className,{checked:t});return l.default.createElement(p.default,(0,r.default)({},e,{role:"checkbox",_shape:"checkable","aria-checked":t,className:n,onClick:this.handleClick}))},i=s=y,s.propTypes={checked:u.default.bool,defaultChecked:u.default.bool,onChange:u.default.func,disabled:u.default.bool,className:u.default.any},s.defaultProps={onChange:n},i);function y(e){(0,a.default)(this,y);var t=(0,o.default)(this,m.call(this,e));return t.state={checked:"checked"in e?e.checked:e.defaultChecked||!1},_(t,["handleClick"]),t}i.displayName="Selectable",t.default=(0,c.polyfill)(i),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var c=l(n(3)),f=l(n(8)),r=l(n(4)),a=l(n(5)),o=l(n(6)),i=n(0),p=l(i),s=l(n(1)),h=l(n(94));function l(e){return e&&e.__esModule?e:{default:e}}var u,o=(u=i.Component,(0,o.default)(d,u),d.prototype.render=function(){var e=this.props,t=e.disabled,n=e.className,r=e.closeArea,a=e.onClose,o=e.afterClose,i=e.onClick,s=e.type,l=e.size,u=e.children,d=e.rtl,e=(0,f.default)(e,["disabled","className","closeArea","onClose","afterClose","onClick","type","size","children","rtl"]);return p.default.createElement(h.default,(0,c.default)({},e,{rtl:d,disabled:t,className:n,closeArea:r,onClose:a,afterClose:o,onClick:i,type:s,size:l,closable:!0}),u)},o=i=d,i.propTypes={disabled:s.default.bool,className:s.default.any,closeArea:s.default.oneOf(["tag","tail"]),onClose:s.default.func,afterClose:s.default.func,onClick:s.default.func,type:s.default.oneOf(["normal","primary"]),size:s.default.oneOf(["small","medium","large"]),children:s.default.any,rtl:s.default.bool},i.defaultProps={disabled:!1,type:"normal"},o);function d(){return(0,r.default)(this,d),(0,a.default)(this,u.apply(this,arguments))}o.displayName="Closeable",t.default=o,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var a=f(n(3)),o=f(n(8)),i=f(n(4)),s=f(n(5)),r=f(n(6)),l=f(n(0)),u=f(n(1)),d=f(n(297)),c=f(n(14));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){e.preventDefault()}var h,r=(h=d.default,(0,r.default)(m,h),m.prototype.render=function(){var e=this.props,t=e.showToggle,n=(0,o.default)(e,["showToggle"]),r=this.state,e=r.hint,r=r.htmlType,e=t?l.default.createElement(c.default,{type:e,onClick:this.toggleEye,onMouseDown:p}):null;return l.default.createElement(d.default,(0,a.default)({},n,{extra:e,htmlType:r}))},r=n=m,n.getDerivedStateFromProps=d.default.getDerivedStateFromProps,n.propTypes=(0,a.default)({},d.default.propTypes,{showToggle:u.default.bool}),n.defaultProps=(0,a.default)({},d.default.defaultProps,{showToggle:!0}),r);function m(){var e,t;(0,i.default)(this,m);for(var n=arguments.length,r=Array(n),a=0;a , as child."),r.push(t),e.props.children&&(t.children=n(e.props.children)))}),r}(e.children):t},O.prototype.fetchInfoFromBinaryChildren=function(e){function o(e,t){return t=t||0,e.forEach(function(e){e.children?t=o(e.children,t):t+=1}),t}var r=!1,a=[],i=[];(function t(){var e=0e.clientHeight,e.scrollWidth,e.clientWidth,(e={})[a]=n,e=e,i||(e[r]=n),t||(e[r]=0,e[a]=0),+n&&(e.marginBottom=-n,e.paddingBottom=n,t&&(e[a]=n)),m.dom.setStyle(this.headerNode,e))},o.prototype.render=function(){var e=this.props,t=e.components,n=e.className,r=e.prefix,a=e.fixedHeader,o=e.lockType,i=e.dataSource,e=(e.maxBodyHeight,(0,u.default)(e,["components","className","prefix","fixedHeader","lockType","dataSource","maxBodyHeight"]));return a&&((t=(0,l.default)({},t)).Header||(t.Header=_.default),t.Body||(t.Body=y.default),t.Wrapper||(t.Wrapper=g.default),n=(0,h.default)(((a={})[r+"table-fixed"]=!0,a[r+"table-wrap-empty"]=!i.length,a[n]=n,a))),f.default.createElement(s,(0,l.default)({},e,{dataSource:i,lockType:o,components:t,className:n,prefix:r}))},o}(f.default.Component),e.FixedHeader=_.default,e.FixedBody=y.default,e.FixedWrapper=g.default,e.propTypes=(0,l.default)({hasHeader:a.default.bool,fixedHeader:a.default.bool,maxBodyHeight:a.default.oneOfType([a.default.number,a.default.string])},s.propTypes),e.defaultProps=(0,l.default)({},s.defaultProps,{hasHeader:!0,fixedHeader:!1,maxBodyHeight:200,components:{},refs:{},prefix:"next-"}),e.childContextTypes={fixedHeader:a.default.bool,getNode:a.default.func,onFixedScrollSync:a.default.func,getTableInstanceForFixed:a.default.func,maxBodyHeight:a.default.oneOfType([a.default.number,a.default.string])},t);return t.displayName="FixedTable",(0,o.statics)(t,s),t};var f=i(n(0)),a=i(n(1)),p=n(11),h=i(n(9)),m=n(7),_=i(n(64)),y=i(n(308)),g=i(n(65)),o=n(25);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(8)),f=o(n(3)),a=o(n(4)),s=o(n(5)),l=o(n(6));t.default=function(o){var e,t=(t=e=function(n){function r(e,t){(0,a.default)(this,r);var c=(0,s.default)(this,n.call(this,e,t));return c.addSelection=function(e){var t=c.props,n=t.prefix,r=t.rowSelection,t=t.size,r=r.columnProps&&r.columnProps()||{};e.find(function(e){return"selection"===e.key})||e.unshift((0,f.default)({key:"selection",title:c.renderSelectionHeader.bind(c),cell:c.renderSelectionBody.bind(c),width:"small"===t?34:50,className:n+"table-selection "+n+"table-prerow",__normalized:!0},r))},c.renderSelectionHeader=function(){var e=c.selectAllRow,t={},n=c.props,r=n.rowSelection,a=n.primaryKey,o=n.dataSource,i=n.entireDataSource,s=n.locale,l=c.state.selectedRowKeys,n=r.mode||"multiple",u=!!l.length,d=!1;c.flatDataSource(i||o).filter(function(e,t){return!r.getProps||!(r.getProps(e,t)||{}).disabled}).map(function(e){return e[a]}).forEach(function(e){-1===l.indexOf(e)?u=!1:d=!0}),t.onClick=b(function(e){e.stopPropagation()},t.onClick);o=r.titleProps&&r.titleProps()||{};return u&&(d=!1),["multiple"===n?p.default.createElement(h.default,(0,f.default)({key:"_total",indeterminate:d,"aria-label":s.selectAll,checked:u,onChange:e},t,o)):null,r.titleAddons&&r.titleAddons()]},c.renderSelectionBody=function(e,t,n){var r=c.props,a=r.rowSelection,o=r.primaryKey,i=c.state.selectedRowKeys,r=a.mode||"multiple",i=-1c.clientHeight;this.isLock()?(e=this.bodyLeftNode,t=this.bodyRightNode,r=this.getWrapperNode("right"),n=f?u:0,c=c.offsetHeight-u,f||(d[s]=0,d[l]=0),+u?(d.marginBottom=-u,d.paddingBottom=u):(d.marginBottom=-20,d.paddingBottom=20),c={"max-height":c},o||+u||(c[l]=0),+u&&(c[l]=-u),e&&_.dom.setStyle(e,c),t&&_.dom.setStyle(t,c),r&&+u&&_.dom.setStyle(r,a?"left":"right",n+"px")):(d.marginBottom=-u,d.paddingBottom=u,d[l]=0,f||(d[s]=0)),i&&_.dom.setStyle(i,d)},r.prototype.adjustHeaderSize=function(){var o=this;this.isLock()&&this.tableInc.groupChildren.forEach(function(e,t){var n=o.tableInc.groupChildren[t].length-1,r=o.getHeaderCellNode(t,n),a=o.getHeaderCellNode(t,0),n=o.getHeaderCellNode(t,0,"right"),t=o.getHeaderCellNode(t,0,"left");r&&n&&(r=r.offsetHeight,_.dom.setStyle(n,"height",r),setTimeout(function(){var e=o.tableRightInc.affixRef;return e&&e.getInstance()&&e.getInstance().updatePosition()})),a&&t&&(a=a.offsetHeight,_.dom.setStyle(t,"height",a),setTimeout(function(){var e=o.tableLeftInc.affixRef;return e&&e.getInstance()&&e.getInstance().updatePosition()}))})},r.prototype.adjustRowHeight=function(){var n=this;this.isLock()&&this.tableInc.props.dataSource.forEach(function(e,t){e=("object"===(void 0===e?"undefined":(0,a.default)(e))&&"__rowIndex"in e?e.__rowIndex:t)+(e.__expanded?"_expanded":"");n.setRowHeight(e,"left"),n.setRowHeight(e,"right")})},r.prototype.setRowHeight=function(e,t){var n=this.getRowNode(e,t),t=this.getRowNode(e),e=(w?t&&t.offsetHeight:t&&parseFloat(getComputedStyle(t).height))||"auto",t=(w?n&&n.offsetHeight:n&&parseFloat(getComputedStyle(n).height))||"auto";n&&e!==t&&_.dom.setStyle(n,"height",e)},r.prototype.getWrapperNode=function(e){e=e?e.charAt(0).toUpperCase()+e.substr(1):"";try{return(0,u.findDOMNode)(this["lock"+e+"El"])}catch(e){return null}},r.prototype.getRowNode=function(e,t){t=this["table"+(t=t?t.charAt(0).toUpperCase()+t.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(t.getRowRef(e))}catch(e){return null}},r.prototype.getHeaderCellNode=function(e,t,n){n=this["table"+(n=n?n.charAt(0).toUpperCase()+n.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(n.getHeaderCellRef(e,t))}catch(e){return null}},r.prototype.getCellNode=function(e,t,n){n=this["table"+(n=n?n.charAt(0).toUpperCase()+n.substr(1):"")+"Inc"];try{return(0,u.findDOMNode)(n.getCellRef(e,t))}catch(e){return null}},r.prototype.render=function(){var e=this.props,t=(e.children,e.columns,e.prefix),n=e.components,r=e.className,a=e.dataSource,o=e.tableWidth,i=(0,f.default)(e,["children","columns","prefix","components","className","dataSource","tableWidth"]),s=this.normalizeChildrenState(this.props),l=s.lockLeftChildren,u=s.lockRightChildren,d=s.children,e={left:this.getFlatenChildrenLength(l),right:this.getFlatenChildrenLength(u),origin:this.getFlatenChildrenLength(d)};if(this._notNeedAdjustLockLeft&&(l=[]),this._notNeedAdjustLockRight&&(u=[]),this.lockLeftChildren=l,this.lockRightChildren=u,this.isOriginLock()){(n=(0,p.default)({},n)).Body=n.Body||g.default,n.Header=n.Header||v.default,n.Wrapper=n.Wrapper||b.default,n.Row=n.Row||y.default;r=(0,m.default)(((s={})[t+"table-lock"]=!0,s[t+"table-wrap-empty"]=!a.length,s[r]=r,s)),u=[h.default.createElement(c,(0,p.default)({},i,{dataSource:a,key:"lock-left",columns:l,className:t+"table-lock-left",lengths:e,prefix:t,lockType:"left",components:n,ref:this.saveLockLeftRef,loading:!1,"aria-hidden":!0})),h.default.createElement(c,(0,p.default)({},i,{dataSource:a,key:"lock-right",columns:u,className:t+"table-lock-right",lengths:e,prefix:t,lockType:"right",components:n,ref:this.saveLockRightRef,loading:!1,"aria-hidden":!0}))];return h.default.createElement(c,(0,p.default)({},i,{tableWidth:o,dataSource:a,columns:d,prefix:t,lengths:e,wrapperContent:u,components:n,className:r}))}return h.default.createElement(c,this.props)},r}(h.default.Component),e.LockRow=y.default,e.LockBody=g.default,e.LockHeader=v.default,e.propTypes=(0,p.default)({scrollToCol:r.default.number,scrollToRow:r.default.number},c.propTypes),e.defaultProps=(0,p.default)({},c.defaultProps),e.childContextTypes={getTableInstance:r.default.func,getLockNode:r.default.func,onLockBodyScroll:r.default.func,onRowMouseEnter:r.default.func,onRowMouseLeave:r.default.func},t);return t.displayName="LockTable",(0,M.statics)(t,c),t};var l=n(0),h=c(l),u=n(11),r=c(n(1)),m=c(n(9)),d=c(n(96)),_=n(7),y=c(n(98)),g=c(n(309)),v=c(n(310)),b=c(n(65)),M=n(25);function c(e){return e&&e.__esModule?e:{default:e}}var w=_.env.ieVersion;function k(e){return function n(e){return e.map(function(e){var t=(0,p.default)({},e);return e.children&&(e.children=n(e.children)),t})}(e)}e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var l=s(n(8)),u=s(n(3)),a=s(n(4)),o=s(n(5)),i=s(n(6));t.default=function(s){var e,t=(t=e=function(n){function r(e,t){(0,a.default)(this,r);var d=(0,o.default)(this,n.call(this,e));return d.state={},d.updateOffsetArr=function(){var e=d.splitChildren||{},t=e.lockLeftChildren,n=e.lockRightChildren,r=e.originChildren,a=d.getFlatenChildren(t).length,e=d.getFlatenChildren(n).length,r=a+e+d.getFlatenChildren(r).length,a=0i.top-e.offset?(r?(a.position="absolute",a.top=o-(i.top-e.offset),n.position="relative"):(a.position="fixed",a.top=e.offset+t.top),u._setAffixStyle(a,!0),u._setContainerStyle(n)):e.bottom&&on&&(t.current=n),this.setState(t),this.props.onPageSizeChange(e)},H.prototype.renderPageTotal=function(){var e=this.props,t=e.prefix,n=e.total,r=e.totalRender,a=this.state,e=a.currentPageSize,a=a.current;return O.default.createElement("div",{className:t+"pagination-total"},r(n,[(a-1)*e+1,a*e]))},H.prototype.renderPageItem=function(e){var t=this.props,n=t.prefix,r=t.size,a=t.link,o=t.pageNumberRender,i=t.total,s=t.pageSize,l=t.locale,t=this.state.current,s=j(i,s),t=parseInt(e,10)===t,t={size:r,className:(0,N.default)(((r={})[n+"pagination-item"]=!0,r[n+"current"]=t,r)),onClick:t?m:this.onPageItemClick.bind(this,e)};return a&&(t.component="a",t.href=a.replace("{page}",e)),O.default.createElement(c.default,(0,E.default)({"aria-label":P.str.template(l.total,{current:e,total:s})},t,{key:e}),o(e))},H.prototype.renderPageFirst=function(e){var t=this.props,n=t.prefix,r=t.size,a=t.shape,t=t.locale,r={disabled:e<=1,size:r,className:(0,N.default)(((r={})[n+"pagination-item"]=!0,r[n+"prev"]=!0,r)),onClick:this.onPageItemClick.bind(this,e-1)},n=O.default.createElement(d.default,{type:"arrow-left",className:n+"pagination-icon-prev"});return O.default.createElement(c.default,(0,E.default)({},r,{"aria-label":P.str.template(t.labelPrev,{current:e})}),n,"arrow-only"===a||"arrow-prev-only"===a||"no-border"===a?"":t.prev)},H.prototype.renderPageLast=function(e,t){var n=this.props,r=n.prefix,a=n.size,o=n.shape,n=n.locale,a={disabled:t<=e,size:a,className:(0,N.default)(((a={})[r+"pagination-item"]=!0,a[r+"next"]=!0,a)),onClick:this.onPageItemClick.bind(this,e+1)},r=O.default.createElement(d.default,{type:"arrow-right",className:r+"pagination-icon-next"});return O.default.createElement(c.default,(0,E.default)({},a,{"aria-label":P.str.template(n.labelNext,{current:e})}),"arrow-only"===o||"no-border"===o?"":n.next,r)},H.prototype.renderPageEllipsis=function(e){var t=this.props.prefix;return O.default.createElement(d.default,{className:t+"pagination-ellipsis "+t+"pagination-icon-ellipsis",type:"ellipsis",key:"ellipsis-"+e})},H.prototype.renderPageJump=function(){var t=this,e=this.props,n=e.prefix,r=e.size,a=e.locale,e=this.state.inputValue;return[O.default.createElement("span",{className:n+"pagination-jump-text"},a.goTo),O.default.createElement(f.default,{className:n+"pagination-jump-input",type:"text","aria-label":a.inputAriaLabel,size:r,value:e,onChange:this.onInputChange.bind(this),onKeyDown:function(e){e.keyCode===P.KEYCODE.ENTER&&t.handleJump(e)}}),O.default.createElement("span",{className:n+"pagination-jump-text"},a.page),O.default.createElement(c.default,{className:n+"pagination-jump-go",size:r,onClick:this.handleJump},a.go)]},H.prototype.renderPageDisplay=function(e,t){var n=this.props,r=n.prefix,n=n.pageNumberRender;return O.default.createElement("span",{className:r+"pagination-display"},O.default.createElement("em",null,n(e)),"/",n(t))},H.prototype.renderPageList=function(e,t){var n=this.props,r=n.prefix,a=n.pageShowCount,o=[];if(t<=a)for(var i=1;i<=t;i++)o.push(this.renderPageItem(i));else{var s=a-3,n=parseInt(s/2,10),a=void 0,l=void 0;o.push(this.renderPageItem(1)),l=e+n,(a=e-n)<=1&&(l=(a=2)+s),2, or explicitly pass "'+d+'" as a prop to "'+a+'".'),n.initSelector(),n.initSubscription(),n}P(e,r);var t=e.prototype;return t.getChildContext=function(){var e=this.propsMode?null:this.subscription,t={};return t[p]=e||this.context[p],t},t.componentDidMount=function(){u&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},t.componentWillReceiveProps=function(e){this.selector.run(e)},t.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},t.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=re,this.store=null,this.selector.run=re,this.selector.shouldComponentUpdate=!1},t.getWrappedInstance=function(){return q()(c,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+s+"() call."),this.wrappedInstance},t.setWrappedInstance=function(e){this.wrappedInstance=e},t.initSelector=function(){var n,r,a,e=i(this.store.dispatch,o);this.selector=(n=e,r=this.store,a={run:function(e){try{var t=n(r.getState(),e);t===a.props&&!a.error||(a.shouldComponentUpdate=!0,a.props=t,a.error=null)}catch(e){a.shouldComponentUpdate=!0,a.error=e}}}),this.selector.run(this.props)},t.initSubscription=function(){var e;u&&(e=(this.propsMode?this.props:this.context)[p],this.subscription=new X(this.store,e,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription))},t.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(ne)):this.notifyNestedSubs()},t.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},t.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},t.addExtraProps=function(e){if(!(c||l||this.propsMode&&this.subscription))return e;e=U({},e);return c&&(e.ref=this.setWrappedInstance),l&&(e[l]=this.renderCount++),this.propsMode&&this.subscription&&(e[p]=this.subscription),e},t.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return Object(y.createElement)(n,this.addExtraProps(e.props))},e}(y.Component);return ee&&(e.prototype.UNSAFE_componentWillReceiveProps=e.prototype.componentWillReceiveProps,delete e.prototype.componentWillReceiveProps),e.WrappedComponent=n,e.displayName=a,e.childContextTypes=_,e.contextTypes=m,e.propTypes=m,$()(e,n)}}var oe=Object.prototype.hasOwnProperty;function ie(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function se(e,t){if(ie(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=0;a outside a "),this.isStatic()&&this.perform()},tt.prototype.componentDidMount=function(){this.isStatic()||this.perform()},tt.prototype.componentDidUpdate=function(e){var t=Re(e.to),n=Re(this.props.to);e=n,(t=t).pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&Ce(t.state,e.state)?xe()(!1,"You tried to redirect to the same route you're currently on: \""+n.pathname+n.search+'"'):this.perform()},tt.prototype.computeTo=function(e){var t=e.computedMatch,e=e.to;return t?"string"==typeof e?Ze(e,t.params):Xe({},e,{pathname:Ze(e.pathname,t.params)}):e},tt.prototype.perform=function(){var e=this.context.router.history,t=this.props.push,n=this.computeTo(this.props);t?e.push(n):e.replace(n)},tt.prototype.render=function(){return null},tt);function tt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,tt),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,et.apply(this,arguments))}E.propTypes={computedMatch:H.a.object,push:H.a.bool,from:H.a.string,to:H.a.oneOfType([H.a.string,H.a.object]).isRequired},E.defaultProps={push:!1},E.contextTypes={router:H.a.shape({history:H.a.shape({push:H.a.func.isRequired,replace:H.a.func.isRequired}).isRequired,staticContext:H.a.object}).isRequired};var nt=E,rt=Object.assign||function(e){for(var t=1;t may have only one child element"),this.unlisten=r.listen(function(){e.setState({match:e.computeMatch(r.location.pathname)})})},it.prototype.componentWillReceiveProps=function(e){xe()(this.props.history===e.history,"You cannot change ")},it.prototype.componentWillUnmount=function(){this.unlisten()},it.prototype.render=function(){var e=this.props.children;return e?_.a.Children.only(e):null},it);function it(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,it);for(var n=arguments.length,r=Array(n),a=0;a ignores the history prop. To use a custom history, use `import { Router }` instead of `import { HashRouter as Router }`.")},dt.prototype.render=function(){return _.a.createElement(st,{history:this.history,children:this.props.children})},dt);function dt(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,dt);for(var n=arguments.length,r=Array(n),a=0;a outside a ")},yt.prototype.componentWillReceiveProps=function(e){xe()(!(e.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),xe()(!(!e.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},yt.prototype.render=function(){var i=this.context.router.route,e=this.props.children,s=this.props.location||i.location,l=void 0,u=void 0;return _.a.Children.forEach(e,function(e){var t,n,r,a,o;null==l&&_.a.isValidElement(e)&&(t=(o=e.props).path,n=o.exact,r=o.strict,a=o.sensitive,o=o.from,u=e,l=mt(s.pathname,{path:t||o,exact:n,strict:r,sensitive:a},i.match))}),l?_.a.cloneElement(u,{location:s,computedMatch:l}):null},yt);function yt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,yt),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,_t.apply(this,arguments))}J.contextTypes={router:H.a.shape({route:H.a.object.isRequired}).isRequired},J.propTypes={children:H.a.node,location:H.a.object};var gt=J,vt=Object.assign||function(e){for(var t=1;t or withRouter() outside a ");t=t.route,r=(r||t.location).pathname;return mt(r,{path:a,strict:o,exact:i,sensitive:e},t.match)},kt.prototype.componentWillMount=function(){xe()(!(this.props.component&&this.props.render),"You should not use and in the same route; will be ignored"),xe()(!(this.props.component&&this.props.children&&!Mt(this.props.children)),"You should not use and in the same route; will be ignored"),xe()(!(this.props.render&&this.props.children&&!Mt(this.props.children)),"You should not use and in the same route; will be ignored")},kt.prototype.componentWillReceiveProps=function(e,t){xe()(!(e.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),xe()(!(!e.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(e,t.router)})},kt.prototype.render=function(){var e=this.state.match,t=this.props,n=t.children,r=t.component,a=t.render,o=this.context.router,i=o.history,t=o.route,o=o.staticContext,o={match:e,location:this.props.location||t.location,history:i,staticContext:o};return r?e?_.a.createElement(r,o):null:a?e?a(o):null:"function"==typeof n?n(o):n&&!Mt(n)?_.a.Children.only(n):null},kt);function kt(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,kt);for(var n=arguments.length,r=Array(n),a=0;acom.alibaba.nacossync
nacossync-parent
- 0.4.7
+ ${revision}
nacossync-console
nacossync-worker
@@ -25,17 +25,45 @@
pom
+ 0.4.8
+ 2.5.14
+ 2020.0.2
UTF-8
+ 3.4.9
+ 4.1.0
+ 1.10.19
+ 1.4.2
+ 1.18.2
+ 3.0.0
+ 1.3.1
+ 3.12.0
+ 30.1-jre
+ 2.2
1.8
1.8
- 2.4.5
+ 3.2.0
+ 1.4.1
+ 3.0.1
+ 3.8.1
+ 3.0.2
+ 2.20
+ 3.1.1
+ 2.7
+ 0.7.8
+ 3.0.4
+ 3.0.2
+ 4.3.0
+ 1.1.0
+ 1.0.2
+ 1.0-beta-4
+ 1.7.17
git@github.com:nacos-group/nacos-sync.git
scm:git@github.com:nacos-group/nacos-sync.git
scm:git@github.com:nacos-group/nacos-sync.git
- nacossync-0.4.6
+ nacos-sync-${project.version}
@@ -58,7 +86,14 @@
org.springframework.boot
spring-boot-dependencies
- ${spring.boot.version}
+ ${spring-boot.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
pom
import
@@ -66,7 +101,87 @@
org.projectlombok
lombok
provided
- 1.18.2
+ ${lombok.verison}
+
+
+ org.mockito
+ mockito-all
+ ${mockito.version}
+ test
+
+
+ io.springfox
+ springfox-swagger2
+ ${swagger.verison}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${swagger.verison}
+
+
+ com.alibaba.nacos
+ nacos-client
+ ${nacos-client.verison}
+
+
+
+ org.apache.zookeeper
+ zookeeper
+ ${zookeeper.version}
+
+
+ slf4j-log4j12
+ org.slf4j
+
+
+
+
+ org.apache.curator
+ curator-recipes
+ ${curator.version}
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+
+
+ org.apache.curator
+ curator-framework
+ ${curator.version}
+
+
+ org.apache.curator
+ curator-client
+ ${curator.version}
+
+
+ slf4j-api
+ org.slf4j
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commoms-lang3.verison}
+
+
+ com.google.guava
+ guava
+ ${guava.verison}
+
+
+ com.ning
+ async-http-client
+ ${async-http-client.version}
+
+
+ ${project.groupId}
+ nacossync-worker
+ ${project.version}
@@ -76,22 +191,22 @@
org.codehaus.mojo
versions-maven-plugin
- 2.2
+ ${versions-maven-plugin.version}
com.github.vongosling
dependency-mediator-maven-plugin
- 1.0.2
+ ${dependency-mediator-maven-plugin.version}
org.codehaus.mojo
clirr-maven-plugin
- 2.7
+ ${clirr-maven-plugin.version}
org.apache.maven.plugins
maven-enforcer-plugin
- 1.4.1
+ ${maven-enforcer-plugin.version}
enforce-ban-circular-dependencies
@@ -110,14 +225,14 @@
org.codehaus.mojo
extra-enforcer-rules
- 1.0-beta-4
+ ${extra-enforcer-rules.version}
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ ${maven-compiler-plugin.version}
${maven.compiler.source}
${maven.compiler.target}
@@ -126,11 +241,10 @@
true
-
org.apache.maven.plugins
maven-source-plugin
- 3.0.1
+ ${maven-source-plugin.version}
attach-sources
@@ -143,7 +257,7 @@
org.apache.maven.plugins
maven-resources-plugin
- 3.0.2
+ ${maven-resources-plugin.version}
${project.build.sourceEncoding}
@@ -152,12 +266,12 @@
org.eluder.coveralls
coveralls-maven-plugin
- 4.3.0
+ ${coveralls-maven-plugin.version}
org.jacoco
jacoco-maven-plugin
- 0.7.8
+ ${jacoco-maven-plugin.version}
default-prepare-agent
@@ -196,7 +310,6 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.20
1
true
@@ -206,12 +319,40 @@
org.codehaus.mojo
findbugs-maven-plugin
- 3.0.4
+ ${findbugs-maven-plugin.version}
org.sonarsource.scanner.maven
sonar-maven-plugin
- 3.0.2
+ ${sonar-maven-plugin.version}
+
+
+ org.codehaus.mojo
+ flatten-maven-plugin
+ ${flatten-maven-plugin.version}
+
+ true
+ resolveCiFriendliesOnly
+
+ expand
+
+
+
+
+ flatten
+ process-resources
+
+ flatten
+
+
+
+ flatten.clean
+ clean
+
+ clean
+
+
+