diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index da04fd312e7..73d1c482388 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -21,7 +21,7 @@ A clear and concise description of what the bug is. **Expected behavior** A clear and concise description of what you expected to happen. -**Acutally behavior** +**Actually behavior** A clear and concise description of what you actually to happen. **How to Reproduce** @@ -29,7 +29,7 @@ Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' -4. See error +4. See errors **Desktop (please complete the following information):** - OS: [e.g. Centos] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdc09b1c430..36e0e079d31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,4 +34,8 @@ jobs: - name: Build with Maven run: mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U - name: Test With Maven - run: mvn -Prelease-nacos clean test -DforkCount=0 + run: mvn -Prelease-nacos clean test -DtrimStackTrace=false + - name: Codecov + uses: codecov/codecov-action@v3.1.0 + with: + files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./plugin-default-impl/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc926b5db61..f345f29c586 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,42 +17,42 @@ Nacos welcome new participants of any role, including user, contributor, committ ![](http://acm-public.oss-cn-hangzhou.aliyuncs.com/contributor_definition.png) -We encourage new comers actively join in Nacos projects and involving from user role to committer role, and even PMC role. In order to accomplish this, new comers needs to actively contribute in Nacos project. The following paragraph introduce how to contribute in Nacos way. +We encourage newcomers actively joining in Nacos projects and involving from user roles to committer roles, and even PMC roles. In order to accomplish this, new comers needs to actively contribute in Nacos project. The following paragraph introduce how to contribute in Nacos way. #### Open / pickup an issue for preparation -If you find a typo in document, find a bug in code, or want new features, or want to give suggestions, you can [open an issue on GitHub](https://github.com/alibaba/Nacos/issues/new) to report it. +If you find a typo in a document, find a bug in code or want new features, or want to give suggestions, you can [open an issue on GitHub](https://github.com/alibaba/Nacos/issues/new) to report it. If you just want to contribute directly you can choose the issue below. - [Contribution Welcome](https://github.com/alibaba/nacos/labels/contribution%20welcome): Heavily needed issue, but currently short of hand. -- [good first issue](https://github.com/alibaba/nacos/labels/good%20first%20issue): Good for newcomers, new comer can pickup one for warm-up. +- [good first issue](https://github.com/alibaba/nacos/labels/good%20first%20issue): Good for newcomers, newcomers can pick up one for warm-up. We strongly value documentation and integration with other projects such as Spring Cloud, Kubernetes, Dubbo, etc. We are very glad to work on any issue for these aspects. -Please note that any PR must be associated with a valid issue. Otherwise the PR will be rejected. +Please note that any PR must be associated with a valid issue. Otherwise, the PR will be rejected. -#### Begin your contribute +#### Begin your contribution Now if you want to contribute, please create a new pull request. -We use the `develop` branch as the development branch, which indicates that this is a unstable branch. +We use the `develop` branch as the development branch, which indicates that this is an unstable branch. -Further more, our branching model complies to [https://nvie.com/posts/a-successful-git-branching-model/](https://nvie.com/posts/a-successful-git-branching-model/). We strongly suggest new comers walk through the above article before creating PR. +Furthermore, our branching model complies with [https://nvie.com/posts/a-successful-git-branching-model/](https://nvie.com/posts/a-successful-git-branching-model/). We strongly suggest new comers walk through the above article before creating PR. Now, if you are ready to create PR, here is the workflow for contributors: 1. Fork to your own -2. Clone fork to local repository +2. Clone fork to a local repository 3. Create a new branch and work on it 4. Keep your branch in sync -5. Commit your changes (make sure your commit message concise) +5. Commit your changes (make sure your commit message is concise) 6. Push your commits to your forked repository @@ -73,7 +73,7 @@ When creating pull request: 6. After creating a PR, one or more reviewers will be assigned to the pull request. -7. Before merging a PR, squash any fix review feedback, typo, merged, and rebased sorts of commits. The final commit message should be clear and concise. +7. Before merging a PR, squash any fix review feedback, typo, merged and rebased sorts of commits. The final commit message should be clear and concise. If your PR contains large changes, e.g. component refactor or new components, please write detailed documents about its design and usage. @@ -86,7 +86,7 @@ Some principles: - Readability - Important code should be well-documented. API should have Javadoc. Code style should be complied with the existing one. -- Elegance: New functions, classes or components should be well designed. +- Elegance: New functions, classes or components should be well-designed. - Testability - 80% of the new code should be covered by unit test cases. @@ -106,7 +106,7 @@ Generally speaking, contribute 8 non-trivial patches and get at least three diff - ability to write good code (last but certainly not least) -A current committer nominates you by slacking the team on the Nacos issue with label "nomination" +A current committer nominates you by slacking the team on the Nacos issue with the label "nomination" - your first and last name @@ -114,10 +114,10 @@ A current committer nominates you by slacking the team on the Nacos issue with l - an explanation of why you should be a committer, -- Elaborate the top 3 PR and the associated issues the nominator has worked with you that can demonstrate your ability. +- Elaborate on the top 3 PR and the associated issues the nominator has worked with you that can demonstrate your ability. -Two other committer need to second your nomination. If no one objects in 5 working days (China), you're a committer. If anyone objects or wants more information, the committers discuss and usually come to a consensus (within the 5 working days). If issues cannot be resolved, there's a vote among current committers. +Two other committers need to second your nomination. If no one objects in 5 working days (China), you're a committer. If anyone objects or wants more information, the committers discuss and usually come to a consensus (within the 5 working days). If issues cannot be resolved, there's a vote among current committers. ![](http://acm-public.oss-cn-hangzhou.aliyuncs.com/nomination_process.png) diff --git a/REPORTING-BUGS.md b/REPORTING-BUGS.md index e8e075430b7..4d600e6c7e8 100644 --- a/REPORTING-BUGS.md +++ b/REPORTING-BUGS.md @@ -1,14 +1,14 @@ -# How to Reporting bugs +# How to report bugs If any part of the Nacos project has bugs or documentation mistakes, please let us know by [opening an issue][Nacos-issue]. We treat bugs and mistakes very seriously and believe no issue is too small, anyOne is implement. Before creating a bug report, please check that an issue reporting the same problem does not already exist. To make the bug report accurate and easy to understand, please try to create bug reports that are: -- Specific. Include as much details as possible: which version, what environment, what configuration, etc. If the bug is related to running the Nacos server, please attach the Nacos log (the starting log with Nacos configuration is especially important). +- Specific. Include as many details as possible: which version, what environment, what configuration, etc. If the bug is related to running the Nacos server, please attach the Nacos log (the starting log with Nacos configuration is especially important). - Reproducible. Include the steps to reproduce the problem. We understand some issues might be hard to reproduce, please includes the steps that might lead to the problem. If possible, please attach the affected Nacos data dir and stack strace to the bug report. -- Unique. Do not duplicate existing bug report. +- Unique. Do not duplicate the existing bug report. It may be worthwhile to read [Elika Etemad’s article on filing good bug reports][filing-good-bugs] before creating a bug report. diff --git a/address/pom.xml b/address/pom.xml index 004dca0a308..8b0185e5dd8 100644 --- a/address/pom.xml +++ b/address/pom.xml @@ -46,6 +46,11 @@ + + org.springframework.boot + spring-boot-starter-test + test + diff --git a/address/src/main/java/com/alibaba/nacos/address/config/AddressServerSecurityConfiguration.java b/address/src/main/java/com/alibaba/nacos/address/config/AddressServerSecurityConfiguration.java new file mode 100644 index 00000000000..e6e09e9ee02 --- /dev/null +++ b/address/src/main/java/com/alibaba/nacos/address/config/AddressServerSecurityConfiguration.java @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.address.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +/** + * nacos web security configuration. + * @author onewe + */ +@Configuration +@Order(99) +public class AddressServerSecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeHttpRequests(requestMatcherRegistry -> requestMatcherRegistry.mvcMatchers("/nacos/v1/as/**").authenticated()) + .csrf().disable().httpBasic(); + } +} diff --git a/address/src/main/java/com/alibaba/nacos/address/controller/AddressServerClusterController.java b/address/src/main/java/com/alibaba/nacos/address/controller/AddressServerClusterController.java index fef68f10c56..6ec2425d43d 100644 --- a/address/src/main/java/com/alibaba/nacos/address/controller/AddressServerClusterController.java +++ b/address/src/main/java/com/alibaba/nacos/address/controller/AddressServerClusterController.java @@ -28,7 +28,6 @@ import com.alibaba.nacos.naming.core.Service; import com.alibaba.nacos.naming.core.ServiceManager; import com.alibaba.nacos.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; @@ -48,14 +47,19 @@ @RequestMapping({AddressServerConstants.ADDRESS_SERVER_REQUEST_URL + "/nodes"}) public class AddressServerClusterController { - @Autowired - private ServiceManager serviceManager; + private final ServiceManager serviceManager; - @Autowired - private AddressServerManager addressServerManager; + private final AddressServerManager addressServerManager; + + private final AddressServerGeneratorManager addressServerGeneratorManager; + + public AddressServerClusterController(ServiceManager serviceManager, AddressServerManager addressServerManager, + AddressServerGeneratorManager addressServerGeneratorManager) { + this.serviceManager = serviceManager; + this.addressServerManager = addressServerManager; + this.addressServerGeneratorManager = addressServerGeneratorManager; + } - @Autowired - private AddressServerGeneratorManager addressServerGeneratorManager; /** * Create new cluster. @@ -146,7 +150,7 @@ public ResponseEntity deleteCluster(@RequestParam(required = false) Stri List instanceList = addressServerGeneratorManager .generateInstancesByIps(serviceName, rawProductName, clusterName, ipArray); serviceManager.removeInstance(Constants.DEFAULT_NAMESPACE_ID, serviceName, false, - instanceList.toArray(new Instance[instanceList.size()])); + instanceList.toArray(new Instance[0])); } else { responseEntity = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(checkResult); } diff --git a/address/src/main/java/com/alibaba/nacos/address/controller/ServerListController.java b/address/src/main/java/com/alibaba/nacos/address/controller/ServerListController.java index c310ecb9c9c..0fc03b0fd1a 100644 --- a/address/src/main/java/com/alibaba/nacos/address/controller/ServerListController.java +++ b/address/src/main/java/com/alibaba/nacos/address/controller/ServerListController.java @@ -21,7 +21,6 @@ import com.alibaba.nacos.naming.core.Cluster; import com.alibaba.nacos.naming.core.Service; import com.alibaba.nacos.naming.core.ServiceManager; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -38,11 +37,15 @@ @RestController public class ServerListController { - @Autowired - private ServiceManager serviceManager; + private final ServiceManager serviceManager; - @Autowired - private AddressServerGeneratorManager addressServerBuilderManager; + private final AddressServerGeneratorManager addressServerBuilderManager; + + public ServerListController(ServiceManager serviceManager, + AddressServerGeneratorManager addressServerBuilderManager) { + this.serviceManager = serviceManager; + this.addressServerBuilderManager = addressServerBuilderManager; + } /** * Get cluster. diff --git a/address/src/test/java/com/alibaba/nacos/address/AddressServerControllerTests.java b/address/src/test/java/com/alibaba/nacos/address/AddressServerControllerTests.java index 03ae0c9a556..285b279ba7b 100644 --- a/address/src/test/java/com/alibaba/nacos/address/AddressServerControllerTests.java +++ b/address/src/test/java/com/alibaba/nacos/address/AddressServerControllerTests.java @@ -16,167 +16,233 @@ package com.alibaba.nacos.address; +import com.alibaba.nacos.common.codec.Base64; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.LinkedMultiValueMap; -import java.util.HashMap; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.TimeUnit; +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, properties = { + "spring.security.user.password=123456", "spring.security.user.name=user"}) public class AddressServerControllerTests { - private static final String PRODUCT_NACOS = "nacos"; - private static final String PRODUCT_CONFIG = "config"; private static final String PRODUCT_NAMING = "naming"; - private static final String DEFAULT_URL_CLUSTER = "serverlist"; - - private static final String GET_SERVERLIST_URL_FORMART = "http://127.0.0.1:8080/%s/%s"; + private static final String HTTP_BASIC_INFO = getHttpBasicInfo(); - //-----------------product=nacos,cluster=DEFAULT -------------------// + @Autowired + private TestRestTemplate restTemplate; - @Test - public void postCluster() { - - String ips = "127.0.0.100,127.0.0.102,127.0.0.104"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - String response = SimpleHttpTestUtils.doPost("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + @BeforeClass + public static void before() { + System.setProperty("nacos.standalone", "true"); + System.setProperty("embeddedStorage", "true"); } - @Test - public void getCluster() { - - String getUrl = String.format(GET_SERVERLIST_URL_FORMART, PRODUCT_NACOS, DEFAULT_URL_CLUSTER); - String response = SimpleHttpTestUtils.doGet(getUrl, new HashMap<>(), "UTF-8"); - System.err.println(response); + @AfterClass + public static void teardown() { + System.clearProperty("nacos.standalone"); + System.clearProperty("embeddedStorage"); } - @Test - public void deleteCluster() { - HashMap deleteIp = new HashMap<>(); - deleteIp.put("ips", "127.0.0.104"); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", deleteIp, "UTF-8"); - System.err.println(response); - } - - @Test - public void deleteClusterWithSpecIp() { - HashMap params = new HashMap<>(); - params.put("ips", "127.0.0.103"); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + private static String getHttpBasicInfo() { + String userName = "user"; + String password = "123456"; + + String info = userName + ":" + password; + + final byte[] bytes = Base64.encodeBase64(info.getBytes(StandardCharsets.UTF_8)); + + return "Basic " + new String(bytes, StandardCharsets.UTF_8); } @Test - public void putCluster() { + public void postClusterWithoutLogin() { + + String ips = "127.0.0.100,127.0.0.102,127.0.0.104"; + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", ips); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").body(params), String.class); - String ips = "127.0.0.114"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - String response = SimpleHttpTestUtils.doPut("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + Assert.assertEquals(postClusterResponseEntity.getStatusCode(), HttpStatus.UNAUTHORIZED); } - //-----------------product=config,cluster=cluster01 -------------------// - @Test - public void postClusterWithProduct() { + public void postCluster() throws InterruptedException { + + String ips = "127.0.0.100,127.0.0.102,127.0.0.104"; + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", ips); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity getClusterResponseEntity = restTemplate.exchange( + RequestEntity.get("/nacos/serverlist").build(), String.class); + + Assert.assertNotNull(getClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), getClusterResponseEntity.getStatusCodeValue()); - String ips = "127.0.0.101,127.0.0.102,127.0.0.103"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - params.put("product", PRODUCT_CONFIG); - String response = SimpleHttpTestUtils.doPost("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); } @Test - public void getClusterWithProduct() { - HashMap params = new HashMap<>(); - String getUrl = String.format(GET_SERVERLIST_URL_FORMART, PRODUCT_CONFIG, DEFAULT_URL_CLUSTER); - String response = SimpleHttpTestUtils.doGet(getUrl, params, "UTF-8"); - System.err.println(response); + public void deleteClusterWithoutLogin() { + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", "127.0.0.104"); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").body(params), String.class); + Assert.assertEquals(postClusterResponseEntity.getStatusCode(), HttpStatus.UNAUTHORIZED); } @Test - public void deleteClusterWithProduct() { - HashMap params = new HashMap<>(); - params.put("product", PRODUCT_CONFIG); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + public void deleteCluster() throws InterruptedException { + + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", "127.0.0.104"); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity deleteClusterResponseEntity = restTemplate.exchange( + RequestEntity.delete("/nacos/v1/as/nodes?ips={ips}", "127.0.0.104") + .header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO).build(), String.class); + + Assert.assertNotNull(deleteClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), deleteClusterResponseEntity.getStatusCodeValue()); } @Test - public void deleteClusterWithProductAndIp() { - HashMap params = new HashMap<>(); - params.put("product", PRODUCT_CONFIG); - params.put("ips", "127.0.0.196"); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + public void postClusterWithProduct() throws InterruptedException { + + LinkedMultiValueMap params = new LinkedMultiValueMap<>(2); + + String ips = "127.0.0.101,127.0.0.102,127.0.0.103"; + params.add("ips", ips); + params.add("product", PRODUCT_CONFIG); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity getClusterResponseEntity = restTemplate.exchange( + RequestEntity.get("/{product}/serverlist", PRODUCT_CONFIG).build(), String.class); + + Assert.assertNotNull(getClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), getClusterResponseEntity.getStatusCodeValue()); + + final String body = getClusterResponseEntity.getBody(); + Assert.assertNotNull(body); } @Test - public void putClusterWithProduct() { - - String ips = "127.0.0.196"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - params.put("product", PRODUCT_CONFIG); - String response = SimpleHttpTestUtils.doPut("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + public void deleteClusterWithProduct() throws InterruptedException { + + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", "127.0.0.104"); + params.add("product", PRODUCT_CONFIG); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity deleteClusterResponseEntity = restTemplate.exchange( + RequestEntity.delete("/nacos/v1/as/nodes?product={product}&ips={ips}", PRODUCT_CONFIG, "127.0.0.104") + .header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO).build(), String.class); + + Assert.assertNotNull(deleteClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), deleteClusterResponseEntity.getStatusCodeValue()); } - //-----------------product=naming,cluster=cluster01 -------------------// - @Test - public void postClusterWithProductAndCluster() { + public void postClusterWithProductAndCluster() throws InterruptedException { + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); String ips = "127.0.0.100,127.0.0.200,127.0.0.31"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - params.put("product", PRODUCT_NAMING); - params.put("cluster", "cluster01"); - String response = SimpleHttpTestUtils.doPost("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); - } - - @Test - public void getClusterWithProductAndCluster() { - HashMap params = new HashMap<>(); - String getUrl = String.format(GET_SERVERLIST_URL_FORMART, PRODUCT_NAMING, "cluster01"); - String response = SimpleHttpTestUtils.doGet(getUrl, params, "UTF-8"); - System.err.println(response); - } - - @Test - public void deleteClusterWithProductAndCluster() { - HashMap params = new HashMap<>(); - params.put("product", PRODUCT_NAMING); - params.put("cluster", "cluster01"); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + + params.add("ips", ips); + params.add("product", PRODUCT_NAMING); + params.add("cluster", "cluster01"); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity getClusterResponseEntity = restTemplate.exchange( + RequestEntity.get("/{product}/{cluster}", PRODUCT_NAMING, "cluster01").build(), String.class); + + Assert.assertNotNull(getClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), getClusterResponseEntity.getStatusCodeValue()); + + final String body = getClusterResponseEntity.getBody(); + Assert.assertNotNull(body); } @Test - public void deleteClusterWithProductAndClusterAndIp() { - HashMap params = new HashMap<>(); - params.put("product", PRODUCT_NAMING); - params.put("cluster", "cluster01"); - params.put("ips", "127.0.0.200"); - String response = SimpleHttpTestUtils.doDelete("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); + public void deleteClusterWithProductAndCluster() throws InterruptedException { + + LinkedMultiValueMap params = new LinkedMultiValueMap<>(1); + params.add("ips", "127.0.0.104"); + params.add("product", PRODUCT_NAMING); + params.add("cluster", "cluster01"); + + final ResponseEntity postClusterResponseEntity = restTemplate.exchange( + RequestEntity.post("/nacos/v1/as/nodes").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO) + .body(params), String.class); + Assert.assertNotNull(postClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), postClusterResponseEntity.getStatusCodeValue()); + + TimeUnit.MILLISECONDS.sleep(500L); + + final ResponseEntity deleteClusterResponseEntity = restTemplate.exchange( + RequestEntity.delete("/nacos/v1/as/nodes?product={product}&cluster={cluster}&ips={ips}", PRODUCT_NAMING, + "cluster01", "127.0.0.104").header(HttpHeaders.AUTHORIZATION, HTTP_BASIC_INFO).build(), + String.class); + + Assert.assertNotNull(deleteClusterResponseEntity); + Assert.assertEquals(HttpStatus.OK.value(), deleteClusterResponseEntity.getStatusCodeValue()); } - @Test - public void putClusterWithProductAndCluster() { - - String ips = "127.0.0.171"; - HashMap params = new HashMap<>(); - params.put("ips", ips); - params.put("product", PRODUCT_NAMING); - params.put("cluster", "cluster01"); - String response = SimpleHttpTestUtils.doPut("http://127.0.0.1:8080/nacos/v1/as/nodes", params, "UTF-8"); - System.err.println(response); - } } diff --git a/address/src/test/java/com/alibaba/nacos/address/SimpleHttpTestUtils.java b/address/src/test/java/com/alibaba/nacos/address/SimpleHttpTestUtils.java deleted file mode 100644 index 2a00c59c415..00000000000 --- a/address/src/test/java/com/alibaba/nacos/address/SimpleHttpTestUtils.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.alibaba.nacos.address; - -import com.alibaba.nacos.common.utils.IoUtils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; -import java.util.Map; - -public class SimpleHttpTestUtils { - - private static final String REQUEST_METHOD_DELETE = "DELETE"; - - private static final String REQUEST_METHOD_PUT = "PUT"; - - private static final String REQUEST_METHOD_POST = "POST"; - - private static final String REQUEST_METHOD_GET = "GET"; - - /** - * 连接超时. - */ - private static final int CONNECT_TIME_OUT = 2000; - - /** - * 读取数据超时. - */ - private static final int READ_TIME_OUT = 2000; - - /** - * 请求编码. - */ - public static final String REQUEST_ENCODING = "UTF-8"; - - /** - * 接收编码. - */ - public static final String RESPONSE_ENCODING = "UTF-8"; - - public static final short OK = 200; - - public static final short BAD_REQUEST = 400; - - public static final short INTERNAL_SERVER_ERROR = 500; - - public static final short PARAM_ERROR_NO_ANALYSESOR = 1000; - - /** - * 发送带参数的GET的HTTP请求. - * - * @param reqUrl HTTP请求URL - * @param paramMap 参数映射表 - * @return HTTP响应的字符串 - */ - public static String doGet(String reqUrl, Map paramMap, String recvEncoding) { - return doRequest(reqUrl, paramMap, REQUEST_METHOD_GET, recvEncoding); - } - - /** - * 发送带参数的POST的HTTP请求. - * - * @param reqUrl HTTP请求URL - * @param paramMap 参数映射表 - * @return HTTP响应的字符串 - */ - public static String doPost(String reqUrl, Map paramMap, String recvEncoding) { - return doRequest(reqUrl, paramMap, REQUEST_METHOD_POST, recvEncoding); - } - - /** - * 发送带参数的 PUT 的 HTTP 请求. - * - * @param reqUrl HTTP请求URL - * @param paramMap 参数映射表 - * @return HTTP响应的字符串 - */ - public static String doPut(String reqUrl, Map paramMap, String recvEncoding) { - return doRequest(reqUrl, paramMap, REQUEST_METHOD_PUT, recvEncoding); - } - - /** - * 发送带参数的 DELETE 的 HTTP 请求. - * - * @param reqUrl HTTP请求URL - * @param paramMap 参数映射表 - * @return HTTP响应的字符串 - */ - public static String doDelete(String reqUrl, Map paramMap, String recvEncoding) { - return doRequest(reqUrl, paramMap, REQUEST_METHOD_DELETE, recvEncoding); - } - - private static String doRequest(String reqUrl, Map paramMap, String reqMethod, - String recvEncoding) { - - return doExecute(reqUrl, paramMap, reqMethod, recvEncoding); - } - - private static String doExecute(String reqUrl, Map paramMap, String reqMethod, - String recvEncoding) { - HttpURLConnection urlCon = null; - String responseContent = null; - try { - StringBuilder params = new StringBuilder(); - if (paramMap != null) { - for (Map.Entry element : paramMap.entrySet()) { - params.append(element.getKey()); - params.append('='); - params.append(URLEncoder.encode(element.getValue(), REQUEST_ENCODING)); - params.append('&'); - } - - if (params.length() > 0) { - params = params.deleteCharAt(params.length() - 1); - } - - if (params.length() > 0 && (REQUEST_METHOD_GET.equals(reqMethod) || REQUEST_METHOD_DELETE - .equals(reqMethod))) { - reqUrl = reqUrl + "?" + params.toString(); - } - } - URL url = new URL(reqUrl); - urlCon = (HttpURLConnection) url.openConnection(); - urlCon.setRequestMethod(reqMethod); - urlCon.setConnectTimeout(CONNECT_TIME_OUT); - urlCon.setReadTimeout(READ_TIME_OUT); - urlCon.setDoOutput(true); - if (REQUEST_METHOD_POST.equals(reqMethod) || REQUEST_METHOD_PUT.equals(reqMethod)) { - byte[] b = params.toString().getBytes(); - urlCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); - urlCon.setRequestProperty("Content-Length", String.valueOf(b.length)); - urlCon.getOutputStream().write(b, 0, b.length); - urlCon.getOutputStream().flush(); - urlCon.getOutputStream().close(); - } - InputStream in = urlCon.getInputStream(); - BufferedReader rd = new BufferedReader(new InputStreamReader(in, recvEncoding)); - String tempLine = rd.readLine(); - StringBuffer tempStr = new StringBuffer(); - while (tempLine != null) { - tempStr.append(tempLine); - tempLine = rd.readLine(); - } - responseContent = tempStr.toString(); - rd.close(); - in.close(); - - urlCon.getResponseMessage(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - IoUtils.closeQuietly(urlCon); - } - return responseContent; - } - -} diff --git a/address/src/test/java/com/alibaba/nacos/address/component/AddressServerGeneratorManagerTest.java b/address/src/test/java/com/alibaba/nacos/address/component/AddressServerGeneratorManagerTest.java new file mode 100644 index 00000000000..0f42249bf54 --- /dev/null +++ b/address/src/test/java/com/alibaba/nacos/address/component/AddressServerGeneratorManagerTest.java @@ -0,0 +1,110 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.address.component; + +import com.alibaba.nacos.address.constant.AddressServerConstants; +import com.alibaba.nacos.naming.core.Instance; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class AddressServerGeneratorManagerTest { + + @Test + public void testGenerateProductName() { + AddressServerGeneratorManager manager = new AddressServerGeneratorManager(); + final String blankName = manager.generateProductName(""); + Assert.assertEquals(AddressServerConstants.ALIWARE_NACOS_DEFAULT_PRODUCT_NAME, blankName); + + final String defaultName = manager.generateProductName(AddressServerConstants.DEFAULT_PRODUCT); + Assert.assertEquals(AddressServerConstants.ALIWARE_NACOS_DEFAULT_PRODUCT_NAME, defaultName); + + final String testName = manager.generateProductName("test"); + Assert.assertEquals("nacos.as.test", testName); + + } + + @Test + public void testGenerateInstancesByIps() { + AddressServerGeneratorManager manager = new AddressServerGeneratorManager(); + final List empty = manager.generateInstancesByIps(null, null, null, null); + Assert.assertNotNull(empty); + Assert.assertTrue(empty.isEmpty()); + + String[] ipArray = new String[]{"192.168.3.1:8848", "192.168.3.2:8848", "192.168.3.3:8848"}; + final List instanceList = manager.generateInstancesByIps("DEFAULT_GROUP@@nacos.as.test", "test", "test", + ipArray); + Assert.assertNotNull(instanceList); + Assert.assertFalse(instanceList.isEmpty()); + Assert.assertEquals(3, instanceList.size()); + + final Instance instance1 = instanceList.get(0); + Assert.assertEquals("192.168.3.1", instance1.getIp()); + + final Instance instance2 = instanceList.get(1); + Assert.assertEquals("192.168.3.2", instance2.getIp()); + + final Instance instance3 = instanceList.get(2); + Assert.assertEquals("192.168.3.3", instance3.getIp()); + + } + + @Test + public void testGenerateResponseIps() { + final List instanceList = new ArrayList<>(); + Instance instance1 = new Instance(); + instance1.setIp("192.168.3.1"); + instance1.setPort(8848); + + Instance instance2 = new Instance(); + instance2.setIp("192.168.3.2"); + instance2.setPort(8848); + + Instance instance3 = new Instance(); + instance3.setIp("192.168.3.3"); + instance3.setPort(8848); + + instanceList.add(instance1); + instanceList.add(instance2); + instanceList.add(instance3); + + AddressServerGeneratorManager manager = new AddressServerGeneratorManager(); + final String ipListStr = manager.generateResponseIps(instanceList); + + StringBuilder expectStr = new StringBuilder(); + final StringBuilder ret = expectStr + .append("192.168.3.1:8848").append('\n') + .append("192.168.3.2:8848").append('\n') + .append("192.168.3.3:8848").append('\n'); + Assert.assertEquals(ret.toString(), ipListStr); + + } + + @Test + public void testGenerateNacosServiceName() { + AddressServerGeneratorManager manager = new AddressServerGeneratorManager(); + + final String containDefault = manager.generateNacosServiceName("DEFAULT_GROUP@@test"); + Assert.assertEquals("DEFAULT_GROUP@@test", containDefault); + + final String product = manager.generateNacosServiceName("product"); + Assert.assertEquals("DEFAULT_GROUP@@product", product); + } + +} diff --git a/address/src/test/java/com/alibaba/nacos/address/component/AddressServerManagerTests.java b/address/src/test/java/com/alibaba/nacos/address/component/AddressServerManagerTests.java index 4141af90f78..25c6441dbb2 100644 --- a/address/src/test/java/com/alibaba/nacos/address/component/AddressServerManagerTests.java +++ b/address/src/test/java/com/alibaba/nacos/address/component/AddressServerManagerTests.java @@ -41,4 +41,23 @@ public void getDefaultClusterNameIfEmpty() { assertEquals("otherServerList", ADDRESS_SERVER_MANAGER.getDefaultClusterNameIfEmpty("otherServerList")); } + @Test + public void testGetRawClusterName() { + assertEquals("serverList", ADDRESS_SERVER_MANAGER.getRawClusterName("serverList")); + assertEquals(AddressServerConstants.DEFAULT_GET_CLUSTER, ADDRESS_SERVER_MANAGER.getRawClusterName("")); + } + + @Test + public void testSplitIps() { + final String[] emptyArr = ADDRESS_SERVER_MANAGER.splitIps(""); + assertEquals(0, emptyArr.length); + final String[] one = ADDRESS_SERVER_MANAGER.splitIps("192.168.1.12:8848"); + assertEquals(1, one.length); + assertEquals("192.168.1.12:8848", one[0]); + final String[] two = ADDRESS_SERVER_MANAGER.splitIps("192.168.1.12:8848,192.268.3.33:8848"); + assertEquals(2, two.length); + assertEquals("192.168.1.12:8848", two[0]); + assertEquals("192.268.3.33:8848", two[1]); + } + } diff --git a/address/src/test/java/com/alibaba/nacos/address/controller/AddressServerClusterControllerTest.java b/address/src/test/java/com/alibaba/nacos/address/controller/AddressServerClusterControllerTest.java new file mode 100644 index 00000000000..366ef5008eb --- /dev/null +++ b/address/src/test/java/com/alibaba/nacos/address/controller/AddressServerClusterControllerTest.java @@ -0,0 +1,163 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.address.controller; + +import com.alibaba.nacos.address.component.AddressServerGeneratorManager; +import com.alibaba.nacos.address.component.AddressServerManager; +import com.alibaba.nacos.address.constant.AddressServerConstants; +import com.alibaba.nacos.api.common.Constants; +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.naming.core.Service; +import com.alibaba.nacos.naming.core.ServiceManager; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(MockitoJUnitRunner.class) +public class AddressServerClusterControllerTest { + + @Mock + private ServiceManager serviceManager; + + private MockMvc mockMvc; + + @Before + public void before() { + mockMvc = MockMvcBuilders.standaloneSetup(new AddressServerClusterController(serviceManager, new AddressServerManager(), + new AddressServerGeneratorManager())).build(); + } + + @Test + public void testPostCluster() throws Exception { + + mockMvc.perform(post("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.3.1,192.168.3.2")) + .andExpect(status().isOk()); + + } + + @Test + public void testPostClusterWithErrorIps() throws Exception { + mockMvc.perform(post("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.1")) + .andExpect(status().isBadRequest()); + } + + @Test + public void testPostClusterThrowException() throws Exception { + + Mockito.doThrow(new NacosException(500, "create service error")).when(serviceManager) + .createServiceIfAbsent(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), Mockito.eq( + Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"), + Mockito.eq(false), Mockito.any()); + + mockMvc.perform(post("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.1")) + .andExpect(status().isInternalServerError()); + + } + + @Test + public void testDeleteCluster() throws Exception { + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(new Service(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default")); + + mockMvc.perform(delete("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.3.1,192.168.3.2") + ).andExpect(status().isOk()); + + } + + @Test + public void testDeleteClusterCannotFindService() throws Exception { + + mockMvc.perform(delete("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.3.1,192.168.3.2") + ).andExpect(status().isNotFound()); + } + + @Test + public void testDeleteClusterEmptyIps() throws Exception { + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(new Service(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default")); + + mockMvc.perform(delete("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "") + ).andExpect(status().isBadRequest()); + } + + @Test + public void testDeleteClusterErrorIps() throws Exception { + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(new Service(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default")); + + mockMvc.perform(delete("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.1") + ).andExpect(status().isBadRequest()); + } + + @Test + public void testDeleteClusterThrowException() throws Exception { + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(new Service(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default")); + + Mockito.doThrow(new NacosException(500, "remove service error")) + .when(serviceManager) + .removeInstance(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"), + Mockito.eq(false), + Mockito.any()); + + mockMvc.perform(delete("/nacos/v1/as/nodes") + .param("product", "default") + .param("cluster", "serverList") + .param("ips", "192.168.3.1,192.168.3.2") + ).andExpect(status().isInternalServerError()); + } + +} diff --git a/address/src/test/java/com/alibaba/nacos/address/controller/ServerListControllerTest.java b/address/src/test/java/com/alibaba/nacos/address/controller/ServerListControllerTest.java new file mode 100644 index 00000000000..43fbaa9fddf --- /dev/null +++ b/address/src/test/java/com/alibaba/nacos/address/controller/ServerListControllerTest.java @@ -0,0 +1,110 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.address.controller; + +import com.alibaba.nacos.address.component.AddressServerGeneratorManager; +import com.alibaba.nacos.address.constant.AddressServerConstants; +import com.alibaba.nacos.api.common.Constants; +import com.alibaba.nacos.naming.core.Cluster; +import com.alibaba.nacos.naming.core.Instance; +import com.alibaba.nacos.naming.core.Service; +import com.alibaba.nacos.naming.core.ServiceManager; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(MockitoJUnitRunner.class) +public class ServerListControllerTest { + + @Mock + private ServiceManager serviceManager; + + private MockMvc mockMvc; + + @Before + public void before() { + this.mockMvc = MockMvcBuilders + .standaloneSetup(new ServerListController(serviceManager, new AddressServerGeneratorManager())) + .build(); + } + + @Test + public void testGetCluster() throws Exception { + + final Service service = new Service( + Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"); + + Cluster cluster = new Cluster(); + cluster.setName("serverList"); + cluster.setService(service); + + final HashMap clusterMap = new HashMap<>(1); + clusterMap.put("serverList", cluster); + service.setClusterMap(clusterMap); + + List list = new ArrayList<>(2); + list.add(new Instance("192.168.3.1", 8848)); + list.add(new Instance("192.168.3.2", 8848)); + cluster.updateIps(list, false); + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(service); + + mockMvc.perform(get("/nacos/serverList")) + .andExpect(status().isOk()); + + } + + @Test + public void testGetClusterCannotFindService() throws Exception { + + mockMvc.perform(get("/default/serverList")) + .andExpect(status().isNotFound()); + + } + + @Test + public void testGetClusterCannotFindCluster() throws Exception { + + final Service service = new Service( + Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"); + + final HashMap clusterMap = new HashMap<>(1); + service.setClusterMap(clusterMap); + + Mockito.when(serviceManager.getService(Mockito.eq(Constants.DEFAULT_NAMESPACE_ID), + Mockito.eq(Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + "nacos.as.default"))) + .thenReturn(service); + + mockMvc.perform(get("/nacos/serverList")) + .andExpect(status().isNotFound()); + + } +} diff --git a/api/pom.xml b/api/pom.xml index 34e8d182ab3..5c9a9658a35 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -97,10 +97,6 @@ io.grpc grpc-stub - - io.netty - netty-all - com.google.api.grpc proto-google-common-protos diff --git a/api/src/main/java/com/alibaba/nacos/api/common/Constants.java b/api/src/main/java/com/alibaba/nacos/api/common/Constants.java index 2d35be79a98..226a2e3a7ee 100644 --- a/api/src/main/java/com/alibaba/nacos/api/common/Constants.java +++ b/api/src/main/java/com/alibaba/nacos/api/common/Constants.java @@ -86,6 +86,10 @@ public class Constants { public static final String USERNAME = "username"; public static final String TOKEN_REFRESH_WINDOW = "tokenRefreshWindow"; + + public static final Integer SDK_GRPC_PORT_DEFAULT_OFFSET = 1000; + + public static final Integer CLUSTER_GRPC_PORT_DEFAULT_OFFSET = 1001; /** * second. @@ -184,7 +188,7 @@ public class Constants { public static final String NULL_STRING = "null"; - public static final String NUMBER_PATTERN = "^\\d+$"; + public static final String NUMBER_PATTERN_STRING = "^\\d+$"; public static final String ANY_PATTERN = ".*"; @@ -210,6 +214,8 @@ public class Constants { public static final String CHARSET_KEY = "charset"; + public static final String CLUSTER_NAME_PATTERN_STRING = "^[0-9a-zA-Z-]+$"; + /** * The constants in config directory. */ diff --git a/api/src/main/java/com/alibaba/nacos/api/config/ConfigType.java b/api/src/main/java/com/alibaba/nacos/api/config/ConfigType.java index ce5d8d0f0ae..2073183c331 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/ConfigType.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/ConfigType.java @@ -65,7 +65,7 @@ public enum ConfigType { private final String type; - private static final Map LOCAL_MAP = new HashMap(); + private static final Map LOCAL_MAP = new HashMap<>(); static { for (ConfigType configType : values()) { diff --git a/api/src/main/java/com/alibaba/nacos/api/config/convert/NacosConfigConverter.java b/api/src/main/java/com/alibaba/nacos/api/config/convert/NacosConfigConverter.java index f6527fc9c10..b66bff0e0bf 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/convert/NacosConfigConverter.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/convert/NacosConfigConverter.java @@ -36,7 +36,7 @@ public interface NacosConfigConverter { /** * Convert the Nacos' config of type S to target type T. * - * @param config the Naocs's config to convert, which must be an instance of S (never {@code null}) + * @param config the Nacos's config to convert, which must be an instance of S (never {@code null}) * @return the converted object, which must be an instance of T (potentially {@code null}) */ T convert(String config); diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/ConfigBatchListenRequest.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/ConfigBatchListenRequest.java index 5e4cc9bcb17..f01e3b32056 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/ConfigBatchListenRequest.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/ConfigBatchListenRequest.java @@ -32,7 +32,7 @@ public class ConfigBatchListenRequest extends AbstractConfigRequest { */ private boolean listen = true; - private List configListenContexts = new ArrayList(); + private List configListenContexts = new ArrayList<>(); /** * add listen config. diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigChangeBatchListenResponse.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigChangeBatchListenResponse.java index 72fc7ba5c35..6b3cc813258 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigChangeBatchListenResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigChangeBatchListenResponse.java @@ -30,7 +30,7 @@ */ public class ConfigChangeBatchListenResponse extends Response { - List changedConfigs = new ArrayList(); + List changedConfigs = new ArrayList<>(); public ConfigChangeBatchListenResponse() { } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigPublishResponse.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigPublishResponse.java index ce9f8012d2f..19b70f2fd6e 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigPublishResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigPublishResponse.java @@ -23,7 +23,7 @@ * ConfigPublishResponse. * * @author liuzunfei - * @version $Id: ConfigPubishResponse.java, v 0.1 2020年07月16日 4:59 PM liuzunfei Exp $ + * @version $Id: ConfigPublishResponse.java, v 0.1 2020年07月16日 4:59 PM liuzunfei Exp $ */ public class ConfigPublishResponse extends Response { diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigRemoveResponse.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigRemoveResponse.java index 7edf4108d9f..f32c9f4338f 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigRemoveResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ConfigRemoveResponse.java @@ -20,10 +20,10 @@ import com.alibaba.nacos.api.remote.response.ResponseCode; /** - * ConfigPubishResponse. + * ConfigRemoveResponse. * * @author liuzunfei - * @version $Id: ConfigPubishResponse.java, v 0.1 2020年07月16日 4:59 PM liuzunfei Exp $ + * @version $Id: ConfigRemoveResponse.java, v 0.1 2020年07月16日 4:59 PM liuzunfei Exp $ */ public class ConfigRemoveResponse extends Response { diff --git a/api/src/main/java/com/alibaba/nacos/api/exception/runtime/NacosDeserializationException.java b/api/src/main/java/com/alibaba/nacos/api/exception/runtime/NacosDeserializationException.java index 73c01eda832..e5c52a9bb92 100644 --- a/api/src/main/java/com/alibaba/nacos/api/exception/runtime/NacosDeserializationException.java +++ b/api/src/main/java/com/alibaba/nacos/api/exception/runtime/NacosDeserializationException.java @@ -33,6 +33,8 @@ public class NacosDeserializationException extends NacosRuntimeException { private static final String MSG_FOR_SPECIFIED_CLASS = "Nacos deserialize for class [%s] failed. "; + private static final String ERROR_MSG_FOR_SPECIFIED_CLASS = "Nacos deserialize for class [%s] failed, cause error[%s]. "; + private Class targetClass; public NacosDeserializationException() { @@ -53,12 +55,12 @@ public NacosDeserializationException(Throwable throwable) { } public NacosDeserializationException(Class targetClass, Throwable throwable) { - super(DESERIALIZE_ERROR_CODE, String.format(MSG_FOR_SPECIFIED_CLASS, targetClass.getName()), throwable); + super(DESERIALIZE_ERROR_CODE, String.format(ERROR_MSG_FOR_SPECIFIED_CLASS, targetClass.getName(), throwable.getMessage()), throwable); this.targetClass = targetClass; } public NacosDeserializationException(Type targetType, Throwable throwable) { - super(DESERIALIZE_ERROR_CODE, String.format(MSG_FOR_SPECIFIED_CLASS, targetType.toString()), throwable); + super(DESERIALIZE_ERROR_CODE, String.format(ERROR_MSG_FOR_SPECIFIED_CLASS, targetType.toString(), throwable.getMessage()), throwable); } public Class getTargetClass() { diff --git a/api/src/main/java/com/alibaba/nacos/api/grpc/auto/Payload.java b/api/src/main/java/com/alibaba/nacos/api/grpc/auto/Payload.java index 0b4ffa223ca..c39ba61f54b 100644 --- a/api/src/main/java/com/alibaba/nacos/api/grpc/auto/Payload.java +++ b/api/src/main/java/com/alibaba/nacos/api/grpc/auto/Payload.java @@ -613,8 +613,7 @@ public MetadataOrBuilder getMetadataOrBuilder() { Metadata, Metadata.Builder, MetadataOrBuilder> getMetadataFieldBuilder() { if (metadataBuilder_ == null) { - metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Metadata, Metadata.Builder, MetadataOrBuilder>( + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<>( getMetadata(), getParentForChildren(), isClean()); @@ -730,8 +729,7 @@ public com.google.protobuf.AnyOrBuilder getBodyOrBuilder() { com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> getBodyFieldBuilder() { if (bodyBuilder_ == null) { - bodyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + bodyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<>( getBody(), getParentForChildren(), isClean()); diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java b/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java index 753629acfd8..be6170cd542 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java @@ -96,6 +96,17 @@ void registerInstance(String serviceName, String groupName, String ip, int port, */ void registerInstance(String serviceName, String groupName, Instance instance) throws NacosException; + /** + * batch register instance to service with specified instance properties. + * + * @param serviceName name of service + * @param groupName group of service + * @param instances instances to register + * @throws NacosException nacos exception + * @since 2.1.1 + */ + void batchRegisterInstance(String serviceName, String groupName, List instances) throws NacosException; + /** * deregister instance from a service. * diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Cluster.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Cluster.java index 547ad6481dc..7ec16abd7ad 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Cluster.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Cluster.java @@ -66,7 +66,7 @@ public class Cluster implements Serializable { */ private boolean useIPPort4Check = true; - private Map metadata = new HashMap(); + private Map metadata = new HashMap<>(); public Cluster() { diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Instance.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Instance.java index 15a5d0d0ece..58acefe9139 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Instance.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Instance.java @@ -18,7 +18,7 @@ import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.naming.PreservedMetadataKeys; -import com.alibaba.nacos.api.utils.StringUtils; +import com.alibaba.nacos.api.naming.utils.NamingUtils; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -26,8 +26,6 @@ import java.util.HashMap; import java.util.Map; -import static com.alibaba.nacos.api.common.Constants.NUMBER_PATTERN; - /** * Instance. * @@ -88,7 +86,7 @@ public class Instance implements Serializable { /** * user extended attributes. */ - private Map metadata = new HashMap(); + private Map metadata = new HashMap<>(); public String getInstanceId() { return this.instanceId; @@ -162,7 +160,7 @@ public void setMetadata(final Map metadata) { */ public void addMetadata(final String key, final String value) { if (metadata == null) { - metadata = new HashMap(4); + metadata = new HashMap<>(4); } metadata.put(key, value); } @@ -252,7 +250,7 @@ private long getMetaDataByKeyWithDefault(final String key, final long defaultVal return defaultValue; } final String value = getMetadata().get(key); - if (!StringUtils.isEmpty(value) && value.matches(NUMBER_PATTERN)) { + if (NamingUtils.isNumber(value)) { return Long.parseLong(value); } return defaultValue; diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Service.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Service.java index 82b4580f3c9..08fa6d269ca 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Service.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/Service.java @@ -54,7 +54,7 @@ public class Service implements Serializable { */ private String groupName; - private Map metadata = new HashMap(); + private Map metadata = new HashMap<>(); public Service() { } diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java index bf6fcee3421..811177a5414 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java @@ -55,7 +55,7 @@ public class ServiceInfo { private long cacheMillis = 1000L; - private List hosts = new ArrayList(); + private List hosts = new ArrayList<>(); private long lastRefTime = 0L; @@ -77,7 +77,7 @@ public void setAllIPs(boolean allIPs) { } /** - * There is only one form of the key:groupName@@name@clusters. This constuctor used by DiskCache.read(String) and + * There is only one form of the key:groupName@@name@clusters. This constructor used by DiskCache.read(String) and * FailoverReactor.FailoverFileReader,you should know that 'groupName' must not be null,and 'clusters' can be null. */ public ServiceInfo(String key) { @@ -96,7 +96,7 @@ public ServiceInfo(String key) { this.name = keys[serviceNameIndex]; } else { //defensive programming - throw new IllegalArgumentException("Cann't parse out 'groupName',but it must not be null!"); + throw new IllegalArgumentException("Can't parse out 'groupName',but it must not be null!"); } } @@ -126,7 +126,7 @@ public void addAllHosts(List hosts) { } public List getHosts() { - return new ArrayList(hosts); + return new ArrayList<>(hosts); } public boolean isValid() { @@ -187,7 +187,7 @@ public boolean validate() { return false; } - List validHosts = new ArrayList(); + List validHosts = new ArrayList<>(); for (Instance host : hosts) { if (!host.isHealthy()) { continue; diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/HealthCheckType.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/HealthCheckType.java index 53ee8539575..750f0b157b4 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/HealthCheckType.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/HealthCheckType.java @@ -54,7 +54,7 @@ public enum HealthCheckType { * In JDK 1.6, the map need full class for general. So ignore check style. */ @SuppressWarnings("checkstyle:linelength") - private static final Map> EXTEND = new ConcurrentHashMap>(); + private static final Map> EXTEND = new ConcurrentHashMap<>(); HealthCheckType(Class healthCheckerClass) { this.healthCheckerClass = healthCheckerClass; @@ -90,7 +90,7 @@ public static Class ofHealthCheckerClass(String } public static List> getLoadedHealthCheckerClasses() { - List> all = new ArrayList>(); + List> all = new ArrayList<>(); for (HealthCheckType type : values()) { all.add(type.healthCheckerClass); } diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/impl/Http.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/impl/Http.java index 2b6fe2a1165..106b297f2e1 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/impl/Http.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/healthcheck/impl/Http.java @@ -76,7 +76,7 @@ public Map getCustomHeaders() { if (StringUtils.isBlank(headers)) { return Collections.emptyMap(); } - final Map headerMap = new HashMap(16); + final Map headerMap = new HashMap<>(16); for (final String s : headers.split(Constants.NAMING_HTTP_HEADER_SPLITTER)) { final String[] splits = s.split(":"); if (splits.length != 2) { diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/NamingRemoteConstants.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/NamingRemoteConstants.java index 7ee3b20d8a6..4eb9cccc30c 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/remote/NamingRemoteConstants.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/remote/NamingRemoteConstants.java @@ -26,6 +26,8 @@ public class NamingRemoteConstants { public static final String REGISTER_INSTANCE = "registerInstance"; + public static final String BATCH_REGISTER_INSTANCE = "batchRegisterInstance"; + public static final String DE_REGISTER_INSTANCE = "deregisterInstance"; public static final String QUERY_SERVICE = "queryService"; diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/BatchInstanceRequest.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/BatchInstanceRequest.java new file mode 100644 index 00000000000..01a67f92478 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/BatchInstanceRequest.java @@ -0,0 +1,62 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.api.naming.remote.request; + +import com.alibaba.nacos.api.naming.pojo.Instance; + +import java.util.List; + +/** + * The client registers multiple service instance request. + * + * @author chenhao26 + */ +public class BatchInstanceRequest extends AbstractNamingRequest { + + private String type; + + /** + * save all service instance. + */ + private List instances; + + public BatchInstanceRequest() { + } + + public BatchInstanceRequest(String namespace, String serviceName, String groupName, String type, + List instances) { + super(namespace, serviceName, groupName); + this.type = type; + this.instances = instances; + } + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return this.type; + } + + public List getInstances() { + return instances; + } + + public void setInstances(List instances) { + this.instances = instances; + } +} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/BatchInstanceResponse.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/BatchInstanceResponse.java new file mode 100644 index 00000000000..983941e2ba2 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/BatchInstanceResponse.java @@ -0,0 +1,40 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.api.naming.remote.response; + +import com.alibaba.nacos.api.remote.response.Response; + +/** + * batch instance response. + * + * @author chenhao26 + */ +public class BatchInstanceResponse extends Response { + + private String type; + + public BatchInstanceResponse() { + } + + public BatchInstanceResponse(String type) { + this.type = type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java b/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java index 962903b8491..5106a89ad3c 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java @@ -21,6 +21,14 @@ import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.utils.StringUtils; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; + +import static com.alibaba.nacos.api.common.Constants.CLUSTER_NAME_PATTERN_STRING; +import static com.alibaba.nacos.api.common.Constants.NUMBER_PATTERN_STRING; + /** * NamingUtils. * @@ -29,6 +37,10 @@ */ public class NamingUtils { + private static final Pattern CLUSTER_NAME_PATTERN = Pattern.compile(CLUSTER_NAME_PATTERN_STRING); + + private static final Pattern NUMBER_PATTERN = Pattern.compile(NUMBER_PATTERN_STRING); + /** * Returns a combined string with serviceName and groupName. serviceName can not be nil. * @@ -129,5 +141,45 @@ public static void checkInstanceIsLegal(Instance instance) throws NacosException throw new NacosException(NacosException.INVALID_PARAM, "Instance 'heart beat interval' must less than 'heart beat timeout' and 'ip delete timeout'."); } + if (!StringUtils.isEmpty(instance.getClusterName()) && !CLUSTER_NAME_PATTERN.matcher(instance.getClusterName()).matches()) { + throw new NacosException(NacosException.INVALID_PARAM, + String.format("Instance 'clusterName' should be characters with only 0-9a-zA-Z-. (current: %s)", + instance.getClusterName())); + } + } + + /** + * check batch register is Ephemeral. + * @param instance instance + * @throws NacosException NacosException + */ + public static void checkInstanceIsEphemeral(Instance instance) throws NacosException { + if (!instance.isEphemeral()) { + throw new NacosException(NacosException.INVALID_PARAM, + String.format("Batch registration does not allow persistent instance registration , Instance:%s", instance)); + } + } + + /** + * Batch verify the validity of instances. + * @param instances List of instances to be registered + * @throws NacosException Nacos + */ + public static void batchCheckInstanceIsLegal(List instances) throws NacosException { + Set newInstanceSet = new HashSet<>(instances); + for (Instance instance : newInstanceSet) { + checkInstanceIsEphemeral(instance); + checkInstanceIsLegal(instance); + } + } + + /** + * Check string is a number or not. + * + * @param str a string of digits + * @return if it is a string of digits, return true + */ + public static boolean isNumber(String str) { + return !StringUtils.isEmpty(str) && NUMBER_PATTERN.matcher(str).matches(); } } diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/RpcScheduledExecutor.java b/api/src/main/java/com/alibaba/nacos/api/remote/RpcScheduledExecutor.java index 5d124d54f74..5fb8dd3b870 100644 --- a/api/src/main/java/com/alibaba/nacos/api/remote/RpcScheduledExecutor.java +++ b/api/src/main/java/com/alibaba/nacos/api/remote/RpcScheduledExecutor.java @@ -17,7 +17,6 @@ package com.alibaba.nacos.api.remote; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; /** * rpc scheduler executor . @@ -34,12 +33,7 @@ public class RpcScheduledExecutor extends ScheduledThreadPoolExecutor { "com.alibaba.nacos.remote.ServerCommonScheduler"); public RpcScheduledExecutor(int corePoolSize, final String threadName) { - super(corePoolSize, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - return new Thread(r, threadName); - } - }); + super(corePoolSize, r -> new Thread(r, threadName)); } } diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/request/ConnectionSetupRequest.java b/api/src/main/java/com/alibaba/nacos/api/remote/request/ConnectionSetupRequest.java index 746908cabd2..56e94dad21f 100644 --- a/api/src/main/java/com/alibaba/nacos/api/remote/request/ConnectionSetupRequest.java +++ b/api/src/main/java/com/alibaba/nacos/api/remote/request/ConnectionSetupRequest.java @@ -35,7 +35,7 @@ public class ConnectionSetupRequest extends InternalRequest { private String tenant; - private Map labels = new HashMap(); + private Map labels = new HashMap<>(); public ConnectionSetupRequest() { } diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestMeta.java b/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestMeta.java index 0376a22c289..82eba58db1b 100644 --- a/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestMeta.java +++ b/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestMeta.java @@ -33,7 +33,7 @@ public class RequestMeta { private String clientVersion = ""; - private Map labels = new HashMap(); + private Map labels = new HashMap<>(); /** * Getter method for property clientVersion. diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/response/ErrorResponse.java b/api/src/main/java/com/alibaba/nacos/api/remote/response/ErrorResponse.java index 2b4da45ba3a..1dc6dddaa12 100644 --- a/api/src/main/java/com/alibaba/nacos/api/remote/response/ErrorResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/remote/response/ErrorResponse.java @@ -16,6 +16,9 @@ package com.alibaba.nacos.api.remote.response; +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.api.exception.runtime.NacosRuntimeException; + /** * UnKnowResponse. * @@ -37,4 +40,24 @@ public static Response build(int errorCode, String msg) { return response; } + /** + * build an error response. + * + * @param exception exception + * @return response + */ + public static Response build(Throwable exception) { + int errorCode; + if (exception instanceof NacosException) { + errorCode = ((NacosException) exception).getErrCode(); + } else if (exception instanceof NacosRuntimeException) { + errorCode = ((NacosRuntimeException) exception).getErrCode(); + } else { + errorCode = ResponseCode.FAIL.getCode(); + } + ErrorResponse response = new ErrorResponse(); + response.setErrorInfo(errorCode, exception.getMessage()); + return response; + } + } diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/response/ServerLoaderInfoResponse.java b/api/src/main/java/com/alibaba/nacos/api/remote/response/ServerLoaderInfoResponse.java index 44d106ab2e8..e66f2e2034a 100644 --- a/api/src/main/java/com/alibaba/nacos/api/remote/response/ServerLoaderInfoResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/remote/response/ServerLoaderInfoResponse.java @@ -29,7 +29,7 @@ public class ServerLoaderInfoResponse extends Response { String address; - Map loaderMetrics = new HashMap(); + Map loaderMetrics = new HashMap<>(); public String getMetricsValue(String key) { return loaderMetrics.get(key); diff --git a/api/src/main/proto/nacos_grpc_service.proto b/api/src/main/proto/nacos_grpc_service.proto index 797cce1d723..adf2a30a1d3 100644 --- a/api/src/main/proto/nacos_grpc_service.proto +++ b/api/src/main/proto/nacos_grpc_service.proto @@ -41,7 +41,7 @@ service Request { } service BiRequestStream { - // Sends a commonRequest + // Sends a biStreamRequest rpc requestBiStream (stream Payload) returns (stream Payload) { } } diff --git a/api/src/test/java/com/alibaba/nacos/api/naming/pojo/InstanceTest.java b/api/src/test/java/com/alibaba/nacos/api/naming/pojo/InstanceTest.java new file mode 100644 index 00000000000..7c43f7db193 --- /dev/null +++ b/api/src/test/java/com/alibaba/nacos/api/naming/pojo/InstanceTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.api.naming.pojo; + +import junit.framework.TestCase; +import org.junit.Test; + +public class InstanceTest extends TestCase { + + @Test + public void testCheckClusterNameFormat() { + Instance instance = new Instance(); + instance.setClusterName("demo"); + assertEquals("demo", instance.getClusterName()); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/alibaba/nacos/api/naming/utils/NamingUtilsTest.java b/api/src/test/java/com/alibaba/nacos/api/naming/utils/NamingUtilsTest.java index 627719174e9..38f74753f8d 100644 --- a/api/src/test/java/com/alibaba/nacos/api/naming/utils/NamingUtilsTest.java +++ b/api/src/test/java/com/alibaba/nacos/api/naming/utils/NamingUtilsTest.java @@ -16,10 +16,20 @@ package com.alibaba.nacos.api.naming.utils; +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.api.naming.PreservedMetadataKeys; +import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.utils.StringUtils; +import org.junit.Assert; import org.junit.Test; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class NamingUtilsTest { @@ -34,4 +44,126 @@ public void testGetGroupedNameOptional() { String groupNameAndServiceName = NamingUtils.getGroupedNameOptional("serviceA", "groupA"); assertEquals("groupA@@serviceA", groupNameAndServiceName); } + + @Test + public void testCheckInstanceIsLegal() throws NacosException { + // check invalid clusterName + Instance instance = new Instance(); + instance.setClusterName("cluster1,cluster2"); + try { + NamingUtils.checkInstanceIsLegal(instance); + assertTrue(false); + } catch (Exception e) { + assertTrue(NacosException.class.equals(e.getClass())); + assertEquals( + "Instance 'clusterName' should be characters with only 0-9a-zA-Z-. (current: cluster1,cluster2)", + e.getMessage()); + } + + // valid clusterName + instance.setClusterName("cluster1"); + NamingUtils.checkInstanceIsLegal(instance); + assertTrue(true); + + // check heartBeatTimeout, heartBeatInterval, ipDeleteTimeout + Map meta = new HashMap<>(); + meta.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, "1"); + meta.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, "2"); + meta.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, "1"); + instance.setMetadata(meta); + try { + NamingUtils.checkInstanceIsLegal(instance); + assertTrue(false); + } catch (Exception e) { + assertTrue(NacosException.class.equals(e.getClass())); + assertEquals( + "Instance 'heart beat interval' must less than 'heart beat timeout' and 'ip delete timeout'.", + e.getMessage()); + } + meta.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, "3"); + meta.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, "2"); + meta.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, "3"); + NamingUtils.checkInstanceIsLegal(instance); + assertTrue(true); + } + + @Test + public void testBatchCheckInstanceIsLegal() throws NacosException { + // check invalid clusterName + Instance instance = new Instance(); + instance.setClusterName("cluster1,cluster2"); + List instanceList = new ArrayList<>(); + instanceList.add(instance); + try { + NamingUtils.batchCheckInstanceIsLegal(instanceList); + assertTrue(false); + } catch (Exception e) { + assertTrue(NacosException.class.equals(e.getClass())); + assertEquals( + "Instance 'clusterName' should be characters with only 0-9a-zA-Z-. (current: cluster1,cluster2)", + e.getMessage()); + } + instanceList.remove(instance); + + // TODO valid clusterName + instance.setClusterName("cluster1"); + instanceList.add(instance); + NamingUtils.batchCheckInstanceIsLegal(instanceList); + assertTrue(true); + + instanceList.remove(instance); + + // check heartBeatTimeout, heartBeatInterval, ipDeleteTimeout + Map meta = new HashMap<>(); + meta.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, "1"); + meta.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, "2"); + meta.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, "1"); + instance.setMetadata(meta); + instanceList.add(instance); + try { + NamingUtils.batchCheckInstanceIsLegal(instanceList); + assertTrue(false); + } catch (Exception e) { + assertTrue(NacosException.class.equals(e.getClass())); + assertEquals( + "Instance 'heart beat interval' must less than 'heart beat timeout' and 'ip delete timeout'.", + e.getMessage()); + } + instanceList.remove(instance); + + meta.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, "3"); + meta.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, "2"); + meta.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, "3"); + instance.setMetadata(meta); + instanceList.add(instance); + NamingUtils.batchCheckInstanceIsLegal(instanceList); + assertTrue(true); + } + + @Test + public void testCheckInstanceIsEphemeral() throws NacosException { + Instance instance = new Instance(); + instance.setIp("127.0.0.1"); + instance.setPort(9089); + instance.setEphemeral(true); + NamingUtils.checkInstanceIsEphemeral(instance); + try { + instance = new Instance(); + instance.setIp("127.0.0.1"); + instance.setPort(9089); + instance.setEphemeral(false); + NamingUtils.checkInstanceIsEphemeral(instance); + } catch (NacosException e) { + Assert.assertEquals(e.getErrCode(), NacosException.INVALID_PARAM); + } + } + + @Test + public void testIsNumber() { + String str1 = "abc"; + assertTrue(!NamingUtils.isNumber(str1)); + + String str2 = "123456"; + assertTrue(NamingUtils.isNumber(str2)); + } } \ No newline at end of file diff --git a/api/src/test/java/com/alibaba/nacos/api/remote/response/ErrorResponseTest.java b/api/src/test/java/com/alibaba/nacos/api/remote/response/ErrorResponseTest.java new file mode 100644 index 00000000000..a5d5ea7a445 --- /dev/null +++ b/api/src/test/java/com/alibaba/nacos/api/remote/response/ErrorResponseTest.java @@ -0,0 +1,72 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.api.remote.response; + +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.api.exception.runtime.NacosRuntimeException; +import org.junit.Assert; +import org.junit.Test; + +public class ErrorResponseTest { + + @Test + public void testBuildWithErrorCode() { + int errorCode = 500; + String msg = "err msg"; + + Response response = ErrorResponse.build(errorCode, msg); + + Assert.assertEquals(errorCode, response.getErrorCode()); + Assert.assertEquals(msg, response.getMessage()); + } + + @Test + public void testBuildWithThrowable() { + String errMsg = "exception msg"; + RuntimeException runtimeException = new RuntimeException(errMsg); + + Response response = ErrorResponse.build(runtimeException); + + Assert.assertEquals(ResponseCode.FAIL.getCode(), response.getErrorCode()); + Assert.assertEquals(errMsg, response.getMessage()); + } + + @Test + public void testBuildWithNacosException() { + int errCode = 500; + String errMsg = "nacos exception msg"; + NacosException nacosException = new NacosException(errCode, errMsg); + + Response response = ErrorResponse.build(nacosException); + + Assert.assertEquals(errCode, response.getErrorCode()); + Assert.assertEquals(errMsg, response.getMessage()); + } + + @Test + public void testBuildWithNacosRuntimeException() { + int errCode = 500; + String errMsg = "nacos runtime exception msg"; + NacosRuntimeException nacosRuntimeException = new NacosRuntimeException(errCode, errMsg); + + Response response = ErrorResponse.build(nacosRuntimeException); + + Assert.assertEquals(errCode, response.getErrorCode()); + Assert.assertEquals("errCode: " + errCode + ", errMsg: " + errMsg + " ", response.getMessage()); + } + +} diff --git a/auth/src/main/java/com/alibaba/nacos/auth/config/AuthConfigs.java b/auth/src/main/java/com/alibaba/nacos/auth/config/AuthConfigs.java index 5611a0caaf4..00ee7ba9722 100644 --- a/auth/src/main/java/com/alibaba/nacos/auth/config/AuthConfigs.java +++ b/auth/src/main/java/com/alibaba/nacos/auth/config/AuthConfigs.java @@ -87,11 +87,9 @@ private void refreshPluginProperties() { for (String each : properties.stringPropertyNames()) { int typeIndex = each.indexOf('.'); String type = each.substring(0, typeIndex); - if (!newProperties.containsKey(type)) { - newProperties.put(type, new Properties()); - } String subKey = each.substring(typeIndex + 1); - newProperties.get(type).setProperty(subKey, properties.getProperty(each)); + newProperties.computeIfAbsent(type, key -> new Properties()) + .setProperty(subKey, properties.getProperty(each)); } authPluginProperties = newProperties; } catch (Exception e) { diff --git a/client/pom.xml b/client/pom.xml index 949a012afa6..7d606636c6d 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -113,11 +113,6 @@ org.apache.httpcomponents httpasyncclient - - net.jcip - jcip-annotations - true - io.prometheus diff --git a/client/src/main/java/com/alibaba/nacos/client/auth/impl/process/HttpLoginProcessor.java b/client/src/main/java/com/alibaba/nacos/client/auth/impl/process/HttpLoginProcessor.java index 5cafb05f3a9..c5b3827f9ef 100644 --- a/client/src/main/java/com/alibaba/nacos/client/auth/impl/process/HttpLoginProcessor.java +++ b/client/src/main/java/com/alibaba/nacos/client/auth/impl/process/HttpLoginProcessor.java @@ -67,8 +67,8 @@ public LoginIdentityContext getResponse(Properties properties) { url = server + contextPath + LOGIN_URL; } - Map params = new HashMap(2); - Map bodyMap = new HashMap(2); + Map params = new HashMap<>(2); + Map bodyMap = new HashMap<>(2); params.put(PropertyKeyConst.USERNAME, properties.getProperty(PropertyKeyConst.USERNAME, StringUtils.EMPTY)); bodyMap.put(PropertyKeyConst.PASSWORD, properties.getProperty(PropertyKeyConst.PASSWORD, StringUtils.EMPTY)); try { @@ -91,7 +91,7 @@ public LoginIdentityContext getResponse(Properties properties) { } return loginIdentityContext; } catch (Exception e) { - SECURITY_LOGGER.error("[ NacosClientAuthServiceImpl] login http request failed" + SECURITY_LOGGER.error("[NacosClientAuthServiceImpl] login http request failed" + " url: {}, params: {}, bodyMap: {}, errorMsg: {}", url, params, bodyMap, e.getMessage()); return null; } diff --git a/client/src/main/java/com/alibaba/nacos/client/auth/ram/identify/CredentialService.java b/client/src/main/java/com/alibaba/nacos/client/auth/ram/identify/CredentialService.java index da66bab211a..b49a848a8ee 100644 --- a/client/src/main/java/com/alibaba/nacos/client/auth/ram/identify/CredentialService.java +++ b/client/src/main/java/com/alibaba/nacos/client/auth/ram/identify/CredentialService.java @@ -31,7 +31,7 @@ public final class CredentialService implements SpasCredentialLoader { private static final Logger LOGGER = LogUtils.logger(CredentialService.class); - private static final ConcurrentHashMap INSTANCES = new ConcurrentHashMap(); + private static final ConcurrentHashMap INSTANCES = new ConcurrentHashMap<>(); private final String appName; diff --git a/client/src/main/java/com/alibaba/nacos/client/auth/ram/injector/ConfigResourceInjector.java b/client/src/main/java/com/alibaba/nacos/client/auth/ram/injector/ConfigResourceInjector.java index 8b176033fb1..7976eff769b 100644 --- a/client/src/main/java/com/alibaba/nacos/client/auth/ram/injector/ConfigResourceInjector.java +++ b/client/src/main/java/com/alibaba/nacos/client/auth/ram/injector/ConfigResourceInjector.java @@ -70,9 +70,7 @@ public void doInject(RequestResource resource, RamContext context, LoginIdentity } Map signHeaders = SpasAdapter .getSignHeaders(getResource(resource.getNamespace(), resource.getGroup()), secretKey); - if (signHeaders != null && !signHeaders.isEmpty()) { - result.setParameters(signHeaders); - } + result.setParameters(signHeaders); } private StsCredential getStsCredential() { diff --git a/client/src/main/java/com/alibaba/nacos/client/auth/ram/utils/SpasAdapter.java b/client/src/main/java/com/alibaba/nacos/client/auth/ram/utils/SpasAdapter.java index 9a6b421d14b..d317053ead1 100644 --- a/client/src/main/java/com/alibaba/nacos/client/auth/ram/utils/SpasAdapter.java +++ b/client/src/main/java/com/alibaba/nacos/client/auth/ram/utils/SpasAdapter.java @@ -45,7 +45,7 @@ public class SpasAdapter { private static final String SHA_ENCRYPT = "HmacSHA1"; public static Map getSignHeaders(String resource, String secretKey) { - Map header = new HashMap(2); + Map header = new HashMap<>(2); String timeStamp = String.valueOf(System.currentTimeMillis()); header.put(TIMESTAMP_HEADER, timeStamp); if (secretKey != null) { diff --git a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java index 9311262fbda..b196f300f32 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java @@ -97,9 +97,21 @@ public String getConfig(String dataId, String group, long timeoutMs) throws Naco @Override public String getConfigAndSignListener(String dataId, String group, long timeoutMs, Listener listener) throws NacosException { - String content = getConfig(dataId, group, timeoutMs); - worker.addTenantListenersWithContent(dataId, group, content, Arrays.asList(listener)); - return content; + group = StringUtils.isBlank(group) ? Constants.DEFAULT_GROUP : group.trim(); + ConfigResponse configResponse = worker.getAgent() + .queryConfig(dataId, group, worker.getAgent().getTenant(), timeoutMs, false); + String content = configResponse.getContent(); + String encryptedDataKey = configResponse.getEncryptedDataKey(); + worker.addTenantListenersWithContent(dataId, group, content, encryptedDataKey, Arrays.asList(listener)); + + // get a decryptContent, fix https://github.com/alibaba/nacos/issues/7039 + ConfigResponse cr = new ConfigResponse(); + cr.setDataId(dataId); + cr.setGroup(group); + cr.setContent(content); + cr.setEncryptedDataKey(encryptedDataKey); + configFilterChainManager.doFilter(null, cr); + return cr.getContent(); } @Override @@ -148,7 +160,11 @@ private String getConfigInner(String tenant, String dataId, String group, long t cr.setTenant(tenant); cr.setGroup(group); - // use local config first + // We first try to use local failover content if exists. + // A config content for failover is not created by client program automatically, + // but is maintained by user. + // This is designed for certain scenario like client emergency reboot, + // changing config needed in the same time, while nacos server is down. String content = LocalConfigInfoProcessor.getFailover(worker.getAgentName(), dataId, group, tenant); if (content != null) { LOGGER.warn("[{}] [get-config] get failover ok, dataId={}, group={}, tenant={}, config={}", @@ -177,13 +193,15 @@ private String getConfigInner(String tenant, String dataId, String group, long t LOGGER.warn("[{}] [get-config] get from server error, dataId={}, group={}, tenant={}, msg={}", worker.getAgentName(), dataId, group, tenant, ioe.toString()); } - - LOGGER.warn("[{}] [get-config] get snapshot ok, dataId={}, group={}, tenant={}, config={}", - worker.getAgentName(), dataId, group, tenant, ContentUtils.truncateContent(content)); + content = LocalConfigInfoProcessor.getSnapshot(worker.getAgentName(), dataId, group, tenant); + if (content != null) { + LOGGER.warn("[{}] [get-config] get snapshot ok, dataId={}, group={}, tenant={}, config={}", + worker.getAgentName(), dataId, group, tenant, ContentUtils.truncateContent(content)); + } cr.setContent(content); String encryptedDataKey = LocalEncryptedDataKeyProcessor - .getEncryptDataKeyFailover(agent.getName(), dataId, group, tenant); + .getEncryptDataKeySnapshot(agent.getName(), dataId, group, tenant); cr.setEncryptedDataKey(encryptedDataKey); configFilterChainManager.doFilter(null, cr); content = cr.getContent(); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigContext.java b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigContext.java index 74761586a09..142f51f67ff 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigContext.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigContext.java @@ -28,7 +28,7 @@ */ public class ConfigContext implements IConfigContext { - private final Map param = new HashMap(); + private final Map param = new HashMap<>(); @Override public Object getParameter(String key) { diff --git a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigRequest.java b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigRequest.java index 16b1d9a4eb2..404039276c6 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigRequest.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigRequest.java @@ -36,7 +36,7 @@ */ public class ConfigRequest implements IConfigRequest { - private final Map param = new HashMap(); + private final Map param = new HashMap<>(); private final IConfigContext configContext = new ConfigContext(); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigResponse.java b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigResponse.java index 6644adee18a..c5d3e4735bb 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigResponse.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigResponse.java @@ -36,7 +36,7 @@ */ public class ConfigResponse implements IConfigResponse { - private final Map param = new HashMap(); + private final Map param = new HashMap<>(); private final IConfigContext configContext = new ConfigContext(); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/http/MetricsHttpAgent.java b/client/src/main/java/com/alibaba/nacos/client/config/http/MetricsHttpAgent.java index af4d9017285..7c1e13a0340 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/http/MetricsHttpAgent.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/http/MetricsHttpAgent.java @@ -21,6 +21,7 @@ import com.alibaba.nacos.common.http.HttpRestResult; import io.prometheus.client.Histogram; +import java.util.Date; import java.util.Map; /** @@ -52,12 +53,14 @@ public void start() throws NacosException { @Override public HttpRestResult httpGet(String path, Map headers, Map paramValues, String encode, long readTimeoutMs) throws Exception { - Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor(GET, path, DEFAULT_CODE); + Date start = new Date(); + Histogram.Child histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, DEFAULT_CODE); HttpRestResult result; try { result = httpAgent.httpGet(path, headers, paramValues, encode, readTimeoutMs); + histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, String.valueOf(result.getCode())); } finally { - timer.observeDuration(); + histogram.observe(System.currentTimeMillis() - start.getTime()); } return result; @@ -66,12 +69,14 @@ public HttpRestResult httpGet(String path, Map headers, @Override public HttpRestResult httpPost(String path, Map headers, Map paramValues, String encode, long readTimeoutMs) throws Exception { - Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor(POST, path, DEFAULT_CODE); + Date start = new Date(); + Histogram.Child histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, DEFAULT_CODE); HttpRestResult result; try { result = httpAgent.httpPost(path, headers, paramValues, encode, readTimeoutMs); + histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, String.valueOf(result.getCode())); } finally { - timer.observeDuration(); + histogram.observe(System.currentTimeMillis() - start.getTime()); } return result; @@ -80,12 +85,14 @@ public HttpRestResult httpPost(String path, Map headers, @Override public HttpRestResult httpDelete(String path, Map headers, Map paramValues, String encode, long readTimeoutMs) throws Exception { - Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor(DELETE, path, DEFAULT_CODE); + Date start = new Date(); + Histogram.Child histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, DEFAULT_CODE); HttpRestResult result; try { result = httpAgent.httpDelete(path, headers, paramValues, encode, readTimeoutMs); + histogram = MetricsMonitor.getConfigRequestMonitor(GET, path, String.valueOf(result.getCode())); } finally { - timer.observeDuration(); + histogram.observe(System.currentTimeMillis() - start.getTime()); } return result; diff --git a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java index 471bb00f877..ae2d94473f5 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java @@ -225,7 +225,8 @@ private String getUrl(String serverAddr, String relativePath) { private boolean isFail(HttpRestResult result) { return result.getCode() == HttpURLConnection.HTTP_INTERNAL_ERROR || result.getCode() == HttpURLConnection.HTTP_BAD_GATEWAY - || result.getCode() == HttpURLConnection.HTTP_UNAVAILABLE; + || result.getCode() == HttpURLConnection.HTTP_UNAVAILABLE + || result.getCode() == HttpURLConnection.HTTP_NOT_FOUND; } public static String getAppname() { diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/AbstractConfigChangeParser.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/AbstractConfigChangeParser.java index a7cd5ec705c..0e8596b791e 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/AbstractConfigChangeParser.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/AbstractConfigChangeParser.java @@ -42,7 +42,7 @@ public boolean isResponsibleFor(String type) { } protected Map filterChangeData(Map oldMap, Map newMap) { - Map result = new HashMap(16); + Map result = new HashMap<>(16); for (Map.Entry e : (Iterable>) oldMap.entrySet()) { ConfigChangeItem cci; if (newMap.containsKey(e.getKey())) { diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java index 1bc230a190d..73868868828 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java @@ -18,6 +18,7 @@ import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.config.ConfigChangeEvent; +import com.alibaba.nacos.api.config.ConfigChangeItem; import com.alibaba.nacos.api.config.listener.AbstractSharedListener; import com.alibaba.nacos.api.config.listener.Listener; import com.alibaba.nacos.api.exception.NacosException; @@ -134,7 +135,7 @@ public String getContent() { public void setContent(String content) { this.content = content; - this.md5 = getMd5String(this.content); + this.md5 = getMd5String(); } /** @@ -168,13 +169,23 @@ public void setType(String type) { * * @param listener listener */ - public void addListener(Listener listener) { + public void addListener(Listener listener) throws NacosException { if (null == listener) { throw new IllegalArgumentException("listener is null"); } - ManagerListenerWrap wrap = - (listener instanceof AbstractConfigChangeListener) ? new ManagerListenerWrap(listener, md5, content) - : new ManagerListenerWrap(listener, md5); + ManagerListenerWrap wrap; + if (listener instanceof AbstractConfigChangeListener) { + ConfigResponse cr = new ConfigResponse(); + cr.setDataId(dataId); + cr.setGroup(group); + cr.setContent(content); + cr.setEncryptedDataKey(encryptedDataKey); + configFilterChainManager.doFilter(null, cr); + String contentTmp = cr.getContent(); + wrap = new ManagerListenerWrap(listener, md5, contentTmp); + } else { + wrap = new ManagerListenerWrap(listener, md5); + } if (listeners.addIfAbsent(wrap)) { LOGGER.info("[{}] [add-listener] ok, tenant={}, dataId={}, group={}, cnt={}", name, tenant, dataId, group, @@ -202,7 +213,7 @@ public void removeListener(Listener listener) { * Returns the iterator on the listener list, read-only. It is guaranteed not to return NULL. */ public List getListeners() { - List result = new ArrayList(); + List result = new ArrayList<>(); for (ManagerListenerWrap wrap : listeners) { result.add(wrap.listener); } @@ -317,11 +328,11 @@ private void safeNotifyListener(final String dataId, final String group, final S listener.receiveConfigInfo(contentTmp); // compare lastContent and content if (listener instanceof AbstractConfigChangeListener) { - Map data = ConfigChangeHandler.getInstance() - .parseChangeData(listenerWrap.lastContent, content, type); + Map data = ConfigChangeHandler.getInstance() + .parseChangeData(listenerWrap.lastContent, contentTmp, type); ConfigChangeEvent event = new ConfigChangeEvent(data); ((AbstractConfigChangeListener) listener).receiveConfigChange(event); - listenerWrap.lastContent = content; + listenerWrap.lastContent = contentTmp; } listenerWrap.lastCallMd5 = md5; @@ -331,8 +342,8 @@ private void safeNotifyListener(final String dataId, final String group, final S LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={} errCode={} errMsg={}", name, dataId, group, md5, listener, ex.getErrCode(), ex.getErrMsg()); } catch (Throwable t) { - LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={} tx={}", name, dataId, group, - md5, listener, t.getCause()); + LOGGER.error("[{}] [notify-error] dataId={}, group={}, md5={}, listener={}", name, dataId, group, md5, + listener, t); } finally { listenerWrap.inNotifying = false; Thread.currentThread().setContextClassLoader(myClassLoader); @@ -367,8 +378,8 @@ private void safeNotifyListener(final String dataId, final String group, final S name, (finishNotify - startNotify), dataId, group, md5, listener); } - public static String getMd5String(String config) { - return (null == config) ? Constants.NULL : MD5Utils.md5Hex(config, Constants.ENCODE); + public String getMd5String() { + return (null == content) ? Constants.NULL : MD5Utils.md5Hex(content, Constants.ENCODE); } private String loadCacheContentFromDiskLocal(String name, String dataId, String group, String tenant) { @@ -392,21 +403,7 @@ public void setSyncWithServer(boolean syncWithServer) { } public CacheData(ConfigFilterChainManager configFilterChainManager, String name, String dataId, String group) { - if (null == dataId || null == group) { - throw new IllegalArgumentException("dataId=" + dataId + ", group=" + group); - } - this.name = name; - this.configFilterChainManager = configFilterChainManager; - this.dataId = dataId; - this.group = group; - this.tenant = TenantUtil.getUserTenantForAcm(); - listeners = new CopyOnWriteArrayList<>(); - this.isInitializing = true; - if (initSnapshot) { - this.content = loadCacheContentFromDiskLocal(name, dataId, group, tenant); - this.md5 = getMd5String(content); - } - this.encryptedDataKey = loadEncryptedDataKeyFromDiskLocal(name, dataId, group, tenant); + this(configFilterChainManager, name, dataId, group, TenantUtil.getUserTenantForAcm()); } public CacheData(ConfigFilterChainManager configFilterChainManager, String name, String dataId, String group, @@ -414,16 +411,17 @@ public CacheData(ConfigFilterChainManager configFilterChainManager, String name, if (null == dataId || null == group) { throw new IllegalArgumentException("dataId=" + dataId + ", group=" + group); } - this.name = name; this.configFilterChainManager = configFilterChainManager; + this.name = name; this.dataId = dataId; this.group = group; this.tenant = tenant; - listeners = new CopyOnWriteArrayList<>(); + this.listeners = new CopyOnWriteArrayList<>(); this.isInitializing = true; if (initSnapshot) { this.content = loadCacheContentFromDiskLocal(name, dataId, group, tenant); - this.md5 = getMd5String(content); + this.encryptedDataKey = loadEncryptedDataKeyFromDiskLocal(name, dataId, group, tenant); + this.md5 = getMd5String(); } } @@ -453,8 +451,11 @@ private static class ManagerListenerWrap { final Listener listener; - String lastCallMd5 = CacheData.getMd5String(null); + String lastCallMd5 = Constants.NULL; + /** + * here is a decryptContent. + */ String lastContent = null; ManagerListenerWrap(Listener listener) { diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java index 93e48522cf6..7cb69a8f1b3 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java @@ -138,7 +138,7 @@ public class ClientWorker implements Closeable { * @param group group of data * @param listeners listeners */ - public void addListeners(String dataId, String group, List listeners) { + public void addListeners(String dataId, String group, List listeners) throws NacosException { group = blank2defaultGroup(group); CacheData cache = addCacheDataIfAbsent(dataId, group); synchronized (cache) { @@ -178,18 +178,20 @@ public void addTenantListeners(String dataId, String group, List listeners) throws NacosException { group = blank2defaultGroup(group); String tenant = agent.getTenant(); CacheData cache = addCacheDataIfAbsent(dataId, group, tenant); synchronized (cache) { + cache.setEncryptedDataKey(encryptedDataKey); cache.setContent(content); for (Listener listener : listeners) { cache.addListener(listener); @@ -362,6 +364,7 @@ public CacheData addCacheDataIfAbsent(String dataId, String group, String tenant // fix issue # 1317 if (enableRemoteSyncConfig) { ConfigResponse response = getServerConfig(dataId, group, tenant, 3000L, false); + cache.setEncryptedDataKey(response.getEncryptedDataKey()); cache.setContent(response.getContent()); } } @@ -432,8 +435,8 @@ private void refreshContentAndCheck(CacheData cacheData, boolean notify) { try { ConfigResponse response = getServerConfig(cacheData.dataId, cacheData.group, cacheData.tenant, 3000L, notify); - cacheData.setContent(response.getContent()); cacheData.setEncryptedDataKey(response.getEncryptedDataKey()); + cacheData.setContent(response.getContent()); if (null != response.getConfigType()) { cacheData.setType(response.getConfigType()); } @@ -521,7 +524,7 @@ private void setHealthServer(boolean isHealthServer) { public class ConfigRpcTransportClient extends ConfigTransportClient { - private final BlockingQueue listenExecutebell = new ArrayBlockingQueue(1); + private final BlockingQueue listenExecutebell = new ArrayBlockingQueue<>(1); private Object bellItem = new Object(); @@ -575,12 +578,12 @@ public void shutdown() throws NacosException { private Map getLabels() { - Map labels = new HashMap(2, 1); + Map labels = new HashMap<>(2, 1); labels.put(RemoteConstants.LABEL_SOURCE, RemoteConstants.LABEL_SOURCE_SDK); labels.put(RemoteConstants.LABEL_MODULE, RemoteConstants.LABEL_MODULE_CONFIG); labels.put(Constants.APPNAME, AppNameUtils.getAppName()); labels.put(Constants.VIPSERVER_TAG, EnvUtil.getSelfVipserverTag()); - labels.put(Constants.AMORY_TAG, EnvUtil.getSelfAmorayTag()); + labels.put(Constants.AMORY_TAG, EnvUtil.getSelfAmoryTag()); labels.put(Constants.LOCATION_TAG, EnvUtil.getSelfLocationTag()); return labels; @@ -665,7 +668,7 @@ public String getCurrentServer() { @Override public List getServerList() { - return ConfigRpcTransportClient.super.serverListManager.serverUrls; + return ConfigRpcTransportClient.super.serverListManager.getServerUrls(); } }); @@ -714,8 +717,8 @@ public void notifyListenConfig() { @Override public void executeConfigListen() { - Map> listenCachesMap = new HashMap>(16); - Map> removeListenCachesMap = new HashMap>(16); + Map> listenCachesMap = new HashMap<>(16); + Map> removeListenCachesMap = new HashMap<>(16); long now = System.currentTimeMillis(); boolean needAllSync = now - lastAllSyncTime >= ALL_SYNC_INTERNAL; for (CacheData cache : cacheMap.get().values()) { @@ -778,7 +781,7 @@ public void executeConfigListen() { rpcClient, configChangeListenRequest); if (configChangeBatchListenResponse != null && configChangeBatchListenResponse.isSuccess()) { - Set changeKeys = new HashSet(); + Set changeKeys = new HashSet<>(); //handle changed keys,notify listener if (!CollectionUtils.isEmpty(configChangeBatchListenResponse.getChangedConfigs())) { hasChangedKeys = true; @@ -1072,4 +1075,9 @@ public boolean removeConfig(String dataId, String group, String tenant, String t public String getAgentName() { return this.agent.getName(); } + + public ConfigTransportClient getAgent() { + return this.agent; + } + } diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigChangeHandler.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigChangeHandler.java index ef6f9488dba..97e4307dc39 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigChangeHandler.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigChangeHandler.java @@ -16,6 +16,7 @@ package com.alibaba.nacos.client.config.impl; +import com.alibaba.nacos.api.config.ConfigChangeItem; import com.alibaba.nacos.api.config.listener.ConfigChangeParser; import com.alibaba.nacos.common.spi.NacosServiceLoader; @@ -40,7 +41,7 @@ private static class ConfigChangeHandlerHolder { } private ConfigChangeHandler() { - this.parserList = new LinkedList(); + this.parserList = new LinkedList<>(); Collection loader = NacosServiceLoader.load(ConfigChangeParser.class); Iterator itr = loader.iterator(); @@ -65,7 +66,7 @@ public static ConfigChangeHandler getInstance() { * @return change data map * @throws IOException io exception */ - public Map parseChangeData(String oldContent, String newContent, String type) throws IOException { + public Map parseChangeData(String oldContent, String newContent, String type) throws IOException { for (ConfigChangeParser changeParser : this.parserList) { if (changeParser.isResponsibleFor(type)) { return changeParser.doParse(oldContent, newContent, type); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigTransportClient.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigTransportClient.java index 85f93187825..dcb0ca0aa95 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigTransportClient.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigTransportClient.java @@ -104,7 +104,7 @@ protected Map getSecurityHeaders(RequestResource resource) throw * @return headers. */ protected Map getCommonHeader() { - Map headers = new HashMap(16); + Map headers = new HashMap<>(16); String ts = String.valueOf(System.currentTimeMillis()); String token = MD5Utils.md5Hex(ts + ParamUtil.getAppKey(), Constants.ENCODE); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/ServerListManager.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/ServerListManager.java index 72467fa1108..85149fea636 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/ServerListManager.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/ServerListManager.java @@ -196,7 +196,7 @@ public ServerListManager(Properties properties) throws NacosException { StringTokenizer serverAddrsTokens = new StringTokenizer(this.serverAddrsStr, ",;"); while (serverAddrsTokens.hasMoreTokens()) { String serverAddr = serverAddrsTokens.nextToken().trim(); - if (serverAddr.startsWith(HTTP_PREFIX) || serverAddr.startsWith(HTTP_PREFIX)) { + if (serverAddr.startsWith(HTTP_PREFIX) || serverAddr.startsWith(HTTPS_PREFIX)) { serverAddrs.add(serverAddr); } else { String[] serverAddrArr = InternetAddressUtil.splitIPPortStr(serverAddr); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/YmlChangeParser.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/YmlChangeParser.java index acb66d67efe..8b6b22e7fd5 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/YmlChangeParser.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/YmlChangeParser.java @@ -77,7 +77,7 @@ private void handleYamlException(ConstructorException e) { } private Map getFlattenedMap(Map source) { - Map result = new LinkedHashMap(128); + Map result = new LinkedHashMap<>(128); buildFlattenedMap(result, source, null); return result; } diff --git a/client/src/main/java/com/alibaba/nacos/client/constant/Constants.java b/client/src/main/java/com/alibaba/nacos/client/constant/Constants.java index 39b6a28a20e..53a35d574e9 100644 --- a/client/src/main/java/com/alibaba/nacos/client/constant/Constants.java +++ b/client/src/main/java/com/alibaba/nacos/client/constant/Constants.java @@ -35,6 +35,8 @@ public static class SysEnv { public static final String JM_SNAPSHOT_PATH = "JM.SNAPSHOT.PATH"; + public static final String NACOS_ENVS_SEARCH = "nacos.envs.search"; + } public static class Disk { diff --git a/client/src/main/java/com/alibaba/nacos/client/env/AbstractPropertySource.java b/client/src/main/java/com/alibaba/nacos/client/env/AbstractPropertySource.java new file mode 100644 index 00000000000..3b34951d672 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/AbstractPropertySource.java @@ -0,0 +1,34 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +abstract class AbstractPropertySource { + + /** + * get property's type. + * @return name + */ + abstract SourceType getType(); + + /** + * get property, if the value can not be got by the special key, the null will be returned. + * @param key special key + * @return value or null + */ + abstract String getProperty(String key); + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/DefaultSettingPropertySource.java b/client/src/main/java/com/alibaba/nacos/client/env/DefaultSettingPropertySource.java new file mode 100644 index 00000000000..6539c698969 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/DefaultSettingPropertySource.java @@ -0,0 +1,54 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import com.alibaba.nacos.common.utils.ResourceUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; + +class DefaultSettingPropertySource extends AbstractPropertySource { + + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSettingPropertySource.class); + + private static final String DEFAULT_SETTING_PATH = "classpath:nacos_default_setting.properties"; + + private final Properties defaultSetting = new Properties(); + + DefaultSettingPropertySource() { + try { + final URL resourceUrl = ResourceUtils.getResourceUrl(DEFAULT_SETTING_PATH); + final InputStream inputStream = resourceUrl.openStream(); + defaultSetting.load(inputStream); + } catch (Exception e) { + LOGGER.warn("load default setting failed"); + } + } + + @Override + SourceType getType() { + return SourceType.DEFAULT_SETTING; + } + + @Override + String getProperty(String key) { + return defaultSetting.getProperty(key); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/JvmArgsPropertySource.java b/client/src/main/java/com/alibaba/nacos/client/env/JvmArgsPropertySource.java new file mode 100644 index 00000000000..5c4475c05f5 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/JvmArgsPropertySource.java @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.util.Properties; + +class JvmArgsPropertySource extends AbstractPropertySource { + + private final Properties properties; + + JvmArgsPropertySource() { + this.properties = System.getProperties(); + } + + @Override + SourceType getType() { + return SourceType.JVM; + } + + @Override + String getProperty(String key) { + return properties.getProperty(key); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironment.java b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironment.java new file mode 100644 index 00000000000..14269fc6dd7 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironment.java @@ -0,0 +1,90 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +/** + * nacos env interface. + * + * @author onewe + */ +public interface NacosEnvironment { + + /** + * get property, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return string value or null. + */ + String getProperty(String key); + + /** + * get property, if the value can not be got by the special key, the default value will be returned. + * @param key special key + * @param defaultValue default value + * @return string value or default value. + */ + String getProperty(String key, String defaultValue); + + /** + * get boolean, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return boolean value or null. + */ + Boolean getBoolean(String key); + + /** + * get boolean, if the value can not be got by the special key, the default value will be returned. + * @param key special key + * @param defaultValue default value + * @return boolean value or defaultValue. + */ + Boolean getBoolean(String key, Boolean defaultValue); + + /** + * get integer, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return integer value or null + */ + Integer getInteger(String key); + + /** + * get integer, if the value can not be got by the special key, the default value will be returned. + * @param key special key + * @param defaultValue default value + * @return integer value or default value + */ + Integer getInteger(String key, Integer defaultValue); + + /** + * get long, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return long value or null + */ + Long getLong(String key); + + /** + * get long, if the value can not be got by the special key, the default value will be returned. + * @param key special key + * @param defaultValue default value + * @return long value or default value + */ + Long getLong(String key, Long defaultValue); + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironmentFactory.java b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironmentFactory.java new file mode 100644 index 00000000000..74e65a461ae --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvironmentFactory.java @@ -0,0 +1,68 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Properties; + +class NacosEnvironmentFactory { + + /** + * create nacos environment. + * @return NacosEnvironment's proxy object, it contains a SearchableEnvironment object. + * @see SearchableEnvironment + */ + static NacosEnvironment createEnvironment() { + + return (NacosEnvironment) Proxy.newProxyInstance(NacosEnvironmentFactory.class.getClassLoader(), new Class[] {NacosEnvironment.class}, + new NacosEnvironmentDelegate() { + volatile NacosEnvironment environment; + + @Override + public void init(Properties properties) { + if (environment == null) { + synchronized (NacosEnvironmentFactory.class) { + if (environment == null) { + environment = new SearchableEnvironment(properties); + } + } + } + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (environment == null) { + throw new IllegalStateException( + "Nacos environment doesn't init, please call NacosEnvs#init method then try it again."); + } + return method.invoke(environment, args); + } + }); + } + + interface NacosEnvironmentDelegate extends InvocationHandler { + + /** + * init environment. + * @param properties user customize properties + */ + void init(Properties properties); + } + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvs.java b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvs.java new file mode 100644 index 00000000000..8510e575a57 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/NacosEnvs.java @@ -0,0 +1,116 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.lang.reflect.Proxy; +import java.util.Properties; + +/** + * environment utils. + * @author onewe + */ +public class NacosEnvs { + + private static final NacosEnvironment ENVIRONMENT = NacosEnvironmentFactory.createEnvironment(); + + /** + * init environment. + * @param properties properties + */ + public static void init(Properties properties) { + NacosEnvironmentFactory.NacosEnvironmentDelegate warrper = (NacosEnvironmentFactory.NacosEnvironmentDelegate) Proxy.getInvocationHandler( + ENVIRONMENT); + warrper.init(properties); + } + + public static String getProperty(String key, String defaultValue) { + return ENVIRONMENT.getProperty(key, defaultValue); + } + + /** + * get property, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return string value or null. + */ + public static String getProperty(String key) { + return ENVIRONMENT.getProperty(key); + } + + /** + * get boolean, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return boolean value or null. + */ + public static Boolean getBoolean(String key) { + return ENVIRONMENT.getBoolean(key); + } + + /** + * get boolean, if the value can not be got by the special key, the default value will be returned. + * + * @param key special key + * @param defaultValue default value + * @return boolean value or defaultValue. + */ + public static Boolean getBoolean(String key, Boolean defaultValue) { + return ENVIRONMENT.getBoolean(key, defaultValue); + } + + /** + * get integer, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return integer value or null + */ + public static Integer getInteger(String key) { + return ENVIRONMENT.getInteger(key); + } + + /** + * get integer, if the value can not be got by the special key, the default value will be returned. + * + * @param key special key + * @param defaultValue default value + * @return integer value or default value + */ + public static Integer getInteger(String key, Integer defaultValue) { + return ENVIRONMENT.getInteger(key, defaultValue); + } + + /** + * get long, if the value can not be got by the special key, the null will be returned. + * + * @param key special key + * @return long value or null + */ + public static Long getLong(String key) { + return ENVIRONMENT.getLong(key); + } + + /** + * get long, if the value can not be got by the special key, the default value will be returned. + * + * @param key special key + * @param defaultValue default value + * @return long value or default value + */ + public static Long getLong(String key, Long defaultValue) { + return ENVIRONMENT.getLong(key, defaultValue); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/PropertiesPropertySource.java b/client/src/main/java/com/alibaba/nacos/client/env/PropertiesPropertySource.java new file mode 100644 index 00000000000..991f83a4d81 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/PropertiesPropertySource.java @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.util.Properties; + +class PropertiesPropertySource extends AbstractPropertySource { + + private final Properties properties; + + PropertiesPropertySource(Properties properties) { + this.properties = properties; + } + + @Override + SourceType getType() { + return SourceType.PROPERTIES; + } + + @Override + String getProperty(String key) { + return properties.getProperty(key); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/PropertySourceSearch.java b/client/src/main/java/com/alibaba/nacos/client/env/PropertySourceSearch.java new file mode 100644 index 00000000000..e73dc995af0 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/PropertySourceSearch.java @@ -0,0 +1,119 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import com.alibaba.nacos.client.constant.Constants; +import com.alibaba.nacos.client.env.convert.CompositeConverter; +import com.alibaba.nacos.common.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.stream.Collectors; + +class PropertySourceSearch { + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertySourceSearch.class); + + private static final List DEFAULT_ORDER = Arrays.asList(SourceType.PROPERTIES, SourceType.JVM, + SourceType.SYS); + + private final List propertySources; + + private final CompositeConverter converter; + + private PropertySourceSearch(List propertySources) { + this.propertySources = propertySources; + this.propertySources.add(new DefaultSettingPropertySource()); + this.converter = new CompositeConverter(); + } + + static PropertySourceSearch build(Properties properties) { + if (properties == null) { + properties = new Properties(); + } + PropertiesPropertySource customizePropertySource = new PropertiesPropertySource(properties); + JvmArgsPropertySource jvmArgsPropertySource = new JvmArgsPropertySource(); + SystemEnvPropertySource systemEnvPropertySource = new SystemEnvPropertySource(); + + String searchPattern = jvmArgsPropertySource.getProperty(Constants.SysEnv.NACOS_ENVS_SEARCH); + if (StringUtils.isBlank(searchPattern)) { + searchPattern = systemEnvPropertySource.getProperty(Constants.SysEnv.NACOS_ENVS_SEARCH); + } + + return resolve(searchPattern, customizePropertySource, jvmArgsPropertySource, systemEnvPropertySource); + } + + private static PropertySourceSearch resolve(String pattern, AbstractPropertySource... propertySources) { + + if (StringUtils.isBlank(pattern)) { + return createPropertySourceSearchWithDefaultOrder(propertySources); + } + + try { + final SourceType sourceType = SourceType.valueOf(pattern.toUpperCase()); + return createPropertySourceSearchByFirstType(sourceType, propertySources); + } catch (Exception e) { + LOGGER.error("first source type parse error, it will be use default order!"); + return createPropertySourceSearchWithDefaultOrder(propertySources); + } + } + + private static PropertySourceSearch createPropertySourceSearchWithDefaultOrder(AbstractPropertySource... propertySources) { + final Map sourceMap = Arrays.stream(propertySources) + .collect(Collectors.toMap(AbstractPropertySource::getType, propertySource -> propertySource)); + final List collect = DEFAULT_ORDER.stream().map(sourceMap::get).collect(Collectors.toList()); + return new PropertySourceSearch(collect); + } + + private static PropertySourceSearch createPropertySourceSearchByFirstType(SourceType firstType, + AbstractPropertySource... propertySources) { + + List tempList = new ArrayList<>(4); + tempList.add(firstType); + + final Map sourceMap = Arrays.stream(propertySources) + .collect(Collectors.toMap(AbstractPropertySource::getType, propertySource -> propertySource)); + final List collect = DEFAULT_ORDER.stream().filter(sourceType -> !sourceType.equals(firstType)) + .collect(() -> tempList, List::add, List::addAll).stream().map(sourceMap::get) + .collect(Collectors.toList()); + + return new PropertySourceSearch(collect); + } + + Optional search(String key, Class targetType) { + if (targetType == null) { + throw new IllegalArgumentException("target type must be not null!"); + } + + for (AbstractPropertySource propertySource : propertySources) { + final String value = propertySource.getProperty(key); + if (value != null) { + if (String.class.isAssignableFrom(targetType)) { + return (Optional) Optional.of(value); + } + return Optional.ofNullable(converter.convert(value, targetType)); + } + } + return Optional.empty(); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/SearchableEnvironment.java b/client/src/main/java/com/alibaba/nacos/client/env/SearchableEnvironment.java new file mode 100644 index 00000000000..7dbb6bc5c47 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/SearchableEnvironment.java @@ -0,0 +1,74 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.util.Properties; + +/** + * Searchable environment. + * + * @author onewe + */ +class SearchableEnvironment implements NacosEnvironment { + + private final PropertySourceSearch sourceSearch; + + SearchableEnvironment(Properties properties) { + this.sourceSearch = PropertySourceSearch.build(properties); + } + + @Override + public String getProperty(String key) { + return getProperty(key, null); + } + + @Override + public String getProperty(String key, String defaultValue) { + return sourceSearch.search(key, String.class).orElse(defaultValue); + } + + @Override + public Boolean getBoolean(String key) { + return getBoolean(key, null); + } + + @Override + public Boolean getBoolean(String key, Boolean defaultValue) { + return sourceSearch.search(key, Boolean.class).orElse(defaultValue); + } + + @Override + public Integer getInteger(String key) { + return getInteger(key, null); + } + + @Override + public Integer getInteger(String key, Integer defaultValue) { + return sourceSearch.search(key, Integer.class).orElse(defaultValue); + } + + @Override + public Long getLong(String key) { + return getLong(key, null); + } + + @Override + public Long getLong(String key, Long defaultValue) { + return sourceSearch.search(key, Long.class).orElse(defaultValue); + } + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/SourceType.java b/client/src/main/java/com/alibaba/nacos/client/env/SourceType.java new file mode 100644 index 00000000000..8a5d1096b14 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/SourceType.java @@ -0,0 +1,36 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +enum SourceType { + /** + * get value from system environment. + */ + SYS, + /** + * get value from jvm args. + */ + JVM, + /** + * get value from properties. + */ + PROPERTIES, + /** + * get value from default setting. + */ + DEFAULT_SETTING +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/SystemEnvPropertySource.java b/client/src/main/java/com/alibaba/nacos/client/env/SystemEnvPropertySource.java new file mode 100644 index 00000000000..6aee164dad0 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/SystemEnvPropertySource.java @@ -0,0 +1,84 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import java.util.Map; + +class SystemEnvPropertySource extends AbstractPropertySource { + + private final Map env; + + SystemEnvPropertySource() { + this.env = System.getenv(); + } + + @Override + SourceType getType() { + return SourceType.SYS; + } + + @Override + String getProperty(String key) { + String checkedKey = checkPropertyName(key); + if (checkedKey == null) { + final String upperCaseKey = key.toUpperCase(); + if (!upperCaseKey.equals(key)) { + checkedKey = checkPropertyName(upperCaseKey); + } + } + if (checkedKey == null) { + return null; + } + return env.get(checkedKey); + } + + /** + * copy from https://github.com/spring-projects/spring-framework.git + * Copyright 2002-2021 the original author or authors. + * Since: + * 3.1 + * Author: + * Chris Beams, Juergen Hoeller + */ + private String checkPropertyName(String name) { + // Check name as-is + if (containsKey(name)) { + return name; + } + // Check name with just dots replaced + String noDotName = name.replace('.', '_'); + if (!name.equals(noDotName) && containsKey(noDotName)) { + return noDotName; + } + // Check name with just hyphens replaced + String noHyphenName = name.replace('-', '_'); + if (!name.equals(noHyphenName) && containsKey(noHyphenName)) { + return noHyphenName; + } + // Check name with dots and hyphens replaced + String noDotNoHyphenName = noDotName.replace('-', '_'); + if (!noDotName.equals(noDotNoHyphenName) && containsKey(noDotNoHyphenName)) { + return noDotNoHyphenName; + } + // Give up + return null; + } + + private boolean containsKey(String name) { + return this.env.containsKey(name); + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/convert/AbstractPropertyConverter.java b/client/src/main/java/com/alibaba/nacos/client/env/convert/AbstractPropertyConverter.java new file mode 100644 index 00000000000..d52ed2f6b9b --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/convert/AbstractPropertyConverter.java @@ -0,0 +1,28 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env.convert; + +abstract class AbstractPropertyConverter { + + /** + * convert property to target object. + * @param property the property gets from environments + * @return target object + */ + abstract T convert(String property); + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/convert/BooleanConverter.java b/client/src/main/java/com/alibaba/nacos/client/env/convert/BooleanConverter.java new file mode 100644 index 00000000000..ae65246b311 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/convert/BooleanConverter.java @@ -0,0 +1,56 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env.convert; + +import com.alibaba.nacos.common.utils.StringUtils; + +import java.util.HashSet; +import java.util.Set; + +class BooleanConverter extends AbstractPropertyConverter { + + private static final Set TRUE_VALUES = new HashSet<>(8); + + private static final Set FALSE_VALUES = new HashSet<>(8); + + static { + TRUE_VALUES.add("true"); + TRUE_VALUES.add("on"); + TRUE_VALUES.add("yes"); + TRUE_VALUES.add("1"); + + FALSE_VALUES.add("false"); + FALSE_VALUES.add("off"); + FALSE_VALUES.add("no"); + FALSE_VALUES.add("0"); + } + + @Override + Boolean convert(String property) { + if (StringUtils.isEmpty(property)) { + return null; + } + property = property.toLowerCase(); + if (TRUE_VALUES.contains(property)) { + return Boolean.TRUE; + } else if (FALSE_VALUES.contains(property)) { + return Boolean.FALSE; + } else { + throw new IllegalArgumentException("Invalid boolean value '" + property + "'"); + } + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/convert/CompositeConverter.java b/client/src/main/java/com/alibaba/nacos/client/env/convert/CompositeConverter.java new file mode 100644 index 00000000000..bb728a7ea19 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/convert/CompositeConverter.java @@ -0,0 +1,52 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env.convert; + +import java.util.HashMap; +import java.util.Map; +import java.util.MissingFormatArgumentException; + +/** + * default converters. + * @author onewe + */ +public class CompositeConverter { + + private final Map, AbstractPropertyConverter> converterRegistry = new HashMap<>(); + + public CompositeConverter() { + converterRegistry.put(Boolean.class, new BooleanConverter()); + converterRegistry.put(Integer.class, new IntegerConverter()); + converterRegistry.put(Long.class, new LongConverter()); + } + + /** + * convert property to target type. + * @param property the property gets from environments + * @param targetClass target class object + * @param target type + * @return the object of target type + */ + public T convert(String property, Class targetClass) { + final AbstractPropertyConverter converter = converterRegistry.get(targetClass); + if (converter == null) { + throw new MissingFormatArgumentException("converter not found, can't convert from String to " + targetClass.getCanonicalName()); + } + return (T) converter.convert(property); + } + +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/convert/IntegerConverter.java b/client/src/main/java/com/alibaba/nacos/client/env/convert/IntegerConverter.java new file mode 100644 index 00000000000..84d045b45ec --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/convert/IntegerConverter.java @@ -0,0 +1,34 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env.convert; + +import com.alibaba.nacos.common.utils.StringUtils; + +class IntegerConverter extends AbstractPropertyConverter { + + @Override + Integer convert(String property) { + if (StringUtils.isEmpty(property)) { + return null; + } + try { + return Integer.valueOf(property); + } catch (Exception e) { + throw new IllegalArgumentException("Cannot convert String [" + property + "] to Integer"); + } + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/env/convert/LongConverter.java b/client/src/main/java/com/alibaba/nacos/client/env/convert/LongConverter.java new file mode 100644 index 00000000000..8794370f84c --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/env/convert/LongConverter.java @@ -0,0 +1,34 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env.convert; + +import com.alibaba.nacos.common.utils.StringUtils; + +class LongConverter extends AbstractPropertyConverter { + + @Override + Long convert(String property) { + if (StringUtils.isEmpty(property)) { + return null; + } + try { + return Long.valueOf(property); + } catch (Exception e) { + throw new IllegalArgumentException("Cannot convert String [" + property + "] to Long"); + } + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java b/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java index f669ca48730..4a5f21aab67 100644 --- a/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java +++ b/client/src/main/java/com/alibaba/nacos/client/logging/logback/LogbackNacosLogging.java @@ -40,11 +40,20 @@ public class LogbackNacosLogging extends AbstractNacosLogging { @Override public void loadConfiguration() { LoggerContext loggerContext = loadConfigurationOnStart(); - if (loggerContext.getObject(CoreConstants.RECONFIGURE_ON_CHANGE_TASK) != null) { + if (loggerContext.getObject(CoreConstants.RECONFIGURE_ON_CHANGE_TASK) != null && !hasListener(loggerContext)) { addListener(loggerContext); } } - + + private boolean hasListener(LoggerContext loggerContext) { + for (LoggerContextListener loggerContextListener : loggerContext.getCopyOfListenerList()) { + if (loggerContextListener instanceof NacosLoggerContextListener) { + return true; + } + } + return false; + } + private LoggerContext loadConfigurationOnStart() { String location = getLocation(NACOS_LOGBACK_LOCATION); try { @@ -57,34 +66,36 @@ private LoggerContext loadConfigurationOnStart() { throw new IllegalStateException("Could not initialize Logback Nacos logging from " + location, e); } } - + + class NacosLoggerContextListener implements LoggerContextListener { + @Override + public boolean isResetResistant() { + return true; + } + + @Override + public void onReset(LoggerContext context) { + loadConfigurationOnStart(); + } + + @Override + public void onStart(LoggerContext context) { + + } + + @Override + public void onStop(LoggerContext context) { + + } + + @Override + public void onLevelChange(Logger logger, Level level) { + + } + } + private void addListener(LoggerContext loggerContext) { - loggerContext.addListener(new LoggerContextListener() { - @Override - public boolean isResetResistant() { - return true; - } - - @Override - public void onReset(LoggerContext context) { - loadConfigurationOnStart(); - } - - @Override - public void onStart(LoggerContext context) { - - } - - @Override - public void onStop(LoggerContext context) { - - } - - @Override - public void onLevelChange(Logger logger, Level level) { - - } - }); + loggerContext.addListener(new NacosLoggerContextListener()); } } diff --git a/client/src/main/java/com/alibaba/nacos/client/monitor/MetricsMonitor.java b/client/src/main/java/com/alibaba/nacos/client/monitor/MetricsMonitor.java index 02e812308f7..dfe52c7cfbb 100644 --- a/client/src/main/java/com/alibaba/nacos/client/monitor/MetricsMonitor.java +++ b/client/src/main/java/com/alibaba/nacos/client/monitor/MetricsMonitor.java @@ -42,11 +42,11 @@ public static Gauge.Child getDom2BeatSizeMonitor() { } public static Gauge.Child getListenConfigCountMonitor() { - return NACOS_MONITOR.labels("naming", "listenConfigCount"); + return NACOS_MONITOR.labels("config", "listenConfigCount"); } - public static Histogram.Timer getConfigRequestMonitor(String method, String url, String code) { - return NACOS_CLIENT_REQUEST_HISTOGRAM.labels("config", method, url, code).startTimer(); + public static Histogram.Child getConfigRequestMonitor(String method, String url, String code) { + return NACOS_CLIENT_REQUEST_HISTOGRAM.labels("config", method, url, code); } public static Histogram.Child getNamingRequestMonitor(String method, String url, String code) { diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java index 2929e2629c3..5a9a37598e9 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java @@ -43,6 +43,7 @@ import java.util.Iterator; import java.util.List; import java.util.Properties; +import java.util.UUID; /** * Nacos Naming Service. @@ -71,6 +72,8 @@ public class NacosNamingService implements NamingService { private NamingClientProxy clientProxy; + private String notifierEventScope; + public NacosNamingService(String serverList) throws NacosException { Properties properties = new Properties(); properties.setProperty(PropertyKeyConst.SERVER_ADDR, serverList); @@ -87,11 +90,12 @@ private void init(Properties properties) throws NacosException { InitUtils.initSerialization(); InitUtils.initWebRootContext(properties); initLogName(properties); - - this.changeNotifier = new InstancesChangeNotifier(); + + this.notifierEventScope = UUID.randomUUID().toString(); + this.changeNotifier = new InstancesChangeNotifier(this.notifierEventScope); NotifyCenter.registerToPublisher(InstancesChangeEvent.class, 16384); NotifyCenter.registerSubscriber(changeNotifier); - this.serviceInfoHolder = new ServiceInfoHolder(namespace, properties); + this.serviceInfoHolder = new ServiceInfoHolder(namespace, this.notifierEventScope, properties); this.clientProxy = new NamingClientProxyDelegate(this.namespace, serviceInfoHolder, properties, changeNotifier); } @@ -145,6 +149,13 @@ public void registerInstance(String serviceName, String groupName, Instance inst clientProxy.registerService(serviceName, groupName, instance); } + @Override + public void batchRegisterInstance(String serviceName, String groupName, List instances) + throws NacosException { + NamingUtils.batchCheckInstanceIsLegal(instances); + clientProxy.batchRegisterService(serviceName, groupName, instances); + } + @Override public void deregisterInstance(String serviceName, String ip, int port) throws NacosException { deregisterInstance(serviceName, ip, port, Constants.DEFAULT_CLUSTER_NAME); @@ -182,23 +193,23 @@ public void deregisterInstance(String serviceName, String groupName, Instance in @Override public List getAllInstances(String serviceName) throws NacosException { - return getAllInstances(serviceName, new ArrayList()); + return getAllInstances(serviceName, new ArrayList<>()); } @Override public List getAllInstances(String serviceName, String groupName) throws NacosException { - return getAllInstances(serviceName, groupName, new ArrayList()); + return getAllInstances(serviceName, groupName, new ArrayList<>()); } @Override public List getAllInstances(String serviceName, boolean subscribe) throws NacosException { - return getAllInstances(serviceName, new ArrayList(), subscribe); + return getAllInstances(serviceName, new ArrayList<>(), subscribe); } @Override public List getAllInstances(String serviceName, String groupName, boolean subscribe) throws NacosException { - return getAllInstances(serviceName, groupName, new ArrayList(), subscribe); + return getAllInstances(serviceName, groupName, new ArrayList<>(), subscribe); } @Override @@ -233,14 +244,14 @@ public List getAllInstances(String serviceName, String groupName, List } List list; if (serviceInfo == null || CollectionUtils.isEmpty(list = serviceInfo.getHosts())) { - return new ArrayList(); + return new ArrayList<>(); } return list; } @Override public List selectInstances(String serviceName, boolean healthy) throws NacosException { - return selectInstances(serviceName, new ArrayList(), healthy); + return selectInstances(serviceName, new ArrayList<>(), healthy); } @Override @@ -251,13 +262,13 @@ public List selectInstances(String serviceName, String groupName, bool @Override public List selectInstances(String serviceName, boolean healthy, boolean subscribe) throws NacosException { - return selectInstances(serviceName, new ArrayList(), healthy, subscribe); + return selectInstances(serviceName, new ArrayList<>(), healthy, subscribe); } @Override public List selectInstances(String serviceName, String groupName, boolean healthy, boolean subscribe) throws NacosException { - return selectInstances(serviceName, groupName, new ArrayList(), healthy, subscribe); + return selectInstances(serviceName, groupName, new ArrayList<>(), healthy, subscribe); } @Override @@ -298,7 +309,7 @@ public List selectInstances(String serviceName, String groupName, List private List selectInstances(ServiceInfo serviceInfo, boolean healthy) { List list; if (serviceInfo == null || CollectionUtils.isEmpty(list = serviceInfo.getHosts())) { - return new ArrayList(); + return new ArrayList<>(); } Iterator iterator = list.iterator(); @@ -314,7 +325,7 @@ private List selectInstances(ServiceInfo serviceInfo, boolean healthy) @Override public Instance selectOneHealthyInstance(String serviceName) throws NacosException { - return selectOneHealthyInstance(serviceName, new ArrayList()); + return selectOneHealthyInstance(serviceName, new ArrayList<>()); } @Override @@ -324,13 +335,13 @@ public Instance selectOneHealthyInstance(String serviceName, String groupName) t @Override public Instance selectOneHealthyInstance(String serviceName, boolean subscribe) throws NacosException { - return selectOneHealthyInstance(serviceName, new ArrayList(), subscribe); + return selectOneHealthyInstance(serviceName, new ArrayList<>(), subscribe); } @Override public Instance selectOneHealthyInstance(String serviceName, String groupName, boolean subscribe) throws NacosException { - return selectOneHealthyInstance(serviceName, groupName, new ArrayList(), subscribe); + return selectOneHealthyInstance(serviceName, groupName, new ArrayList<>(), subscribe); } @Override @@ -369,12 +380,12 @@ public Instance selectOneHealthyInstance(String serviceName, String groupName, L @Override public void subscribe(String serviceName, EventListener listener) throws NacosException { - subscribe(serviceName, new ArrayList(), listener); + subscribe(serviceName, new ArrayList<>(), listener); } @Override public void subscribe(String serviceName, String groupName, EventListener listener) throws NacosException { - subscribe(serviceName, groupName, new ArrayList(), listener); + subscribe(serviceName, groupName, new ArrayList<>(), listener); } @Override @@ -395,12 +406,12 @@ public void subscribe(String serviceName, String groupName, List cluster @Override public void unsubscribe(String serviceName, EventListener listener) throws NacosException { - unsubscribe(serviceName, new ArrayList(), listener); + unsubscribe(serviceName, new ArrayList<>(), listener); } @Override public void unsubscribe(String serviceName, String groupName, EventListener listener) throws NacosException { - unsubscribe(serviceName, groupName, new ArrayList(), listener); + unsubscribe(serviceName, groupName, new ArrayList<>(), listener); } @Override diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java index 58a3c754761..92815cf4766 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java @@ -40,7 +40,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER; @@ -60,9 +59,9 @@ public class FailoverReactor implements Closeable { private static final String FAILOVER_MODE_PARAM = "failover-mode"; - private Map serviceMap = new ConcurrentHashMap(); + private Map serviceMap = new ConcurrentHashMap<>(); - private final Map switchParams = new ConcurrentHashMap(); + private final Map switchParams = new ConcurrentHashMap<>(); private static final long DAY_PERIOD_MINUTES = 24 * 60; @@ -76,14 +75,11 @@ public FailoverReactor(ServiceInfoHolder serviceInfoHolder, String cacheDir) { this.serviceInfoHolder = serviceInfoHolder; this.failoverDir = cacheDir + FAILOVER_DIR; // init executorService - this.executorService = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread thread = new Thread(r); - thread.setDaemon(true); - thread.setName("com.alibaba.nacos.naming.failover"); - return thread; - } + this.executorService = new ScheduledThreadPoolExecutor(1, r -> { + Thread thread = new Thread(r); + thread.setDaemon(true); + thread.setName("com.alibaba.nacos.naming.failover"); + return thread; }); this.init(); } @@ -98,25 +94,22 @@ public void init() { executorService.scheduleWithFixedDelay(new DiskFileWriter(), 30, DAY_PERIOD_MINUTES, TimeUnit.MINUTES); // backup file on startup if failover directory is empty. - executorService.schedule(new Runnable() { - @Override - public void run() { - try { - File cacheDir = new File(failoverDir); - - if (!cacheDir.exists() && !cacheDir.mkdirs()) { - throw new IllegalStateException("failed to create cache dir: " + failoverDir); - } - - File[] files = cacheDir.listFiles(); - if (files == null || files.length <= 0) { - new DiskFileWriter().run(); - } - } catch (Throwable e) { - NAMING_LOGGER.error("[NA] failed to backup file on startup.", e); + executorService.schedule(() -> { + try { + File cacheDir = new File(failoverDir); + + if (!cacheDir.exists() && !cacheDir.mkdirs()) { + throw new IllegalStateException("failed to create cache dir: " + failoverDir); } - + + File[] files = cacheDir.listFiles(); + if (files == null || files.length <= 0) { + new DiskFileWriter().run(); + } + } catch (Throwable e) { + NAMING_LOGGER.error("[NA] failed to backup file on startup.", e); } + }, 10000L, TimeUnit.MILLISECONDS); } @@ -191,7 +184,7 @@ class FailoverFileReader implements Runnable { @Override public void run() { - Map domMap = new HashMap(16); + Map domMap = new HashMap<>(16); BufferedReader reader = null; try { diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/beat/BeatReactor.java b/client/src/main/java/com/alibaba/nacos/client/naming/beat/BeatReactor.java index 922777f3c83..1acb4d6083c 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/beat/BeatReactor.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/beat/BeatReactor.java @@ -37,7 +37,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER; @@ -57,7 +56,7 @@ public class BeatReactor implements Closeable { private boolean lightBeatEnabled = false; - public final Map dom2Beat = new ConcurrentHashMap(); + public final Map dom2Beat = new ConcurrentHashMap<>(); public BeatReactor(NamingHttpClientProxy serverProxy) { this(serverProxy, null); @@ -66,14 +65,11 @@ public BeatReactor(NamingHttpClientProxy serverProxy) { public BeatReactor(NamingHttpClientProxy serverProxy, Properties properties) { this.serverProxy = serverProxy; int threadCount = initClientBeatThreadCount(properties); - this.executorService = new ScheduledThreadPoolExecutor(threadCount, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread thread = new Thread(r); - thread.setDaemon(true); - thread.setName("com.alibaba.nacos.naming.beat.sender"); - return thread; - } + this.executorService = new ScheduledThreadPoolExecutor(threadCount, r -> { + Thread thread = new Thread(r); + thread.setDaemon(true); + thread.setName("com.alibaba.nacos.naming.beat.sender"); + return thread; }); } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java index d7659fa7b37..6c614eabb75 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java @@ -90,7 +90,7 @@ public static String getLineSeparator() { * @return service infos */ public static Map read(String cacheDir) { - Map domMap = new HashMap(16); + Map domMap = new HashMap<>(16); BufferedReader reader = null; try { @@ -109,7 +109,7 @@ public static Map read(String cacheDir) { if (!(fileName.endsWith(Constants.SERVICE_INFO_SPLITER + "meta") || fileName .endsWith(Constants.SERVICE_INFO_SPLITER + "special-url"))) { ServiceInfo dom = new ServiceInfo(fileName); - List ips = new ArrayList(); + List ips = new ArrayList<>(); dom.setHosts(ips); ServiceInfo newFormat = null; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolder.java b/client/src/main/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolder.java index 1dae55147da..b8be26b140a 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolder.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolder.java @@ -66,7 +66,9 @@ public class ServiceInfoHolder implements Closeable { private String cacheDir; - public ServiceInfoHolder(String namespace, Properties properties) { + private String notifierEventScope; + + public ServiceInfoHolder(String namespace, String notifierEventScope, Properties properties) { initCacheDir(namespace, properties); if (isLoadCacheAtStart(properties)) { this.serviceInfoMap = new ConcurrentHashMap<>(DiskCache.read(this.cacheDir)); @@ -75,6 +77,7 @@ public ServiceInfoHolder(String namespace, Properties properties) { } this.failoverReactor = new FailoverReactor(this, cacheDir); this.pushEmptyProtection = isPushEmptyProtect(properties); + this.notifierEventScope = notifierEventScope; } private void initCacheDir(String namespace, Properties properties) { @@ -165,7 +168,7 @@ public ServiceInfo processServiceInfo(ServiceInfo serviceInfo) { if (changed) { NAMING_LOGGER.info("current ips:({}) service: {} -> {}", serviceInfo.ipCount(), serviceInfo.getKey(), JacksonUtils.toJson(serviceInfo.getHosts())); - NotifyCenter.publishEvent(new InstancesChangeEvent(serviceInfo.getName(), serviceInfo.getGroupName(), + NotifyCenter.publishEvent(new InstancesChangeEvent(notifierEventScope, serviceInfo.getName(), serviceInfo.getGroupName(), serviceInfo.getClusters(), serviceInfo.getHosts())); DiskCache.write(serviceInfo, cacheDir); } @@ -188,20 +191,20 @@ private boolean isChangedServiceInfo(ServiceInfo oldService, ServiceInfo newServ return false; } boolean changed = false; - Map oldHostMap = new HashMap(oldService.getHosts().size()); + Map oldHostMap = new HashMap<>(oldService.getHosts().size()); for (Instance host : oldService.getHosts()) { oldHostMap.put(host.toInetAddr(), host); } - Map newHostMap = new HashMap(newService.getHosts().size()); + Map newHostMap = new HashMap<>(newService.getHosts().size()); for (Instance host : newService.getHosts()) { newHostMap.put(host.toInetAddr(), host); } - Set modHosts = new HashSet(); - Set newHosts = new HashSet(); - Set remvHosts = new HashSet(); + Set modHosts = new HashSet<>(); + Set newHosts = new HashSet<>(); + Set remvHosts = new HashSet<>(); - List> newServiceHosts = new ArrayList>( + List> newServiceHosts = new ArrayList<>( newHostMap.entrySet()); for (Map.Entry entry : newServiceHosts) { Instance host = entry.getValue(); @@ -222,11 +225,9 @@ private boolean isChangedServiceInfo(ServiceInfo oldService, ServiceInfo newServ if (newHostMap.containsKey(key)) { continue; } - - if (!newHostMap.containsKey(key)) { - remvHosts.add(host); - } - + + //add to remove hosts + remvHosts.add(host); } if (newHosts.size() > 0) { diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/core/Balancer.java b/client/src/main/java/com/alibaba/nacos/client/naming/core/Balancer.java index 66d2f777d6e..b4dab6bc344 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/core/Balancer.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/core/Balancer.java @@ -83,14 +83,14 @@ protected static Instance getHostByRandomWeight(List hosts) { return null; } NAMING_LOGGER.debug("new Chooser"); - List> hostsWithWeight = new ArrayList>(); + List> hostsWithWeight = new ArrayList<>(); for (Instance host : hosts) { if (host.isHealthy()) { hostsWithWeight.add(new Pair(host, host.getWeight())); } } NAMING_LOGGER.debug("for (Host host : hosts)"); - Chooser vipChooser = new Chooser("www.taobao.com"); + Chooser vipChooser = new Chooser<>("www.taobao.com"); vipChooser.refresh(hostsWithWeight); NAMING_LOGGER.debug("vipChooser.refresh"); return vipChooser.randomWithWeight(); diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/core/PushReceiver.java b/client/src/main/java/com/alibaba/nacos/client/naming/core/PushReceiver.java index 3e9f36c2628..78fc8eb9328 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/core/PushReceiver.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/core/PushReceiver.java @@ -32,7 +32,6 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER; @@ -74,14 +73,11 @@ public PushReceiver(ServiceInfoHolder serviceInfoHolder) { } else { this.udpSocket = new DatagramSocket(new InetSocketAddress(Integer.parseInt(udpPort))); } - this.executorService = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread thread = new Thread(r); - thread.setDaemon(true); - thread.setName("com.alibaba.nacos.naming.push.receiver"); - return thread; - } + this.executorService = new ScheduledThreadPoolExecutor(1, r -> { + Thread thread = new Thread(r); + thread.setDaemon(true); + thread.setName("com.alibaba.nacos.naming.push.receiver"); + return thread; }); this.executorService.execute(this); diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/core/ServerListManager.java b/client/src/main/java/com/alibaba/nacos/client/naming/core/ServerListManager.java index 9f208a695af..14ac914a438 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/core/ServerListManager.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/core/ServerListManager.java @@ -125,7 +125,7 @@ private List getServerListFromEndpoint() { "Error while requesting: " + urlString + "'. Server returned: " + restResult.getCode()); } String content = restResult.getData(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (String line : IoUtils.readLines(new StringReader(content))) { if (!line.trim().isEmpty()) { list.add(line.trim()); diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/core/ServiceInfoUpdateService.java b/client/src/main/java/com/alibaba/nacos/client/naming/core/ServiceInfoUpdateService.java index e18e4485b1b..ddb0d619ffb 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/core/ServiceInfoUpdateService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/core/ServiceInfoUpdateService.java @@ -51,7 +51,7 @@ public class ServiceInfoUpdateService implements Closeable { private static final int DEFAULT_UPDATE_CACHE_TIME_MULTIPLE = 6; - private final Map> futureMap = new HashMap>(); + private final Map> futureMap = new HashMap<>(); private final ServiceInfoHolder serviceInfoHolder; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeEvent.java b/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeEvent.java index 170e07bd8f0..87cd8953882 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeEvent.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeEvent.java @@ -31,6 +31,8 @@ public class InstancesChangeEvent extends Event { private static final long serialVersionUID = -8823087028212249603L; + private final String eventScope; + private final String serviceName; private final String groupName; @@ -39,7 +41,8 @@ public class InstancesChangeEvent extends Event { private final List hosts; - public InstancesChangeEvent(String serviceName, String groupName, String clusters, List hosts) { + public InstancesChangeEvent(String eventScope, String serviceName, String groupName, String clusters, List hosts) { + this.eventScope = eventScope; this.serviceName = serviceName; this.groupName = groupName; this.clusters = clusters; @@ -62,4 +65,8 @@ public List getHosts() { return hosts; } + @Override + public String scope() { + return this.eventScope; + } } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifier.java b/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifier.java index 10167a1c14d..95293a416dd 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifier.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifier.java @@ -21,6 +21,7 @@ import com.alibaba.nacos.api.naming.listener.NamingEvent; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.api.naming.utils.NamingUtils; +import com.alibaba.nacos.common.JustForTest; import com.alibaba.nacos.common.notify.Event; import com.alibaba.nacos.common.notify.listener.Subscriber; import com.alibaba.nacos.common.utils.CollectionUtils; @@ -29,6 +30,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; /** @@ -39,10 +41,21 @@ */ public class InstancesChangeNotifier extends Subscriber { - private final Map> listenerMap = new ConcurrentHashMap>(); + private final String eventScope; + + private final Map> listenerMap = new ConcurrentHashMap<>(); private final Object lock = new Object(); + @JustForTest + public InstancesChangeNotifier() { + this.eventScope = UUID.randomUUID().toString(); + } + + public InstancesChangeNotifier(String eventScope) { + this.eventScope = eventScope; + } + /** * register listener. * @@ -58,7 +71,7 @@ public void registerListener(String groupName, String serviceName, String cluste synchronized (lock) { eventListeners = listenerMap.get(key); if (eventListeners == null) { - eventListeners = new ConcurrentHashSet(); + eventListeners = new ConcurrentHashSet<>(); listenerMap.put(key, eventListeners); } } @@ -101,7 +114,7 @@ public boolean isSubscribed(String groupName, String serviceName, String cluster } public List getSubscribeServices() { - List serviceInfos = new ArrayList(); + List serviceInfos = new ArrayList<>(); for (String key : listenerMap.keySet()) { serviceInfos.add(ServiceInfo.fromKey(key)); } @@ -137,4 +150,8 @@ public Class subscribeType() { return InstancesChangeEvent.class; } + @Override + public boolean scopeMatches(InstancesChangeEvent event) { + return this.eventScope.equals(event.scope()); + } } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxy.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxy.java index 3cfa93d086b..c46adf32479 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxy.java @@ -24,6 +24,7 @@ import com.alibaba.nacos.api.selector.AbstractSelector; import com.alibaba.nacos.common.lifecycle.Closeable; +import java.util.List; import java.util.Set; /** @@ -43,6 +44,17 @@ public interface NamingClientProxy extends Closeable { */ void registerService(String serviceName, String groupName, Instance instance) throws NacosException; + /** + * Batch register instance to service with specified instance properties. + * + * @param serviceName service name + * @param groupName group name + * @param instances instance + * @throws NacosException nacos exception + * @since 2.1.1 + */ + void batchRegisterService(String serviceName, String groupName, List instances) throws NacosException; + /** * Deregister instance from a service. * diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegate.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegate.java index ceb8b184be5..f7af0cd6c37 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegate.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegate.java @@ -31,8 +31,10 @@ import com.alibaba.nacos.client.naming.remote.http.NamingHttpClientManager; import com.alibaba.nacos.client.naming.remote.http.NamingHttpClientProxy; import com.alibaba.nacos.client.security.SecurityProxy; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.ThreadUtils; +import java.util.List; import java.util.Properties; import java.util.Set; import java.util.concurrent.ScheduledExecutorService; @@ -94,6 +96,17 @@ public void registerService(String serviceName, String groupName, Instance insta getExecuteClientProxy(instance).registerService(serviceName, groupName, instance); } + @Override + public void batchRegisterService(String serviceName, String groupName, List instances) + throws NacosException { + NAMING_LOGGER.info("batchRegisterInstance instances: {} ,serviceName: {} begin.", instances, serviceName); + if (CollectionUtils.isEmpty(instances)) { + NAMING_LOGGER.warn("batchRegisterInstance instances is Empty:{}", instances); + } + grpcClientProxy.batchRegisterService(serviceName, groupName, instances); + NAMING_LOGGER.info("batchRegisterInstance instances: {} ,serviceName: {} finish.", instances, serviceName); + } + @Override public void deregisterService(String serviceName, String groupName, Instance instance) throws NacosException { getExecuteClientProxy(instance).deregisterService(serviceName, groupName, instance); diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxy.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxy.java index 55bdb71a163..d7c739d9885 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxy.java @@ -24,10 +24,12 @@ import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.api.naming.remote.NamingRemoteConstants; import com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest; +import com.alibaba.nacos.api.naming.remote.request.BatchInstanceRequest; import com.alibaba.nacos.api.naming.remote.request.InstanceRequest; import com.alibaba.nacos.api.naming.remote.request.ServiceListRequest; import com.alibaba.nacos.api.naming.remote.request.ServiceQueryRequest; import com.alibaba.nacos.api.naming.remote.request.SubscribeServiceRequest; +import com.alibaba.nacos.api.naming.remote.response.BatchInstanceResponse; import com.alibaba.nacos.api.naming.remote.response.QueryServiceResponse; import com.alibaba.nacos.api.naming.remote.response.ServiceListResponse; import com.alibaba.nacos.api.naming.remote.response.SubscribeServiceResponse; @@ -50,6 +52,7 @@ import com.alibaba.nacos.common.utils.JacksonUtils; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -80,7 +83,7 @@ public NamingGrpcClientProxy(String namespaceId, SecurityProxy securityProxy, Se this.namespaceId = namespaceId; this.uuid = UUID.randomUUID().toString(); this.requestTimeout = Long.parseLong(properties.getProperty(CommonParams.NAMING_REQUEST_TIMEOUT, "-1")); - Map labels = new HashMap(); + Map labels = new HashMap<>(); labels.put(RemoteConstants.LABEL_SOURCE, RemoteConstants.LABEL_SOURCE_SDK); labels.put(RemoteConstants.LABEL_MODULE, RemoteConstants.LABEL_MODULE_NAMING); this.rpcClient = RpcClientFactory.createClient(uuid, ConnectionType.GRPC, labels); @@ -114,6 +117,29 @@ public void registerService(String serviceName, String groupName, Instance insta doRegisterService(serviceName, groupName, instance); } + @Override + public void batchRegisterService(String serviceName, String groupName, List instances) + throws NacosException { + redoService.cacheInstanceForRedo(serviceName, groupName, instances); + doBatchRegisterService(serviceName, groupName, instances); + } + + /** + * Execute batch register operation. + * + * @param serviceName service name + * @param groupName group name + * @param instances instances + * @throws NacosException NacosException + */ + public void doBatchRegisterService(String serviceName, String groupName, List instances) + throws NacosException { + BatchInstanceRequest request = new BatchInstanceRequest(namespaceId, serviceName, groupName, + NamingRemoteConstants.BATCH_REGISTER_INSTANCE, instances); + requestToServer(request, BatchInstanceResponse.class); + redoService.instanceRegistered(serviceName, groupName); + } + /** * Execute register operation. * @@ -199,7 +225,7 @@ public ListView getServiceList(int pageNo, int pageSize, String groupNam } } ServiceListResponse response = requestToServer(request, ServiceListResponse.class); - ListView result = new ListView(); + ListView result = new ListView<>(); result.setCount(response.getCount()); result.setData(response.getServiceNames()); return result; @@ -284,6 +310,8 @@ private T requestToServer(AbstractNamingRequest request, Cl } NAMING_LOGGER.error("Server return unexpected response '{}', expected response should be '{}'", response.getClass().getName(), responseClass.getName()); + } catch (NacosException e) { + throw e; } catch (Exception e) { throw new NacosException(NacosException.SERVER_ERROR, "Request nacos server failed: ", e); } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoService.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoService.java index cd372f49163..4b68b6e3bc0 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoService.java @@ -20,6 +20,7 @@ import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.api.naming.utils.NamingUtils; import com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy; +import com.alibaba.nacos.client.naming.remote.gprc.redo.data.BatchInstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.InstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.SubscriberRedoData; import com.alibaba.nacos.client.utils.LogUtils; @@ -27,6 +28,7 @@ import com.alibaba.nacos.common.remote.client.ConnectionEventListener; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -104,6 +106,21 @@ public void cacheInstanceForRedo(String serviceName, String groupName, Instance } } + /** + * Cache registered instance for redo. + * + * @param serviceName service name + * @param groupName group name + * @param instances batch registered instance + */ + public void cacheInstanceForRedo(String serviceName, String groupName, List instances) { + String key = NamingUtils.getGroupedName(serviceName, groupName); + BatchInstanceRedoData redoData = BatchInstanceRedoData.build(serviceName, groupName, instances); + synchronized (registeredInstances) { + registeredInstances.put(key, redoData); + } + } + /** * Instance register successfully, mark registered status as {@code true}. * diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/RedoScheduledTask.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/RedoScheduledTask.java index f7607b39644..99d890b3e98 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/RedoScheduledTask.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/RedoScheduledTask.java @@ -18,6 +18,7 @@ import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy; +import com.alibaba.nacos.client.naming.remote.gprc.redo.data.BatchInstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.InstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.RedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.SubscriberRedoData; @@ -75,7 +76,7 @@ private void redoForInstance(InstanceRedoData redoData) throws NacosException { if (isClientDisabled()) { return; } - clientProxy.doRegisterService(serviceName, groupName, redoData.get()); + processRegisterRedoType(redoData, serviceName, groupName); break; case UNREGISTER: if (isClientDisabled()) { @@ -91,6 +92,16 @@ private void redoForInstance(InstanceRedoData redoData) throws NacosException { } + private void processRegisterRedoType(InstanceRedoData redoData, String serviceName, String groupName) throws NacosException { + if (redoData instanceof BatchInstanceRedoData) { + // Execute Batch Register + BatchInstanceRedoData batchInstanceRedoData = (BatchInstanceRedoData) redoData; + clientProxy.doBatchRegisterService(serviceName, groupName, batchInstanceRedoData.getInstances()); + return; + } + clientProxy.doRegisterService(serviceName, groupName, redoData.get()); + } + private void redoForSubscribes() { for (SubscriberRedoData each : redoService.findSubscriberRedoData()) { try { diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/BatchInstanceRedoData.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/BatchInstanceRedoData.java new file mode 100644 index 00000000000..3c51a9e18f0 --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/BatchInstanceRedoData.java @@ -0,0 +1,57 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.naming.remote.gprc.redo.data; + +import com.alibaba.nacos.api.naming.pojo.Instance; + +import java.util.List; + +/** + * batch instance redo service. + * + * @author chenhao26 + */ +public class BatchInstanceRedoData extends InstanceRedoData { + + List instances; + + public List getInstances() { + return instances; + } + + public void setInstances(List instances) { + this.instances = instances; + } + + protected BatchInstanceRedoData(String serviceName, String groupName) { + super(serviceName, groupName); + } + + /** + * build BatchInstanceRedoData. + * + * @param serviceName service name + * @param groupName group name + * @param instances instances + * @return build BatchInstanceRedoData + */ + public static BatchInstanceRedoData build(String serviceName, String groupName, List instances) { + BatchInstanceRedoData result = new BatchInstanceRedoData(serviceName, groupName); + result.setInstances(instances); + return result; + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/InstanceRedoData.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/InstanceRedoData.java index f9a10c8ecf9..4f3df9f5c6e 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/InstanceRedoData.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/gprc/redo/data/InstanceRedoData.java @@ -25,7 +25,7 @@ */ public class InstanceRedoData extends RedoData { - private InstanceRedoData(String serviceName, String groupName) { + protected InstanceRedoData(String serviceName, String groupName) { super(serviceName, groupName); } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java b/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java index fcfb4b3945c..2622d0f8ccd 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java @@ -150,7 +150,7 @@ public void registerService(String serviceName, String groupName, Instance insta BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance); beatReactor.addBeatInfo(groupedServiceName, beatInfo); } - final Map params = new HashMap(32); + final Map params = new HashMap<>(32); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, groupedServiceName); params.put(CommonParams.GROUP_NAME, groupName); @@ -167,6 +167,11 @@ public void registerService(String serviceName, String groupName, Instance insta } + @Override + public void batchRegisterService(String serviceName, String groupName, List instances) { + throw new UnsupportedOperationException("Do not support persistent instances to perform batch registration methods."); + } + @Override public void deregisterService(String serviceName, String groupName, Instance instance) throws NacosException { NAMING_LOGGER @@ -176,7 +181,7 @@ public void deregisterService(String serviceName, String groupName, Instance ins beatReactor.removeBeatInfo(NamingUtils.getGroupedName(serviceName, groupName), instance.getIp(), instance.getPort()); } - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, NamingUtils.getGroupedName(serviceName, groupName)); params.put(CommonParams.CLUSTER_NAME, instance.getClusterName()); @@ -192,7 +197,7 @@ public void updateInstance(String serviceName, String groupName, Instance instan NAMING_LOGGER .info("[UPDATE-SERVICE] {} update service {} with instance: {}", namespaceId, serviceName, instance); - final Map params = new HashMap(32); + final Map params = new HashMap<>(32); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, serviceName); params.put(CommonParams.GROUP_NAME, groupName); @@ -210,7 +215,7 @@ public void updateInstance(String serviceName, String groupName, Instance instan @Override public ServiceInfo queryInstancesOfService(String serviceName, String groupName, String clusters, int udpPort, boolean healthyOnly) throws NacosException { - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, NamingUtils.getGroupedName(serviceName, groupName)); params.put(CLUSTERS_PARAM, clusters); @@ -228,7 +233,7 @@ public ServiceInfo queryInstancesOfService(String serviceName, String groupName, public Service queryService(String serviceName, String groupName) throws NacosException { NAMING_LOGGER.info("[QUERY-SERVICE] {} query service : {}, {}", namespaceId, serviceName, groupName); - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, serviceName); params.put(CommonParams.GROUP_NAME, groupName); @@ -242,7 +247,7 @@ public void createService(Service service, AbstractSelector selector) throws Nac NAMING_LOGGER.info("[CREATE-SERVICE] {} creating service : {}", namespaceId, service); - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, service.getName()); params.put(CommonParams.GROUP_NAME, service.getGroupName()); @@ -259,7 +264,7 @@ public boolean deleteService(String serviceName, String groupName) throws NacosE NAMING_LOGGER.info("[DELETE-SERVICE] {} deleting service : {} with groupName : {}", namespaceId, serviceName, groupName); - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, serviceName); params.put(CommonParams.GROUP_NAME, groupName); @@ -272,7 +277,7 @@ public boolean deleteService(String serviceName, String groupName) throws NacosE public void updateService(Service service, AbstractSelector selector) throws NacosException { NAMING_LOGGER.info("[UPDATE-SERVICE] {} updating service : {}", namespaceId, service); - final Map params = new HashMap(16); + final Map params = new HashMap<>(16); params.put(CommonParams.NAMESPACE_ID, namespaceId); params.put(CommonParams.SERVICE_NAME, service.getName()); params.put(CommonParams.GROUP_NAME, service.getGroupName()); @@ -296,8 +301,8 @@ public JsonNode sendBeat(BeatInfo beatInfo, boolean lightBeatEnabled) throws Nac if (NAMING_LOGGER.isDebugEnabled()) { NAMING_LOGGER.debug("[BEAT] {} sending beat to server: {}", namespaceId, beatInfo.toString()); } - Map params = new HashMap(16); - Map bodyMap = new HashMap(2); + Map params = new HashMap<>(16); + Map bodyMap = new HashMap<>(2); if (!lightBeatEnabled) { bodyMap.put("beat", JacksonUtils.toJson(beatInfo)); } @@ -314,7 +319,7 @@ public JsonNode sendBeat(BeatInfo beatInfo, boolean lightBeatEnabled) throws Nac public boolean serverHealthy() { try { - String result = reqApi(UtilAndComs.nacosUrlBase + "/operator/metrics", new HashMap(8), + String result = reqApi(UtilAndComs.nacosUrlBase + "/operator/metrics", new HashMap<>(8), HttpMethod.GET); JsonNode json = JacksonUtils.toObj(result); String serverStatus = json.get("status").asText(); @@ -328,7 +333,7 @@ public boolean serverHealthy() { public ListView getServiceList(int pageNo, int pageSize, String groupName, AbstractSelector selector) throws NacosException { - Map params = new HashMap(16); + Map params = new HashMap<>(16); params.put("pageNo", String.valueOf(pageNo)); params.put("pageSize", String.valueOf(pageSize)); params.put(CommonParams.NAMESPACE_ID, namespaceId); @@ -350,7 +355,7 @@ public ListView getServiceList(int pageNo, int pageSize, String groupNam String result = reqApi(UtilAndComs.nacosUrlBase + "/service/list", params, HttpMethod.GET); JsonNode json = JacksonUtils.toObj(result); - ListView listView = new ListView(); + ListView listView = new ListView<>(); listView.setCount(json.get("count").asInt()); listView.setData(JacksonUtils.toObj(json.get("doms").toString(), new TypeReference>() { })); @@ -482,12 +487,11 @@ public String callServer(String api, Map params, Map restResult = nacosRestTemplate .exchangeForm(url, header, Query.newInstance().initParams(params), body, method, String.class); end = System.currentTimeMillis(); - + MetricsMonitor.getNamingRequestMonitor(method, url, String.valueOf(restResult.getCode())) .observe(end - start); @@ -498,6 +502,9 @@ public String callServer(String api, Map params, Map> pairs) { - Ref ref = new Ref(pairs); + Ref ref = new Ref<>(pairs); ref.refresh(); this.uniqueKey = uniqueKey; this.ref = ref; @@ -100,7 +100,7 @@ public Ref getRef() { * @param itemsWithWeight items with weight */ public void refresh(List> itemsWithWeight) { - Ref newRef = new Ref(itemsWithWeight); + Ref newRef = new Ref<>(itemsWithWeight); newRef.refresh(); newRef.poller = this.ref.poller.refresh(newRef.items); this.ref = newRef; @@ -108,11 +108,11 @@ public void refresh(List> itemsWithWeight) { public class Ref { - private List> itemsWithWeight = new ArrayList>(); + private List> itemsWithWeight = new ArrayList<>(); - private final List items = new ArrayList(); + private final List items = new ArrayList<>(); - private Poller poller = new GenericPoller(items); + private Poller poller = new GenericPoller<>(items); private double[] weights; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java index fc01ff5c58d..c16268c6b33 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java @@ -29,7 +29,7 @@ public class GenericPoller implements Poller { private final AtomicInteger index = new AtomicInteger(0); - private List items = new ArrayList(); + private List items = new ArrayList<>(); public GenericPoller(List items) { this.items = items; @@ -42,6 +42,6 @@ public T next() { @Override public Poller refresh(List items) { - return new GenericPoller(items); + return new GenericPoller<>(items); } } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/UtilAndComs.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/UtilAndComs.java index b45501edd32..39a3b0b1226 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/UtilAndComs.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/UtilAndComs.java @@ -26,9 +26,9 @@ */ public class UtilAndComs { - // using ClientCommonUtils#VERSION instead. + // using com.alibaba.nacos.common.utils.VersionUtils.getFullClientVersion instead. @Deprecated - public static final String VERSION = "Nacos-Java-Client:v" + VersionUtils.version; + public static final String VERSION = VersionUtils.getFullClientVersion(); public static String webContext = "/nacos"; diff --git a/client/src/main/java/com/alibaba/nacos/client/utils/EnvUtil.java b/client/src/main/java/com/alibaba/nacos/client/utils/EnvUtil.java index 949cc2b005b..cb658b47fb4 100644 --- a/client/src/main/java/com/alibaba/nacos/client/utils/EnvUtil.java +++ b/client/src/main/java/com/alibaba/nacos/client/utils/EnvUtil.java @@ -31,7 +31,7 @@ public class EnvUtil { public static final Logger LOGGER = LogUtils.logger(EnvUtil.class); - private static String selfAmorayTag; + private static String selfAmoryTag; private static String selfVipserverTag; @@ -39,17 +39,17 @@ public class EnvUtil { public static void setSelfEnv(Map> headers) { if (headers != null) { - List amorayTagTmp = headers.get(Constants.AMORY_TAG); - if (amorayTagTmp == null) { - if (selfAmorayTag != null) { - selfAmorayTag = null; + List amoryTagTmp = headers.get(Constants.AMORY_TAG); + if (amoryTagTmp == null) { + if (selfAmoryTag != null) { + selfAmoryTag = null; LOGGER.warn("selfAmoryTag:null"); } } else { - String amorayTagTmpStr = listToString(amorayTagTmp); - if (!amorayTagTmpStr.equals(selfAmorayTag)) { - selfAmorayTag = amorayTagTmpStr; - LOGGER.warn("selfAmoryTag:{}", selfAmorayTag); + String amoryTagTmpStr = listToString(amoryTagTmp); + if (!amoryTagTmpStr.equals(selfAmoryTag)) { + selfAmoryTag = amoryTagTmpStr; + LOGGER.warn("selfAmoryTag:{}", selfAmoryTag); } } @@ -82,8 +82,8 @@ public static void setSelfEnv(Map> headers) { } } - public static String getSelfAmorayTag() { - return selfAmorayTag; + public static String getSelfAmoryTag() { + return selfAmoryTag; } public static String getSelfVipserverTag() { diff --git a/client/src/main/resources/nacos_default_setting.properties b/client/src/main/resources/nacos_default_setting.properties new file mode 100644 index 00000000000..b85b76b88e3 --- /dev/null +++ b/client/src/main/resources/nacos_default_setting.properties @@ -0,0 +1,36 @@ +# +# Copyright 1999-2022 Alibaba Group Holding Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +contextPath=/nacos +nacos.cache.data.init.snapshot=true +configLongPollTimeout=30000 +configRetryTime=2000 +enableRemoteSyncConfig=false +maxRetry=3 +limitTime=5 +isUseEndpointParsingRule=true +isMultiInstance=false +com.alibaba.nacos.naming.log.filename=naming.log +namingRequestTimeout=-1 +com.alibaba.nacos.client.naming.rtimeout=50000 +com.alibaba.nacos.client.naming.ctimeout=3000 +tls.enable=false +namingRequestDomainMaxRetryCount=3 +nacos.use.cloud.namespace.parsing=true +nacos.use.endpoint.parsing.rule=true +nacos.client.contextPath=nacos +nacos.server.port=8848 +NACOS.CONNECT.TIMEOUT=1000 +PER_TASK_CONFIG_SIZE=3000 \ No newline at end of file diff --git a/client/src/test/java/com/alibaba/nacos/client/config/NacosConfigServiceTest.java b/client/src/test/java/com/alibaba/nacos/client/config/NacosConfigServiceTest.java index dea516aae21..2e7fce068cd 100644 --- a/client/src/test/java/com/alibaba/nacos/client/config/NacosConfigServiceTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/config/NacosConfigServiceTest.java @@ -21,7 +21,9 @@ import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.client.config.filter.impl.ConfigResponse; import com.alibaba.nacos.client.config.impl.ClientWorker; +import com.alibaba.nacos.client.config.impl.ConfigTransportClient; import com.alibaba.nacos.client.config.impl.LocalConfigInfoProcessor; +import com.alibaba.nacos.client.config.impl.ServerListManager; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -99,14 +101,61 @@ public void receiveConfigInfo(String configInfo) { response.setContent(content); response.setConfigType("bb"); Mockito.when(mockWoker.getServerConfig(dataId, group, "", timeout, false)).thenReturn(response); + Mockito.when(mockWoker.getAgent()).thenReturn(new ConfigTransportClient(new Properties(), new ServerListManager()) { + @Override + public void startInternal() throws NacosException { + // NOOP + } + + @Override + public String getName() { + return "TestConfigTransportClient"; + } + + @Override + public void notifyListenConfig() { + // NOOP + } + + @Override + public void executeConfigListen() { + // NOOP + } + + @Override + public void removeCache(String dataId, String group) { + // NOOP + } + + @Override + public ConfigResponse queryConfig(String dataId, String group, String tenant, long readTimeous, + boolean notify) throws NacosException { + ConfigResponse configResponse = new ConfigResponse(); + configResponse.setContent(content); + configResponse.setDataId(dataId); + configResponse.setGroup(group); + configResponse.setTenant(tenant); + return configResponse; + } + + @Override + public boolean publishConfig(String dataId, String group, String tenant, String appName, String tag, + String betaIps, String content, String encryptedDataKey, String casMd5, String type) + throws NacosException { + return false; + } + + @Override + public boolean removeConfig(String dataId, String group, String tenant, String tag) throws NacosException { + return false; + } + }); final String config = nacosConfigService.getConfigAndSignListener(dataId, group, timeout, listener); Assert.assertEquals(content, config); - Mockito.verify(mockWoker, Mockito.times(1)).getServerConfig(dataId, group, tenant, timeout, false); Mockito.verify(mockWoker, Mockito.times(1)) - .addTenantListenersWithContent(dataId, group, content, Arrays.asList(listener)); - + .addTenantListenersWithContent(dataId, group, content, null, Arrays.asList(listener)); } @Test diff --git a/client/src/test/java/com/alibaba/nacos/client/config/impl/CacheDataTest.java b/client/src/test/java/com/alibaba/nacos/client/config/impl/CacheDataTest.java index 56f2db776ad..110e2a8db42 100644 --- a/client/src/test/java/com/alibaba/nacos/client/config/impl/CacheDataTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/config/impl/CacheDataTest.java @@ -17,6 +17,7 @@ package com.alibaba.nacos.client.config.impl; import com.alibaba.nacos.api.config.listener.Listener; +import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.client.config.filter.impl.ConfigFilterChainManager; import com.alibaba.nacos.common.utils.MD5Utils; import org.junit.Assert; @@ -80,7 +81,7 @@ public void testGetter() { } @Test - public void testListener() { + public void testListener() throws NacosException { ConfigFilterChainManager filter = new ConfigFilterChainManager(new Properties()); final CacheData cacheData1 = new CacheData(filter, "name1", "key", "group", "tenant"); @@ -104,7 +105,7 @@ public void receiveConfigInfo(String configInfo) { } @Test - public void testCheckListenerMd5() { + public void testCheckListenerMd5() throws NacosException { ConfigFilterChainManager filter = new ConfigFilterChainManager(new Properties()); final CacheData data = new CacheData(filter, "name1", "key", "group", "tenant"); final List list = new ArrayList<>(); diff --git a/client/src/test/java/com/alibaba/nacos/client/config/impl/ClientWorkerTest.java b/client/src/test/java/com/alibaba/nacos/client/config/impl/ClientWorkerTest.java index cf99559f0dd..21545fc1994 100644 --- a/client/src/test/java/com/alibaba/nacos/client/config/impl/ClientWorkerTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/config/impl/ClientWorkerTest.java @@ -94,7 +94,7 @@ public void receiveConfigInfo(String configInfo) { Assert.assertEquals(0, listeners.size()); String content = "d"; - clientWorker.addTenantListenersWithContent(dataId, group, content, Arrays.asList(listener)); + clientWorker.addTenantListenersWithContent(dataId, group, content, null, Arrays.asList(listener)); listeners = clientWorker.getCache(dataId, group).getListeners(); Assert.assertEquals(1, listeners.size()); Assert.assertEquals(listener, listeners.get(0)); diff --git a/client/src/test/java/com/alibaba/nacos/client/config/impl/ServerListManagerTest.java b/client/src/test/java/com/alibaba/nacos/client/config/impl/ServerListManagerTest.java index 600f725d7cc..5363bb20a36 100644 --- a/client/src/test/java/com/alibaba/nacos/client/config/impl/ServerListManagerTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/config/impl/ServerListManagerTest.java @@ -60,6 +60,16 @@ public void testGetter() throws NacosException { final ServerListManager mgr2 = new ServerListManager(properties); Assert.assertEquals("aaa", mgr2.getContentPath()); } + + // Test https + { + Properties properties = new Properties(); + properties.put(PropertyKeyConst.CONTEXT_PATH, "aaa"); + properties.put(PropertyKeyConst.SERVER_ADDR, "https://1.1.1.1:8848"); + final ServerListManager mgr2 = new ServerListManager(properties); + Assert.assertEquals("aaa", mgr2.getContentPath()); + Assert.assertEquals("[https://1.1.1.1:8848]", mgr2.getServerUrls().toString()); + } { Properties properties2 = new Properties(); diff --git a/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvironmentFactoryTest.java b/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvironmentFactoryTest.java new file mode 100644 index 00000000000..13bda0fab6e --- /dev/null +++ b/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvironmentFactoryTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import org.junit.Assert; +import org.junit.Test; + +import java.lang.reflect.Proxy; +import java.util.Properties; + +public class NacosEnvironmentFactoryTest { + + @Test(expected = IllegalStateException.class) + public void testCreateEnvironment() { + final NacosEnvironment environment = NacosEnvironmentFactory.createEnvironment(); + Assert.assertNotNull(environment); + Assert.assertTrue(Proxy.isProxyClass(environment.getClass())); + environment.getProperty("test.exception"); + } + + @Test + public void testNacosEnvInit() { + final NacosEnvironment environment = NacosEnvironmentFactory.createEnvironment(); + final NacosEnvironmentFactory.NacosEnvironmentDelegate invocationHandler = + (NacosEnvironmentFactory.NacosEnvironmentDelegate) Proxy.getInvocationHandler( + environment); + Properties properties = new Properties(); + properties.setProperty("init.nacos", "true"); + + invocationHandler.init(properties); + + final String property = environment.getProperty("init.nacos"); + Assert.assertEquals("true", property); + } + +} diff --git a/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvsTest.java b/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvsTest.java new file mode 100644 index 00000000000..28ed1e6ddd2 --- /dev/null +++ b/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvsTest.java @@ -0,0 +1,174 @@ +/* + * Copyright 1999-2022 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.client.env; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; + +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Properties; + +public class NacosEnvsTest { + + static MockedStatic mockedStatic; + + @BeforeClass + public static void before() { + mockedStatic = Mockito.mockStatic(NacosEnvironmentFactory.class); + mockedStatic.when(NacosEnvironmentFactory::createEnvironment).thenReturn(createProxy()); + + } + + @AfterClass + public static void teardown() { + if (mockedStatic != null) { + mockedStatic.close(); + } + } + + private static NacosEnvironment createProxy() { + return (NacosEnvironment) Proxy.newProxyInstance(NacosEnvironmentFactory.class.getClassLoader(), + new Class[] {NacosEnvironment.class}, new NacosEnvironmentFactory.NacosEnvironmentDelegate() { + volatile NacosEnvironment environment; + + @Override + public void init(Properties properties) { + environment = new SearchableEnvironment(properties); + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (environment == null) { + throw new IllegalStateException( + "Nacos environment doesn't init, please call NEnvs#init method then try it again."); + } + return method.invoke(environment, args); + } + }); + } + + @Test + public void testGetProperty() { + + final Properties properties = new Properties(); + properties.setProperty("nacos.home", "/home/nacos"); + NacosEnvs.init(properties); + final String value = NacosEnvs.getProperty("nacos.home"); + + Assert.assertEquals("/home/nacos", value); + } + + @Test + public void testGetPropertyDefaultValue() { + + final Properties properties = new Properties(); + NacosEnvs.init(properties); + final String value = NacosEnvs.getProperty("nacos.home", "/home/default_value"); + + Assert.assertEquals("/home/default_value", value); + } + + @Test + public void testGetBoolean() { + final Properties properties = new Properties(); + properties.setProperty("use.cluster", "true"); + NacosEnvs.init(properties); + + final Boolean value = NacosEnvs.getBoolean("use.cluster"); + Assert.assertTrue(value); + } + + @Test + public void testGetBooleanDefaultValue() { + final Properties properties = new Properties(); + NacosEnvs.init(properties); + + final Boolean value = NacosEnvs.getBoolean("use.cluster", false); + Assert.assertFalse(value); + } + + @Test + public void testGetInteger() { + final Properties properties = new Properties(); + properties.setProperty("max.timeout", "200"); + NacosEnvs.init(properties); + + final Integer value = NacosEnvs.getInteger("max.timeout"); + + Assert.assertEquals(200, value.intValue()); + } + + @Test + public void testGetIntegerDefaultValue() { + final Properties properties = new Properties(); + NacosEnvs.init(properties); + + final Integer value = NacosEnvs.getInteger("max.timeout", 400); + Assert.assertEquals(400, value.intValue()); + } + + @Test + public void testGetLong() { + final Properties properties = new Properties(); + properties.setProperty("connection.timeout", "200"); + NacosEnvs.init(properties); + + final Long value = NacosEnvs.getLong("connection.timeout"); + Assert.assertEquals(200L, value.longValue()); + } + + @Test + public void testGetLongDefault() { + final Properties properties = new Properties(); + NacosEnvs.init(properties); + final Long value = NacosEnvs.getLong("connection.timeout", 400L); + Assert.assertEquals(400L, value.longValue()); + } + + @Test + public void testGetPropertyJvmFirst() { + System.setProperty("nacos.envs.search", "jvm"); + System.setProperty("nacos.home", "/home/jvm_first"); + + Properties properties = new Properties(); + properties.setProperty("nacos.home", "/home/properties_first"); + + NacosEnvs.init(properties); + final String value = NacosEnvs.getProperty("nacos.home"); + + Assert.assertEquals("/home/jvm_first", value); + System.clearProperty("nacos.envs.search"); + System.clearProperty("nacos.home"); + } + + @Test + public void testGetPropertyDefaultSetting() { + Properties properties = new Properties(); + + NacosEnvs.init(properties); + final String value = NacosEnvs.getProperty("nacos.home.default.test"); + + Assert.assertEquals("/home/default_setting", value); + + } + +} diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/NacosNamingServiceTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/NacosNamingServiceTest.java index 18ae41b3122..6be6dd88b83 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/NacosNamingServiceTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/NacosNamingServiceTest.java @@ -21,7 +21,6 @@ import com.alibaba.nacos.api.PropertyKeyConst; import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.exception.NacosException; -import com.alibaba.nacos.api.naming.listener.Event; import com.alibaba.nacos.api.naming.listener.EventListener; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; @@ -29,10 +28,12 @@ import com.alibaba.nacos.client.naming.event.InstancesChangeNotifier; import com.alibaba.nacos.client.naming.remote.NamingClientProxy; import com.alibaba.nacos.client.naming.remote.http.NamingHttpClientProxy; +import com.alibaba.nacos.client.naming.utils.CollectionUtils; import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; -import org.mockito.ArgumentMatcher; +import org.junit.rules.ExpectedException; import java.lang.reflect.Field; import java.util.ArrayList; @@ -52,6 +53,9 @@ public class NacosNamingServiceTest { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + private NacosNamingService client; private NamingClientProxy proxy; @@ -86,14 +90,30 @@ public void testRegisterInstance1() throws NacosException { client.registerInstance(serviceName, ip, port); //then verify(proxy, times(1)) - .registerService(eq(serviceName), eq(Constants.DEFAULT_GROUP), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .registerService(eq(serviceName), eq(Constants.DEFAULT_GROUP), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(Constants.DEFAULT_CLUSTER_NAME); - } - })); + .equals(Constants.DEFAULT_CLUSTER_NAME))); + } + + @Test + public void testBatchRegisterInstance() throws NacosException { + Instance instance = new Instance(); + String serviceName = "service1"; + String ip = "1.1.1.1"; + int port = 10000; + instance.setServiceName(serviceName); + instance.setEphemeral(true); + instance.setPort(port); + instance.setIp(ip); + List instanceList = new ArrayList<>(); + instanceList.add(instance); + //when + client.batchRegisterInstance(serviceName, Constants.DEFAULT_GROUP, instanceList); + //then + verify(proxy, times(1)) + .batchRegisterService(eq(serviceName), eq(Constants.DEFAULT_GROUP), argThat( + instances -> CollectionUtils.isEqualCollection(instanceList, instances))); } @Test @@ -107,14 +127,10 @@ public void testRegisterInstance2() throws NacosException { client.registerInstance(serviceName, groupName, ip, port); //then verify(proxy, times(1)) - .registerService(eq(serviceName), eq(groupName), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .registerService(eq(serviceName), eq(groupName), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(Constants.DEFAULT_CLUSTER_NAME); - } - })); + .equals(Constants.DEFAULT_CLUSTER_NAME))); } @Test @@ -128,14 +144,10 @@ public void testRegisterInstance3() throws NacosException { client.registerInstance(serviceName, ip, port, clusterName); //then verify(proxy, times(1)) - .registerService(eq(serviceName), eq(Constants.DEFAULT_GROUP), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .registerService(eq(serviceName), eq(Constants.DEFAULT_GROUP), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(clusterName); - } - })); + .equals(clusterName))); } @Test @@ -150,14 +162,10 @@ public void testRegisterInstance4() throws NacosException { client.registerInstance(serviceName, groupName, ip, port, clusterName); //then verify(proxy, times(1)) - .registerService(eq(serviceName), eq(groupName), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .registerService(eq(serviceName), eq(groupName), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(clusterName); - } - })); + .equals(clusterName))); } @Test @@ -183,6 +191,21 @@ public void testRegisterInstance6() throws NacosException { verify(proxy, times(1)).registerService(serviceName, groupName, instance); } + @Test + public void testRegisterInstance7() throws NacosException { + expectedException.expect(NacosException.class); + expectedException.expectMessage( + "Instance 'clusterName' should be characters with only 0-9a-zA-Z-. (current: cluster1,cluster2)"); + + //given + String serviceName = "service1"; + String groupName = "group1"; + Instance instance = new Instance(); + instance.setClusterName("cluster1,cluster2"); + //when + client.registerInstance(serviceName, groupName, instance); + } + @Test public void testDeregisterInstance1() throws NacosException { //given @@ -193,14 +216,9 @@ public void testDeregisterInstance1() throws NacosException { client.deregisterInstance(serviceName, ip, port); //then verify(proxy, times(1)).deregisterService(eq(serviceName), eq(Constants.DEFAULT_GROUP), - argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port - && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(Constants.DEFAULT_CLUSTER_NAME); - } - })); + argThat(instance -> instance.getIp().equals(ip) && instance.getPort() == port + && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() + .equals(Constants.DEFAULT_CLUSTER_NAME))); } @Test @@ -214,14 +232,10 @@ public void testDeregisterInstance2() throws NacosException { client.deregisterInstance(serviceName, groupName, ip, port); //then verify(proxy, times(1)) - .deregisterService(eq(serviceName), eq(groupName), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .deregisterService(eq(serviceName), eq(groupName), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(Constants.DEFAULT_CLUSTER_NAME); - } - })); + .equals(Constants.DEFAULT_CLUSTER_NAME))); } @Test @@ -235,14 +249,9 @@ public void testDeregisterInstance3() throws NacosException { client.deregisterInstance(serviceName, ip, port, clusterName); //then verify(proxy, times(1)).deregisterService(eq(serviceName), eq(Constants.DEFAULT_GROUP), - argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port - && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(clusterName); - } - })); + argThat(instance -> instance.getIp().equals(ip) && instance.getPort() == port + && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() + .equals(clusterName))); } @Test @@ -257,14 +266,10 @@ public void testDeregisterInstance4() throws NacosException { client.deregisterInstance(serviceName, groupName, ip, port, clusterName); //then verify(proxy, times(1)) - .deregisterService(eq(serviceName), eq(groupName), argThat(new ArgumentMatcher() { - @Override - public boolean matches(Instance instance) { - return instance.getIp().equals(ip) && instance.getPort() == port + .deregisterService(eq(serviceName), eq(groupName), argThat( + instance -> instance.getIp().equals(ip) && instance.getPort() == port && Math.abs(instance.getWeight() - 1.0) < 0.01f && instance.getClusterName() - .equals(clusterName); - } - })); + .equals(clusterName))); } @Test @@ -679,11 +684,8 @@ public void testSelectOneHealthyInstance8() throws NacosException { public void testSubscribe1() throws NacosException { //given String serviceName = "service1"; - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; //when client.subscribe(serviceName, listener); @@ -697,11 +699,8 @@ public void testSubscribe2() throws NacosException { //given String serviceName = "service1"; String groupName = "group1"; - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; //when client.subscribe(serviceName, groupName, listener); @@ -715,11 +714,8 @@ public void testSubscribe3() throws NacosException { //given String serviceName = "service1"; List clusterList = Arrays.asList("cluster1", "cluster2"); - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; //when client.subscribe(serviceName, clusterList, listener); @@ -735,11 +731,8 @@ public void testSubscribe4() throws NacosException { String serviceName = "service1"; String groupName = "group1"; List clusterList = Arrays.asList("cluster1", "cluster2"); - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; //when client.subscribe(serviceName, groupName, clusterList, listener); @@ -752,11 +745,8 @@ public void onEvent(Event event) { public void testUnSubscribe1() throws NacosException { //given String serviceName = "service1"; - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; when(changeNotifier.isSubscribed(serviceName, Constants.DEFAULT_GROUP, "")).thenReturn(false); //when @@ -771,11 +761,8 @@ public void testUnSubscribe2() throws NacosException { //given String serviceName = "service1"; String groupName = "group1"; - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; when(changeNotifier.isSubscribed(serviceName, groupName, "")).thenReturn(false); @@ -791,11 +778,8 @@ public void testUnSubscribe3() throws NacosException { //given String serviceName = "service1"; List clusterList = Arrays.asList("cluster1", "cluster2"); - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; when(changeNotifier.isSubscribed(serviceName, Constants.DEFAULT_GROUP, "cluster1,cluster2")).thenReturn(false); @@ -813,11 +797,8 @@ public void testUnSubscribe4() throws NacosException { String serviceName = "service1"; String groupName = "group1"; List clusterList = Arrays.asList("cluster1", "cluster2"); - EventListener listener = new EventListener() { - @Override - public void onEvent(Event event) { - - } + EventListener listener = event -> { + }; when(changeNotifier.isSubscribed(serviceName, groupName, "cluster1,cluster2")).thenReturn(false); diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolderTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolderTest.java index 7d02749a6af..5e94972143c 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolderTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/cache/ServiceInfoHolderTest.java @@ -35,11 +35,13 @@ public class ServiceInfoHolderTest { @Test - public void testGetServiceInfoMap() { + public void testGetServiceInfoMap() throws NoSuchFieldException, IllegalAccessException { Properties prop = new Properties(); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); Assert.assertEquals(0, holder.getServiceInfoMap().size()); - + Field fieldNotifierEventScope = ServiceInfoHolder.class.getDeclaredField("notifierEventScope"); + fieldNotifierEventScope.setAccessible(true); + Assert.assertEquals("scope-001", fieldNotifierEventScope.get(holder)); } @Test @@ -53,7 +55,7 @@ public void testProcessServiceInfo() { info.setHosts(hosts); Properties prop = new Properties(); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); ServiceInfo actual1 = holder.processServiceInfo(info); Assert.assertEquals(info, actual1); @@ -81,7 +83,7 @@ private Instance createInstance(String ip, int port) { @Test public void testProcessServiceInfo2() { Properties prop = new Properties(); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); String json = "{\"groupName\":\"a\",\"name\":\"b\",\"clusters\":\"c\"}"; ServiceInfo actual = holder.processServiceInfo(json); @@ -102,7 +104,7 @@ public void testProcessServiceInfoWithPushEmpty() { Properties prop = new Properties(); prop.setProperty(PropertyKeyConst.NAMING_PUSH_EMPTY_PROTECTION, "true"); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); holder.processServiceInfo(oldInfo); ServiceInfo newInfo = new ServiceInfo("a@@b@@c"); @@ -122,7 +124,7 @@ public void testGetServiceInfo() { info.setHosts(hosts); Properties prop = new Properties(); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); ServiceInfo expect = holder.processServiceInfo(info); String serviceName = "b"; @@ -137,7 +139,7 @@ public void testGetServiceInfo() { @Test public void testShutdown() throws NacosException, NoSuchFieldException, IllegalAccessException { Properties prop = new Properties(); - ServiceInfoHolder holder = new ServiceInfoHolder("aa", prop); + ServiceInfoHolder holder = new ServiceInfoHolder("aa", "scope-001", prop); Field field = ServiceInfoHolder.class.getDeclaredField("failoverReactor"); field.setAccessible(true); FailoverReactor reactor = (FailoverReactor) field.get(holder); diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeEventTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeEventTest.java index c4c6d78cb24..17cdfff75c4 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeEventTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeEventTest.java @@ -27,13 +27,15 @@ public class InstancesChangeEventTest { @Test public void testGetServiceName() { + String eventScope = "scope-001"; String serviceName = "a"; String groupName = "b"; String clusters = "c"; List hosts = new ArrayList<>(); Instance ins = new Instance(); hosts.add(ins); - InstancesChangeEvent event = new InstancesChangeEvent(serviceName, groupName, clusters, hosts); + InstancesChangeEvent event = new InstancesChangeEvent(eventScope, serviceName, groupName, clusters, hosts); + Assert.assertEquals(eventScope, event.scope()); Assert.assertEquals(serviceName, event.getServiceName()); Assert.assertEquals(clusters, event.getClusters()); Assert.assertEquals(groupName, event.getGroupName()); diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifierTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifierTest.java index 79e8bcbc987..7f20b3af629 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifierTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/event/InstancesChangeNotifierTest.java @@ -17,11 +17,13 @@ package com.alibaba.nacos.client.naming.event; import com.alibaba.nacos.api.naming.listener.EventListener; +import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; +import java.util.ArrayList; import java.util.List; import static org.mockito.ArgumentMatchers.any; @@ -31,10 +33,11 @@ public class InstancesChangeNotifierTest { @Test public void testRegisterListener() { + String eventScope = "scope-001"; String group = "a"; String name = "b"; String clusters = "c"; - InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(); + InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(eventScope); EventListener listener = Mockito.mock(EventListener.class); instancesChangeNotifier.registerListener(group, name, clusters, listener); List subscribeServices = instancesChangeNotifier.getSubscribeServices(); @@ -42,15 +45,21 @@ public void testRegisterListener() { Assert.assertEquals(group, subscribeServices.get(0).getGroupName()); Assert.assertEquals(name, subscribeServices.get(0).getName()); Assert.assertEquals(clusters, subscribeServices.get(0).getClusters()); - + + List hosts = new ArrayList<>(); + Instance ins = new Instance(); + hosts.add(ins); + InstancesChangeEvent event = new InstancesChangeEvent(eventScope, name, group, clusters, hosts); + Assert.assertEquals(true, instancesChangeNotifier.scopeMatches(event)); } @Test public void testDeregisterListener() { + String eventScope = "scope-001"; String group = "a"; String name = "b"; String clusters = "c"; - InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(); + InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(eventScope); EventListener listener = Mockito.mock(EventListener.class); instancesChangeNotifier.registerListener(group, name, clusters, listener); List subscribeServices = instancesChangeNotifier.getSubscribeServices(); @@ -64,10 +73,11 @@ public void testDeregisterListener() { @Test public void testIsSubscribed() { + String eventScope = "scope-001"; String group = "a"; String name = "b"; String clusters = "c"; - InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(); + InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(eventScope); EventListener listener = Mockito.mock(EventListener.class); Assert.assertFalse(instancesChangeNotifier.isSubscribed(group, name, clusters)); @@ -77,10 +87,11 @@ public void testIsSubscribed() { @Test public void testOnEvent() { + String eventScope = "scope-001"; String group = "a"; String name = "b"; String clusters = "c"; - InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(); + InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(eventScope); EventListener listener = Mockito.mock(EventListener.class); instancesChangeNotifier.registerListener(group, name, clusters, listener); @@ -95,7 +106,8 @@ public void testOnEvent() { @Test public void testSubscribeType() { - InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(); + String eventScope = "scope-001"; + InstancesChangeNotifier instancesChangeNotifier = new InstancesChangeNotifier(eventScope); Assert.assertEquals(InstancesChangeEvent.class, instancesChangeNotifier.subscribeType()); } } \ No newline at end of file diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/remote/AbstractNamingClientProxyTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/remote/AbstractNamingClientProxyTest.java index 5ba1d7eadd8..96e237272ec 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/remote/AbstractNamingClientProxyTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/remote/AbstractNamingClientProxyTest.java @@ -38,6 +38,7 @@ import org.mockito.junit.MockitoJUnitRunner; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -50,6 +51,9 @@ public class AbstractNamingClientProxyTest { @Mock private SecurityProxy sc; + /** + * test get security headers for accessToken. + */ @Test public void testGetSecurityHeadersForAccessToken() { AbstractNamingClientProxy proxy = new MockNamingClientProxy(sc); @@ -63,6 +67,10 @@ public void testGetSecurityHeadersForAccessToken() { Assert.assertEquals(AppNameUtils.getAppName(), securityHeaders.get("app")); } + /** + * get security headers for ram. + * @throws Exception exception + */ @Test public void testGetSecurityHeadersForRam() throws Exception { String ak = "aa"; @@ -94,7 +102,13 @@ protected MockNamingClientProxy(SecurityProxy securityProxy) { public void registerService(String serviceName, String groupName, Instance instance) throws NacosException { } + + @Override + public void batchRegisterService(String serviceName, String groupName, List instances) + throws NacosException { + } + @Override public void deregisterService(String serviceName, String groupName, Instance instance) throws NacosException { diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegateTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegateTest.java index 29d674f1599..b3e44804fc2 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegateTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/remote/NamingClientProxyDelegateTest.java @@ -34,7 +34,9 @@ import org.mockito.Mockito; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Properties; import java.util.Set; @@ -64,12 +66,37 @@ public void testRegisterServiceByGrpc() throws NacosException, NoSuchFieldExcept instance.setClusterName(groupName); instance.setIp("1.1.1.1"); instance.setPort(1); - // use http instance.setEphemeral(true); delegate.registerService(serviceName, groupName, instance); verify(mockGrpcClient, times(1)).registerService(serviceName, groupName, instance); } + @Test + public void testBatchRegisterServiceByGrpc() throws NacosException, NoSuchFieldException, IllegalAccessException { + String ns = "ns1"; + ServiceInfoHolder holder = Mockito.mock(ServiceInfoHolder.class); + Properties props = new Properties(); + props.setProperty("serverAddr", "localhost"); + InstancesChangeNotifier notifier = new InstancesChangeNotifier(); + NamingClientProxyDelegate delegate = new NamingClientProxyDelegate(ns, holder, props, notifier); + NamingGrpcClientProxy mockGrpcClient = Mockito.mock(NamingGrpcClientProxy.class); + Field grpcClientProxyField = NamingClientProxyDelegate.class.getDeclaredField("grpcClientProxy"); + grpcClientProxyField.setAccessible(true); + grpcClientProxyField.set(delegate, mockGrpcClient); + + String serviceName = "service1"; + String groupName = "group1"; + Instance instance = new Instance(); + instance.setServiceName(serviceName); + instance.setClusterName(groupName); + instance.setIp("1.1.1.1"); + instance.setPort(1); + instance.setEphemeral(true); + List instanceList = new ArrayList<>(); + delegate.batchRegisterService(serviceName, groupName, instanceList); + verify(mockGrpcClient, times(1)).batchRegisterService(serviceName, groupName, instanceList); + } + @Test public void testRegisterServiceByHttp() throws NacosException, NoSuchFieldException, IllegalAccessException { String ns = "ns1"; diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxyTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxyTest.java index 1d9e8a6216c..0da87a8eeb0 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxyTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/NamingGrpcClientProxyTest.java @@ -24,8 +24,10 @@ import com.alibaba.nacos.api.naming.pojo.Service; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.api.naming.remote.NamingRemoteConstants; +import com.alibaba.nacos.api.naming.remote.request.BatchInstanceRequest; import com.alibaba.nacos.api.naming.remote.request.InstanceRequest; import com.alibaba.nacos.api.naming.remote.request.SubscribeServiceRequest; +import com.alibaba.nacos.api.naming.remote.response.BatchInstanceResponse; import com.alibaba.nacos.api.naming.remote.response.InstanceResponse; import com.alibaba.nacos.api.naming.remote.response.QueryServiceResponse; import com.alibaba.nacos.api.naming.remote.response.ServiceListResponse; @@ -34,6 +36,7 @@ import com.alibaba.nacos.api.remote.RequestCallBack; import com.alibaba.nacos.api.remote.RequestFuture; import com.alibaba.nacos.api.remote.request.Request; +import com.alibaba.nacos.api.remote.response.ErrorResponse; import com.alibaba.nacos.api.remote.response.Response; import com.alibaba.nacos.api.selector.AbstractSelector; import com.alibaba.nacos.api.selector.NoneSelector; @@ -53,9 +56,11 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -72,6 +77,9 @@ @RunWith(MockitoJUnitRunner.class) public class NamingGrpcClientProxyTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); private static final String NAMESPACE_ID = "ns1"; @@ -137,6 +145,38 @@ public void testRegisterService() throws NacosException { })); } + @Test + public void testRegisterServiceThrowsNacosException() throws NacosException { + expectedException.expect(NacosException.class); + expectedException.expectMessage("err args"); + + when(this.rpcClient.request(Mockito.any())).thenReturn(ErrorResponse.build(400, "err args")); + + try { + client.registerService(SERVICE_NAME, GROUP_NAME, instance); + } catch (NacosException ex) { + Assert.assertEquals(null, ex.getCause()); + + throw ex; + } + } + + @Test + public void testRegisterServiceThrowsException() throws NacosException { + expectedException.expect(NacosException.class); + expectedException.expectMessage("Request nacos server failed: "); + + when(this.rpcClient.request(Mockito.any())).thenReturn(null); + + try { + client.registerService(SERVICE_NAME, GROUP_NAME, instance); + } catch (NacosException ex) { + Assert.assertEquals(NullPointerException.class, ex.getCause().getClass()); + + throw ex; + } + } + @Test public void testDeregisterService() throws NacosException { client.deregisterService(SERVICE_NAME, GROUP_NAME, instance); @@ -149,6 +189,24 @@ public void testDeregisterService() throws NacosException { })); } + @Test + public void testBatchRegisterService() throws NacosException { + List instanceList = new ArrayList<>(); + instance.setHealthy(true); + instanceList.add(instance); + response = new BatchInstanceResponse(); + when(this.rpcClient.request(any())).thenReturn(response); + client.batchRegisterService(SERVICE_NAME, GROUP_NAME, instanceList); + verify(this.rpcClient, times(1)).request(argThat(request -> { + if (request instanceof BatchInstanceRequest) { + BatchInstanceRequest request1 = (BatchInstanceRequest) request; + request1.setRequestId("1"); + return request1.getType().equals(NamingRemoteConstants.BATCH_REGISTER_INSTANCE); + } + return false; + })); + } + @Test public void testUpdateInstance() throws Exception { //TODO thrown.expect(UnsupportedOperationException.class); diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoServiceTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoServiceTest.java index afaffea0048..150ff5d87c2 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoServiceTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/remote/gprc/redo/NamingGrpcRedoServiceTest.java @@ -18,6 +18,7 @@ import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy; +import com.alibaba.nacos.client.naming.remote.gprc.redo.data.BatchInstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.InstanceRedoData; import com.alibaba.nacos.client.naming.remote.gprc.redo.data.SubscriberRedoData; import com.alibaba.nacos.common.utils.ReflectUtils; @@ -28,6 +29,8 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ScheduledExecutorService; @@ -100,6 +103,23 @@ public void testCacheInstanceForRedo() { assertFalse(actual.isUnregistering()); } + @Test + public void testCacheInstanceForRedoByBatchInstanceRedoData() { + ConcurrentMap registeredInstances = getInstanceRedoDataMap(); + assertTrue(registeredInstances.isEmpty()); + Instance instance = new Instance(); + List instanceList = new ArrayList<>(); + instanceList.add(instance); + redoService.cacheInstanceForRedo(SERVICE, GROUP, instanceList); + assertFalse(registeredInstances.isEmpty()); + BatchInstanceRedoData actual = (BatchInstanceRedoData) registeredInstances.entrySet().iterator().next().getValue(); + assertEquals(SERVICE, actual.getServiceName()); + assertEquals(GROUP, actual.getGroupName()); + assertEquals(instanceList, actual.getInstances()); + assertFalse(actual.isRegistered()); + assertFalse(actual.isUnregistering()); + } + @Test public void testInstanceRegistered() { ConcurrentMap registeredInstances = getInstanceRedoDataMap(); diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxyTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxyTest.java index b46ab9f9615..2d5e8674d97 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxyTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxyTest.java @@ -90,6 +90,76 @@ public void testRegisterService() throws Exception { verify(nacosRestTemplate, times(1)).exchangeForm(any(), any(), any(), any(), any(), any()); } + @Test + public void testRegisterServiceThrowsNacosException() throws Exception { + thrown.expect(NacosException.class); + thrown.expectMessage("failed to req API"); + + NacosRestTemplate nacosRestTemplate = mock(NacosRestTemplate.class); + HttpRestResult a = new HttpRestResult(); + a.setCode(503); + when(nacosRestTemplate.exchangeForm(any(), any(), any(), any(), any(), any())).thenReturn(a); + + SecurityProxy proxy = mock(SecurityProxy.class); + ServerListManager mgr = mock(ServerListManager.class); + when(mgr.getServerList()).thenReturn(Arrays.asList("localhost")); + Properties props = new Properties(); + ServiceInfoHolder holder = mock(ServiceInfoHolder.class); + NamingHttpClientProxy clientProxy = new NamingHttpClientProxy("namespaceId", proxy, mgr, props, holder); + + final Field nacosRestTemplateField = NamingHttpClientProxy.class.getDeclaredField("nacosRestTemplate"); + nacosRestTemplateField.setAccessible(true); + nacosRestTemplateField.set(clientProxy, nacosRestTemplate); + String serviceName = "service1"; + String groupName = "group1"; + Instance instance = new Instance(); + + try { + clientProxy.registerService(serviceName, groupName, instance); + } catch (NacosException ex) { + // verify the `NacosException` is directly thrown + Assert.assertEquals(null, ex.getCause()); + + throw ex; + } + } + + @Test + public void testRegisterServiceThrowsException() throws Exception { + // assert throw NacosException + thrown.expect(NacosException.class); + + NacosRestTemplate nacosRestTemplate = mock(NacosRestTemplate.class); + HttpRestResult a = new HttpRestResult(); + a.setCode(503); + // makes exchangeForm failed with a NullPointerException + when(nacosRestTemplate.exchangeForm(any(), any(), any(), any(), any(), any())).thenReturn(null); + + SecurityProxy proxy = mock(SecurityProxy.class); + ServerListManager mgr = mock(ServerListManager.class); + when(mgr.getServerList()).thenReturn(Arrays.asList("localhost")); + Properties props = new Properties(); + ServiceInfoHolder holder = mock(ServiceInfoHolder.class); + NamingHttpClientProxy clientProxy = new NamingHttpClientProxy("namespaceId", proxy, mgr, props, holder); + + final Field nacosRestTemplateField = NamingHttpClientProxy.class.getDeclaredField("nacosRestTemplate"); + nacosRestTemplateField.setAccessible(true); + nacosRestTemplateField.set(clientProxy, nacosRestTemplate); + String serviceName = "service1"; + String groupName = "group1"; + Instance instance = new Instance(); + + try { + clientProxy.registerService(serviceName, groupName, instance); + } catch (NacosException ex) { + // verify the `NacosException` is directly thrown + Assert.assertTrue(ex.getErrMsg().contains("java.lang.NullPointerException")); + Assert.assertEquals(NacosException.SERVER_ERROR, ex.getErrCode()); + + throw ex; + } + } + @Test public void testDeregisterService() throws Exception { //given diff --git a/client/src/test/java/com/alibaba/nacos/client/utils/EnvUtilTest.java b/client/src/test/java/com/alibaba/nacos/client/utils/EnvUtilTest.java index 7ec496383ef..231321aafba 100644 --- a/client/src/test/java/com/alibaba/nacos/client/utils/EnvUtilTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/utils/EnvUtilTest.java @@ -36,7 +36,7 @@ public void testSetSelfEnv() { headers.put(Constants.VIPSERVER_TAG, Arrays.asList("b", "2")); headers.put(Constants.LOCATION_TAG, Arrays.asList("c", "3")); EnvUtil.setSelfEnv(headers); - Assert.assertEquals("a,1", EnvUtil.getSelfAmorayTag()); + Assert.assertEquals("a,1", EnvUtil.getSelfAmoryTag()); Assert.assertEquals("b,2", EnvUtil.getSelfVipserverTag()); Assert.assertEquals("c,3", EnvUtil.getSelfLocationTag()); } diff --git a/client/src/test/resources/nacos_default_setting.properties b/client/src/test/resources/nacos_default_setting.properties new file mode 100644 index 00000000000..43a7185025d --- /dev/null +++ b/client/src/test/resources/nacos_default_setting.properties @@ -0,0 +1,16 @@ +# +# Copyright 1999-2022 Alibaba Group Holding Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +nacos.home.default.test=/home/default_setting \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..1d6261311b7 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +comment: + behavior: default + layout: reach,diff,flags,files,footer + require_changes: false diff --git a/common/src/main/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCache.java b/common/src/main/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCache.java index c8884c87284..fd3e9a5344d 100644 --- a/common/src/main/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCache.java +++ b/common/src/main/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCache.java @@ -87,6 +87,9 @@ public int getSize() { } private boolean isExpire(CacheItemProperties itemProperties) { + if (itemProperties == null) { + return true; + } return expireNanos != -1 && (System.nanoTime() - itemProperties.getExpireNanos() > expireNanos); } diff --git a/common/src/main/java/com/alibaba/nacos/common/cache/impl/SimpleCache.java b/common/src/main/java/com/alibaba/nacos/common/cache/impl/SimpleCache.java index 188e2ebdff4..29775d87e77 100644 --- a/common/src/main/java/com/alibaba/nacos/common/cache/impl/SimpleCache.java +++ b/common/src/main/java/com/alibaba/nacos/common/cache/impl/SimpleCache.java @@ -32,7 +32,7 @@ public class SimpleCache implements Cache { private Map cache; public SimpleCache(int size) { - cache = new HashMap(size); + cache = new HashMap<>(size); } @Override diff --git a/common/src/main/java/com/alibaba/nacos/common/executor/ExecutorFactory.java b/common/src/main/java/com/alibaba/nacos/common/executor/ExecutorFactory.java index 23b169d9d83..071408b8a5e 100644 --- a/common/src/main/java/com/alibaba/nacos/common/executor/ExecutorFactory.java +++ b/common/src/main/java/com/alibaba/nacos/common/executor/ExecutorFactory.java @@ -68,7 +68,7 @@ public static ScheduledExecutorService newScheduledExecutorService(final int nTh public static ThreadPoolExecutor newCustomerThreadExecutor(final int coreThreads, final int maxThreads, final long keepAliveTimeMs, final ThreadFactory threadFactory) { return new ThreadPoolExecutor(coreThreads, maxThreads, keepAliveTimeMs, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue(), threadFactory); + new LinkedBlockingQueue<>(), threadFactory); } public static final class Managed { @@ -172,7 +172,7 @@ public static ScheduledExecutorService newScheduledExecutorService(final String public static ThreadPoolExecutor newCustomerThreadExecutor(final String group, final int coreThreads, final int maxThreads, final long keepAliveTimeMs, final ThreadFactory threadFactory) { ThreadPoolExecutor executor = new ThreadPoolExecutor(coreThreads, maxThreads, keepAliveTimeMs, - TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), threadFactory); + TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory); THREAD_POOL_MANAGER.register(DEFAULT_NAMESPACE, group, executor); return executor; } diff --git a/common/src/main/java/com/alibaba/nacos/common/executor/ThreadPoolManager.java b/common/src/main/java/com/alibaba/nacos/common/executor/ThreadPoolManager.java index ce3d0985d69..e4ce5822b33 100644 --- a/common/src/main/java/com/alibaba/nacos/common/executor/ThreadPoolManager.java +++ b/common/src/main/java/com/alibaba/nacos/common/executor/ThreadPoolManager.java @@ -44,7 +44,7 @@ public final class ThreadPoolManager { private Map>> resourcesManager; - private Map lockers = new ConcurrentHashMap(8); + private Map lockers = new ConcurrentHashMap<>(8); private static final ThreadPoolManager INSTANCE = new ThreadPoolManager(); @@ -52,13 +52,10 @@ public final class ThreadPoolManager { static { INSTANCE.init(); - ThreadUtils.addShutdownHook(new Thread(new Runnable() { - @Override - public void run() { - LOGGER.warn("[ThreadPoolManager] Start destroying ThreadPool"); - shutdown(); - LOGGER.warn("[ThreadPoolManager] Destruction of the end"); - } + ThreadUtils.addShutdownHook(new Thread(() -> { + LOGGER.warn("[ThreadPoolManager] Start destroying ThreadPool"); + shutdown(); + LOGGER.warn("[ThreadPoolManager] Destruction of the end"); })); } @@ -70,7 +67,7 @@ private ThreadPoolManager() { } private void init() { - resourcesManager = new ConcurrentHashMap>>(8); + resourcesManager = new ConcurrentHashMap<>(8); } /** @@ -88,16 +85,12 @@ public void register(String namespace, String group, ExecutorService executor) { synchronized (monitor) { Map> map = resourcesManager.get(namespace); if (map == null) { - map = new HashMap>(8); - map.put(group, new HashSet()); - map.get(group).add(executor); + map = new HashMap<>(8); + map.computeIfAbsent(group, key -> new HashSet<>()).add(executor); resourcesManager.put(namespace, map); return; } - if (!map.containsKey(group)) { - map.put(group, new HashSet()); - } - map.get(group).add(executor); + map.computeIfAbsent(group, key -> new HashSet<>()).add(executor); } } diff --git a/common/src/main/java/com/alibaba/nacos/common/http/AbstractHttpClientFactory.java b/common/src/main/java/com/alibaba/nacos/common/http/AbstractHttpClientFactory.java index 7db59c6bf53..6ffd23483b2 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/AbstractHttpClientFactory.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/AbstractHttpClientFactory.java @@ -64,18 +64,10 @@ public NacosRestTemplate createNacosRestTemplate() { final JdkHttpClientRequest clientRequest = new JdkHttpClientRequest(httpClientConfig); // enable ssl - initTls(new BiConsumer() { - @Override - public void accept(SSLContext sslContext, HostnameVerifier hostnameVerifier) { - clientRequest.setSSLContext(loadSSLContext()); - clientRequest.replaceSSLHostnameVerifier(hostnameVerifier); - } - }, new TlsFileWatcher.FileChangeListener() { - @Override - public void onChanged(String filePath) { - clientRequest.setSSLContext(loadSSLContext()); - } - }); + initTls((sslContext, hostnameVerifier) -> { + clientRequest.setSSLContext(loadSSLContext()); + clientRequest.replaceSSLHostnameVerifier(hostnameVerifier); + }, filePath -> clientRequest.setSSLContext(loadSSLContext())); return new NacosRestTemplate(assignLogger(), clientRequest); } diff --git a/common/src/main/java/com/alibaba/nacos/common/http/HttpClientBeanHolder.java b/common/src/main/java/com/alibaba/nacos/common/http/HttpClientBeanHolder.java index 2842906bd25..873df0fb878 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/HttpClientBeanHolder.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/HttpClientBeanHolder.java @@ -36,20 +36,15 @@ public final class HttpClientBeanHolder { private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientBeanHolder.class); - private static final Map SINGLETON_REST = new HashMap(10); + private static final Map SINGLETON_REST = new HashMap<>(10); - private static final Map SINGLETON_ASYNC_REST = new HashMap( + private static final Map SINGLETON_ASYNC_REST = new HashMap<>( 10); private static final AtomicBoolean ALREADY_SHUTDOWN = new AtomicBoolean(false); static { - ThreadUtils.addShutdownHook(new Runnable() { - @Override - public void run() { - shutdown(); - } - }); + ThreadUtils.addShutdownHook(HttpClientBeanHolder::shutdown); } public static NacosRestTemplate getNacosRestTemplate(Logger logger) { diff --git a/common/src/main/java/com/alibaba/nacos/common/http/HttpUtils.java b/common/src/main/java/com/alibaba/nacos/common/http/HttpUtils.java index feba543e751..88aa3d096b7 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/HttpUtils.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/HttpUtils.java @@ -114,7 +114,7 @@ public static void initRequestFromEntity(HttpRequestBase requestBase, Map params = new ArrayList(body.size()); + List params = new ArrayList<>(body.size()); for (Map.Entry entry : body.entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } @@ -176,9 +176,9 @@ public static String buildUrl(boolean isHttps, String serverAddr, String... subP * @throws Exception exception */ public static Map translateParameterMap(Map parameterMap) throws Exception { - Map map = new HashMap(16); - for (String key : parameterMap.keySet()) { - map.put(key, parameterMap.get(key)[0]); + Map map = new HashMap<>(16); + for (Map.Entry entry : parameterMap.entrySet()) { + map.put(entry.getKey(), entry.getValue()[0]); } return map; } diff --git a/common/src/main/java/com/alibaba/nacos/common/http/client/NacosRestTemplate.java b/common/src/main/java/com/alibaba/nacos/common/http/client/NacosRestTemplate.java index 1d60c2e4cff..9b165d74454 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/client/NacosRestTemplate.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/client/NacosRestTemplate.java @@ -49,7 +49,7 @@ public class NacosRestTemplate extends AbstractNacosRestTemplate { private final HttpClientRequest requestClient; - private final List interceptors = new ArrayList(); + private final List interceptors = new ArrayList<>(); public NacosRestTemplate(Logger logger, HttpClientRequest requestClient) { super(logger); diff --git a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/AbstractResponseHandler.java b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/AbstractResponseHandler.java index 04918837171..6c80d7ef327 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/AbstractResponseHandler.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/AbstractResponseHandler.java @@ -49,7 +49,7 @@ public final HttpRestResult handle(HttpClientResponse response) throws Except private HttpRestResult handleError(HttpClientResponse response) throws Exception { Header headers = response.getHeaders(); String message = IoUtils.toString(response.getBody(), headers.getCharset()); - return new HttpRestResult(headers, response.getStatusCode(), null, message); + return new HttpRestResult<>(headers, response.getStatusCode(), null, message); } /** diff --git a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/BeanResponseHandler.java b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/BeanResponseHandler.java index 70c531534c6..1e8b655ad87 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/BeanResponseHandler.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/BeanResponseHandler.java @@ -37,6 +37,6 @@ public HttpRestResult convertResult(HttpClientResponse response, Type respons final Header headers = response.getHeaders(); InputStream body = response.getBody(); T extractBody = JacksonUtils.toObj(body, responseType); - return new HttpRestResult(headers, response.getStatusCode(), extractBody, null); + return new HttpRestResult<>(headers, response.getStatusCode(), extractBody, null); } } diff --git a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/RestResultResponseHandler.java b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/RestResultResponseHandler.java index ec83b6aec55..10886cac2f6 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/RestResultResponseHandler.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/RestResultResponseHandler.java @@ -44,7 +44,7 @@ public HttpRestResult convertResult(HttpClientResponse response, Type respons } private static HttpRestResult convert(RestResult restResult) { - HttpRestResult httpRestResult = new HttpRestResult(); + HttpRestResult httpRestResult = new HttpRestResult<>(); httpRestResult.setCode(restResult.getCode()); httpRestResult.setData(restResult.getData()); httpRestResult.setMessage(restResult.getMessage()); diff --git a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/StringResponseHandler.java b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/StringResponseHandler.java index 43ca2cb44c8..8e776dc5c0f 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/client/handler/StringResponseHandler.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/client/handler/StringResponseHandler.java @@ -34,6 +34,6 @@ public class StringResponseHandler extends AbstractResponseHandler { public HttpRestResult convertResult(HttpClientResponse response, Type responseType) throws Exception { final Header headers = response.getHeaders(); String extractBody = IoUtils.toString(response.getBody(), headers.getCharset()); - return new HttpRestResult(headers, response.getStatusCode(), extractBody, null); + return new HttpRestResult<>(headers, response.getStatusCode(), extractBody, null); } } diff --git a/common/src/main/java/com/alibaba/nacos/common/http/param/Header.java b/common/src/main/java/com/alibaba/nacos/common/http/param/Header.java index 616e1c47196..98dc8efc7a5 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/param/Header.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/param/Header.java @@ -45,8 +45,8 @@ public class Header { private static final String DEFAULT_ENCODING = "gzip"; private Header() { - header = new TreeMap(String.CASE_INSENSITIVE_ORDER); - originalResponseHeader = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + header = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + originalResponseHeader = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); addParam(HttpHeaderConsts.CONTENT_TYPE, MediaType.APPLICATION_JSON); addParam(HttpHeaderConsts.ACCEPT_CHARSET, DEFAULT_CHARSET); //addParam(HttpHeaderConsts.ACCEPT_ENCODING, DEFAULT_ENCODING); @@ -99,7 +99,7 @@ public Iterator> iterator() { * @return KV string list */ public List toList() { - List list = new ArrayList(header.size() * 2); + List list = new ArrayList<>(header.size() * 2); Iterator> iterator = iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); diff --git a/common/src/main/java/com/alibaba/nacos/common/http/param/Query.java b/common/src/main/java/com/alibaba/nacos/common/http/param/Query.java index 4c6027f3101..a3056b15c85 100644 --- a/common/src/main/java/com/alibaba/nacos/common/http/param/Query.java +++ b/common/src/main/java/com/alibaba/nacos/common/http/param/Query.java @@ -41,7 +41,7 @@ public class Query { private static final String DEFAULT_ENC = "UTF-8"; public Query() { - params = new LinkedHashMap(); + params = new LinkedHashMap<>(); } public static Query newInstance() { diff --git a/common/src/main/java/com/alibaba/nacos/common/model/RestResult.java b/common/src/main/java/com/alibaba/nacos/common/model/RestResult.java index e97c30b7de5..aa31cb4f62e 100644 --- a/common/src/main/java/com/alibaba/nacos/common/model/RestResult.java +++ b/common/src/main/java/com/alibaba/nacos/common/model/RestResult.java @@ -86,7 +86,7 @@ public String toString() { } public static ResResultBuilder builder() { - return new ResResultBuilder(); + return new ResResultBuilder<>(); } public static final class ResResultBuilder { @@ -121,7 +121,7 @@ public ResResultBuilder withData(T data) { * @return result */ public RestResult build() { - RestResult restResult = new RestResult(); + RestResult restResult = new RestResult<>(); restResult.setCode(code); restResult.setMessage(errMsg); restResult.setData(data); diff --git a/common/src/main/java/com/alibaba/nacos/common/notify/DefaultPublisher.java b/common/src/main/java/com/alibaba/nacos/common/notify/DefaultPublisher.java index dd25a9488c8..389f2e2e8f2 100644 --- a/common/src/main/java/com/alibaba/nacos/common/notify/DefaultPublisher.java +++ b/common/src/main/java/com/alibaba/nacos/common/notify/DefaultPublisher.java @@ -180,6 +180,10 @@ void receiveEvent(Event event) { // Notification single event listener for (Subscriber subscriber : subscribers) { + if (!subscriber.scopeMatches(event)) { + continue; + } + // Whether to ignore expiration events if (subscriber.ignoreExpireEvent() && lastEventSequence > currentEventSequence) { LOGGER.debug("[NotifyCenter] the {} is unacceptable to this subscriber, because had expire", diff --git a/common/src/main/java/com/alibaba/nacos/common/notify/DefaultSharePublisher.java b/common/src/main/java/com/alibaba/nacos/common/notify/DefaultSharePublisher.java index 26c62be91cc..ab8c989e361 100644 --- a/common/src/main/java/com/alibaba/nacos/common/notify/DefaultSharePublisher.java +++ b/common/src/main/java/com/alibaba/nacos/common/notify/DefaultSharePublisher.java @@ -47,7 +47,7 @@ public void addSubscriber(Subscriber subscriber, Class subscrib try { Set sets = subMappings.get(subSlowEventType); if (sets == null) { - Set newSet = new ConcurrentHashSet(); + Set newSet = new ConcurrentHashSet<>(); newSet.add(subscriber); subMappings.put(subSlowEventType, newSet); return; diff --git a/common/src/main/java/com/alibaba/nacos/common/notify/Event.java b/common/src/main/java/com/alibaba/nacos/common/notify/Event.java index e5dc694f802..408b7a84b50 100644 --- a/common/src/main/java/com/alibaba/nacos/common/notify/Event.java +++ b/common/src/main/java/com/alibaba/nacos/common/notify/Event.java @@ -43,5 +43,13 @@ public long sequence() { return sequence; } + /** + * Event scope. + * + * @return event scope, return null if for all scope + */ + public String scope() { + return null; + } } diff --git a/common/src/main/java/com/alibaba/nacos/common/notify/listener/Subscriber.java b/common/src/main/java/com/alibaba/nacos/common/notify/listener/Subscriber.java index 65a41d59eee..2e6500b558f 100644 --- a/common/src/main/java/com/alibaba/nacos/common/notify/listener/Subscriber.java +++ b/common/src/main/java/com/alibaba/nacos/common/notify/listener/Subscriber.java @@ -60,4 +60,15 @@ public Executor executor() { public boolean ignoreExpireEvent() { return false; } + + /** + * Whether the event's scope matches current subscriber. Default implementation is all scopes matched. + * If you override this method, it better to override related {@link com.alibaba.nacos.common.notify.Event#scope()}. + * + * @param event {@link Event} + * @return Whether the event's scope matches current subscriber + */ + public boolean scopeMatches(T event) { + return event.scope() == null; + } } diff --git a/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/AbstractResource.java b/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/AbstractResource.java index 2937cfbef74..14da3398dd7 100644 --- a/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/AbstractResource.java +++ b/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/AbstractResource.java @@ -18,8 +18,8 @@ import com.alibaba.nacos.common.packagescan.util.NestedIoException; import com.alibaba.nacos.common.packagescan.util.ResourceUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileNotFoundException; @@ -58,7 +58,7 @@ public boolean exists() { try { return getFile().exists(); } catch (IOException ex) { - Log logger = LogFactory.getLog(getClass()); + Logger logger = LoggerFactory.getLogger(getClass()); if (logger.isDebugEnabled()) { logger.debug("Could not retrieve File for existence check of " + getDescription(), ex); } @@ -69,7 +69,7 @@ public boolean exists() { getInputStream().close(); return true; } catch (Throwable ex) { - Log logger = LogFactory.getLog(getClass()); + Logger logger = LoggerFactory.getLogger(getClass()); if (logger.isDebugEnabled()) { logger.debug("Could not retrieve InputStream for existence check of " + getDescription(), ex); } @@ -169,7 +169,7 @@ public long contentLength() throws IOException { try { is.close(); } catch (IOException ex) { - Log logger = LogFactory.getLog(getClass()); + Logger logger = LoggerFactory.getLogger(getClass()); if (logger.isDebugEnabled()) { logger.debug("Could not close content-length InputStream for " + getDescription(), ex); } diff --git a/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/PathMatchingResourcePatternResolver.java b/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/PathMatchingResourcePatternResolver.java index a86aef1bfb8..b4de963d039 100644 --- a/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/PathMatchingResourcePatternResolver.java +++ b/common/src/main/java/com/alibaba/nacos/common/packagescan/resource/PathMatchingResourcePatternResolver.java @@ -22,8 +22,8 @@ import com.alibaba.nacos.common.utils.ClassUtils; import com.alibaba.nacos.common.utils.ReflectUtils; import com.alibaba.nacos.common.utils.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileNotFoundException; @@ -174,7 +174,7 @@ */ public class PathMatchingResourcePatternResolver implements ResourcePatternResolver { - private static final Log LOGGER = LogFactory.getLog(PathMatchingResourcePatternResolver.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PathMatchingResourcePatternResolver.class); private static Method equinoxResolveMethod; diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java b/common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java index 15f6b535f0a..8edb1110008 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java @@ -390,7 +390,7 @@ public final void start() throws NacosException { } catch (Throwable e) { LoggerUtils.printIfWarnEnabled(LOGGER, "[{}] Fail to connect to server on start up, error message = {}, start up retry times left: {}", - name, e.getMessage(), startUpRetryTimes); + name, e.getMessage(), startUpRetryTimes, e); } } @@ -551,6 +551,10 @@ protected void reconnect(final ServerInfo recommendServerInfo, boolean onRequest recommendServer.set(null); } + if (CollectionUtils.isEmpty(RpcClient.this.serverListFactory.getServerList())) { + throw new Exception("server list is empty"); + } + if (reConnectTimes > 0 && reConnectTimes % RpcClient.this.serverListFactory.getServerList().size() == 0) { LoggerUtils.printIfInfoEnabled(LOGGER, diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClient.java b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClient.java index e9affa0a207..d285583fbcd 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClient.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClient.java @@ -130,26 +130,29 @@ public void shutdown() throws NacosException { grpcExecutor.shutdown(); } } - + + /** + * Create a stub using a channel. + * + * @param managedChannelTemp channel. + * @return if server check success,return a non-null stub. + */ + private RequestGrpc.RequestFutureStub createNewChannelStub(ManagedChannel managedChannelTemp) { + return RequestGrpc.newFutureStub(managedChannelTemp); + } + /** * create a new channel with specific server address. * * @param serverIp serverIp. * @param serverPort serverPort. - * @return if server check success,return a non-null stub. + * @return if server check success,return a non-null channel. */ - private RequestGrpc.RequestFutureStub createNewChannelStub(String serverIp, int serverPort) { - - ManagedChannelBuilder o = ManagedChannelBuilder.forAddress(serverIp, serverPort).executor(grpcExecutor) - .compressorRegistry(CompressorRegistry.getDefaultInstance()) - .decompressorRegistry(DecompressorRegistry.getDefaultInstance()) - .maxInboundMessageSize(getInboundMessageSize()) - .keepAliveTime(keepAliveTimeMillis(), TimeUnit.MILLISECONDS).usePlaintext(); - - ManagedChannel managedChannelTemp = o.build(); - - return RequestGrpc.newFutureStub(managedChannelTemp); - + private ManagedChannel createNewManagedChannel(String serverIp, int serverPort) { + ManagedChannelBuilder managedChannelBuilder = ManagedChannelBuilder.forAddress(serverIp, serverPort).executor(grpcExecutor) + .compressorRegistry(CompressorRegistry.getDefaultInstance()).decompressorRegistry(DecompressorRegistry.getDefaultInstance()) + .maxInboundMessageSize(getInboundMessageSize()).keepAliveTime(keepAliveTimeMillis(), TimeUnit.MILLISECONDS).usePlaintext(); + return managedChannelBuilder.build(); } private int getInboundMessageSize() { @@ -296,12 +299,13 @@ public Connection connectToServer(ServerInfo serverInfo) { this.grpcExecutor = createGrpcExecutor(serverInfo.getServerIp()); } int port = serverInfo.getServerPort() + rpcPortOffset(); - RequestGrpc.RequestFutureStub newChannelStubTemp = createNewChannelStub(serverInfo.getServerIp(), port); + ManagedChannel managedChannel = createNewManagedChannel(serverInfo.getServerIp(), port); + RequestGrpc.RequestFutureStub newChannelStubTemp = createNewChannelStub(managedChannel); if (newChannelStubTemp != null) { Response response = serverCheck(serverInfo.getServerIp(), port, newChannelStubTemp); if (response == null || !(response instanceof ServerCheckResponse)) { - shuntDownChannel((ManagedChannel) newChannelStubTemp.getChannel()); + shuntDownChannel(managedChannel); return null; } @@ -316,7 +320,7 @@ public Connection connectToServer(ServerInfo serverInfo) { // stream observer to send response to server grpcConn.setPayloadStreamObserver(payloadStreamObserver); grpcConn.setGrpcFutureServiceStub(newChannelStubTemp); - grpcConn.setChannel((ManagedChannel) newChannelStubTemp.getChannel()); + grpcConn.setChannel(managedChannel); //send a setup request. ConnectionSetupRequest conSetupRequest = new ConnectionSetupRequest(); conSetupRequest.setClientVersion(VersionUtils.getFullClientVersion()); diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClusterClient.java b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClusterClient.java index 4ff21445685..7b63653b659 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClusterClient.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClusterClient.java @@ -16,6 +16,8 @@ package com.alibaba.nacos.common.remote.client.grpc; +import com.alibaba.nacos.api.common.Constants; + /** * gRPC client for cluster. * @@ -24,8 +26,6 @@ */ public class GrpcClusterClient extends GrpcClient { - private static final String NACOS_SERVER_CLUSTER_GRPC_PORT_DEFAULT_OFFSET = "1001"; - /** * Empty constructor. * @@ -37,8 +37,8 @@ public GrpcClusterClient(String name) { @Override public int rpcPortOffset() { - return Integer.parseInt(System.getProperty( - NACOS_SERVER_GRPC_PORT_OFFSET_KEY, NACOS_SERVER_CLUSTER_GRPC_PORT_DEFAULT_OFFSET)); + return Integer.parseInt(System.getProperty(NACOS_SERVER_GRPC_PORT_OFFSET_KEY, + String.valueOf(Constants.CLUSTER_GRPC_PORT_DEFAULT_OFFSET))); } } diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcSdkClient.java b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcSdkClient.java index 1dcf5e70665..34cf408243a 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcSdkClient.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcSdkClient.java @@ -16,6 +16,8 @@ package com.alibaba.nacos.common.remote.client.grpc; +import com.alibaba.nacos.api.common.Constants; + /** * gRPC client for sdk. * @@ -24,8 +26,6 @@ */ public class GrpcSdkClient extends GrpcClient { - private static final String NACOS_SERVER_GRPC_PORT_DEFAULT_OFFSET = "1000"; - /** * Empty constructor. * @@ -37,8 +37,8 @@ public GrpcSdkClient(String name) { @Override public int rpcPortOffset() { - return Integer.parseInt(System.getProperty( - NACOS_SERVER_GRPC_PORT_OFFSET_KEY, NACOS_SERVER_GRPC_PORT_DEFAULT_OFFSET)); + return Integer.parseInt(System.getProperty(NACOS_SERVER_GRPC_PORT_OFFSET_KEY, + String.valueOf(Constants.SDK_GRPC_PORT_DEFAULT_OFFSET))); } } \ No newline at end of file diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcUtils.java b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcUtils.java index 03cbfef25f4..bd7c60c56b9 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcUtils.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcUtils.java @@ -17,8 +17,6 @@ package com.alibaba.nacos.common.remote.client.grpc; import com.alibaba.nacos.api.exception.NacosException; -import com.alibaba.nacos.api.exception.runtime.NacosDeserializationException; -import com.alibaba.nacos.api.exception.runtime.NacosSerializationException; import com.alibaba.nacos.api.grpc.auto.Metadata; import com.alibaba.nacos.api.grpc.auto.Payload; import com.alibaba.nacos.api.remote.request.Request; @@ -27,15 +25,13 @@ import com.alibaba.nacos.api.utils.NetUtils; import com.alibaba.nacos.common.remote.PayloadRegistry; import com.alibaba.nacos.common.remote.exception.RemoteException; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.alibaba.nacos.common.utils.JacksonUtils; +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; import com.google.protobuf.Any; import com.google.protobuf.ByteString; +import com.google.protobuf.UnsafeByteOperations; -import java.io.IOException; -import java.nio.charset.StandardCharsets; +import java.nio.ByteBuffer; /** * gRPC utils, use to parse request and response. @@ -45,45 +41,6 @@ */ public class GrpcUtils { - static ObjectMapper mapper = new ObjectMapper(); - - static { - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - } - - /** - * Object to json string. - * - * @param obj obj - * @return json string - * @throws NacosSerializationException if transfer failed - */ - private static String toJson(Object obj) { - try { - return mapper.writeValueAsString(obj); - } catch (JsonProcessingException e) { - throw new NacosSerializationException(obj.getClass(), e); - } - } - - /** - * Json string deserialize to Object. - * - * @param json json string - * @param cls class of object - * @param General type - * @return object - * @throws NacosDeserializationException if deserialize failed - */ - public static T toObj(String json, Class cls) { - try { - return mapper.readValue(json, cls); - } catch (IOException e) { - throw new NacosDeserializationException(cls, e); - } - } - /** * convert request to payload. * @@ -103,9 +60,9 @@ public static Payload convert(Request request, RequestMeta meta) { // request body . request.clearHeaders(); - String jsonString = toJson(request); + byte[] jsonBytes = JacksonUtils.toJsonBytes(request); return payloadBuilder - .setBody(Any.newBuilder().setValue(ByteString.copyFrom(jsonString, StandardCharsets.UTF_8))) + .setBody(Any.newBuilder().setValue(UnsafeByteOperations.unsafeWrap(jsonBytes))) .build(); } @@ -121,12 +78,12 @@ public static Payload convert(Request request) { Metadata newMeta = Metadata.newBuilder().setType(request.getClass().getSimpleName()) .setClientIp(NetUtils.localIP()).putAllHeaders(request.getHeaders()).build(); request.clearHeaders(); - String jsonString = toJson(request); + byte[] jsonBytes = JacksonUtils.toJsonBytes(request); Payload.Builder builder = Payload.newBuilder(); return builder - .setBody(Any.newBuilder().setValue(ByteString.copyFrom(jsonString, StandardCharsets.UTF_8))) + .setBody(Any.newBuilder().setValue(UnsafeByteOperations.unsafeWrap(jsonBytes))) .setMetadata(newMeta).build(); } @@ -138,11 +95,11 @@ public static Payload convert(Request request) { * @return payload. */ public static Payload convert(Response response) { - String jsonString = toJson(response); + byte[] jsonBytes = JacksonUtils.toJsonBytes(response); Metadata.Builder metaBuilder = Metadata.newBuilder().setType(response.getClass().getSimpleName()); return Payload.newBuilder() - .setBody(Any.newBuilder().setValue(ByteString.copyFrom(jsonString, StandardCharsets.UTF_8))) + .setBody(Any.newBuilder().setValue(UnsafeByteOperations.unsafeWrap(jsonBytes))) .setMetadata(metaBuilder.build()).build(); } @@ -155,7 +112,9 @@ public static Payload convert(Response response) { public static Object parse(Payload payload) { Class classType = PayloadRegistry.getClassByType(payload.getMetadata().getType()); if (classType != null) { - Object obj = toObj(payload.getBody().getValue().toString(StandardCharsets.UTF_8), classType); + ByteString byteString = payload.getBody().getValue(); + ByteBuffer byteBuffer = byteString.asReadOnlyByteBuffer(); + Object obj = JacksonUtils.toObj(new ByteBufferBackedInputStream(byteBuffer), classType); if (obj instanceof Request) { ((Request) obj).putAllHeader(payload.getMetadata().getHeadersMap()); } diff --git a/common/src/main/java/com/alibaba/nacos/common/spi/NacosServiceLoader.java b/common/src/main/java/com/alibaba/nacos/common/spi/NacosServiceLoader.java index 2bd058884e8..315073365d6 100644 --- a/common/src/main/java/com/alibaba/nacos/common/spi/NacosServiceLoader.java +++ b/common/src/main/java/com/alibaba/nacos/common/spi/NacosServiceLoader.java @@ -30,7 +30,7 @@ */ public class NacosServiceLoader { - private static final Map, Collection>> SERVICES = new ConcurrentHashMap, Collection>>(); + private static final Map, Collection>> SERVICES = new ConcurrentHashMap<>(); /** * Load service. @@ -45,7 +45,7 @@ public static Collection load(final Class service) { if (SERVICES.containsKey(service)) { return newServiceInstances(service); } - Collection result = new LinkedHashSet(); + Collection result = new LinkedHashSet<>(); for (T each : ServiceLoader.load(service)) { result.add(each); cacheServiceClass(service, each); @@ -55,7 +55,7 @@ public static Collection load(final Class service) { private static void cacheServiceClass(final Class service, final T instance) { if (!SERVICES.containsKey(service)) { - SERVICES.put(service, new LinkedHashSet>()); + SERVICES.put(service, new LinkedHashSet<>()); } SERVICES.get(service).add(instance.getClass()); } @@ -73,7 +73,7 @@ public static Collection newServiceInstances(final Class service) { @SuppressWarnings("unchecked") private static Collection newServiceInstancesFromCache(Class service) { - Collection result = new LinkedHashSet(); + Collection result = new LinkedHashSet<>(); for (Class each : SERVICES.get(service)) { result.add((T) newServiceInstance(each)); } diff --git a/common/src/main/java/com/alibaba/nacos/common/task/engine/NacosDelayTaskExecuteEngine.java b/common/src/main/java/com/alibaba/nacos/common/task/engine/NacosDelayTaskExecuteEngine.java index 23ff94d9ef1..ea8d97c57c5 100644 --- a/common/src/main/java/com/alibaba/nacos/common/task/engine/NacosDelayTaskExecuteEngine.java +++ b/common/src/main/java/com/alibaba/nacos/common/task/engine/NacosDelayTaskExecuteEngine.java @@ -104,7 +104,7 @@ public AbstractDelayTask removeTask(Object key) { @Override public Collection getAllTaskKeys() { - Collection keys = new HashSet(); + Collection keys = new HashSet<>(); lock.lock(); try { keys.addAll(tasks.keySet()); diff --git a/common/src/main/java/com/alibaba/nacos/common/task/engine/TaskExecuteWorker.java b/common/src/main/java/com/alibaba/nacos/common/task/engine/TaskExecuteWorker.java index 63ad61e40af..f220d753407 100644 --- a/common/src/main/java/com/alibaba/nacos/common/task/engine/TaskExecuteWorker.java +++ b/common/src/main/java/com/alibaba/nacos/common/task/engine/TaskExecuteWorker.java @@ -54,7 +54,7 @@ public TaskExecuteWorker(final String name, final int mod, final int total) { public TaskExecuteWorker(final String name, final int mod, final int total, final Logger logger) { this.name = name + "_" + mod + "%" + total; - this.queue = new ArrayBlockingQueue(QUEUE_CAPACITY); + this.queue = new ArrayBlockingQueue<>(QUEUE_CAPACITY); this.closed = new AtomicBoolean(false); this.log = null == logger ? LoggerFactory.getLogger(TaskExecuteWorker.class) : logger; new InnerWorker(name).start(); diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/DeregisterInstanceReason.java b/common/src/main/java/com/alibaba/nacos/common/trace/DeregisterInstanceReason.java new file mode 100644 index 00000000000..5b0f834c784 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/DeregisterInstanceReason.java @@ -0,0 +1,42 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace; + +/** + * The reasons of deregister instance. + * + * @author yanda + */ +public enum DeregisterInstanceReason { + /** + * client initiates request. + */ + REQUEST, + /** + * Instance native disconnected. + */ + NATIVE_DISCONNECTED, + /** + * Instance synced disconnected. + */ + SYNCED_DISCONNECTED, + /** + * Instance heart beat timeout expire. + */ + HEARTBEAT_EXPIRE, + +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/HealthCheckType.java b/common/src/main/java/com/alibaba/nacos/common/trace/HealthCheckType.java new file mode 100644 index 00000000000..1681abb4aa6 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/HealthCheckType.java @@ -0,0 +1,51 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace; + +/** + * The types of health check. + * + * @author yanda + */ +public enum HealthCheckType { + /** + * Instance heart beat timeout. + */ + CLIENT_BEAT("client_beat"), + /** + * Http health check. + */ + HTTP_HEALTH_CHECK("http"), + /** + * Mysql health check. + */ + MYSQL_HEALTH_CHECK("mysql"), + /** + * Tcp super sense health check . + */ + TCP_SUPER_SENSE("tcp"); + + private String prefix; + + private HealthCheckType(String prefix) { + this.prefix = prefix; + } + + public String getPrefix() { + return prefix; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/TraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/TraceEvent.java new file mode 100644 index 00000000000..9d216ce2432 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/TraceEvent.java @@ -0,0 +1,64 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event; + +import com.alibaba.nacos.common.notify.Event; + +/** + * Trace event. + * + * @author yanda + */ +public class TraceEvent extends Event { + private String type; + + private final long eventTime; + + private final String namespace; + + private final String group; + + private final String name; + + public String getType() { + return type; + } + + public long getEventTime() { + return eventTime; + } + + public String getNamespace() { + return namespace; + } + + public String getGroup() { + return group; + } + + public String getName() { + return name; + } + + public TraceEvent(String eventType, long eventTime, String namespace, String group, String name) { + this.type = eventType; + this.eventTime = eventTime; + this.namespace = namespace; + this.group = group; + this.name = name; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterInstanceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterInstanceTraceEvent.java new file mode 100644 index 00000000000..96676ee7e54 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterInstanceTraceEvent.java @@ -0,0 +1,72 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +import com.alibaba.nacos.common.trace.DeregisterInstanceReason; + +/** + * Naming deregister instance trace event. + * @author yanda + */ +public class DeregisterInstanceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = 3850573686472190256L; + + private final String clientIp; + + private final boolean rpc; + + private String instanceIp; + + private int instancePort; + + public final DeregisterInstanceReason reason; + + public String getClientIp() { + return clientIp; + } + + public boolean isRpc() { + return rpc; + } + + public String getInstanceIp() { + return instanceIp; + } + + public int getInstancePort() { + return instancePort; + } + + public String toInetAddr() { + return instanceIp + ":" + instancePort; + } + + public DeregisterInstanceReason getReason() { + return reason; + } + + public DeregisterInstanceTraceEvent(long eventTime, String clientIp, boolean rpc, DeregisterInstanceReason reason, + String serviceNamespace, String serviceGroup, String serviceName, String instanceIp, int instancePort) { + super("DEREGISTER_INSTANCE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.clientIp = clientIp; + this.reason = reason; + this.rpc = rpc; + this.instanceIp = instanceIp; + this.instancePort = instancePort; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterServiceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterServiceTraceEvent.java new file mode 100644 index 00000000000..617c97d7a0b --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/DeregisterServiceTraceEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming deregister service trace event. + * @author yanda + */ +public class DeregisterServiceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = 7358195336881398548L; + + public DeregisterServiceTraceEvent(long eventTime, String serviceNamespace, + String serviceGroup, String serviceName) { + super("DEREGISTER_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/HealthStateChangeTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/HealthStateChangeTraceEvent.java new file mode 100644 index 00000000000..bb90e97bf4f --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/HealthStateChangeTraceEvent.java @@ -0,0 +1,83 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +import com.alibaba.nacos.common.trace.HealthCheckType; + +/** + * Naming instance health state change trace event. + * @author yanda + */ +public class HealthStateChangeTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = 6966396191118694597L; + + private String instanceIp; + + private int instancePort; + + private boolean isHealthy; + + private HealthCheckType healthCheckType; + + private String healthStateChangeReason; + + public String getInstanceIp() { + return instanceIp; + } + + public int getInstancePort() { + return instancePort; + } + + public String toInetAddr() { + return instanceIp + ":" + instancePort; + } + + public boolean isHealthy() { + return isHealthy; + } + + public HealthCheckType getHealthCheckType() { + return healthCheckType; + } + + public String getHealthStateChangeReason() { + return healthStateChangeReason; + } + + public HealthStateChangeTraceEvent(long eventTime, String serviceNamespace, String serviceGroup, + String serviceName, String instanceIp, int instancePort, boolean isHealthy, String healthStateChangeReason) { + super("HEALTH_STATE_CHANGE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.instanceIp = instanceIp; + this.instancePort = instancePort; + this.isHealthy = isHealthy; + this.healthCheckType = getHealthCheckTypeFromReason(healthStateChangeReason); + this.healthStateChangeReason = healthStateChangeReason; + } + + public HealthCheckType getHealthCheckTypeFromReason(String reason) { + if (reason.startsWith(HealthCheckType.HTTP_HEALTH_CHECK.getPrefix())) { + return HealthCheckType.HTTP_HEALTH_CHECK; + } else if (reason.startsWith(HealthCheckType.TCP_SUPER_SENSE.getPrefix())) { + return HealthCheckType.TCP_SUPER_SENSE; + } else if (reason.startsWith(HealthCheckType.MYSQL_HEALTH_CHECK.getPrefix())) { + return HealthCheckType.MYSQL_HEALTH_CHECK; + } + return HealthCheckType.CLIENT_BEAT; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/NamingTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/NamingTraceEvent.java new file mode 100644 index 00000000000..ca195d811c4 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/NamingTraceEvent.java @@ -0,0 +1,34 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +import com.alibaba.nacos.common.trace.event.TraceEvent; + +/** + * Naming trace event. + * + * @author yanda + */ +public class NamingTraceEvent extends TraceEvent { + + private static final long serialVersionUID = 2923077640400851816L; + + public NamingTraceEvent(String eventType, long eventTime, + String serviceNamespace, String serviceGroup, String name) { + super(eventType, eventTime, serviceNamespace, serviceGroup, name); + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/PushServiceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/PushServiceTraceEvent.java new file mode 100644 index 00000000000..aca60c172f8 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/PushServiceTraceEvent.java @@ -0,0 +1,67 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming push service trace event. + * @author yanda + */ +public class PushServiceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = 787915741281241877L; + + private final String clientIp; + + private final int instanceSize; + + private final long pushCostTimeForNetWork; + + private final long pushCostTimeForAll; + + private final long serviceLevelAgreementTime; + + public String getClientIp() { + return clientIp; + } + + public int getInstanceSize() { + return instanceSize; + } + + public long getPushCostTimeForNetWork() { + return pushCostTimeForNetWork; + } + + public long getPushCostTimeForAll() { + return pushCostTimeForAll; + } + + public long getServiceLevelAgreementTime() { + return serviceLevelAgreementTime; + } + + public PushServiceTraceEvent(long eventTime, long pushCostTimeForNetWork, long pushCostTimeForAll, + long serviceLevelAgreementTime, String clientIp, String serviceNamespace, + String serviceGroup, String serviceName, int instanceSize) { + super("PUSH_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.clientIp = clientIp; + this.instanceSize = instanceSize; + this.pushCostTimeForAll = pushCostTimeForAll; + this.pushCostTimeForNetWork = pushCostTimeForNetWork; + this.serviceLevelAgreementTime = serviceLevelAgreementTime; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterInstanceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterInstanceTraceEvent.java new file mode 100644 index 00000000000..e579e764482 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterInstanceTraceEvent.java @@ -0,0 +1,63 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming register instance trace event. + * @author yanda + */ +public class RegisterInstanceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = -8283438151444483864L; + + private final String clientIp; + + private final boolean rpc; + + private String instanceIp; + + private int instancePort; + + public String getClientIp() { + return clientIp; + } + + public boolean isRpc() { + return rpc; + } + + public String getInstanceIp() { + return instanceIp; + } + + public int getInstancePort() { + return instancePort; + } + + public String toInetAddr() { + return instanceIp + ":" + instancePort; + } + + public RegisterInstanceTraceEvent(long eventTime, String clientIp, boolean rpc, String serviceNamespace, + String serviceGroup, String serviceName, String instanceIp, int instancePort) { + super("REGISTER_INSTANCE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.clientIp = clientIp; + this.rpc = rpc; + this.instanceIp = instanceIp; + this.instancePort = instancePort; + } +} \ No newline at end of file diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterServiceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterServiceTraceEvent.java new file mode 100644 index 00000000000..c123f65168c --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/RegisterServiceTraceEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming deregister service trace event. + * @author yanda + */ +public class RegisterServiceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = -8568231862586636388L; + + public RegisterServiceTraceEvent(long eventTime, String serviceNamespace, + String serviceGroup, String serviceName) { + super("REGISTER_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/SubscribeServiceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/SubscribeServiceTraceEvent.java new file mode 100644 index 00000000000..a8c987cb866 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/SubscribeServiceTraceEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming subscribe service trace event. + * @author yanda + */ +public class SubscribeServiceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = -8856834879168816801L; + + private final String clientIp; + + public String getClientIp() { + return clientIp; + } + + public SubscribeServiceTraceEvent(long eventTime, String clientIp, String serviceNamespace, + String serviceGroup, String serviceName) { + super("SUBSCRIBE_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.clientIp = clientIp; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/UnsubscribeServiceTraceEvent.java b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/UnsubscribeServiceTraceEvent.java new file mode 100644 index 00000000000..0fc195dfd5e --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/event/naming/UnsubscribeServiceTraceEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.event.naming; + +/** + * Naming unsubscribe service trace event. + * @author yanda + */ +public class UnsubscribeServiceTraceEvent extends NamingTraceEvent { + + private static final long serialVersionUID = -7461808613817897106L; + + private final String clientIp; + + public String getClientIp() { + return clientIp; + } + + public UnsubscribeServiceTraceEvent(long eventTime, String clientIp, String serviceNamespace, + String serviceGroup, String serviceName) { + super("UNSUBSCRIBE_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName); + this.clientIp = clientIp; + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisher.java b/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisher.java new file mode 100644 index 00000000000..cb89af38d85 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisher.java @@ -0,0 +1,194 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.publisher; + +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.common.notify.Event; +import com.alibaba.nacos.common.notify.ShardedEventPublisher; +import com.alibaba.nacos.common.notify.listener.Subscriber; +import com.alibaba.nacos.common.utils.ConcurrentHashSet; +import com.alibaba.nacos.common.utils.ThreadUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; + +/** + * Event publisher for trace event. + * + * @author yanda + */ +public class TraceEventPublisher extends Thread implements ShardedEventPublisher { + + private static final String THREAD_NAME = "trace.publisher-"; + + private static final Logger LOGGER = LoggerFactory.getLogger("com.alibaba.nacos.common.trace.publisher"); + + private static final int DEFAULT_WAIT_TIME = 60; + + private final Map, Set>> subscribes = new ConcurrentHashMap<>(); + + private volatile boolean initialized = false; + + private volatile boolean shutdown = false; + + private int queueMaxSize = -1; + + private BlockingQueue queue; + + private String publisherName; + + @Override + public void init(Class type, int bufferSize) { + this.queueMaxSize = bufferSize; + this.queue = new ArrayBlockingQueue<>(bufferSize); + this.publisherName = type.getSimpleName(); + super.setName(THREAD_NAME + this.publisherName); + super.setDaemon(true); + super.start(); + initialized = true; + } + + @Override + public long currentEventSize() { + return this.queue.size(); + } + + @Override + public void addSubscriber(Subscriber subscriber) { + addSubscriber(subscriber, subscriber.subscribeType()); + } + + @Override + public void addSubscriber(Subscriber subscriber, Class subscribeType) { + subscribes.computeIfAbsent(subscribeType, inputType -> new ConcurrentHashSet<>()); + subscribes.get(subscribeType).add(subscriber); + } + + @Override + public void removeSubscriber(Subscriber subscriber) { + removeSubscriber(subscriber, subscriber.subscribeType()); + } + + @Override + public void removeSubscriber(Subscriber subscriber, Class subscribeType) { + subscribes.computeIfPresent(subscribeType, (inputType, subscribers) -> { + subscribers.remove(subscriber); + return subscribers.isEmpty() ? null : subscribers; + }); + } + + @Override + public boolean publish(Event event) { + checkIsStart(); + boolean success = this.queue.offer(event); + if (!success) { + LOGGER.warn("Trace Event Publish failed, event : {}, publish queue size : {}", event, currentEventSize()); + return true; + } + return true; + } + + @Override + public void notifySubscriber(Subscriber subscriber, Event event) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("[NotifyCenter] the {} will received by {}", event, subscriber); + } + final Runnable job = () -> subscriber.onEvent(event); + final Executor executor = subscriber.executor(); + if (executor != null) { + executor.execute(job); + } else { + try { + job.run(); + } catch (Throwable e) { + LOGGER.error("Event callback exception: ", e); + } + } + } + + @Override + public void shutdown() throws NacosException { + this.shutdown = true; + this.queue.clear(); + } + + @Override + public void run() { + try { + waitSubscriberForInit(); + handleEvents(); + } catch (Exception e) { + LOGGER.error("Trace Event Publisher {}, stop to handle event due to unexpected exception: ", + this.publisherName, e); + } + } + + private void waitSubscriberForInit() { + // To ensure that messages are not lost, enable EventHandler when + // waiting for the first Subscriber to register + for (int waitTimes = DEFAULT_WAIT_TIME; waitTimes > 0; waitTimes--) { + if (shutdown || !subscribes.isEmpty()) { + break; + } + ThreadUtils.sleep(1000L); + } + } + + private void handleEvents() { + while (!shutdown) { + try { + final Event event = queue.take(); + handleEvent(event); + } catch (InterruptedException e) { + LOGGER.warn("Trace Event Publisher {} take event from queue failed:", this.publisherName, e); + // set the interrupted flag + Thread.currentThread().interrupt(); + } + } + } + + private void handleEvent(Event event) { + Class eventType = event.getClass(); + Set> subscribers = subscribes.get(eventType); + if (null == subscribers) { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("[NotifyCenter] No subscribers for slow event {}", eventType.getName()); + } + return; + } + for (Subscriber subscriber : subscribers) { + notifySubscriber(subscriber, event); + } + } + + void checkIsStart() { + if (!initialized) { + throw new IllegalStateException("Publisher does not start"); + } + } + + public String getStatus() { + return String.format("Publisher %-30s: shutdown=%5s, queue=%7d/%-7d", publisherName, shutdown, + currentEventSize(), queueMaxSize); + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactory.java b/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactory.java new file mode 100644 index 00000000000..5bf18e74268 --- /dev/null +++ b/common/src/main/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactory.java @@ -0,0 +1,82 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.publisher; + +import com.alibaba.nacos.common.notify.Event; +import com.alibaba.nacos.common.notify.EventPublisher; +import com.alibaba.nacos.common.notify.EventPublisherFactory; +import com.alibaba.nacos.common.trace.event.TraceEvent; +import com.alibaba.nacos.common.utils.ConcurrentHashSet; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +/** + * event publisher factory for trace event. + * + * @author yanda + */ + +public class TraceEventPublisherFactory implements EventPublisherFactory { + private static final TraceEventPublisherFactory INSTANCE = new TraceEventPublisherFactory(); + + private final Map, TraceEventPublisher> publisher; + + private final Set> publisherEvents; + + private TraceEventPublisherFactory() { + publisher = new ConcurrentHashMap<>(); + publisherEvents = new ConcurrentHashSet<>(); + } + + public static TraceEventPublisherFactory getInstance() { + return INSTANCE; + } + + @Override + public EventPublisher apply(final Class eventType, final Integer maxQueueSize) { + // Like ClientEvent$ClientChangeEvent cache by ClientEvent + Class cachedEventType = TraceEvent.class; + + for (Class publisherEvent : publisherEvents) { + if (publisherEvent.isAssignableFrom(eventType)) { + cachedEventType = publisherEvent; + break; + } + } + + publisher.computeIfAbsent(cachedEventType, eventClass -> { + TraceEventPublisher result = new TraceEventPublisher(); + result.init(eventClass, maxQueueSize); + return result; + }); + return publisher.get(cachedEventType); + } + + public String getAllPublisherStatues() { + StringBuilder result = new StringBuilder("Trace event publisher statues:\n"); + for (TraceEventPublisher each : publisher.values()) { + result.append('\t').append(each.getStatus()).append('\n'); + } + return result.toString(); + } + + public void addPublisherEvent(Class event) { + this.publisherEvents.add(event); + } +} diff --git a/common/src/main/java/com/alibaba/nacos/common/utils/ConcurrentHashSet.java b/common/src/main/java/com/alibaba/nacos/common/utils/ConcurrentHashSet.java index f6617aa2e7a..855158eb1ea 100644 --- a/common/src/main/java/com/alibaba/nacos/common/utils/ConcurrentHashSet.java +++ b/common/src/main/java/com/alibaba/nacos/common/utils/ConcurrentHashSet.java @@ -31,7 +31,7 @@ public class ConcurrentHashSet extends AbstractSet { public ConcurrentHashSet() { super(); - map = new ConcurrentHashMap(); + map = new ConcurrentHashMap<>(); } @Override diff --git a/common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java b/common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java index 207211671c4..98f4ebaccf8 100644 --- a/common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java +++ b/common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java @@ -35,6 +35,7 @@ import java.net.HttpURLConnection; import java.nio.channels.FileChannel; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -64,10 +65,8 @@ public static byte[] tryDecompress(InputStream raw) throws IOException { } catch (IOException e) { e.printStackTrace(); } finally { - closeQuietly(out); - closeQuietly(gis); + closeQuietly(out, gis); } - return null; } @@ -91,8 +90,7 @@ public static byte[] tryDecompress(byte[] raw) throws Exception { IoUtils.copy(gis, out); return out.toByteArray(); } finally { - closeQuietly(out); - closeQuietly(gis); + closeQuietly(out, gis); } } @@ -151,7 +149,7 @@ public static void writeStringToFile(File file, String data, String encoding) th */ public static List readLines(Reader input) throws IOException { BufferedReader reader = toBufferedReader(input); - List list = new ArrayList(); + List list = new ArrayList<>(); String line = null; for (; ; ) { line = reader.readLine(); @@ -325,8 +323,7 @@ public static void copyFile(String source, String target) throws IOException { sc = new FileInputStream(sf).getChannel(); sc.transferTo(0, sc.size(), tc); } finally { - closeQuietly(sc); - closeQuietly(tc); + closeQuietly(sc, tc); } } @@ -360,14 +357,6 @@ public static void closeQuietly(HttpURLConnection connection) { } } - public static void closeQuietly(InputStream input) { - closeQuietly((Closeable) input); - } - - public static void closeQuietly(OutputStream output) { - closeQuietly((Closeable) output); - } - /** * Close closable object quietly. * @@ -381,5 +370,9 @@ public static void closeQuietly(Closeable closeable) { } catch (IOException ignored) { } } + + public static void closeQuietly(Closeable... closeable) { + Arrays.stream(closeable).forEach(IoUtils::closeQuietly); + } } diff --git a/common/src/main/java/com/alibaba/nacos/common/utils/Observable.java b/common/src/main/java/com/alibaba/nacos/common/utils/Observable.java index 341dbf642f5..de57cc4a4f8 100644 --- a/common/src/main/java/com/alibaba/nacos/common/utils/Observable.java +++ b/common/src/main/java/com/alibaba/nacos/common/utils/Observable.java @@ -28,7 +28,7 @@ public class Observable { private transient boolean changed = false; - private transient Set obs = new ConcurrentHashSet(); + private transient Set obs = new ConcurrentHashSet<>(); private volatile int observerCnt = 0; diff --git a/common/src/main/java/com/alibaba/nacos/common/utils/StringUtils.java b/common/src/main/java/com/alibaba/nacos/common/utils/StringUtils.java index ad4d93553a2..3418b625658 100644 --- a/common/src/main/java/com/alibaba/nacos/common/utils/StringUtils.java +++ b/common/src/main/java/com/alibaba/nacos/common/utils/StringUtils.java @@ -192,9 +192,7 @@ public static String join(Collection collection, String separator) { if (objects[i] != null) { stringBuilder.append(objects[i]); if (i != collection.size() - 1 && separator != null) { - if (separator != null) { - stringBuilder.append(separator); - } + stringBuilder.append(separator); } } } diff --git a/common/src/test/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCacheTest.java b/common/src/test/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCacheTest.java index 6fc69d1bbb4..a75b70c98c1 100644 --- a/common/src/test/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCacheTest.java +++ b/common/src/test/java/com/alibaba/nacos/common/cache/decorators/AutoExpireCacheTest.java @@ -53,4 +53,12 @@ public void testExpire() throws Exception { TimeUnit.SECONDS.sleep(2); Assert.assertNull(cache.get("a")); } + + @Test + public void testGetCache() { + Cache cache = CacheBuilder.builder().expireNanos(1, TimeUnit.MINUTES).build(); + cache.put("test", "test"); + Assert.assertNotNull(cache.get("test")); + Assert.assertNull(cache.get("test2")); + } } diff --git a/common/src/test/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClientTest.java b/common/src/test/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClientTest.java new file mode 100644 index 00000000000..5a81ab3ed4d --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/remote/client/grpc/GrpcClientTest.java @@ -0,0 +1,81 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.remote.client.grpc; + +import com.alibaba.nacos.api.grpc.auto.RequestGrpc; +import com.alibaba.nacos.common.remote.client.RpcClient; +import io.grpc.ManagedChannel; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import static org.mockito.Mockito.spy; + +@RunWith(MockitoJUnitRunner.class) +public class GrpcClientTest { + + GrpcClient grpcClient; + + Method createNewManagedChannelMethod; + + Method createNewChannelStubMethod; + + ManagedChannel managedChannel; + + RpcClient.ServerInfo serverInfo; + + @Before + public void setUp() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + grpcClient = spy(new GrpcClient("testClient") { + @Override + public int rpcPortOffset() { + return 1000; + } + }); + RpcClient.ServerInfo serverInfo = spy(new RpcClient.ServerInfo("10.10.10.10", 8848)); + createNewManagedChannelMethod = GrpcClient.class.getDeclaredMethod("createNewManagedChannel", String.class, int.class); + createNewManagedChannelMethod.setAccessible(true); + int port = serverInfo.getServerPort() + grpcClient.rpcPortOffset(); + managedChannel = (ManagedChannel) createNewManagedChannelMethod.invoke(grpcClient, serverInfo.getServerIp(), port); + } + + @Test + public void testCreateNewManagedChannel() throws InvocationTargetException, IllegalAccessException { + GrpcConnection grpcConnection = new GrpcConnection(serverInfo, null); + grpcConnection.setChannel(managedChannel); + } + + @Test + public void createNewChannelStub() throws InvocationTargetException, IllegalAccessException, NoSuchMethodException { + createNewChannelStubMethod = GrpcClient.class.getDeclaredMethod("createNewChannelStub", ManagedChannel.class); + createNewChannelStubMethod.setAccessible(true); + Object invoke = createNewChannelStubMethod.invoke(grpcClient, managedChannel); + Assert.assertTrue(invoke instanceof RequestGrpc.RequestFutureStub); + } + + @After + public void close() { + managedChannel.shutdownNow(); + } + +} diff --git a/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactoryTest.java b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactoryTest.java new file mode 100644 index 00000000000..d228a496053 --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherFactoryTest.java @@ -0,0 +1,62 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.publisher; + +import com.alibaba.nacos.common.notify.EventPublisher; +import com.alibaba.nacos.common.notify.NotifyCenter; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +public class TraceEventPublisherFactoryTest { + private Map originalEventPublisherMap; + + @Before + public void setUp() throws Exception { + originalEventPublisherMap = new HashMap<>(NotifyCenter.getPublisherMap()); + NotifyCenter.getPublisherMap().clear(); + // Protect other unit test publisher affect this case. + Field field = TraceEventPublisherFactory.class.getDeclaredField("publisher"); + field.setAccessible(true); + Map map = (Map) field.get(TraceEventPublisherFactory.getInstance()); + map.clear(); + } + + @After + public void tearDown() throws Exception { + NotifyCenter.getPublisherMap().clear(); + NotifyCenter.getPublisherMap().putAll(originalEventPublisherMap); + originalEventPublisherMap = null; + } + + @Test + public void testApply() { + TraceEventPublisherFactory.getInstance().apply(TraceTestEvent.TraceTestEvent1.class, Byte.SIZE); + TraceEventPublisherFactory.getInstance().apply(TraceTestEvent.TraceTestEvent2.class, Byte.SIZE); + TraceEventPublisherFactory.getInstance().apply(TraceTestEvent.class, Byte.SIZE); + String expectedStatus = "Trace event publisher statues:\n" + + "\tPublisher TraceEvent : shutdown=false, queue= 0/8 \n"; + assertThat(TraceEventPublisherFactory.getInstance().getAllPublisherStatues(), is(expectedStatus)); + } +} diff --git a/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherTest.java b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherTest.java new file mode 100644 index 00000000000..39a515d7192 --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceEventPublisherTest.java @@ -0,0 +1,102 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.publisher; + +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.common.notify.listener.SmartSubscriber; +import com.alibaba.nacos.common.notify.listener.Subscriber; +import com.alibaba.nacos.common.utils.ThreadUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +@RunWith(MockitoJUnitRunner.class) +public class TraceEventPublisherTest { + + @Mock + private Subscriber subscriber; + + @Mock + private SmartSubscriber smartSubscriber; + + private TraceEventPublisher traceEventPublisher; + + @Before + public void setUp() throws Exception { + traceEventPublisher = new TraceEventPublisher(); + traceEventPublisher.init(TraceTestEvent.class, Byte.SIZE); + } + + @After + public void tearDown() throws Exception { + traceEventPublisher.shutdown(); + } + + @Test + public void testAddSubscriber() { + traceEventPublisher.addSubscriber(subscriber, TraceTestEvent.TraceTestEvent1.class); + traceEventPublisher.addSubscriber(smartSubscriber, TraceTestEvent.TraceTestEvent2.class); + TraceTestEvent.TraceTestEvent1 traceTestEvent1 = new TraceTestEvent.TraceTestEvent1(); + TraceTestEvent.TraceTestEvent2 traceTestEvent2 = new TraceTestEvent.TraceTestEvent2(); + traceEventPublisher.publish(traceTestEvent1); + traceEventPublisher.publish(traceTestEvent2); + ThreadUtils.sleep(2000L); + verify(subscriber).onEvent(traceTestEvent1); + verify(smartSubscriber).onEvent(traceTestEvent2); + } + + @Test + public void testRemoveSubscriber() { + traceEventPublisher.addSubscriber(subscriber, TraceTestEvent.TraceTestEvent1.class); + traceEventPublisher.addSubscriber(smartSubscriber, TraceTestEvent.TraceTestEvent1.class); + TraceTestEvent.TraceTestEvent1 traceTestEvent1 = new TraceTestEvent.TraceTestEvent1(); + traceEventPublisher.publish(traceTestEvent1); + ThreadUtils.sleep(2000L); + verify(subscriber).onEvent(traceTestEvent1); + verify(smartSubscriber).onEvent(traceTestEvent1); + traceEventPublisher.removeSubscriber(smartSubscriber, TraceTestEvent.TraceTestEvent1.class); + traceTestEvent1 = new TraceTestEvent.TraceTestEvent1(); + traceEventPublisher.publish(traceTestEvent1); + ThreadUtils.sleep(500L); + verify(subscriber).onEvent(traceTestEvent1); + verify(smartSubscriber, never()).onEvent(traceTestEvent1); + } + + @Test + public void getStatus() throws NacosException { + traceEventPublisher.publish(new TraceTestEvent()); + traceEventPublisher.publish(new TraceTestEvent.TraceTestEvent1()); + traceEventPublisher.publish(new TraceTestEvent.TraceTestEvent2()); + String expectedStatus = "Publisher TraceTestEvent : shutdown=false, queue= 3/8 "; + assertThat(traceEventPublisher.getStatus(), is(expectedStatus)); + traceEventPublisher.addSubscriber(subscriber, TraceTestEvent.TraceTestEvent1.class); + ThreadUtils.sleep(2000L); + expectedStatus = "Publisher TraceTestEvent : shutdown=false, queue= 0/8 "; + assertThat(traceEventPublisher.getStatus(), is(expectedStatus)); + traceEventPublisher.shutdown(); + expectedStatus = "Publisher TraceTestEvent : shutdown= true, queue= 0/8 "; + assertThat(traceEventPublisher.getStatus(), is(expectedStatus)); + } +} diff --git a/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceTestEvent.java b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceTestEvent.java new file mode 100644 index 00000000000..c239bc2d156 --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/trace/publisher/TraceTestEvent.java @@ -0,0 +1,33 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.trace.publisher; + +import com.alibaba.nacos.common.notify.Event; + +public class TraceTestEvent extends Event { + private static final long serialVersionUID = 8568231862586636388L; + + static class TraceTestEvent1 extends TraceTestEvent { + + private static final long serialVersionUID = 4188906203345433816L; + } + + static class TraceTestEvent2 extends TraceTestEvent { + + private static final long serialVersionUID = -7358195336881398548L; + } +} diff --git a/common/src/test/java/com/alibaba/nacos/common/utils/IoUtilsTest.java b/common/src/test/java/com/alibaba/nacos/common/utils/IoUtilsTest.java new file mode 100644 index 00000000000..54b993594d7 --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/utils/IoUtilsTest.java @@ -0,0 +1,73 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.common.utils; + +import org.apache.commons.io.Charsets; +import org.junit.Assert; +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * Unit test of IoUtils. + * + * @author karsonto + */ +public class IoUtilsTest { + + @Test() + public void testCloseQuietly() throws IOException { + BufferedReader br = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream("111".getBytes(Charsets.toCharset("UTF-8"))))); + Assert.assertEquals("111", br.readLine()); + IoUtils.closeQuietly(br); + try { + br.readLine(); + } catch (IOException e) { + Assert.assertNotNull(e); + return; + } + Assert.fail(); + } + + @Test() + public void testCloseQuietly2() throws IOException { + BufferedReader br = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream("123".getBytes(Charsets.toCharset("UTF-8"))))); + Assert.assertEquals("123", br.readLine()); + BufferedReader br2 = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream("456".getBytes(Charsets.toCharset("UTF-8"))))); + Assert.assertEquals("456", br2.readLine()); + IoUtils.closeQuietly(br, br2); + try { + br.readLine(); + } catch (IOException e) { + Assert.assertNotNull(e); + } + try { + br2.readLine(); + } catch (IOException e) { + Assert.assertNotNull(e); + return; + } + Assert.fail(); + } + +} diff --git a/config/pom.xml b/config/pom.xml index 59e1fdf9e6a..ee3356b8a56 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -74,15 +74,6 @@ nacos-encryption-plugin - - - org.aspectj - aspectjrt - - - cglib - cglib-nodep - org.apache.httpcomponents httpasyncclient @@ -102,11 +93,6 @@ com.fasterxml.jackson.core jackson-databind - - net.jcip - jcip-annotations - true - io.micrometer micrometer-registry-prometheus diff --git a/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java b/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java index 972d293286f..d158fa74405 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/aspect/CapacityManagementAspect.java @@ -34,6 +34,8 @@ import javax.servlet.http.HttpServletResponse; import java.nio.charset.StandardCharsets; +import static com.alibaba.nacos.config.server.constant.Constants.LIMIT_ERROR_CODE; + /** * Capacity management aspect: batch write and update but don't process it. * @@ -427,10 +429,10 @@ public enum LimitType { /** * over limit. */ - OVER_CLUSTER_QUOTA("超过集群配置个数上限", 429), - OVER_GROUP_QUOTA("超过该Group配置个数上限", 429), - OVER_TENANT_QUOTA("超过该租户配置个数上限", 429), - OVER_MAX_SIZE("超过配置的内容大小上限", 429); + OVER_CLUSTER_QUOTA("超过集群配置个数上限", LIMIT_ERROR_CODE), + OVER_GROUP_QUOTA("超过该Group配置个数上限", LIMIT_ERROR_CODE), + OVER_TENANT_QUOTA("超过该租户配置个数上限", LIMIT_ERROR_CODE), + OVER_MAX_SIZE("超过配置的内容大小上限", LIMIT_ERROR_CODE); public final String description; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/constant/Constants.java b/config/src/main/java/com/alibaba/nacos/config/server/constant/Constants.java index ad765cd18a0..21600d8492d 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/constant/Constants.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/constant/Constants.java @@ -275,4 +275,6 @@ public class Constants { public static final String CONFIG_EXPORT_METADATA = ".meta.yml"; public static final String CONFIG_EXPORT_METADATA_NEW = ".metadata.yml"; + + public static final int LIMIT_ERROR_CODE = 429; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/CommunicationController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/CommunicationController.java index 9e257ece708..a32119d6abf 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/CommunicationController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/CommunicationController.java @@ -95,7 +95,7 @@ public Boolean notifyConfigInfo(HttpServletRequest request, @RequestParam("dataI public SampleResult getSubClientConfig(@RequestParam("dataId") String dataId, @RequestParam("group") String group, @RequestParam(value = "tenant", required = false) String tenant, ModelMap modelMap) { group = StringUtils.isBlank(group) ? Constants.DEFAULT_GROUP : group; - // long polling listners. + // long polling listeners. SampleResult result = longPollingService.getCollectSubscribleInfo(dataId, group, tenant); // rpc listeners. String groupKey = GroupKey2.getKey(dataId, group, tenant); @@ -103,17 +103,17 @@ public SampleResult getSubClientConfig(@RequestParam("dataId") String dataId, @R if (CollectionUtils.isEmpty(listenersClients)) { return result; } - Map lisentersGroupkeyStatus = new HashMap<>(listenersClients.size(), 1); + Map listenersGroupkeyStatus = new HashMap<>(listenersClients.size(), 1); for (String connectionId : listenersClients) { Connection client = connectionManager.getConnection(connectionId); if (client != null) { String md5 = configChangeListenContext.getListenKeyMd5(connectionId, groupKey); if (md5 != null) { - lisentersGroupkeyStatus.put(client.getMetaInfo().getClientIp(), md5); + listenersGroupkeyStatus.put(client.getMetaInfo().getClientIp(), md5); } } } - result.getLisentersGroupkeyStatus().putAll(lisentersGroupkeyStatus); + result.getLisentersGroupkeyStatus().putAll(listenersGroupkeyStatus); return result; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java index 0b5736ee6a6..d19e2170f46 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java @@ -118,12 +118,17 @@ public ConfigController(ConfigServletInner inner, PersistService persistService, /** * Adds or updates non-aggregated data. - * + *

+ * request and response will be used in aspect, see + * {@link com.alibaba.nacos.config.server.aspect.CapacityManagementAspect} and + * {@link com.alibaba.nacos.config.server.aspect.RequestLogAspect}. + *

* @throws NacosException NacosException. */ @PostMapping @Secured(action = ActionTypes.WRITE, signType = SignType.CONFIG) - public Boolean publishConfig(HttpServletRequest request, @RequestParam(value = "dataId") String dataId, + public Boolean publishConfig(HttpServletRequest request, HttpServletResponse response, + @RequestParam(value = "dataId") String dataId, @RequestParam(value = "group") String group, @RequestParam(value = "tenant", required = false, defaultValue = StringUtils.EMPTY) String tenant, @RequestParam(value = "content") String content, @RequestParam(value = "tag", required = false) String tag, @@ -252,11 +257,17 @@ public ConfigAllInfo detailConfigInfo(@RequestParam("dataId") String dataId, @Re /** * Synchronously delete all pre-aggregation data under a dataId. * + *

+ * request and response will be used in aspect, see + * {@link com.alibaba.nacos.config.server.aspect.CapacityManagementAspect} and + * {@link com.alibaba.nacos.config.server.aspect.RequestLogAspect}. + *

+ * * @throws NacosException NacosException. */ @DeleteMapping @Secured(action = ActionTypes.WRITE, signType = SignType.CONFIG) - public Boolean deleteConfig(HttpServletRequest request, @RequestParam("dataId") String dataId, + public Boolean deleteConfig(HttpServletRequest request, HttpServletResponse response, @RequestParam("dataId") String dataId, @RequestParam("group") String group, @RequestParam(value = "tenant", required = false, defaultValue = StringUtils.EMPTY) String tenant, @RequestParam(value = "tag", required = false) String tag) throws NacosException { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java index 6ce254e6811..cf95b726cd0 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java @@ -37,7 +37,6 @@ import com.alibaba.nacos.config.server.utils.RequestUtil; import com.alibaba.nacos.config.server.utils.TimeUtils; import com.alibaba.nacos.plugin.encryption.handler.EncryptionHandler; -import org.apache.commons.codec.Charsets; import org.springframework.stereotype.Service; import javax.servlet.ServletException; @@ -258,7 +257,7 @@ public String doGetConfig(HttpServletRequest request, HttpServletResponse respon out.flush(); out.close(); } else { - String fileContent = IoUtils.toString(fis, Charsets.UTF_8.name()); + String fileContent = IoUtils.toString(fis, StandardCharsets.UTF_8.name()); String encryptedDataKey = cacheItem.getEncryptedDataKey(); Pair pair = EncryptionHandler.decryptHandler(dataId, encryptedDataKey, fileContent); String decryptContent = pair.getSecond(); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/filter/CurcuitFilter.java b/config/src/main/java/com/alibaba/nacos/config/server/filter/CurcuitFilter.java index 6e9109d182c..fb26c50b345 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/filter/CurcuitFilter.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/filter/CurcuitFilter.java @@ -102,7 +102,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha resp.sendError(HttpServletResponse.SC_FORBIDDEN, "access denied: " + ExceptionUtil.getAllExceptionMsg(e)); } catch (Throwable e) { DEFAULT_LOG.warn("[CURCUIT-FILTER] Server failed: ", e); - resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Server failed, " + e.toString()); + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Server failed, " + e); } } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/monitor/MetricsMonitor.java b/config/src/main/java/com/alibaba/nacos/config/server/monitor/MetricsMonitor.java index 1526c5e8432..c12de68ec4f 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/monitor/MetricsMonitor.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/monitor/MetricsMonitor.java @@ -57,40 +57,41 @@ public class MetricsMonitor { private static AtomicInteger dumpTask = new AtomicInteger(); static { - List tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + ImmutableTag immutableTag = new ImmutableTag("module", "config"); + + List tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "getConfig")); Metrics.gauge("nacos_monitor", tags, getConfig); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "publish")); Metrics.gauge("nacos_monitor", tags, publish); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "longPolling")); Metrics.gauge("nacos_monitor", tags, longPolling); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "configCount")); Metrics.gauge("nacos_monitor", tags, configCount); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "notifyTask")); Metrics.gauge("nacos_monitor", tags, notifyTask); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "notifyClientTask")); Metrics.gauge("nacos_monitor", tags, notifyClientTask); - tags = new ArrayList(); - tags.add(new ImmutableTag("module", "config")); + tags = new ArrayList<>(); + tags.add(immutableTag); tags.add(new ImmutableTag("name", "dumpTask")); - Metrics.gauge("nacos_monitor", tags, dumpTask); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigChangeListenContext.java b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigChangeListenContext.java index 0e77370b3f0..037c794b765 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigChangeListenContext.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigChangeListenContext.java @@ -39,12 +39,12 @@ public class ConfigChangeListenContext { /** * groupKey-> connection set. */ - private ConcurrentHashMap> groupKeyContext = new ConcurrentHashMap>(); + private ConcurrentHashMap> groupKeyContext = new ConcurrentHashMap<>(); /** * connectionId-> group key set. */ - private ConcurrentHashMap> connectionIdContext = new ConcurrentHashMap>(); + private ConcurrentHashMap> connectionIdContext = new ConcurrentHashMap<>(); /** * add listen. @@ -56,7 +56,7 @@ public synchronized void addListen(String groupKey, String md5, String connectio // 1.add groupKeyContext Set listenClients = groupKeyContext.get(groupKey); if (listenClients == null) { - groupKeyContext.putIfAbsent(groupKey, new HashSet()); + groupKeyContext.putIfAbsent(groupKey, new HashSet<>()); listenClients = groupKeyContext.get(groupKey); } listenClients.add(connectionId); @@ -64,7 +64,7 @@ public synchronized void addListen(String groupKey, String md5, String connectio // 2.add connectionIdContext HashMap groupKeys = connectionIdContext.get(connectionId); if (groupKeys == null) { - connectionIdContext.putIfAbsent(connectionId, new HashMap(16)); + connectionIdContext.putIfAbsent(connectionId, new HashMap<>(16)); groupKeys = connectionIdContext.get(connectionId); } groupKeys.put(groupKey, md5); @@ -105,7 +105,7 @@ public synchronized Set getListeners(String groupKey) { HashSet strings = groupKeyContext.get(groupKey); if (CollectionUtils.isNotEmpty(strings)) { - Set listenConnections = new HashSet(); + Set listenConnections = new HashSet<>(); safeCopy(strings, listenConnections); return listenConnections; } @@ -159,7 +159,7 @@ public synchronized void clearContextForConnectionId(final String connectionId) */ public synchronized Map getListenKeys(String connectionId) { HashMap stringStringHashMap = connectionIdContext.get(connectionId); - return stringStringHashMap == null ? null : new HashMap(stringStringHashMap); + return stringStringHashMap == null ? null : new HashMap<>(stringStringHashMap); } /** diff --git a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java index 3ded2ce7608..1cd4851c771 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java @@ -82,7 +82,7 @@ public ConfigPublishResponse handle(ConfigPublishRequest request, RequestMeta me // check tenant ParamUtils.checkParam(dataId, group, "datumId", content); ParamUtils.checkParam(tag); - Map configAdvanceInfo = new HashMap(10); + Map configAdvanceInfo = new HashMap<>(10); MapUtil.putIfValNoNull(configAdvanceInfo, "config_tags", request.getAdditionParam("config_tags")); MapUtil.putIfValNoNull(configAdvanceInfo, "desc", request.getAdditionParam("desc")); MapUtil.putIfValNoNull(configAdvanceInfo, "use", request.getAdditionParam("use")); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/AggrWhitelist.java b/config/src/main/java/com/alibaba/nacos/config/server/service/AggrWhitelist.java index 551f93773a4..250352c6fc6 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/AggrWhitelist.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/AggrWhitelist.java @@ -38,8 +38,8 @@ public class AggrWhitelist { public static final String AGGRIDS_METADATA = "com.alibaba.nacos.metadata.aggrIDs"; - static final AtomicReference> AGGR_DATAID_WHITELIST = new AtomicReference>( - new ArrayList()); + static final AtomicReference> AGGR_DATAID_WHITELIST = new AtomicReference<>( + new ArrayList<>()); /** * Judge whether specified dataId includes aggregation white list. @@ -81,7 +81,7 @@ public static void load(String content) { } static void compile(List whitelist) { - List list = new ArrayList(whitelist.size()); + List list = new ArrayList<>(whitelist.size()); for (String line : whitelist) { if (!StringUtils.isBlank(line)) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientIpWhiteList.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientIpWhiteList.java index 911a60e0439..59bb4e430a1 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientIpWhiteList.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientIpWhiteList.java @@ -37,8 +37,8 @@ public class ClientIpWhiteList { public static final String CLIENT_IP_WHITELIST_METADATA = "com.alibaba.nacos.metadata.clientIpWhitelist"; - private static final AtomicReference> CLIENT_IP_WHITELIST = new AtomicReference>( - new ArrayList()); + private static final AtomicReference> CLIENT_IP_WHITELIST = new AtomicReference<>( + new ArrayList<>()); private static Boolean isOpen = false; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientRecord.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientRecord.java index f84809e65b6..bf7f6537472 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientRecord.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientRecord.java @@ -36,8 +36,8 @@ public class ClientRecord { public ClientRecord(final String clientIp) { this.ip = clientIp; - this.groupKey2md5Map = new ConcurrentHashMap(20, 0.75f, 1); - this.groupKey2pollingTsMap = new ConcurrentHashMap(20, 0.75f, 1); + this.groupKey2md5Map = new ConcurrentHashMap<>(20, 0.75f, 1); + this.groupKey2pollingTsMap = new ConcurrentHashMap<>(20, 0.75f, 1); } public String getIp() { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java index 6ab74a3efe7..04448abee2c 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java @@ -94,7 +94,7 @@ public static long subscriberCount() { * Groupkey -> SubscriberStatus. */ public static Map listSubStatus(String ip) { - Map status = new HashMap(100); + Map status = new HashMap<>(100); ClientRecord record = getClientRecord(ip); if (record == null) { @@ -117,7 +117,7 @@ public static Map listSubStatus(String ip) { * Ip -> SubscriberStatus. */ public static Map listSubsByGroup(String groupKey) { - Map subs = new HashMap(100); + Map subs = new HashMap<>(100); for (ClientRecord clientRec : clientRecords.values()) { String clientMd5 = clientRec.getGroupKey2md5Map().get(groupKey); @@ -137,7 +137,7 @@ public static Map listSubsByGroup(String groupKey) { * groupKey -> isUptodate. */ public static Map isClientUptodate(String ip) { - Map result = new HashMap(100); + Map result = new HashMap<>(100); for (Map.Entry entry : getClientRecord(ip).getGroupKey2md5Map().entrySet()) { String groupKey = entry.getKey(); String clientMd5 = entry.getValue(); @@ -152,7 +152,7 @@ public static Map isClientUptodate(String ip) { * IP -> isUptodate. */ public static Map listSubscriberByGroup(String groupKey) { - Map subs = new HashMap(100); + Map subs = new HashMap<>(100); for (ClientRecord clientRec : clientRecords.values()) { String clientMd5 = clientRec.getGroupKey2md5Map().get(groupKey); @@ -181,13 +181,13 @@ private static ClientRecord getClientRecord(String clientIp) { } public static void refreshClientRecord() { - clientRecords = new ConcurrentHashMap(50); + clientRecords = new ConcurrentHashMap<>(50); } /** * All of client records, adding or deleting. */ - static volatile ConcurrentMap clientRecords = new ConcurrentHashMap(); + static volatile ConcurrentMap clientRecords = new ConcurrentHashMap<>(); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigCacheService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigCacheService.java index 464029c6c6a..ecfe467cf1b 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigCacheService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigCacheService.java @@ -356,7 +356,7 @@ public static void reloadConfig() { * @return return diff result list. */ public static List checkMd5() { - List diffList = new ArrayList(); + List diffList = new ArrayList<>(); long startTime = System.currentTimeMillis(); for (Entry entry : CACHE.entrySet()) { String groupKey = entry.getKey(); @@ -521,7 +521,7 @@ public static void updateMd5(String groupKey, String md5, long lastModifiedTs, S public static void updateBetaMd5(String groupKey, String md5, List ips4Beta, long lastModifiedTs, String encryptedDataKey) { CacheItem cache = makeSure(groupKey, encryptedDataKey, true); - if (cache.md54Beta == null || !cache.md54Beta.equals(md5)) { + if (cache.md54Beta == null || !cache.md54Beta.equals(md5) || !ips4Beta.equals(cache.ips4Beta)) { cache.isBeta = true; cache.md54Beta = md5; cache.lastModifiedTs4Beta = lastModifiedTs; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java index f42225a0933..b6c65f93aac 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java @@ -69,7 +69,7 @@ public class LongPollingService { private static final String TRUE_STR = "true"; - private Map retainIps = new ConcurrentHashMap(); + private Map retainIps = new ConcurrentHashMap<>(); private static boolean isFixedPolling() { return SwitchService.getSwitchBoolean(SwitchService.FIXED_POLLING, false); @@ -96,7 +96,7 @@ public Map getClientSubConfigInfo(String clientIp) { public SampleResult getSubscribleInfo(String dataId, String group, String tenant) { String groupKey = GroupKey.getKeyTenant(dataId, group, tenant); SampleResult sampleResult = new SampleResult(); - Map lisentersGroupkeyStatus = new HashMap(50); + Map lisentersGroupkeyStatus = new HashMap<>(50); for (ClientLongPolling clientLongPolling : allSubs) { if (clientLongPolling.clientMd5Map.containsKey(groupKey)) { @@ -109,7 +109,7 @@ public SampleResult getSubscribleInfo(String dataId, String group, String tenant public SampleResult getSubscribleInfoByIp(String clientIp) { SampleResult sampleResult = new SampleResult(); - Map lisentersGroupkeyStatus = new HashMap(50); + Map lisentersGroupkeyStatus = new HashMap<>(50); for (ClientLongPolling clientLongPolling : allSubs) { if (clientLongPolling.ip.equals(clientIp)) { @@ -132,7 +132,7 @@ public SampleResult getSubscribleInfoByIp(String clientIp) { */ public SampleResult mergeSampleResult(List sampleResults) { SampleResult mergeResult = new SampleResult(); - Map lisentersGroupkeyStatus = new HashMap(50); + Map lisentersGroupkeyStatus = new HashMap<>(50); for (SampleResult sampleResult : sampleResults) { Map lisentersGroupkeyStatusTmp = sampleResult.getLisentersGroupkeyStatus(); for (Map.Entry entry : lisentersGroupkeyStatusTmp.entrySet()) { @@ -152,7 +152,7 @@ public Map> collectApplicationSubscribeConfigInfos() { if (allSubs == null || allSubs.isEmpty()) { return null; } - HashMap> app2Groupkeys = new HashMap>(50); + HashMap> app2Groupkeys = new HashMap<>(50); for (ClientLongPolling clientLongPolling : allSubs) { if (StringUtils.isEmpty(clientLongPolling.appName) || "unknown" .equalsIgnoreCase(clientLongPolling.appName)) { @@ -161,7 +161,7 @@ public Map> collectApplicationSubscribeConfigInfos() { Set appSubscribeConfigs = app2Groupkeys.get(clientLongPolling.appName); Set clientSubscribeConfigs = clientLongPolling.clientMd5Map.keySet(); if (appSubscribeConfigs == null) { - appSubscribeConfigs = new HashSet(clientSubscribeConfigs.size()); + appSubscribeConfigs = new HashSet<>(clientSubscribeConfigs.size()); } appSubscribeConfigs.addAll(clientSubscribeConfigs); app2Groupkeys.put(clientLongPolling.appName, appSubscribeConfigs); @@ -171,7 +171,7 @@ public Map> collectApplicationSubscribeConfigInfos() { } public SampleResult getCollectSubscribleInfo(String dataId, String group, String tenant) { - List sampleResultLst = new ArrayList(50); + List sampleResultLst = new ArrayList<>(50); for (int i = 0; i < SAMPLE_TIMES; i++) { SampleResult sampleTmp = getSubscribleInfo(dataId, group, tenant); if (sampleTmp != null) { @@ -283,7 +283,7 @@ public static boolean isSupportLongPolling(HttpServletRequest req) { @SuppressWarnings("PMD.ThreadPoolCreationRule") public LongPollingService() { - allSubs = new ConcurrentLinkedQueue(); + allSubs = new ConcurrentLinkedQueue<>(); ConfigExecutor.scheduleLongPolling(new StatTask(), 0L, 10L, TimeUnit.SECONDS); @@ -392,45 +392,41 @@ class ClientLongPolling implements Runnable { @Override public void run() { - asyncTimeoutFuture = ConfigExecutor.scheduleLongPolling(new Runnable() { - @Override - public void run() { - try { - getRetainIps().put(ClientLongPolling.this.ip, System.currentTimeMillis()); - - // Delete subscriber's relations. - boolean removeFlag = allSubs.remove(ClientLongPolling.this); - - if (removeFlag) { - if (isFixedPolling()) { - LogUtil.CLIENT_LOG - .info("{}|{}|{}|{}|{}|{}", (System.currentTimeMillis() - createTime), "fix", - RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), - "polling", clientMd5Map.size(), probeRequestSize); - List changedGroups = MD5Util - .compareMd5((HttpServletRequest) asyncContext.getRequest(), - (HttpServletResponse) asyncContext.getResponse(), clientMd5Map); - if (changedGroups.size() > 0) { - sendResponse(changedGroups); - } else { - sendResponse(null); - } + asyncTimeoutFuture = ConfigExecutor.scheduleLongPolling(() -> { + try { + getRetainIps().put(ClientLongPolling.this.ip, System.currentTimeMillis()); + + // Delete subscriber's relations. + boolean removeFlag = allSubs.remove(ClientLongPolling.this); + + if (removeFlag) { + if (isFixedPolling()) { + LogUtil.CLIENT_LOG + .info("{}|{}|{}|{}|{}|{}", (System.currentTimeMillis() - createTime), "fix", + RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), + "polling", clientMd5Map.size(), probeRequestSize); + List changedGroups = MD5Util + .compareMd5((HttpServletRequest) asyncContext.getRequest(), + (HttpServletResponse) asyncContext.getResponse(), clientMd5Map); + if (changedGroups.size() > 0) { + sendResponse(changedGroups); } else { - LogUtil.CLIENT_LOG - .info("{}|{}|{}|{}|{}|{}", (System.currentTimeMillis() - createTime), "timeout", - RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), - "polling", clientMd5Map.size(), probeRequestSize); sendResponse(null); } } else { - LogUtil.DEFAULT_LOG.warn("client subsciber's relations delete fail."); + LogUtil.CLIENT_LOG + .info("{}|{}|{}|{}|{}|{}", (System.currentTimeMillis() - createTime), "timeout", + RequestUtil.getRemoteIp((HttpServletRequest) asyncContext.getRequest()), + "polling", clientMd5Map.size(), probeRequestSize); + sendResponse(null); } - } catch (Throwable t) { - LogUtil.DEFAULT_LOG.error("long polling error:" + t.getMessage(), t.getCause()); + } else { + LogUtil.DEFAULT_LOG.warn("client subsciber's relations delete fail."); } - + } catch (Throwable t) { + LogUtil.DEFAULT_LOG.error("long polling error:" + t.getMessage(), t.getCause()); } - + }, timeoutTime, TimeUnit.MILLISECONDS); allSubs.add(this); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java index fd8cb967ef3..337718e1538 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/SwitchService.java @@ -47,7 +47,7 @@ public class SwitchService { public static final String DISABLE_APP_COLLECTOR = "disableAppCollector"; - private static volatile Map switches = new HashMap(); + private static volatile Map switches = new HashMap<>(); public static boolean getSwitchBoolean(String key, boolean defaultValue) { boolean rtn; @@ -90,7 +90,7 @@ public static void load(String config) { } FATAL_LOG.warn("[switch-config] {}", config); - Map map = new HashMap(30); + Map map = new HashMap<>(30); try { for (String line : IoUtils.readLines(new StringReader(config))) { if (!StringUtils.isBlank(line) && !line.startsWith("#")) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSource.java b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSource.java index fd45941b3af..3a70277baa2 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSource.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSource.java @@ -17,14 +17,12 @@ package com.alibaba.nacos.config.server.service.datasource; import com.alibaba.nacos.config.server.utils.PropertyUtil; -import org.springframework.stereotype.Component; /** * Datasource adapter. * * @author Nacos */ -@Component public class DynamicDataSource { private DataSourceService localDataSourceService = null; @@ -32,7 +30,9 @@ public class DynamicDataSource { private DataSourceService basicDataSourceService = null; private static final DynamicDataSource INSTANCE = new DynamicDataSource(); - + + private DynamicDataSource() {} + public static DynamicDataSource getInstance() { return INSTANCE; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/ExternalDataSourceServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/ExternalDataSourceServiceImpl.java index 7968e256a1f..8ac97a99f56 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/ExternalDataSourceServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/ExternalDataSourceServiceImpl.java @@ -93,8 +93,8 @@ public void init() { // Database health check - testJtList = new ArrayList(); - isHealthList = new ArrayList(); + testJtList = new ArrayList<>(); + isHealthList = new ArrayList<>(); tm = new DataSourceTransactionManager(); tjt = new TransactionTemplate(tm); @@ -105,7 +105,7 @@ public void init() { try { reload(); } catch (IOException e) { - FATAL_LOG.error("[ExternalDataSourceService] dats source reload error", e); + FATAL_LOG.error("[ExternalDataSourceService] datasource reload error", e); throw new RuntimeException(DB_LOAD_ERROR_MSG); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/LocalDataSourceServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/LocalDataSourceServiceImpl.java index f8175468a48..ba58962e70a 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/LocalDataSourceServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/datasource/LocalDataSourceServiceImpl.java @@ -206,7 +206,7 @@ public void setHealthStatus(String healthStatus) { * @throws Exception Exception. */ private List loadSql(String sqlFile) throws Exception { - List sqlList = new ArrayList(); + List sqlList = new ArrayList<>(); InputStream sqlFileIn = null; try { File file = new File( diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java index 78eb8d9683f..e1afda70f6b 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java @@ -391,7 +391,7 @@ public void dumpAll() { } static List> splitList(List list, int count) { - List> result = new ArrayList>(count); + List> result = new ArrayList<>(count); for (int i = 0; i < count; i++) { result.add(new ArrayList<>()); } @@ -423,7 +423,7 @@ public void run() { String group = configInfo.getGroup(); String tenant = configInfo.getTenant(); try { - List datumList = new ArrayList(); + List datumList = new ArrayList<>(); int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant); int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE); for (int pageNo = 1; pageNo <= pageCount; pageNo++) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java index d6293bf0183..c14abb43e3f 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java @@ -70,7 +70,7 @@ public MergeDatumService(PersistService persistService) { } static List> splitList(List list, int count) { - List> result = new ArrayList>(count); + List> result = new ArrayList<>(count); for (int i = 0; i < count; i++) { result.add(new ArrayList()); } @@ -144,7 +144,7 @@ public void run() { String group = configInfo.getGroup(); String tenant = configInfo.getTenant(); try { - List datumList = new ArrayList(); + List datumList = new ArrayList<>(); int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant); int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE); for (int pageNo = 1; pageNo <= pageCount; pageNo++) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java index 4e42595f783..07a00ab0ee7 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeTaskProcessor.java @@ -66,7 +66,7 @@ public boolean process(NacosTask task) { final String tag = mergeTask.tag; final String clientIp = mergeTask.getClientIp(); try { - List datumList = new ArrayList(); + List datumList = new ArrayList<>(); int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant); int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE); for (int pageNo = 1; pageNo <= pageCount; pageNo++) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java index 8f2ba68d881..7c0eadf9649 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java @@ -106,8 +106,8 @@ public void onEvent(Event event) { Collection ipList = memberManager.allMembers(); // In fact, any type of queue here can be - Queue httpQueue = new LinkedList(); - Queue rpcQueue = new LinkedList(); + Queue httpQueue = new LinkedList<>(); + Queue rpcQueue = new LinkedList<>(); for (Member member : ipList) { if (!MemberUtil.isSupportedLongCon(member)) { @@ -267,7 +267,7 @@ public NotifySingleRpcTask(String dataId, String group, String tenant, String ta private void asyncTaskExecute(NotifySingleTask task) { int delay = getDelayTime(task); - Queue queue = new LinkedList(); + Queue queue = new LinkedList<>(); queue.add(task); AsyncTask asyncTask = new AsyncTask(nacosAsyncRestTemplate, queue); ConfigExecutor.scheduleAsyncNotify(asyncTask, delay, TimeUnit.MILLISECONDS); @@ -275,7 +275,7 @@ private void asyncTaskExecute(NotifySingleTask task) { private void asyncTaskExecute(NotifySingleRpcTask task) { int delay = getDelayTime(task); - Queue queue = new LinkedList(); + Queue queue = new LinkedList<>(); queue.add(task); AsyncRpcTask asyncTask = new AsyncRpcTask(queue); ConfigExecutor.scheduleAsyncNotify(asyncTask, delay, TimeUnit.MILLISECONDS); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/HttpClientManager.java b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/HttpClientManager.java index 9a9f447745e..953a3606d7c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/HttpClientManager.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/HttpClientManager.java @@ -52,12 +52,7 @@ public final class HttpClientManager { new ConfigHttpClientFactory(PropertyUtil.getNotifyConnectTimeout(), PropertyUtil.getNotifySocketTimeout())); - ThreadUtils.addShutdownHook(new Runnable() { - @Override - public void run() { - shutdown(); - } - }); + ThreadUtils.addShutdownHook(HttpClientManager::shutdown); } public static NacosRestTemplate getNacosRestTemplate() { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/RowMapperManager.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/RowMapperManager.java index 7d876d6e7ce..970bbc24b88 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/RowMapperManager.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/RowMapperManager.java @@ -167,6 +167,7 @@ public static synchronized void registerRowMapper(String classFullName, RowM mapperMap.get(classFullName).getClass().getCanonicalName(), rowMapper.getClass().getCanonicalName()); } + mapperMap.put(classFullName, rowMapper); } public static final class MapRowMapper implements RowMapper> { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedPaginationHelperImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedPaginationHelperImpl.java index ea0281056e4..452001c340f 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedPaginationHelperImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedPaginationHelperImpl.java @@ -76,7 +76,7 @@ public Page fetchPage(final String sqlCountRows, final String sqlFetchRows, f } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -114,7 +114,7 @@ public Page fetchPageLimit(final String sqlCountRows, final String sqlFetchRo } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -150,7 +150,7 @@ public Page fetchPageLimit(final String sqlCountRows, final Object[] args1, f } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -175,7 +175,7 @@ public Page fetchPageLimit(final String sqlFetchRows, final Object[] args, fi throw new IllegalArgumentException("pageNo and pageSize must be greater than zero"); } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); String selectSql = sqlFetchRows.replaceAll("(?i)LIMIT \\?,\\?", "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java index d4cc8a808ae..7ce0361d90c 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java @@ -181,7 +181,7 @@ public DatabaseOperate getDatabaseOperate() { @Override public PaginationHelper createPaginationHelper() { - return new EmbeddedPaginationHelperImpl(databaseOperate); + return new EmbeddedPaginationHelperImpl<>(databaseOperate); } @Override @@ -357,9 +357,9 @@ public void updateConfigInfo4Beta(ConfigInfo configInfo, String betaIps, String try { String md5 = MD5Utils.md5Hex(configInfo.getContent(), Constants.ENCODE); - final String sql = "UPDATE config_info_beta SET content=?,md5=?,src_ip=?,src_user=?,gmt_modified=?,app_name=?,encrypted_data_key=? WHERE data_id=? AND group_id=? AND tenant_id=?"; + final String sql = "UPDATE config_info_beta SET content=?,md5=?,beta_ips=?,src_ip=?,src_user=?,gmt_modified=?,app_name=?,encrypted_data_key=? WHERE data_id=? AND group_id=? AND tenant_id=?"; - final Object[] args = new Object[] {configInfo.getContent(), md5, srcIp, srcUser, time, appNameTmp, + final Object[] args = new Object[] {configInfo.getContent(), md5, betaIps, srcIp, srcUser, time, appNameTmp, encryptedDataKey, configInfo.getDataId(), configInfo.getGroup(), tenantTmp}; EmbeddedStorageContextUtils.onModifyConfigBetaInfo(configInfo, betaIps, srcIp, time); @@ -381,9 +381,9 @@ public boolean updateConfigInfo4BetaCas(ConfigInfo configInfo, String betaIps, S try { String md5 = MD5Utils.md5Hex(configInfo.getContent(), Constants.ENCODE); - final String sql = "UPDATE config_info_beta SET content=?,md5=?,src_ip=?,src_user=?,gmt_modified=?,app_name=? WHERE data_id=? AND group_id=? AND tenant_id=? AND (md5=? OR md5 IS NULL OR md5='')"; + final String sql = "UPDATE config_info_beta SET content=?,md5=?,beta_ips=?,src_ip=?,src_user=?,gmt_modified=?,app_name=? WHERE data_id=? AND group_id=? AND tenant_id=? AND (md5=? OR md5 IS NULL OR md5='')"; - final Object[] args = new Object[] {configInfo.getContent(), md5, srcIp, srcUser, time, appNameTmp, + final Object[] args = new Object[] {configInfo.getContent(), md5, betaIps, srcIp, srcUser, time, appNameTmp, configInfo.getDataId(), configInfo.getGroup(), tenantTmp, configInfo.getMd5()}; EmbeddedStorageContextUtils.onModifyConfigBetaInfo(configInfo, betaIps, srcIp, time); @@ -849,7 +849,7 @@ public ConfigInfo findConfigInfoAdvanceInfo(final String dataId, final String gr String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; final String appName = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("appName"); final String configTags = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("config_tags"); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(dataId); paramList.add(group); paramList.add(tenantTmp); @@ -940,7 +940,7 @@ public Page findConfigInfoByDataIdAndAdvance(final int pageNo, final StringBuilder sqlCount = new StringBuilder("SELECT count(*) FROM config_info WHERE data_id=? AND tenant_id=? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE data_id=? AND tenant_id=? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(dataId); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { @@ -993,7 +993,7 @@ public Page findConfigInfo4Page(final int pageNo, final int pageSize String sqlCount = "SELECT count(*) FROM config_info"; String sql = "SELECT id,data_id,group_id,tenant_id,app_name,content,type FROM config_info"; StringBuilder where = new StringBuilder(" WHERE "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { sqlCount = "SELECT count(*) FROM config_info a LEFT JOIN config_tags_relation b ON a.id=b.id"; @@ -1096,7 +1096,7 @@ public Page findConfigInfoByGroupAndAdvance(final int pageNo, final "SELECT count(*) FROM config_info WHERE group_id=? AND tenant_id=? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE group_id=? AND tenant_id=? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(group); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { @@ -1160,7 +1160,7 @@ public Page findConfigInfoByAdvance(final int pageNo, final int page StringBuilder sqlCount = new StringBuilder("SELECT count(*) FROM config_info WHERE tenant_id LIKE ? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info where tenant_id LIKE ? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { sqlCount = new StringBuilder( @@ -1361,7 +1361,7 @@ public Page findAllConfigKey(final int pageNo, final int pageSize, fi return null; } - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(totalCount); @@ -1399,7 +1399,7 @@ public Page findAllConfigInfoForDumpAll(final int pageNo, fin PaginationHelper helper = createPaginationHelper(); - return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, EMPTY_ARRAY, pageNo, pageSize, + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, pageNo, pageSize, CONFIG_INFO_WRAPPER_ROW_MAPPER); } @@ -1454,7 +1454,7 @@ public List findConfigInfoByBatch(final List dataIds, final if (subQueryLimit > QUERY_LIMIT_SIZE) { subQueryLimit = 50; } - List result = new ArrayList(dataIds.size()); + List result = new ArrayList<>(dataIds.size()); String sqlStart = "SELECT data_id, group_id, tenant_id, app_name, content FROM config_info WHERE group_id = ? AND tenant_id = ? AND data_id IN ("; String sqlEnd = ")"; @@ -1462,7 +1462,7 @@ public List findConfigInfoByBatch(final List dataIds, final for (int i = 0; i < dataIds.size(); i += subQueryLimit) { // dataids - List params = new ArrayList( + List params = new ArrayList<>( dataIds.subList(i, Math.min(i + subQueryLimit, dataIds.size()))); for (int j = 0; j < params.size(); j++) { @@ -1503,7 +1503,7 @@ public Page findConfigInfoLike(final int pageNo, final int pageSize, final String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE "; String where = " 1=1 "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -1539,11 +1539,11 @@ public Page findConfigInfoLike(final int pageNo, final int pageSize, StringBuilder where = new StringBuilder(" 1=1 "); // White list, please synchronize the condition is empty, there is no qualified configuration if (configKeys.length == 0 && !blacklist) { - Page page = new Page(); + Page page = new Page<>(); page.setTotalCount(0); return page; } - List params = new ArrayList(); + List params = new ArrayList<>(); boolean isFirst = true; for (ConfigKey configInfo : configKeys) { String dataId = configInfo.getDataId(); @@ -1635,7 +1635,7 @@ public Page findConfigInfoLike4Page(final int pageNo, final int page String sqlCountRows = "SELECT count(*) FROM config_info"; String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,encrypted_data_key FROM config_info"; StringBuilder where = new StringBuilder(" WHERE "); - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(generateLikeArgument(tenantTmp)); if (StringUtils.isNotBlank(configTags)) { sqlCountRows = "SELECT count(*) FROM config_info a LEFT JOIN config_tags_relation b ON a.id=b.id "; @@ -1712,7 +1712,7 @@ public Page findConfigInfoBaseLike(final int pageNo, final int p final String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,content FROM config_info WHERE "; String where = " 1=1 AND tenant_id='' "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -1779,11 +1779,11 @@ public Page findConfigInfoAggrLike(final int pageNo, final int p StringBuilder where = new StringBuilder(" 1=1 "); // White list, please synchronize the condition is empty, there is no qualified configuration if (configKeys.length == 0 && blacklist == false) { - Page page = new Page(); + Page page = new Page<>(); page.setTotalCount(0); return page; } - List params = new ArrayList(); + List params = new ArrayList<>(); boolean isFirst = true; for (ConfigKey configInfoAggr : configKeys) { @@ -1897,7 +1897,7 @@ public Page findChangeConfig(final String dataId, final Strin final String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; final String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,type,md5,gmt_modified FROM config_info WHERE "; String where = " 1=1 "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -1970,7 +1970,7 @@ public long addConfigInfoAtomic(final long id, final String srcIp, final String public void addConfigTagRelationAtomic(long configId, String tagName, String dataId, String group, String tenant) { final String sql = "INSERT INTO config_tags_relation(id,tag_name,tag_type,data_id,group_id,tenant_id) " + "VALUES(?,?,?,?,?,?)"; - final Object[] args = new Object[] {configId, tagName, null, dataId, group, tenant}; + final Object[] args = new Object[] {configId, tagName, StringUtils.EMPTY, dataId, group, tenant}; EmbeddedStorageContextUtils.addSqlContext(sql, args); } @@ -2308,7 +2308,7 @@ public void removeTenantInfoAtomic(final String kp, final String tenantId) { @Override public List convertDeletedConfig(List> list) { - List configs = new ArrayList(); + List configs = new ArrayList<>(); for (Map map : list) { String dataId = (String) map.get("data_id"); String group = (String) map.get("group_id"); @@ -2324,7 +2324,7 @@ public List convertDeletedConfig(List> list) { @Override public List convertChangeConfig(List> list) { - List configs = new ArrayList(); + List configs = new ArrayList<>(); for (Map map : list) { String dataId = (String) map.get("data_id"); String group = (String) map.get("group_id"); @@ -2347,7 +2347,7 @@ public List listAllGroupKeyMd5() { final int pageSize = 10000; int totalCount = configInfoCount(); int pageCount = (int) Math.ceil(totalCount * 1.0 / pageSize); - List allConfigInfo = new ArrayList(); + List allConfigInfo = new ArrayList<>(); for (int pageNo = 1; pageNo <= pageCount; pageNo++) { List configInfoList = listGroupKeyMd5ByPage(pageNo, pageSize); allConfigInfo.addAll(configInfoList); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePaginationHelperImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePaginationHelperImpl.java index 923e96a464e..66dc082d15c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePaginationHelperImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePaginationHelperImpl.java @@ -77,7 +77,7 @@ public Page fetchPage(final String sqlCountRows, final String sqlFetchRows, f } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -122,7 +122,7 @@ public Page fetchPageLimit(final String sqlCountRows, final String sqlFetchRo } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -162,7 +162,7 @@ public Page fetchPageLimit(final String sqlCountRows, final Object[] args1, f } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(rowCountInt); @@ -190,7 +190,7 @@ public Page fetchPageLimit(final String sqlFetchRows, final Object[] args, fi throw new IllegalArgumentException("pageNo and pageSize must be greater than zero"); } // Create Page object - final Page page = new Page(); + final Page page = new Page<>(); String selectSql = sqlFetchRows; if (isDerby()) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java index 2f7619d0795..e05a6f1fb34 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java @@ -168,7 +168,7 @@ public String getCurrentDBUrl() { @Override public PaginationHelper createPaginationHelper() { - return new ExternalStoragePaginationHelperImpl(jt); + return new ExternalStoragePaginationHelperImpl<>(jt); } // ----------------------- config_info table insert update delete @@ -307,8 +307,8 @@ public void updateConfigInfo4Beta(ConfigInfo configInfo, String betaIps, String : configInfo.getEncryptedDataKey(); try { jt.update( - "UPDATE config_info_beta SET content=?, md5 = ?, src_ip=?,src_user=?,gmt_modified=?,app_name=?,encrypted_data_key = ?WHERE " - + "data_id=? AND group_id=? AND tenant_id=?", configInfo.getContent(), md5, srcIp, srcUser, + "UPDATE config_info_beta SET content=?, md5=?, beta_ips=?, src_ip=?,src_user=?,gmt_modified=?,app_name=?,encrypted_data_key=? " + + " WHERE data_id=? AND group_id=? AND tenant_id=?", configInfo.getContent(), md5, betaIps, srcIp, srcUser, time, appNameTmp, encryptedDataKey, configInfo.getDataId(), configInfo.getGroup(), tenantTmp); } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); @@ -324,9 +324,9 @@ public boolean updateConfigInfo4BetaCas(ConfigInfo configInfo, String betaIps, S String md5 = MD5Utils.md5Hex(configInfo.getContent(), Constants.ENCODE); try { return jt - .update("UPDATE config_info_beta SET content=?, md5 = ?, src_ip=?,src_user=?,gmt_modified=?,app_name=? WHERE " - + "data_id=? AND group_id=? AND tenant_id=? AND (md5=? or md5 is null or md5='')", - configInfo.getContent(), md5, srcIp, srcUser, time, appNameTmp, configInfo.getDataId(), + .update("UPDATE config_info_beta SET content=?, md5=?, beta_ips=?, src_ip=?,src_user=?,gmt_modified=?,app_name=? " + + " WHERE data_id=? AND group_id=? AND tenant_id=? AND (md5=? or md5 is null or md5='')", + configInfo.getContent(), md5, betaIps, srcIp, srcUser, time, appNameTmp, configInfo.getDataId(), configInfo.getGroup(), tenantTmp, configInfo.getMd5()) > 0; } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); @@ -681,20 +681,17 @@ public long findConfigMaxId() { public boolean batchPublishAggr(final String dataId, final String group, final String tenant, final Map datumMap, final String appName) { try { - Boolean isPublishOk = tjt.execute(new TransactionCallback() { - @Override - public Boolean doInTransaction(TransactionStatus status) { - for (Map.Entry entry : datumMap.entrySet()) { - try { - if (!addAggrConfigInfo(dataId, group, tenant, entry.getKey(), appName, entry.getValue())) { - throw new TransactionSystemException("error in addAggrConfigInfo"); - } - } catch (Throwable e) { + Boolean isPublishOk = tjt.execute(status -> { + for (Map.Entry entry : datumMap.entrySet()) { + try { + if (!addAggrConfigInfo(dataId, group, tenant, entry.getKey(), appName, entry.getValue())) { throw new TransactionSystemException("error in addAggrConfigInfo"); } + } catch (Throwable e) { + throw new TransactionSystemException("error in addAggrConfigInfo"); } - return Boolean.TRUE; } + return Boolean.TRUE; }); if (isPublishOk == null) { return false; @@ -710,23 +707,20 @@ public Boolean doInTransaction(TransactionStatus status) { public boolean replaceAggr(final String dataId, final String group, final String tenant, final Map datumMap, final String appName) { try { - Boolean isReplaceOk = tjt.execute(new TransactionCallback() { - @Override - public Boolean doInTransaction(TransactionStatus status) { - try { - String appNameTmp = appName == null ? "" : appName; - removeAggrConfigInfo(dataId, group, tenant); - String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; - String sql = "INSERT INTO config_info_aggr(data_id, group_id, tenant_id, datum_id, app_name, content, gmt_modified) VALUES(?,?,?,?,?,?,?) "; - for (Map.Entry datumEntry : datumMap.entrySet()) { - jt.update(sql, dataId, group, tenantTmp, datumEntry.getKey(), appNameTmp, - datumEntry.getValue(), new Timestamp(System.currentTimeMillis())); - } - } catch (Throwable e) { - throw new TransactionSystemException("error in addAggrConfigInfo"); + Boolean isReplaceOk = tjt.execute(status -> { + try { + String appNameTmp = appName == null ? "" : appName; + removeAggrConfigInfo(dataId, group, tenant); + String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; + String sql = "INSERT INTO config_info_aggr(data_id, group_id, tenant_id, datum_id, app_name, content, gmt_modified) VALUES(?,?,?,?,?,?,?) "; + for (Map.Entry datumEntry : datumMap.entrySet()) { + jt.update(sql, dataId, group, tenantTmp, datumEntry.getKey(), appNameTmp, + datumEntry.getValue(), new Timestamp(System.currentTimeMillis())); } - return Boolean.TRUE; + } catch (Throwable e) { + throw new TransactionSystemException("error in addAggrConfigInfo"); } + return Boolean.TRUE; }); if (isReplaceOk == null) { return false; @@ -811,7 +805,7 @@ public ConfigInfo findConfigInfoAdvanceInfo(final String dataId, final String gr String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; final String appName = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("appName"); final String configTags = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("config_tags"); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(dataId); paramList.add(group); paramList.add(tenantTmp); @@ -938,7 +932,7 @@ public Page findConfigInfoByDataIdAndAdvance(final int pageNo, final StringBuilder sqlCount = new StringBuilder("SELECT count(*) FROM config_info WHERE data_id=? AND tenant_id=? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE data_id=? AND tenant_id=? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(dataId); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { @@ -1112,7 +1106,7 @@ public Page findConfigInfoByGroupAndAdvance(final int pageNo, final "SELECT count(*) FROM config_info WHERE group_id=? AND tenant_id=? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE group_id=? AND tenant_id=? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(group); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { @@ -1184,7 +1178,7 @@ public Page findConfigInfoByAdvance(final int pageNo, final int page StringBuilder sqlCount = new StringBuilder("SELECT count(*) FROM config_info WHERE tenant_id LIKE ? "); StringBuilder sql = new StringBuilder( "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE tenant_id LIKE ? "); - List paramList = new ArrayList(); + List paramList = new ArrayList<>(); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { sqlCount = new StringBuilder( @@ -1386,7 +1380,7 @@ public Page findAllConfigKey(final int pageNo, final int pageSize, fi return null; } - final Page page = new Page(); + final Page page = new Page<>(); page.setPageNumber(pageNo); page.setPagesAvailable(pageCount); page.setTotalCount(totalCount); @@ -1435,13 +1429,11 @@ public Page findAllConfigInfoForDumpAll(final int pageNo, fin + " g, config_info t WHERE g.id = t.id "; PaginationHelper helper = createPaginationHelper(); - List params = new ArrayList(); - try { - return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, params.toArray(), pageNo, pageSize, + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, pageNo, pageSize, CONFIG_INFO_WRAPPER_ROW_MAPPER); } catch (CannotGetJdbcConnectionException e) { - LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); + LogUtil.FATAL_LOG.error("[db-error]", e); throw e; } } @@ -1509,7 +1501,7 @@ public List findConfigInfoByBatch(final List dataIds, final if (subQueryLimit > QUERY_LIMIT_SIZE) { subQueryLimit = 50; } - List result = new ArrayList(dataIds.size()); + List result = new ArrayList<>(dataIds.size()); String sqlStart = "SELECT data_id, group_id, tenant_id, app_name, content FROM config_info WHERE group_id = ? AND tenant_id = ? AND data_id IN ("; String sqlEnd = ")"; @@ -1517,7 +1509,7 @@ public List findConfigInfoByBatch(final List dataIds, final for (int i = 0; i < dataIds.size(); i += subQueryLimit) { // dataids - List params = new ArrayList( + List params = new ArrayList<>( dataIds.subList(i, i + subQueryLimit < dataIds.size() ? i + subQueryLimit : dataIds.size())); for (int j = 0; j < params.size(); j++) { @@ -1559,7 +1551,7 @@ public Page findConfigInfoLike(final int pageNo, final int pageSize, String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE "; String where = " 1=1 "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -1599,12 +1591,12 @@ public Page findConfigInfoLike(final int pageNo, final int pageSize, StringBuilder where = new StringBuilder(" 1=1 "); // Whitelist, please leave the synchronization condition empty, there is no configuration that meets the conditions if (configKeys.length == 0 && blacklist == false) { - Page page = new Page(); + Page page = new Page<>(); page.setTotalCount(0); return page; } PaginationHelper helper = createPaginationHelper(); - List params = new ArrayList(); + List params = new ArrayList<>(); boolean isFirst = true; for (ConfigKey configInfo : configKeys) { String dataId = configInfo.getDataId(); @@ -1701,7 +1693,7 @@ public Page findConfigInfoLike4Page(final int pageNo, final int page String sqlCountRows = "SELECT count(*) FROM config_info"; String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,encrypted_data_key FROM config_info"; StringBuilder where = new StringBuilder(" WHERE "); - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(generateLikeArgument(tenantTmp)); if (StringUtils.isNotBlank(configTags)) { sqlCountRows = "SELECT count(*) FROM config_info a LEFT JOIN config_tags_relation b ON a.id=b.id "; @@ -1783,7 +1775,7 @@ public Page findConfigInfoBaseLike(final int pageNo, final int p String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,content FROM config_info WHERE "; String where = " 1=1 AND tenant_id='' "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -1874,12 +1866,12 @@ public Page findConfigInfoAggrLike(final int pageNo, final int p StringBuilder where = new StringBuilder(" 1=1 "); // Whitelist, please leave the synchronization condition empty, there is no configuration that meets the conditions if (configKeys.length == 0 && blacklist == false) { - Page page = new Page(); + Page page = new Page<>(); page.setTotalCount(0); return page; } PaginationHelper helper = createPaginationHelper(); - List params = new ArrayList(); + List params = new ArrayList<>(); boolean isFirst = true; for (ConfigKey configInfoAggr : configKeys) { @@ -2020,7 +2012,7 @@ public Page findChangeConfig(final String dataId, final Strin String sqlCountRows = "SELECT count(*) FROM config_info WHERE "; String sqlFetchRows = "SELECT id,data_id,group_id,tenant_id,app_name,content,type,md5,gmt_modified FROM config_info WHERE "; String where = " 1=1 "; - List params = new ArrayList(); + List params = new ArrayList<>(); if (!StringUtils.isBlank(dataId)) { where += " AND data_id LIKE ? "; @@ -2146,7 +2138,7 @@ public void addConfigTagRelationAtomic(long configId, String tagName, String dat try { jt.update( "INSERT INTO config_tags_relation(id,tag_name,tag_type,data_id,group_id,tenant_id) VALUES(?,?,?,?,?,?)", - configId, tagName, null, dataId, group, tenant); + configId, tagName, StringUtils.EMPTY, dataId, group, tenant); } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); throw e; @@ -2261,8 +2253,8 @@ public void updateConfigInfoAtomic(final ConfigInfo configInfo, final String src try { jt.update("UPDATE config_info SET content=?, md5 = ?, src_ip=?,src_user=?,gmt_modified=?," - + "app_name=?,c_desc=?,c_use=?,effect=?,type=?,c_schema=?,encrypted_data_key=?" - + "WHERE data_id=? AND group_id=? AND tenant_id=?", configInfo.getContent(), md5Tmp, srcIp, srcUser, + + "app_name=?,c_desc=?,c_use=?,effect=?,type=?,c_schema=?,encrypted_data_key=? " + + " WHERE data_id=? AND group_id=? AND tenant_id=?", configInfo.getContent(), md5Tmp, srcIp, srcUser, time, appNameTmp, desc, use, effect, type, schema, encryptedDataKey, configInfo.getDataId(), configInfo.getGroup(), tenantTmp); } catch (CannotGetJdbcConnectionException e) { @@ -2546,7 +2538,7 @@ public void removeTenantInfoAtomic(final String kp, final String tenantId) { @Override public List convertDeletedConfig(List> list) { - List configs = new ArrayList(); + List configs = new ArrayList<>(); for (Map map : list) { String dataId = (String) map.get("data_id"); String group = (String) map.get("group_id"); @@ -2562,7 +2554,7 @@ public List convertDeletedConfig(List> list) { @Override public List convertChangeConfig(List> list) { - List configs = new ArrayList(); + List configs = new ArrayList<>(); for (Map map : list) { String dataId = (String) map.get("data_id"); String group = (String) map.get("group_id"); @@ -2585,7 +2577,7 @@ public List listAllGroupKeyMd5() { final int pageSize = 10000; int totalCount = configInfoCount(); int pageCount = (int) Math.ceil(totalCount * 1.0 / pageSize); - List allConfigInfo = new ArrayList(); + List allConfigInfo = new ArrayList<>(); for (int pageNo = 1; pageNo <= pageCount; pageNo++) { List configInfoList = listGroupKeyMd5ByPage(pageNo, pageSize); allConfigInfo.addAll(configInfoList); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/MD5Util.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/MD5Util.java index 76da2d2d9fa..c0633c2061f 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/MD5Util.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/MD5Util.java @@ -51,7 +51,7 @@ public class MD5Util { */ public static List compareMd5(HttpServletRequest request, HttpServletResponse response, Map clientMd5Map) { - List changedGroupKeys = new ArrayList(); + List changedGroupKeys = new ArrayList<>(); String tag = request.getHeader("Vipserver-Tag"); for (Map.Entry entry : clientMd5Map.entrySet()) { String groupKey = entry.getKey(); @@ -118,13 +118,13 @@ public static String compareMd5ResultString(List changedGroupKeys) throw */ public static Map getClientMd5Map(String configKeysString) { - Map md5Map = new HashMap(5); + Map md5Map = new HashMap<>(5); if (null == configKeysString || "".equals(configKeysString)) { return md5Map; } int start = 0; - List tmpList = new ArrayList(3); + List tmpList = new ArrayList<>(3); for (int i = start; i < configKeysString.length(); i++) { char c = configKeysString.charAt(i); if (c == WORD_SEPARATOR_CHAR) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleCache.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleCache.java index 1d16f33c364..889f445e911 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleCache.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleCache.java @@ -27,7 +27,7 @@ */ public class SimpleCache { - final ConcurrentMap> cache = new ConcurrentHashMap>(); + final ConcurrentMap> cache = new ConcurrentHashMap<>(); private static class CacheEntry { @@ -48,7 +48,7 @@ public void put(String key, E e, long ttlMs) { if (key == null || e == null) { return; } - CacheEntry entry = new CacheEntry(e, System.currentTimeMillis() + ttlMs); + CacheEntry entry = new CacheEntry<>(e, System.currentTimeMillis() + ttlMs); cache.put(key, entry); } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionDistributedEmbedStorageTest.java b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionDistributedEmbedStorageTest.java index 11a24ad20c9..c77430bf6a4 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionDistributedEmbedStorageTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionDistributedEmbedStorageTest.java @@ -22,6 +22,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -39,27 +40,34 @@ public class ConditionDistributedEmbedStorageTest { @Before public void init() { conditionDistributedEmbedStorage = new ConditionDistributedEmbedStorage(); - Mockito.mockStatic(PropertyUtil.class); - Mockito.mockStatic(EnvUtil.class); + } @Test public void testMatches() { - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(true); + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); + MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(true); Assert.assertFalse(conditionDistributedEmbedStorage.matches(context, metadata)); Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(false); Assert.assertTrue(conditionDistributedEmbedStorage.matches(context, metadata)); - - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(true); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(true); Assert.assertFalse(conditionDistributedEmbedStorage.matches(context, metadata)); - - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(false); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(false); Assert.assertFalse(conditionDistributedEmbedStorage.matches(context, metadata)); + + propertyUtilMockedStatic.close(); + envUtilMockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnEmbeddedStorageTest.java b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnEmbeddedStorageTest.java index 97342c36986..36ec69a000c 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnEmbeddedStorageTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnEmbeddedStorageTest.java @@ -21,6 +21,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -38,16 +39,18 @@ public class ConditionOnEmbeddedStorageTest { @Before public void init() { conditionOnEmbeddedStorage = new ConditionOnEmbeddedStorage(); - Mockito.mockStatic(PropertyUtil.class); } @Test public void testMatches() { - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); + MockedStatic mockedStatic = Mockito.mockStatic(PropertyUtil.class); + mockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); Assert.assertTrue(conditionOnEmbeddedStorage.matches(context, metadata)); - - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); + + mockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); Assert.assertFalse(conditionOnEmbeddedStorage.matches(context, metadata)); + + mockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnExternalStorageTest.java b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnExternalStorageTest.java index 8b3c456d6f8..8698ccc8061 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnExternalStorageTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionOnExternalStorageTest.java @@ -21,6 +21,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -38,16 +39,19 @@ public class ConditionOnExternalStorageTest { @Before public void init() { conditionOnExternalStorage = new ConditionOnExternalStorage(); - Mockito.mockStatic(PropertyUtil.class); } @Test public void testMatches() { - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - Assert.assertFalse(conditionOnExternalStorage.matches(context, metadata)); + MockedStatic mockedStatic = Mockito.mockStatic(PropertyUtil.class); - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); + mockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + Assert.assertFalse(conditionOnExternalStorage.matches(context, metadata)); + + mockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); Assert.assertTrue(conditionOnExternalStorage.matches(context, metadata)); + + mockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionStandaloneEmbedStorageTest.java b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionStandaloneEmbedStorageTest.java index bd634f6b1f2..29222df3ea0 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionStandaloneEmbedStorageTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/configuration/ConditionStandaloneEmbedStorageTest.java @@ -22,6 +22,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -39,27 +40,31 @@ public class ConditionStandaloneEmbedStorageTest { @Before public void init() { conditionStandaloneEmbedStorage = new ConditionStandaloneEmbedStorage(); - Mockito.mockStatic(PropertyUtil.class); - Mockito.mockStatic(EnvUtil.class); } @Test public void testMatches() { - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(true); - Assert.assertTrue(conditionStandaloneEmbedStorage.matches(context, metadata)); + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); + MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(true); + Assert.assertTrue(conditionStandaloneEmbedStorage.matches(context, metadata)); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(false); Assert.assertFalse(conditionStandaloneEmbedStorage.matches(context, metadata)); - - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(true); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(true); Assert.assertFalse(conditionStandaloneEmbedStorage.matches(context, metadata)); - - Mockito.when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); - Mockito.when(EnvUtil.getStandaloneMode()).thenReturn(false); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); + envUtilMockedStatic.when(EnvUtil::getStandaloneMode).thenReturn(false); Assert.assertFalse(conditionStandaloneEmbedStorage.matches(context, metadata)); + + propertyUtilMockedStatic.close(); + envUtilMockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigControllerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigControllerTest.java index 3de08f98509..e8e537c888d 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigControllerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigControllerTest.java @@ -38,6 +38,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.core.env.StandardEnvironment; import org.springframework.mock.web.MockMultipartFile; @@ -389,15 +390,15 @@ public void testExportConfigV2() throws Exception { @Test public void testImportAndPublishConfig() throws Exception { - - Mockito.mockStatic(ZipUtils.class); + + MockedStatic zipUtilsMockedStatic = Mockito.mockStatic(ZipUtils.class); List zipItems = new ArrayList<>(); ZipUtils.ZipItem zipItem = new ZipUtils.ZipItem("test/test", "test"); zipItems.add(zipItem); ZipUtils.UnZipResult unziped = new ZipUtils.UnZipResult(zipItems, null); MockMultipartFile file = new MockMultipartFile("file", "test.zip", "application/zip", "test".getBytes()); - when(ZipUtils.unzip(file.getBytes())).thenReturn(unziped); + zipUtilsMockedStatic.when(() -> ZipUtils.unzip(file.getBytes())).thenReturn(unziped); when(persistService.tenantInfoCountByTenantId("public")).thenReturn(1); Map map = new HashMap<>(); map.put("test", "test"); @@ -416,6 +417,8 @@ public void testImportAndPublishConfig() throws Exception { Assert.assertEquals("200", code); Map resultMap = JacksonUtils.toObj(JacksonUtils.toObj(actualValue).get("data").toString(), Map.class); Assert.assertEquals(map.get("test"), resultMap.get("test").toString()); + + zipUtilsMockedStatic.close(); } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigOpsControllerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigOpsControllerTest.java index 047a6ad7328..a368db61af0 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigOpsControllerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigOpsControllerTest.java @@ -100,13 +100,12 @@ public void testSetLogLevel() throws Exception { @Test public void testDerbyOps() throws Exception { - - MockedStatic propertyUtil = Mockito.mockStatic(PropertyUtil.class); - when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - propertyUtil.close(); - Mockito.mockStatic(DynamicDataSource.class); + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); + MockedStatic dynamicDataSourceMockedStatic = Mockito.mockStatic(DynamicDataSource.class); + + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); DynamicDataSource dataSource = Mockito.mock(DynamicDataSource.class); - when(DynamicDataSource.getInstance()).thenReturn(dataSource); + dynamicDataSourceMockedStatic.when(DynamicDataSource::getInstance).thenReturn(dataSource); LocalDataSourceServiceImpl dataSourceService = Mockito.mock(LocalDataSourceServiceImpl.class); when(dataSource.getDataSource()).thenReturn(dataSourceService); JdbcTemplate template = Mockito.mock(JdbcTemplate.class); @@ -118,23 +117,27 @@ public void testDerbyOps() throws Exception { .param("sql", "SELECT * FROM TEST"); String actualValue = mockMvc.perform(builder).andReturn().getResponse().getContentAsString(); Assert.assertEquals("200", JacksonUtils.toObj(actualValue).get("code").toString()); + propertyUtilMockedStatic.close(); + dynamicDataSourceMockedStatic.close(); } @Test public void testImportDerby() throws Exception { + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); + MockedStatic applicationUtilsMockedStatic = Mockito.mockStatic(ApplicationUtils.class); - MockedStatic propertyUtil = Mockito.mockStatic(PropertyUtil.class); - when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); - propertyUtil.close(); - Mockito.mockStatic(ApplicationUtils.class); - when(ApplicationUtils.getBean(DatabaseOperate.class)).thenReturn(Mockito.mock(DatabaseOperate.class)); + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); + applicationUtilsMockedStatic.when(() -> ApplicationUtils.getBean(DatabaseOperate.class)) + .thenReturn(Mockito.mock(DatabaseOperate.class)); MockMultipartFile file = new MockMultipartFile("file", "test.zip", "application/zip", "test".getBytes()); MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.multipart(Constants.OPS_CONTROLLER_PATH + "/data/removal").file(file); int actualValue = mockMvc.perform(builder).andReturn().getResponse().getStatus(); Assert.assertEquals(200, actualValue); + propertyUtilMockedStatic.close(); + applicationUtilsMockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigServletInnerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigServletInnerTest.java index d60beabe2b7..d1df6f5931a 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigServletInnerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigServletInnerTest.java @@ -82,8 +82,8 @@ public void setUp() { @Test public void testDoPollingConfig() throws Exception { + MockedStatic md5UtilMockedStatic = Mockito.mockStatic(MD5Util.class); - final MockedStatic md5Util = Mockito.mockStatic(MD5Util.class); Map clientMd5Map = new HashMap<>(); MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); @@ -91,9 +91,9 @@ public void testDoPollingConfig() throws Exception { changedGroups.add("1"); changedGroups.add("2"); - when(MD5Util.compareMd5(request, response, clientMd5Map)).thenReturn(changedGroups); - when(MD5Util.compareMd5OldResult(changedGroups)).thenReturn("test-old"); - when(MD5Util.compareMd5ResultString(changedGroups)).thenReturn("test-new"); + md5UtilMockedStatic.when(() -> MD5Util.compareMd5(request, response, clientMd5Map)).thenReturn(changedGroups); + md5UtilMockedStatic.when(() -> MD5Util.compareMd5OldResult(changedGroups)).thenReturn("test-old"); + md5UtilMockedStatic.when(() -> MD5Util.compareMd5ResultString(changedGroups)).thenReturn("test-new"); String actualValue = configServletInner.doPollingConfig(request, response, clientMd5Map, 1); @@ -101,19 +101,18 @@ public void testDoPollingConfig() throws Exception { Assert.assertEquals("test-old", response.getHeader(Constants.PROBE_MODIFY_RESPONSE)); Assert.assertEquals("test-new", response.getHeader(Constants.PROBE_MODIFY_RESPONSE_NEW)); Assert.assertEquals("no-cache,no-store", response.getHeader("Cache-Control")); - - md5Util.close(); + + md5UtilMockedStatic.close(); } @Test public void testDoGetConfigV1() throws Exception { + final MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); + final MockedStatic diskUtilMockedStatic = Mockito.mockStatic(DiskUtil.class); + final MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); - final MockedStatic diskUtil = Mockito.mockStatic(DiskUtil.class); - final MockedStatic configCacheService = Mockito.mockStatic(ConfigCacheService.class); - final MockedStatic propertyUtil = Mockito.mockStatic(PropertyUtil.class); - - when(ConfigCacheService.tryReadLock(anyString())).thenReturn(1); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.tryReadLock(anyString())).thenReturn(1); // isBeta: true CacheItem cacheItem = new CacheItem("test"); @@ -121,10 +120,10 @@ public void testDoGetConfigV1() throws Exception { List ips4Beta = new ArrayList<>(); ips4Beta.add("localhost"); cacheItem.setIps4Beta(ips4Beta); - when(ConfigCacheService.getContentCache(anyString())).thenReturn(cacheItem); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.getContentCache(anyString())).thenReturn(cacheItem); // if direct read is true - when(PropertyUtil.isDirectRead()).thenReturn(true); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(true); ConfigInfoBetaWrapper configInfoBetaWrapper = new ConfigInfoBetaWrapper(); configInfoBetaWrapper.setDataId("test"); configInfoBetaWrapper.setGroup("test"); @@ -141,29 +140,28 @@ public void testDoGetConfigV1() throws Exception { Assert.assertEquals("isBeta:true, direct read: true", response.getContentAsString()); // if direct read is false - when(PropertyUtil.isDirectRead()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(false); File file = tempFolder.newFile("test.txt"); - when(DiskUtil.targetBetaFile(anyString(), anyString(), anyString())).thenReturn(file); + diskUtilMockedStatic.when(() -> DiskUtil.targetBetaFile(anyString(), anyString(), anyString())).thenReturn(file); response = new MockHttpServletResponse(); actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_OK + "", actualValue); Assert.assertEquals("true", response.getHeader("isBeta")); Assert.assertEquals("", response.getContentAsString()); - - diskUtil.close(); - configCacheService.close(); - propertyUtil.close(); - + + configCacheServiceMockedStatic.close(); + diskUtilMockedStatic.close(); + propertyUtilMockedStatic.close(); } @Test public void testDoGetConfigV2() throws Exception { + + final MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); + final MockedStatic diskUtilMockedStatic = Mockito.mockStatic(DiskUtil.class); + final MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); - final MockedStatic diskUtil = Mockito.mockStatic(DiskUtil.class); - final MockedStatic configCacheService = Mockito.mockStatic(ConfigCacheService.class); - final MockedStatic propertyUtil = Mockito.mockStatic(PropertyUtil.class); - - when(ConfigCacheService.tryReadLock(anyString())).thenReturn(1); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.tryReadLock(anyString())).thenReturn(1); // isBeta: false CacheItem cacheItem = new CacheItem("test"); @@ -171,10 +169,10 @@ public void testDoGetConfigV2() throws Exception { List ips4Beta = new ArrayList<>(); ips4Beta.add("localhost"); cacheItem.setIps4Beta(ips4Beta); - when(ConfigCacheService.getContentCache(anyString())).thenReturn(cacheItem); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.getContentCache(anyString())).thenReturn(cacheItem); // if tag is blank and direct read is true - when(PropertyUtil.isDirectRead()).thenReturn(true); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(true); ConfigInfoWrapper configInfoWrapper = new ConfigInfoWrapper(); configInfoWrapper.setDataId("test"); configInfoWrapper.setGroup("test"); @@ -189,16 +187,16 @@ public void testDoGetConfigV2() throws Exception { Assert.assertEquals("tag is blank and direct read is true", response.getContentAsString()); // if tag is blank and direct read is false - when(PropertyUtil.isDirectRead()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(false); response = new MockHttpServletResponse(); File file = tempFolder.newFile("test.txt"); - when(DiskUtil.targetFile(anyString(), anyString(), anyString())).thenReturn(file); + diskUtilMockedStatic.when(() -> DiskUtil.targetFile(anyString(), anyString(), anyString())).thenReturn(file); actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_OK + "", actualValue); Assert.assertEquals("", response.getContentAsString()); // if tag is not blank and direct read is true - when(PropertyUtil.isDirectRead()).thenReturn(true); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(true); ConfigInfoTagWrapper configInfoTagWrapper = new ConfigInfoTagWrapper(); configInfoTagWrapper.setDataId("test"); configInfoTagWrapper.setGroup("test"); @@ -210,15 +208,15 @@ public void testDoGetConfigV2() throws Exception { Assert.assertEquals("tag is not blank and direct read is true", response.getContentAsString()); // if tag is not blank and direct read is false - when(PropertyUtil.isDirectRead()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(false); response = new MockHttpServletResponse(); - when(DiskUtil.targetTagFile(anyString(), anyString(), anyString(), anyString())).thenReturn(file); + diskUtilMockedStatic.when(() -> DiskUtil.targetTagFile(anyString(), anyString(), anyString(), anyString())).thenReturn(file); actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "test", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_OK + "", actualValue); Assert.assertEquals("", response.getContentAsString()); // if use auto tag and direct read is true - when(PropertyUtil.isDirectRead()).thenReturn(true); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(true); Map tagMd5 = new HashMap<>(); tagMd5.put("auto-tag-test", "auto-tag-test"); cacheItem.setTagMd5(tagMd5); @@ -231,36 +229,34 @@ public void testDoGetConfigV2() throws Exception { Assert.assertEquals("auto tag mode and direct read is true", response.getContentAsString()); // if use auto tag and direct read is false - when(PropertyUtil.isDirectRead()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(false); response = new MockHttpServletResponse(); actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_OK + "", actualValue); Assert.assertEquals("", response.getContentAsString()); - - diskUtil.close(); - configCacheService.close(); - propertyUtil.close(); - + + configCacheServiceMockedStatic.close(); + diskUtilMockedStatic.close(); + propertyUtilMockedStatic.close(); } @Test public void testDoGetConfigV3() throws Exception { + + final MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); - final MockedStatic configCacheService = Mockito.mockStatic(ConfigCacheService.class); - // if lockResult equals 0 - when(ConfigCacheService.tryReadLock(anyString())).thenReturn(0); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.tryReadLock(anyString())).thenReturn(0); MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); String actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "test", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND + "", actualValue); // if lockResult less than 0 - when(ConfigCacheService.tryReadLock(anyString())).thenReturn(-1); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.tryReadLock(anyString())).thenReturn(-1); actualValue = configServletInner.doGetConfig(request, response, "test", "test", "test", "test", "true", "localhost"); Assert.assertEquals(HttpServletResponse.SC_CONFLICT + "", actualValue); - - configCacheService.close(); - + + configCacheServiceMockedStatic.close(); } } \ No newline at end of file diff --git a/config/src/test/java/com/alibaba/nacos/config/server/controller/HealthControllerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/controller/HealthControllerTest.java index 5fce7da1dbf..8b36886a75c 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/controller/HealthControllerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/controller/HealthControllerTest.java @@ -75,6 +75,7 @@ public void setUp() { when(memberManager.getLookup()).thenReturn(memberLookup); when(servletContext.getContextPath()).thenReturn("/nacos"); ReflectionTestUtils.setField(healthController, "memberManager", memberManager); + ReflectionTestUtils.setField(healthController, "dataSourceService", dataSourceService); mockmvc = MockMvcBuilders.standaloneSetup(healthController).build(); } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/controller/HistoryControllerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/controller/HistoryControllerTest.java index e2210c7a374..c4698e5aed1 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/controller/HistoryControllerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/controller/HistoryControllerTest.java @@ -122,6 +122,7 @@ public void testGetConfigHistoryInfo() throws Exception { configHistoryInfo.setDataId("test"); configHistoryInfo.setGroup("test"); configHistoryInfo.setContent("test"); + configHistoryInfo.setTenant(""); configHistoryInfo.setCreatedTime(new Timestamp(new Date().getTime())); configHistoryInfo.setLastModifiedTime(new Timestamp(new Date().getTime())); @@ -149,6 +150,7 @@ public void testGetPreviousConfigHistoryInfo() throws Exception { configHistoryInfo.setDataId("test"); configHistoryInfo.setGroup("test"); configHistoryInfo.setContent("test"); + configHistoryInfo.setTenant(""); configHistoryInfo.setCreatedTime(new Timestamp(new Date().getTime())); configHistoryInfo.setLastModifiedTime(new Timestamp(new Date().getTime())); diff --git a/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigChangeBatchListenRequestHandlerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigChangeBatchListenRequestHandlerTest.java index ac9e6373f6a..af522752cd3 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigChangeBatchListenRequestHandlerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigChangeBatchListenRequestHandlerTest.java @@ -28,12 +28,12 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class ConfigChangeBatchListenRequestHandlerTest extends TestCase { @@ -52,18 +52,22 @@ public void setUp() { ReflectionTestUtils.setField(configQueryRequestHandler, "configChangeListenContext", configChangeListenContext); requestMeta = new RequestMeta(); requestMeta.setClientIp("1.1.1.1"); - Mockito.mockStatic(ConfigCacheService.class); } @Test public void testHandle() { + MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); + String dataId = "dataId"; String group = "group"; String tenant = "tenant"; - String groupKey = GroupKey2 - .getKey(dataId, group, tenant); + String groupKey = GroupKey2.getKey(dataId, group, tenant); groupKey = StringPool.get(groupKey); - when(ConfigCacheService.isUptodate(eq(groupKey), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(false); + + final String groupKeyCopy = groupKey; + configCacheServiceMockedStatic.when( + () -> ConfigCacheService.isUptodate(eq(groupKeyCopy), Mockito.any(), Mockito.any(), Mockito.any())) + .thenReturn(false); ConfigBatchListenRequest configChangeListenRequest = new ConfigBatchListenRequest(); configChangeListenRequest.addConfigListenContext(group, dataId, tenant, " "); try { @@ -79,6 +83,8 @@ public void testHandle() { assertTrue(hasChange); } catch (NacosException e) { e.printStackTrace(); + } finally { + configCacheServiceMockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandlerTest.java b/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandlerTest.java index c4f13b9c6b8..85a5abd82d9 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandlerTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandlerTest.java @@ -34,6 +34,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.core.env.StandardEnvironment; @@ -47,37 +48,43 @@ @RunWith(MockitoJUnitRunner.class) public class ConfigQueryRequestHandlerTest { - + @InjectMocks private ConfigQueryRequestHandler configQueryRequestHandler; - + @Mock private PersistService persistService; - + @Mock private File file; - + @Before public void setUp() throws IOException { EnvUtil.setEnvironment(new StandardEnvironment()); - Mockito.mockStatic(ConfigCacheService.class); - Mockito.mockStatic(PropertyUtil.class); - Mockito.mockStatic(FileUtils.class); - Mockito.mockStatic(DiskUtil.class); + } + + @Test + public void testHandle() throws NacosException { + final MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); + final MockedStatic fileUtilsMockedStatic = Mockito.mockStatic(FileUtils.class); + final MockedStatic diskUtilMockedStatic = Mockito.mockStatic(DiskUtil.class); + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); + + propertyUtilMockedStatic.when(PropertyUtil::isDirectRead).thenReturn(false); + ReflectionTestUtils.setField(configQueryRequestHandler, "persistService", persistService); final String groupKey = GroupKey2.getKey("dataId", "group", ""); - when(ConfigCacheService.tryReadLock(groupKey)).thenReturn(1); - when(DiskUtil.targetFile(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(file); - when(FileUtils.readFileToString(file, ENCODE)).thenReturn("content"); + configCacheServiceMockedStatic.when(() -> ConfigCacheService.tryReadLock(groupKey)).thenReturn(1); + diskUtilMockedStatic.when(() -> DiskUtil.targetFile(Mockito.any(), Mockito.any(), Mockito.any())) + .thenReturn(file); + fileUtilsMockedStatic.when(() -> FileUtils.readFileToString(file, ENCODE)).thenReturn("content"); when(file.exists()).thenReturn(true); CacheItem cacheItem = new CacheItem(groupKey); cacheItem.setMd5("1"); cacheItem.setLastModifiedTs(1L); - when(ConfigCacheService.getContentCache(Mockito.any())).thenReturn(cacheItem); - } - - @Test - public void testHandle() throws NacosException { + configCacheServiceMockedStatic.when(() -> ConfigCacheService.getContentCache(Mockito.any())) + .thenReturn(cacheItem); + ConfigQueryRequest configQueryRequest = new ConfigQueryRequest(); configQueryRequest.setDataId("dataId"); configQueryRequest.setGroup("group"); @@ -85,6 +92,11 @@ public void testHandle() throws NacosException { requestMeta.setClientIp("127.0.0.1"); ConfigQueryResponse response = configQueryRequestHandler.handle(configQueryRequest, requestMeta); Assert.assertEquals(response.getContent(), "content"); + + configCacheServiceMockedStatic.close(); + fileUtilsMockedStatic.close(); + diskUtilMockedStatic.close(); + propertyUtilMockedStatic.close(); } } \ No newline at end of file diff --git a/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/GroupCapacityPersistServiceTest.java b/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/GroupCapacityPersistServiceTest.java index b4098032b2c..018f8ce2bcb 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/GroupCapacityPersistServiceTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/GroupCapacityPersistServiceTest.java @@ -28,6 +28,7 @@ import org.mockito.ArgumentMatcher; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import org.springframework.jdbc.core.JdbcTemplate; @@ -194,6 +195,7 @@ public void testDecrementUsage() { @Test public void testUpdateGroupCapacity() { + final MockedStatic timeUtilsMockedStatic = Mockito.mockStatic(TimeUtils.class); List argList = CollectionUtils.list(); @@ -210,8 +212,8 @@ public void testUpdateGroupCapacity() { argList.add(maxAggrSize); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - Mockito.mockStatic(TimeUtils.class); - when(TimeUtils.getCurrentTime()).thenReturn(timestamp); + + timeUtilsMockedStatic.when(TimeUtils::getCurrentTime).thenReturn(timestamp); argList.add(timestamp); String group = "test"; @@ -230,6 +232,7 @@ public void testUpdateGroupCapacity() { return 0; }); Assert.assertTrue(service.updateGroupCapacity(group, quota, maxSize, maxAggrCount, maxAggrSize)); + timeUtilsMockedStatic.close(); } @Test diff --git a/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/TenantCapacityPersistServiceTest.java b/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/TenantCapacityPersistServiceTest.java index 793e81a2434..17cc4a6ed0c 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/TenantCapacityPersistServiceTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/service/capacity/TenantCapacityPersistServiceTest.java @@ -27,6 +27,7 @@ import org.mockito.ArgumentMatcher; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import org.springframework.jdbc.core.JdbcTemplate; @@ -157,6 +158,7 @@ public void testDecrementUsage() { @Test public void testUpdateTenantCapacity() { + final MockedStatic timeUtilsMockedStatic = Mockito.mockStatic(TimeUtils.class); List argList = CollectionUtils.list(); @@ -173,8 +175,7 @@ public void testUpdateTenantCapacity() { argList.add(maxAggrSize); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - Mockito.mockStatic(TimeUtils.class); - when(TimeUtils.getCurrentTime()).thenReturn(timestamp); + timeUtilsMockedStatic.when(TimeUtils::getCurrentTime).thenReturn(timestamp); argList.add(timestamp); String tenant = "test"; @@ -193,11 +194,12 @@ public void testUpdateTenantCapacity() { return 0; }); Assert.assertTrue(service.updateTenantCapacity(tenant, quota, maxSize, maxAggrCount, maxAggrSize)); + + timeUtilsMockedStatic.close(); } @Test public void testUpdateQuota() { - List argList = CollectionUtils.list(); Integer quota = 2; diff --git a/config/src/test/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSourceTest.java b/config/src/test/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSourceTest.java index 0899240e0bc..1893f00c529 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSourceTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/service/datasource/DynamicDataSourceTest.java @@ -23,14 +23,13 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.springframework.mock.web.MockServletContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.util.ReflectionTestUtils; -import static org.mockito.Mockito.when; - @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MockServletContext.class) public class DynamicDataSourceTest { @@ -53,14 +52,15 @@ public void setUp() { @Test public void testGetDataSource() { + MockedStatic propertyUtilMockedStatic = Mockito.mockStatic(PropertyUtil.class); - Mockito.mockStatic(PropertyUtil.class); - - when(PropertyUtil.isEmbeddedStorage()).thenReturn(true); + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(true); Assert.assertTrue(dataSource.getDataSource() instanceof LocalDataSourceServiceImpl); - when(PropertyUtil.isEmbeddedStorage()).thenReturn(false); + propertyUtilMockedStatic.when(PropertyUtil::isEmbeddedStorage).thenReturn(false); Assert.assertTrue(dataSource.getDataSource() instanceof ExternalDataSourceServiceImpl); + + propertyUtilMockedStatic.close(); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/service/dump/DumpServiceTest.java b/config/src/test/java/com/alibaba/nacos/config/server/service/dump/DumpServiceTest.java index fb4756b579a..fb476af286a 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/service/dump/DumpServiceTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/service/dump/DumpServiceTest.java @@ -16,6 +16,8 @@ package com.alibaba.nacos.config.server.service.dump; +import com.alibaba.nacos.config.server.service.datasource.DynamicDataSource; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +25,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.util.ReflectionTestUtils; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest @@ -33,6 +36,13 @@ public class DumpServiceTest { @Autowired DumpService service; + @BeforeClass + public static void setUp() { + + ReflectionTestUtils.setField(DynamicDataSource.getInstance(), "localDataSourceService", null); + ReflectionTestUtils.setField(DynamicDataSource.getInstance(), "basicDataSourceService", null); + } + @Test public void init() throws Throwable { service.init(); diff --git a/config/src/test/java/com/alibaba/nacos/config/server/service/repository/embedded/StandaloneDatabaseOperateImplTest.java b/config/src/test/java/com/alibaba/nacos/config/server/service/repository/embedded/StandaloneDatabaseOperateImplTest.java new file mode 100644 index 00000000000..f922cc8c8e8 --- /dev/null +++ b/config/src/test/java/com/alibaba/nacos/config/server/service/repository/embedded/StandaloneDatabaseOperateImplTest.java @@ -0,0 +1,357 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.nacos.config.server.service.repository.embedded; + +import com.alibaba.nacos.common.model.RestResult; +import com.alibaba.nacos.config.server.model.ConfigInfo; +import com.alibaba.nacos.config.server.service.sql.EmbeddedStorageContextUtils; +import com.alibaba.nacos.config.server.service.sql.ModifyRequest; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionTemplate; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.function.BiConsumer; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class StandaloneDatabaseOperateImplTest { + + @Spy + @InjectMocks + private StandaloneDatabaseOperateImpl operate; + + @Mock + private RowMapper rowMapper; + + @Mock + private JdbcTemplate jdbcTemplate; + + @Mock + private JdbcTemplate tempJdbcTemplate; + + @Mock + private BiConsumer biConsumer; + + @Mock + private File file; + + @Mock + private TransactionTemplate transactionTemplate; + + @Before + public void setUp() { + ReflectionTestUtils.setField(operate, "jdbcTemplate", jdbcTemplate); + ReflectionTestUtils.setField(operate, "transactionTemplate", transactionTemplate); + when(file.exists()).thenReturn(true); + when(file.isDirectory()).thenReturn(false); + when(file.canRead()).thenReturn(true); + when(file.getPath()).thenReturn("test"); + } + + @Test + public void testQueryOne1() { + String sql = "SELECT 1"; + Class clazz = Long.class; + Long num = 1L; + when(jdbcTemplate.queryForObject(sql, clazz)).thenReturn(num); + Assert.assertEquals(operate.queryOne(sql, clazz), (Long) 1L); + } + + @Test + public void testQueryOne2() { + final String sql = "SELECT * FROM config_info WHERE id = ? AND data_id = ? AND group_id = ?"; + ConfigInfo configInfo = new ConfigInfo(); + configInfo.setId(1L); + configInfo.setDataId("test"); + configInfo.setGroup("test"); + Object[] args = new Object[]{configInfo.getId(), configInfo.getDataId(), configInfo.getGroup()}; + when(jdbcTemplate.queryForObject(sql, args, ConfigInfo.class)).thenReturn(configInfo); + Assert.assertEquals(operate.queryOne(sql, args, ConfigInfo.class), configInfo); + } + + @Test + public void testQueryOne3() { + final String sql = "SELECT * FROM config_info WHERE id = ? AND data_id = ? AND group_id = ?"; + ConfigInfo configInfo = new ConfigInfo(); + configInfo.setId(1L); + configInfo.setDataId("test"); + configInfo.setGroup("test"); + Object[] args = new Object[]{configInfo.getId(), configInfo.getDataId(), configInfo.getGroup()}; + when(jdbcTemplate.queryForObject(eq(sql), eq(args), any(RowMapper.class))).thenReturn(configInfo); + Assert.assertEquals(operate.queryOne(sql, args, rowMapper), configInfo); + } + + @Test + public void testQueryOne4() { + String sql = "SELECT 1"; + Class clazz = Long.class; + Long result = 1L; + when(tempJdbcTemplate.queryForObject(sql, clazz)).thenReturn(result); + Assert.assertEquals(operate.queryOne(tempJdbcTemplate, sql, clazz), result); + } + + @Test + public void testQueryOne5() { + final String sql = "SELECT * FROM config_info WHERE id = ? AND data_id = ? AND group_id = ?"; + ConfigInfo configInfo = new ConfigInfo(); + configInfo.setId(1L); + configInfo.setDataId("test"); + configInfo.setGroup("test"); + Object[] args = new Object[]{configInfo.getId(), configInfo.getDataId(), configInfo.getGroup()}; + when(tempJdbcTemplate.queryForObject(sql, args, ConfigInfo.class)).thenReturn(configInfo); + Assert.assertEquals(operate.queryOne(tempJdbcTemplate, sql, args, ConfigInfo.class), configInfo); + } + + @Test + public void testQueryOne6() { + final String sql = "SELECT * FROM config_info WHERE id = ? AND data_id = ? AND group_id = ?"; + ConfigInfo configInfo = new ConfigInfo(); + configInfo.setId(1L); + configInfo.setDataId("test"); + configInfo.setGroup("test"); + Object[] args = new Object[]{configInfo.getId(), configInfo.getDataId(), configInfo.getGroup()}; + when(tempJdbcTemplate.queryForObject(eq(sql), eq(args), any(RowMapper.class))).thenReturn(configInfo); + Assert.assertEquals(operate.queryOne(tempJdbcTemplate, sql, args, rowMapper), configInfo); + } + + @Test + public void testQueryMany1() { + final String sql = "SELECT * FROM config_info WHERE id >= ? AND id <= ?"; + final Object[] args = new Object[]{1, 2}; + ConfigInfo configInfo1 = new ConfigInfo(); + configInfo1.setId(1); + ConfigInfo configInfo2 = new ConfigInfo(); + configInfo2.setId(2); + List configInfos = new ArrayList<>(); + configInfos.add(configInfo1); + configInfos.add(configInfo2); + when(jdbcTemplate.query(eq(sql), eq(args), any(RowMapper.class))).thenReturn(configInfos); + Assert.assertEquals(configInfos, operate.queryMany(sql, args, rowMapper)); + } + + @Test + public void testQueryMany2() { + final String sql = "SELECT id, data_id, group_id FROM config_info WHERE id >= ? AND id <= ?"; + final Object[] args = new Object[]{1, 2}; + + final List> resultList = new ArrayList<>(); + Map map1 = new HashMap<>(); + map1.put("id", 1); + map1.put("data_id", "test"); + map1.put("group_id", "test"); + + final Map map2 = new HashMap<>(); + map1.put("id", 2); + map1.put("data_id", "test"); + map1.put("group_id", "test"); + + resultList.add(map1); + resultList.add(map2); + + when(jdbcTemplate.queryForList(sql, args)).thenReturn(resultList); + Assert.assertEquals(operate.queryMany(sql, args), resultList); + } + + @Test + public void testQueryMany3() { + String sql = "SELECT data_id FROM config_info WHERE id >= ? AND id <= ?"; + Object[] args = new Object[]{1, 2}; + String dataId1 = "test1"; + String dataId2 = "test2"; + List resultList = new ArrayList<>(); + resultList.add(dataId1); + resultList.add(dataId2); + Class clazz = dataId1.getClass(); + when(jdbcTemplate.queryForList(sql, args, clazz)).thenReturn(resultList); + Assert.assertEquals(operate.queryMany(sql, args, clazz), resultList); + } + + @Test + public void testQueryMany4() { + final String sql = "SELECT data_id FROM config_info WHERE id >= ? AND id <= ?"; + final Object[] args = new Object[]{1, 2}; + final List> resultList = new ArrayList<>(); + Map map1 = new HashMap<>(); + map1.put("id", 1); + map1.put("data_id", "test"); + map1.put("group_id", "test"); + + final Map map2 = new HashMap<>(); + map1.put("id", 2); + map1.put("data_id", "test"); + map1.put("group_id", "test"); + + resultList.add(map1); + resultList.add(map2); + + when(tempJdbcTemplate.queryForList(sql, args)).thenReturn(resultList); + Assert.assertEquals(operate.queryMany(tempJdbcTemplate, sql, args), resultList); + } + + @Test + public void testQueryMany5() { + String sql = "SELECT data_id FROM config_info WHERE id >= ? AND id <= ?"; + Object[] args = new Object[]{1, 2}; + String dataId1 = "test1"; + String dataId2 = "test2"; + List resultList = new ArrayList<>(); + resultList.add(dataId1); + resultList.add(dataId2); + Class clazz = dataId1.getClass(); + when(operate.queryMany(jdbcTemplate, sql, args, clazz)).thenReturn(resultList); + Assert.assertEquals(operate.queryMany(jdbcTemplate, sql, args, clazz), resultList); + } + + @Test + public void testQueryMany6() { + final String sql = "SELECT * FROM config_info WHERE id >= ? AND id <= ?"; + final Object[] args = new Object[]{1, 2}; + ConfigInfo configInfo1 = new ConfigInfo(); + configInfo1.setId(1); + ConfigInfo configInfo2 = new ConfigInfo(); + configInfo2.setId(2); + List configInfos = new ArrayList<>(); + configInfos.add(configInfo1); + configInfos.add(configInfo2); + when(tempJdbcTemplate.query(eq(sql), eq(args), any(RowMapper.class))).thenReturn(configInfos); + Assert.assertEquals(operate.queryMany(tempJdbcTemplate, sql, args, rowMapper), configInfos); + } + + @Test + public void testDataImport() throws ExecutionException, InterruptedException { + RestResult errorResult = RestResult.builder().withCode(500).withMsg("null").withData(null) + .build(); + CompletableFuture> errorFuture = new CompletableFuture<>(); + errorFuture.complete(errorResult); + doReturn(errorFuture).when(operate).dataImport(null); + Assert.assertEquals(operate.dataImport(null).get(), errorResult); + } + + @Test + public void testUpdate1() { + List modifyRequests = new ArrayList<>(); + ModifyRequest modifyRequest1 = new ModifyRequest(); + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = ?;"; + modifyRequest1.setSql(sql); + Object[] args = new Object[]{1}; + modifyRequest1.setArgs(args); + modifyRequests.add(modifyRequest1); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.update(modifyRequests)); + } + + @Test + public void testUpdate2() { + List modifyRequests = new ArrayList<>(); + ModifyRequest modifyRequest1 = new ModifyRequest(); + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = ?;"; + modifyRequest1.setSql(sql); + Object[] args = new Object[]{1}; + modifyRequest1.setArgs(args); + modifyRequests.add(modifyRequest1); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.update(modifyRequests, biConsumer)); + } + + @Test + public void testUpdate3() { + List modifyRequests = new ArrayList<>(); + ModifyRequest modifyRequest1 = new ModifyRequest(); + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = ?;"; + modifyRequest1.setSql(sql); + Object[] args = new Object[]{1}; + modifyRequest1.setArgs(args); + modifyRequests.add(modifyRequest1); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.update(transactionTemplate, jdbcTemplate, modifyRequests)); + } + + @Test + public void testUpdate4() { + List modifyRequests = new ArrayList<>(); + ModifyRequest modifyRequest1 = new ModifyRequest(); + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = ?;"; + modifyRequest1.setSql(sql); + Object[] args = new Object[]{1}; + modifyRequest1.setArgs(args); + modifyRequests.add(modifyRequest1); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.update(transactionTemplate, jdbcTemplate, modifyRequests, biConsumer)); + } + + @Test + public void testBlockUpdate1() { + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = 1;"; + EmbeddedStorageContextUtils.addSqlContext(sql); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.blockUpdate()); + } + + @Test + public void testBlockUpdate2() { + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = 1;"; + EmbeddedStorageContextUtils.addSqlContext(sql); + when(transactionTemplate.execute(any(TransactionCallback.class))).thenReturn(true); + Assert.assertTrue(operate.blockUpdate(biConsumer)); + } + + @Test + public void testDoDataImport() { + List modifyRequests = new ArrayList<>(); + ModifyRequest modifyRequest1 = new ModifyRequest(); + String sql = "UPDATE config_info SET data_id = 'test' WHERE id = ?;"; + modifyRequest1.setSql(sql); + Object[] args = new Object[]{1}; + modifyRequest1.setArgs(args); + modifyRequests.add(modifyRequest1); + when(tempJdbcTemplate.batchUpdate(sql)).thenReturn(new int[]{1}); + Assert.assertTrue(operate.doDataImport(tempJdbcTemplate, modifyRequests)); + } + + @Test + public void testFutureUpdate() throws ExecutionException, InterruptedException { + String sql = "SELECT 1"; + EmbeddedStorageContextUtils.addSqlContext(sql); + CompletableFuture future = new CompletableFuture<>(); + future.complete(true); + doAnswer((invocationOnMock) -> null).when(operate).futureUpdate(); + when(operate.futureUpdate()).thenReturn(future); + Assert.assertTrue(operate.futureUpdate().get()); + } +} \ No newline at end of file diff --git a/config/src/test/java/com/alibaba/nacos/config/server/utils/DiskUtilsTest.java b/config/src/test/java/com/alibaba/nacos/config/server/utils/DiskUtilsTest.java index 57c90c4dcff..cb61c9a8ac6 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/utils/DiskUtilsTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/utils/DiskUtilsTest.java @@ -23,15 +23,12 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import org.mockito.MockedStatic; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import java.io.IOException; -@RunWith(SpringJUnit4ClassRunner.class) public class DiskUtilsTest { static MockedStatic fileUtils; @@ -100,13 +97,13 @@ public void testRemoveHeartHeat() { @Test public void testTargetFile() { File file = DiskUtil.targetFile("test1", "test2", "test3"); - String[] arr = file.getPath().split("\\\\"); + String[] arr = file.getPath().split(File.separator); Assert.assertEquals("test1", arr[arr.length - 1]); Assert.assertEquals("test2", arr[arr.length - 2]); Assert.assertEquals("test3", arr[arr.length - 3]); File file2 = DiskUtil.targetFile("test1", "test2", ""); - String[] arr2 = file2.getPath().split("\\\\"); + String[] arr2 = file2.getPath().split(File.separator); Assert.assertEquals("test1", arr2[arr2.length - 1]); Assert.assertEquals("test2", arr2[arr2.length - 2]); Assert.assertEquals("config-data", arr2[arr2.length - 3]); @@ -115,13 +112,13 @@ public void testTargetFile() { @Test public void testTargetBetaFile() { File file = DiskUtil.targetBetaFile("test1", "test2", "test3"); - String[] arr = file.getPath().split("\\\\"); + String[] arr = file.getPath().split(File.separator); Assert.assertEquals("test1", arr[arr.length - 1]); Assert.assertEquals("test2", arr[arr.length - 2]); Assert.assertEquals("test3", arr[arr.length - 3]); File file2 = DiskUtil.targetBetaFile("test1", "test2", ""); - String[] arr2 = file2.getPath().split("\\\\"); + String[] arr2 = file2.getPath().split(File.separator); Assert.assertEquals("test1", arr2[arr2.length - 1]); Assert.assertEquals("test2", arr2[arr2.length - 2]); Assert.assertEquals("beta-data", arr2[arr2.length - 3]); @@ -130,14 +127,14 @@ public void testTargetBetaFile() { @Test public void testTargetTagFile() { File file = DiskUtil.targetTagFile("test1", "test2", "test3", "tag"); - String[] arr = file.getPath().split("\\\\"); + String[] arr = file.getPath().split(File.separator); Assert.assertEquals("tag", arr[arr.length - 1]); Assert.assertEquals("test1", arr[arr.length - 2]); Assert.assertEquals("test2", arr[arr.length - 3]); Assert.assertEquals("test3", arr[arr.length - 4]); File file2 = DiskUtil.targetTagFile("test1", "test2", "", "tag"); - String[] arr2 = file2.getPath().split("\\\\"); + String[] arr2 = file2.getPath().split(File.separator); Assert.assertEquals("tag", arr2[arr2.length - 1]); Assert.assertEquals("test1", arr2[arr2.length - 2]); Assert.assertEquals("test2", arr2[arr2.length - 3]); @@ -162,7 +159,7 @@ public void testGetLocalConfigMd5() throws IOException { @Test public void testHeartBeatFile() { File file = DiskUtil.heartBeatFile(); - String[] arr = file.getPath().split("\\\\"); + String[] arr = file.getPath().split(File.separator); Assert.assertEquals("heartBeat.txt", arr[arr.length - 1]); Assert.assertEquals("status", arr[arr.length - 2]); Assert.assertEquals("nacos", arr[arr.length - 3]); @@ -171,7 +168,7 @@ public void testHeartBeatFile() { @Test public void testRelativePath() { String relativePath = DiskUtil.relativePath("test1", "test2"); - String[] arr = relativePath.split("/"); + String[] arr = relativePath.split(File.separator); Assert.assertEquals("test2", arr[arr.length - 1]); Assert.assertEquals("test1", arr[arr.length - 2]); } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/utils/MD5UtilTest.java b/config/src/test/java/com/alibaba/nacos/config/server/utils/MD5UtilTest.java index a66f4f3c691..72e628aef06 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/utils/MD5UtilTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/utils/MD5UtilTest.java @@ -38,18 +38,17 @@ import java.util.Map; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; public class MD5UtilTest { @Test public void testCompareMd5() { - - final MockedStatic configCacheServiceMockedStatic = Mockito - .mockStatic(ConfigCacheService.class); - - when(ConfigCacheService.isUptodate(anyString(), anyString(), anyString(), anyString())).thenReturn(false); - + final MockedStatic configCacheServiceMockedStatic = Mockito.mockStatic(ConfigCacheService.class); + + configCacheServiceMockedStatic.when( + () -> ConfigCacheService.isUptodate(anyString(), anyString(), anyString(), anyString())) + .thenReturn(false); + Map clientMd5Map = new HashMap<>(); clientMd5Map.put("test", "test"); @@ -61,13 +60,13 @@ public void testCompareMd5() { Assert.assertEquals(1, changedGroupKeys.size()); Assert.assertEquals("test", changedGroupKeys.get(0)); - + configCacheServiceMockedStatic.close(); + } @Test public void testCompareMd5OldResult() { - final MockedStatic groupKey2MockedStatic = Mockito.mockStatic(GroupKey2.class); List changedGroupKeys = new ArrayList<>(); @@ -77,18 +76,18 @@ public void testCompareMd5OldResult() { arr[0] = "test0"; arr[1] = "test1"; arr[2] = "test2"; - when(GroupKey2.parseKey(anyString())).thenReturn(arr); + groupKey2MockedStatic.when(() -> GroupKey2.parseKey(anyString())).thenReturn(arr); String actualValue = MD5Util.compareMd5OldResult(changedGroupKeys); Assert.assertEquals("test0:test1;", actualValue); - + groupKey2MockedStatic.close(); + } @Test public void testCompareMd5ResultString() { - final MockedStatic groupKey2MockedStatic = Mockito.mockStatic(GroupKey2.class); List changedGroupKeys = new ArrayList<>(); @@ -98,15 +97,15 @@ public void testCompareMd5ResultString() { arr[0] = "test0"; arr[1] = "test1"; arr[2] = "test2"; - when(GroupKey2.parseKey(anyString())).thenReturn(arr); + groupKey2MockedStatic.when(() -> GroupKey2.parseKey(anyString())).thenReturn(arr); try { String actualValue = MD5Util.compareMd5ResultString(changedGroupKeys); Assert.assertEquals("test0%02test1%02test2%01", actualValue); } catch (IOException e) { - System.out.println(e.toString()); + System.out.println(e); } - + groupKey2MockedStatic.close(); } @@ -142,7 +141,7 @@ public void testToStringV1() { String actualValue = MD5Util.toString(input, "UTF-8"); Assert.assertEquals("test", actualValue); } catch (IOException e) { - System.out.println(e.toString()); + System.out.println(e); } } @@ -154,7 +153,7 @@ public void testToStringV2() { String actualValue = MD5Util.toString(reader); Assert.assertEquals("test", actualValue); } catch (IOException e) { - System.out.println(e.toString()); + System.out.println(e); } } @@ -171,7 +170,7 @@ public void testCopy() { Assert.assertEquals(content, output.toString()); } catch (IOException e) { - System.out.println(e.toString()); + System.out.println(e); } } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/utils/ParamUtilsTest.java b/config/src/test/java/com/alibaba/nacos/config/server/utils/ParamUtilsTest.java index a20fd5c8249..7672dca5d53 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/utils/ParamUtilsTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/utils/ParamUtilsTest.java @@ -19,13 +19,10 @@ import com.alibaba.nacos.api.exception.NacosException; import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.HashMap; import java.util.Map; -@RunWith(SpringJUnit4ClassRunner.class) public class ParamUtilsTest { @Test diff --git a/config/src/test/java/com/alibaba/nacos/config/server/utils/PropertyUtilTest.java b/config/src/test/java/com/alibaba/nacos/config/server/utils/PropertyUtilTest.java index 0a907383ec3..721c4ab18f6 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/utils/PropertyUtilTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/utils/PropertyUtilTest.java @@ -27,7 +27,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; @RunWith(SpringJUnit4ClassRunner.class) public class PropertyUtilTest { @@ -37,19 +36,24 @@ public class PropertyUtilTest { @Test public void testGetPropertyV1() { - final MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); + MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); + EnvUtil.setEnvironment(configurableEnvironment); - when(EnvUtil.getProperty(eq("test"))).thenReturn("test"); + envUtilMockedStatic.when(() -> EnvUtil.getProperty(eq("test"))).thenReturn("test"); Assert.assertEquals("test", new PropertyUtil().getProperty("test")); + envUtilMockedStatic.close(); } @Test public void testGetPropertyV2() { - final MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); + MockedStatic envUtilMockedStatic = Mockito.mockStatic(EnvUtil.class); + EnvUtil.setEnvironment(configurableEnvironment); - when(EnvUtil.getProperty(eq("test"), eq("default"))).thenReturn("default"); + envUtilMockedStatic.when(() -> EnvUtil.getProperty(eq("test"), eq("default"))).thenReturn("default"); Assert.assertEquals("default", new PropertyUtil().getProperty("test", "default")); + envUtilMockedStatic.close(); } + } diff --git a/config/src/test/java/com/alibaba/nacos/config/server/utils/ResponseUtilTest.java b/config/src/test/java/com/alibaba/nacos/config/server/utils/ResponseUtilTest.java index 0d00d62b34d..abb7e6efca3 100644 --- a/config/src/test/java/com/alibaba/nacos/config/server/utils/ResponseUtilTest.java +++ b/config/src/test/java/com/alibaba/nacos/config/server/utils/ResponseUtilTest.java @@ -24,13 +24,16 @@ public class ResponseUtilTest { + String lineSeparator = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("line.separator")); + @Test public void testWriteErrMsg() { MockHttpServletResponse response = new MockHttpServletResponse(); ResponseUtil.writeErrMsg(response, 404, "test"); Assert.assertEquals(404, response.getStatus()); try { - Assert.assertEquals("test\r\n", response.getContentAsString()); + Assert.assertEquals("test" + lineSeparator, response.getContentAsString()); } catch (UnsupportedEncodingException e) { System.out.println(e.toString()); } diff --git a/consistency/src/main/java/com/alibaba/nacos/consistency/SerializeFactory.java b/consistency/src/main/java/com/alibaba/nacos/consistency/SerializeFactory.java index 69604c431a9..4eaaa4b76c0 100644 --- a/consistency/src/main/java/com/alibaba/nacos/consistency/SerializeFactory.java +++ b/consistency/src/main/java/com/alibaba/nacos/consistency/SerializeFactory.java @@ -31,7 +31,7 @@ public class SerializeFactory { public static final String HESSIAN_INDEX = "Hessian".toLowerCase(); - private static final Map SERIALIZER_MAP = new HashMap(4); + private static final Map SERIALIZER_MAP = new HashMap<>(4); public static String defaultSerializer = HESSIAN_INDEX; diff --git a/console-ui/src/globalLib.js b/console-ui/src/globalLib.js index 58b7b175d8d..90d772cb135 100644 --- a/console-ui/src/globalLib.js +++ b/console-ui/src/globalLib.js @@ -500,10 +500,11 @@ const request = (function(_global) { console.log('Token Error', localStorage.token, e); goLogin(); } - const { accessToken = '', username = '' } = token; - const [url, paramsStr = ''] = config.url.split('?'); - const params = paramsStr.split('&'); + const { accessToken = '' } = token; + const [url, paramsStr] = config.url.split('?'); + const params = paramsStr ? paramsStr.split('&') : []; params.push(`accessToken=${accessToken}`); + params.push('message=true'); return $.ajax( Object.assign({}, config, { diff --git a/console-ui/src/layouts/Header.js b/console-ui/src/layouts/Header.js index 23bcbfa9acc..8bf44d6a4fb 100644 --- a/console-ui/src/layouts/Header.js +++ b/console-ui/src/layouts/Header.js @@ -56,6 +56,7 @@ class Header extends React.Component { changePassword = () => { this.setState({ passwordResetUser: this.getUsername(), + passwordResetUserVisible: true, }); }; @@ -84,7 +85,7 @@ class Header extends React.Component { location: { pathname }, } = this.props; const { home, docs, blog, community, enterprise, languageSwitchButton } = locale; - const { passwordResetUser = '' } = this.state; + const { passwordResetUser = '', passwordResetUserVisible = false } = this.state; const BASE_URL = `https://nacos.io/${language.toLocaleLowerCase()}/`; const NAV_MENU = [ { id: 1, title: home, link: BASE_URL }, @@ -135,13 +136,16 @@ class Header extends React.Component { passwordReset(user).then(res => { return res; }) } - onCancel={() => this.setState({ passwordResetUser: undefined })} + onCancel={() => + this.setState({ passwordResetUser: undefined, passwordResetUserVisible: false }) + } /> ); diff --git a/console-ui/src/layouts/MainLayout.js b/console-ui/src/layouts/MainLayout.js index a7e6132f942..69e1c53ce61 100644 --- a/console-ui/src/layouts/MainLayout.js +++ b/console-ui/src/layouts/MainLayout.js @@ -51,7 +51,10 @@ class MainLayout extends React.Component { navTo(url) { const { search } = this.props.location; - this.props.history.push([url, search].join('')); + let urlSearchParams = new URLSearchParams(search); + urlSearchParams.set('namespace', window.nownamespace); + urlSearchParams.set('namespaceShowName', window.namespaceShowName); + this.props.history.push([url, '?', urlSearchParams.toString()].join('')); } isCurrentPath(url) { @@ -120,7 +123,7 @@ class MainLayout extends React.Component { } return ( c) .join(' ')} diff --git a/console-ui/src/lib.js b/console-ui/src/lib.js index a2068179491..5956d228d51 100644 --- a/console-ui/src/lib.js +++ b/console-ui/src/lib.js @@ -13,9 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { getParams, request, aliwareIntl } from './globalLib'; - -let hasAlert = false; +import { getParams, request } from './globalLib'; window.edasprefix = 'acm'; // 固定的edas网关需要的项目名 @@ -48,55 +46,6 @@ request.middleWare((_config = {}) => { } } - const preSucess = config.success; - const preErorr = config.error; - - config.success = function(res) { - if (res.code === 'ConsoleNeedLogin' && window.location.host.indexOf('acm') !== -1) { - window.location.reload(); - } - if (res.code === 403 && !hasAlert) { - hasAlert = true; - window.Dialog.alert({ - style: { width: 400 }, - content: res.message, - onOk: () => { - hasAlert = false; - }, - onCancel: () => { - hasAlert = false; - }, - onClose: () => { - hasAlert = false; - }, - }); - } else { - typeof preSucess === 'function' && preSucess(res); - } - }; - - config.error = function(res) { - if (res.status === 403 && !hasAlert) { - hasAlert = true; - - window.Dialog.alert({ - style: { width: 400 }, - content: aliwareIntl.get('com.alibaba.nacos.pubshow'), // '子账号没有权限,请联系主账号负责人RAM上授权', - onOk: () => { - hasAlert = false; - }, - onCancel: () => { - hasAlert = false; - }, - onClose: () => { - hasAlert = false; - }, - }); - } else { - typeof preErorr === 'function' && preErorr(res); - } - }; - return config; }); diff --git a/console-ui/src/locales/en-US.js b/console-ui/src/locales/en-US.js index ebc88b3df3e..322d4ca607d 100644 --- a/console-ui/src/locales/en-US.js +++ b/console-ui/src/locales/en-US.js @@ -243,6 +243,10 @@ const I18N_CONF = { lastUpdateTime: 'Last Modified At', operator: 'Operator', operation: 'Operation', + compare: 'Compare', + historyCompareTitle: 'History Compare', + historyCompareLastVersion: 'Lasted Release Version', + historyCompareSelectedVersion: 'Selected Version', }, HistoryDetail: { historyDetails: 'History Details', @@ -287,7 +291,9 @@ const I18N_CONF = { queryResults: 'Search Results: Found', articleMeetRequirements: 'configuration items', fuzzyd: "Add wildcard '*' for fuzzy query", + defaultFuzzyd: 'Default fuzzy query mode opened', fuzzyg: "Add wildcard '*' for fuzzy query", + defaultFuzzyg: 'Default fuzzy query mode opened', query: 'Search', advancedQuery9: 'Advanced Query', application0: 'Application:', @@ -354,6 +360,7 @@ const I18N_CONF = { newListingMain: 'Create Configuration', newListing: 'Create Configuration', publishFailed: 'Publish failed. Make sure parameters are entered correctly.', + publishFailed403: 'Publish failed. No permission to create Configuration', doNotEnter: 'Illegal characters not allowed', newConfig: 'Data ID cannot be empty.', dataIdIsNotEmpty: 'Data ID cannot exceed 255 characters in length', @@ -437,6 +444,7 @@ const I18N_CONF = { dialogTitle: 'Content Comparison', dialogCurrentArea: 'Current Value', dialogOriginalArea: 'Original Value', + publishFailed403: 'Publish failed. No operation permission', }, EditorNameSpace: { notice: 'Notice', diff --git a/console-ui/src/locales/zh-CN.js b/console-ui/src/locales/zh-CN.js index e6532eb1ef7..eca63d51a89 100644 --- a/console-ui/src/locales/zh-CN.js +++ b/console-ui/src/locales/zh-CN.js @@ -242,6 +242,10 @@ const I18N_CONF = { lastUpdateTime: '最后更新时间', operator: '操作人', operation: '操作', + compare: '比较', + historyCompareTitle: '历史版本比较', + historyCompareLastVersion: '最新版本', + historyCompareSelectedVersion: '当前选中版本', }, HistoryDetail: { historyDetails: '历史详情', @@ -285,7 +289,9 @@ const I18N_CONF = { queryResults: '查询结果:共查询到', articleMeetRequirements: '条满足要求的配置。', fuzzyd: "添加通配符'*'进行模糊查询", + defaultFuzzyd: '已开启默认模糊查询', fuzzyg: "添加通配符'*'进行模糊查询", + defaultFuzzyg: '已开启默认模糊查询', query: '查询', advancedQuery9: '高级查询', application0: '归属应用:', @@ -351,6 +357,7 @@ const I18N_CONF = { newListingMain: '新建配置', newListing: '新建配置', publishFailed: '发布失败。请检查参数是否正确。', + publishFailed403: '发布失败,请检查是否有权限新增配置', doNotEnter: '不允许非法字符', newConfig: 'Data ID 不能为空', dataIdIsNotEmpty: 'Data ID 长度不能超过255字符', @@ -434,6 +441,7 @@ const I18N_CONF = { dialogTitle: '内容比较', dialogCurrentArea: '当前值', dialogOriginalArea: '原始值', + publishFailed403: '发布失败,请检查是否有权限', }, EditorNameSpace: { notice: '提示', diff --git a/console-ui/src/pages/AuthorityControl/UserManagement/PasswordReset.js b/console-ui/src/pages/AuthorityControl/UserManagement/PasswordReset.js index 60408bf333e..b8a3e84921c 100644 --- a/console-ui/src/pages/AuthorityControl/UserManagement/PasswordReset.js +++ b/console-ui/src/pages/AuthorityControl/UserManagement/PasswordReset.js @@ -67,12 +67,12 @@ class PasswordReset extends React.Component { render() { const { locale } = this.props; const { getError } = this.field; - const { username, onOk, onCancel } = this.props; + const { username, onOk, onCancel, visible } = this.props; return ( <> { const vals = this.check(); if (vals) { diff --git a/console-ui/src/pages/AuthorityControl/UserManagement/UserManagement.js b/console-ui/src/pages/AuthorityControl/UserManagement/UserManagement.js index f3170d79bfc..a60f5d30ce5 100644 --- a/console-ui/src/pages/AuthorityControl/UserManagement/UserManagement.js +++ b/console-ui/src/pages/AuthorityControl/UserManagement/UserManagement.js @@ -69,7 +69,14 @@ class UserManagement extends React.Component { render() { const { users, locale } = this.props; - const { loading, pageSize, pageNo, createUserVisible, passwordResetUser } = this.state; + const { + loading, + pageSize, + pageNo, + createUserVisible, + passwordResetUserVisible, + passwordResetUser, + } = this.state; return ( <> @@ -99,7 +106,9 @@ class UserManagement extends React.Component { <> @@ -144,6 +153,7 @@ class UserManagement extends React.Component { onCancel={() => this.colseCreateUser()} /> passwordReset(user).then(res => { @@ -151,7 +161,9 @@ class UserManagement extends React.Component { return res; }) } - onCancel={() => this.setState({ passwordResetUser: undefined })} + onCancel={() => + this.setState({ passwordResetUser: undefined, passwordResetUserVisible: false }) + } /> ); diff --git a/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js b/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js index 6a7fd366f15..d204e2476be 100644 --- a/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js +++ b/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js @@ -210,7 +210,7 @@ class ClusterNodeList extends React.Component { this.rowColor(row)} + rowProps={row => this.rowColor(row)} > { - if (res) { - if (isNewConfig) { - this.setState({ isNewConfig: false }); + }).then( + res => { + if (res) { + if (isNewConfig) { + this.setState({ isNewConfig: false }); + } + this.getConfig(beta); + } + this.setState({ loading: false }); + return res; + }, + error => { + this.setState({ loading: false }); + if (error.status && error.status === 403) { + Dialog.alert({ + content: this.props.locale.publishFailed403, + }); } - this.getConfig(beta); } - this.setState({ loading: false }); - return res; - }); + ); } publishBeta() { diff --git a/console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js b/console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js index d000763d3c9..70821cb6de4 100644 --- a/console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js +++ b/console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js @@ -35,6 +35,7 @@ import { Message, MenuButton, Box, + Switch, } from '@alifd/next'; import BatchHandle from 'components/BatchHandle'; import RegionGroup from 'components/RegionGroup'; @@ -115,6 +116,7 @@ class ConfigurationManagement extends React.Component { selectedRowKeys: [], }, isPageEnter: false, + defaultFuzzySearch: true, }; const obj = { dataId: this.dataId || '', @@ -236,6 +238,22 @@ class ConfigurationManagement extends React.Component { this.setState({ rowSelection }); } + changeParamsBySearchType(params) { + if (this.state.defaultFuzzySearch) { + if (params.dataId && params.dataId !== '') { + params.dataId = '*' + params.dataId + '*'; + } + if (params.group && params.group !== '') { + params.group = '*' + params.group + '*'; + } + } + if (params.dataId.indexOf('*') !== -1 || params.group.indexOf('*') !== -1) { + params.search = 'blur'; + } else { + params.search = 'accurate'; + } + } + getData(pageNo = 1, clearSelect = true) { if (this.state.loading) { return; @@ -258,11 +276,7 @@ class ConfigurationManagement extends React.Component { }; setParams('pageSize', null); setParams('pageNo', null); - if (this.dataId.indexOf('*') !== -1 || this.group.indexOf('*') !== -1) { - params.search = 'blur'; - } else { - params.search = 'accurate'; - } + this.changeParamsBySearchType(params); this.setState({ loading: true }); this.props .getConfigs(params) @@ -448,6 +462,12 @@ class ConfigurationManagement extends React.Component { }); } + handleDefaultFuzzySwitchChange = () => { + this.setState({ + defaultFuzzySearch: !this.state.defaultFuzzySearch, + }); + }; + selectAll() { setParams('dataId', this.dataId); setParams('group', this.group); @@ -969,7 +989,7 @@ class ConfigurationManagement extends React.Component { accept: 'application/zip', action: `v1/cs/configs?import=true&namespace=${getParams( 'namespace' - )}&accessToken=${accessToken}&username=${username}`, + )}&accessToken=${accessToken}&username=${username}&tenant=${getParams('namespace')}`, headers: Object.assign({}, {}, { accessToken }), data: { policy: self.field.getValue('sameConfigPolicy'), @@ -1135,7 +1155,9 @@ class ConfigurationManagement extends React.Component { { this.dataId = dataId; @@ -1149,7 +1171,9 @@ class ConfigurationManagement extends React.Component { + + + + + - diff --git a/console-ui/src/pages/NameSpace/NameSpace.js b/console-ui/src/pages/NameSpace/NameSpace.js index 33cb914e521..5f09270fb33 100644 --- a/console-ui/src/pages/NameSpace/NameSpace.js +++ b/console-ui/src/pages/NameSpace/NameSpace.js @@ -39,6 +39,7 @@ class NameSpace extends React.Component { this.state = { loading: false, defaultNamespace: '', + defaultNamespaceName: 'public', dataSource: [], }; } @@ -162,8 +163,6 @@ class NameSpace extends React.Component { namespaceName, namespaceID, configurationManagement, - removeSuccess, - deletedSuccessfully, deletedFailure, } = locale; Dialog.confirm({ @@ -193,6 +192,9 @@ class NameSpace extends React.Component { const urlnamespace = getParams('namespace'); if (record.namespace === urlnamespace) { setParams('namespace', this.state.defaultNamespace); + setParams('namespaceShowName', this.state.defaultNamespaceName); + window.nownamespace = this.state.defaultNamespace; + window.namespaceShowName = this.state.defaultNamespaceName; } } else { Dialog.alert({ content: res.message, title: deletedFailure }); @@ -288,6 +290,7 @@ class NameSpace extends React.Component { namespace, namespaceAdd, namespaceNames, + description, namespaceNumber, configuration, namespaceOperation, @@ -328,6 +331,7 @@ class NameSpace extends React.Component { cell={this.renderName.bind(this)} /> + this.rowColor(row)} + rowProps={row => this.rowColor(row)} loading={this.state.loading} > diff --git a/console-ui/src/utils/request.js b/console-ui/src/utils/request.js index 6c6e355fba6..c157e6b5149 100644 --- a/console-ui/src/utils/request.js +++ b/console-ui/src/utils/request.js @@ -39,6 +39,7 @@ const request = () => { if (!params) { config.params = {}; } + config.params.message = true; if (!url.includes('auth/users/login')) { let token = {}; try { @@ -89,7 +90,7 @@ const request = () => { if ( [401, 403].includes(status) && - ['unknown user!', 'token invalid!', 'token expired!', 'authorization failed!'].includes( + ['unknown user!', 'token invalid!', 'token expired!', 'session expired!'].includes( message ) ) { diff --git a/console/pom.xml b/console/pom.xml index a457bbb1d38..fb3785c88c5 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -36,10 +36,6 @@ ${project.groupId} nacos-config - - org.apache.tomcat.embed - tomcat-embed-jasper - ${project.groupId} nacos-naming diff --git a/console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java b/console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java index 8803956da36..2afdaaef503 100644 --- a/console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java +++ b/console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java @@ -61,10 +61,10 @@ public void init() { public CorsFilter corsFilter() { CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); - config.addAllowedOrigin("*"); config.addAllowedHeader("*"); config.setMaxAge(18000L); config.addAllowedMethod("*"); + config.addAllowedOriginPattern("*"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); diff --git a/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java b/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java index 9ce7325c936..642b8cf4cf4 100644 --- a/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java +++ b/console/src/main/java/com/alibaba/nacos/console/controller/NamespaceController.java @@ -17,7 +17,6 @@ package com.alibaba.nacos.console.controller; import com.alibaba.nacos.auth.annotation.Secured; -import com.alibaba.nacos.plugin.auth.constant.ActionTypes; import com.alibaba.nacos.common.model.RestResult; import com.alibaba.nacos.common.model.RestResultUtils; import com.alibaba.nacos.common.utils.StringUtils; @@ -26,6 +25,7 @@ import com.alibaba.nacos.console.enums.NamespaceTypeEnum; import com.alibaba.nacos.console.model.Namespace; import com.alibaba.nacos.console.model.NamespaceAllInfo; +import com.alibaba.nacos.plugin.auth.constant.ActionTypes; import com.alibaba.nacos.plugin.auth.impl.constant.AuthConstants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -86,8 +86,8 @@ public RestResult> getNamespaces() { namespaces.add(namespace0); for (TenantInfo tenantInfo : tenantInfos) { int configCount = persistService.configInfoCount(tenantInfo.getTenantId()); - Namespace namespaceTmp = new Namespace(tenantInfo.getTenantId(), tenantInfo.getTenantName(), DEFAULT_QUOTA, - configCount, NamespaceTypeEnum.CUSTOM.getType()); + Namespace namespaceTmp = new Namespace(tenantInfo.getTenantId(), tenantInfo.getTenantName(), + tenantInfo.getTenantDesc(), DEFAULT_QUOTA, configCount, NamespaceTypeEnum.CUSTOM.getType()); namespaces.add(namespaceTmp); } return RestResultUtils.success(namespaces); diff --git a/console/src/main/java/com/alibaba/nacos/console/model/Namespace.java b/console/src/main/java/com/alibaba/nacos/console/model/Namespace.java index d762d1f164c..0a13166f633 100644 --- a/console/src/main/java/com/alibaba/nacos/console/model/Namespace.java +++ b/console/src/main/java/com/alibaba/nacos/console/model/Namespace.java @@ -27,6 +27,8 @@ public class Namespace { private String namespaceShowName; + private String namespaceDesc; + private int quota; private int configCount; @@ -68,6 +70,24 @@ public Namespace(String namespace, String namespaceShowName, int quota, int conf this.type = type; } + public Namespace(String namespace, String namespaceShowName, String namespaceDesc, int quota, int configCount, + int type) { + this.namespace = namespace; + this.namespaceShowName = namespaceShowName; + this.quota = quota; + this.configCount = configCount; + this.type = type; + this.namespaceDesc = namespaceDesc; + } + + public String getNamespaceDesc() { + return namespaceDesc; + } + + public void setNamespaceDesc(String namespaceDesc) { + this.namespaceDesc = namespaceDesc; + } + public int getQuota() { return quota; } diff --git a/console/src/main/java/com/alibaba/nacos/console/model/NamespaceAllInfo.java b/console/src/main/java/com/alibaba/nacos/console/model/NamespaceAllInfo.java index 73732622397..92d9c8fd53d 100644 --- a/console/src/main/java/com/alibaba/nacos/console/model/NamespaceAllInfo.java +++ b/console/src/main/java/com/alibaba/nacos/console/model/NamespaceAllInfo.java @@ -23,23 +23,9 @@ */ public class NamespaceAllInfo extends Namespace { - private String namespaceDesc; - - public String getNamespaceDesc() { - return namespaceDesc; - } - - public void setNamespaceDesc(String namespaceDesc) { - this.namespaceDesc = namespaceDesc; - } - - public NamespaceAllInfo() { - } - public NamespaceAllInfo(String namespace, String namespaceShowName, int quota, int configCount, int type, String namespaceDesc) { - super(namespace, namespaceShowName, quota, configCount, type); - this.namespaceDesc = namespaceDesc; + super(namespace, namespaceShowName, namespaceDesc, quota, configCount, type); } } diff --git a/console/src/main/resources/META-INF/nacos-default.properties b/console/src/main/resources/META-INF/nacos-default.properties index 04aa6500e78..e65fa5a1ecd 100644 --- a/console/src/main/resources/META-INF/nacos-default.properties +++ b/console/src/main/resources/META-INF/nacos-default.properties @@ -73,6 +73,6 @@ management.metrics.export.influx.enabled=false server.tomcat.accesslog.enabled=true server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D # default current work dir -server.tomcat.basedir= +server.tomcat.basedir=file:. diff --git a/console/src/main/resources/application.properties b/console/src/main/resources/application.properties index 42b230caf2a..273d6dcd38e 100644 --- a/console/src/main/resources/application.properties +++ b/console/src/main/resources/application.properties @@ -17,6 +17,8 @@ #*************** Spring Boot Related Configurations ***************# ### Default web context path: server.servlet.contextPath=/nacos +### Include message field +server.error.include-message=ON_PARAM ### Default web server port: #*************** Network Related Configurations ***************# @@ -94,14 +96,14 @@ management.metrics.export.influx.enabled=false ### If turn on the access log: server.tomcat.accesslog.enabled=true -### accesslog automatic cleaning time +### accesslog automatic cleaning time server.tomcat.accesslog.max-days=30 ### The access log pattern: server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i ### The directory of access log: -server.tomcat.basedir= +server.tomcat.basedir=file:. #spring.datasource.platform=mysql #db.num=1 #db.url.0=jdbc:mysql://10.101.167.27:3306/acm?characterEncoding=utf8&connectTimeout=1000&socketTimeout=10000&autoReconnect=true diff --git a/console/src/main/resources/static/css/main.css b/console/src/main/resources/static/css/main.css index 11204490560..191b602e7af 100644 --- a/console/src/main/resources/static/css/main.css +++ b/console/src/main/resources/static/css/main.css @@ -300,7 +300,7 @@ * 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. - */.next-progress-circle[dir=rtl] .next-progress-circle-container{transform:scaleX(-1)}.next-progress-line[dir=rtl] .next-progress-line-overlay{left:auto;right:0}.next-progress-line,.next-progress-line *,.next-progress-line :after,.next-progress-line :before{box-sizing:border-box}.next-progress-line{width:100%;display:inline-block;position:relative}.next-progress-line-container{display:inline-block;width:100%;vertical-align:middle}.next-progress-line-underlay{position:relative;overflow:hidden;width:100%;background:#ebecf0}.next-progress-line-overlay{position:absolute;left:0;top:0;transition:all .3s ease}.next-progress-line-overlay-normal{background:#5584ff}.next-progress-line-overlay-success{background:#46bc15}.next-progress-line-overlay-error,.next-progress-line-overlay-started{background:#ff3000}.next-progress-line-overlay-middle{background:#ff9300}.next-progress-line-overlay-finishing{background:#46bc15}.next-progress-line.next-small .next-progress-line-underlay{border-radius:20px;height:4px}.next-progress-line.next-small .next-progress-line-overlay{height:4px;border-radius:20px;top:50%;margin-top:-2px}.next-progress-line.next-small .next-progress-line-text{font-size:12px;line-height:4px}.next-progress-line.next-medium .next-progress-line-underlay{border-radius:20px;height:8px}.next-progress-line.next-medium .next-progress-line-overlay{height:8px;border-radius:20px;top:50%;margin-top:-4px}.next-progress-line.next-medium .next-progress-line-text{font-size:12px;line-height:8px}.next-progress-line.next-large .next-progress-line-underlay{border-radius:20px;height:12px}.next-progress-line.next-large .next-progress-line-overlay{height:12px;border-radius:20px;top:50%;margin-top:-6px}.next-progress-line.next-large .next-progress-line-text{font-size:12px;line-height:12px}.next-progress-line-show-info .next-progress-line-container{padding-right:60px;margin-right:-60px}.next-progress-line-show-info .next-progress-line-text{width:50px;text-align:left;margin-left:10px;vertical-align:middle;display:inline-block;color:#333}.next-progress-line-show-border .next-progress-line-underlay{border:1px solid #dcdee3}.next-progress-line-show-border.next-small .next-progress-line-underlay{border-radius:20px;height:6px}.next-progress-line-show-border.next-small .next-progress-line-overlay{height:4px;border-radius:20px;top:50%;margin-top:-2px}.next-progress-line-show-border.next-small .next-progress-line-text{font-size:12px;line-height:6px}.next-progress-line-show-border.next-medium .next-progress-line-underlay{border-radius:20px;height:10px}.next-progress-line-show-border.next-medium .next-progress-line-overlay{height:8px;border-radius:20px;top:50%;margin-top:-4px}.next-progress-line-show-border.next-medium .next-progress-line-text{font-size:12px;line-height:10px}.next-progress-line-show-border.next-large .next-progress-line-underlay{border-radius:20px;height:14px}.next-progress-line-show-border.next-large .next-progress-line-overlay{height:12px;border-radius:20px;top:50%;margin-top:-6px}.next-progress-line-show-border.next-large .next-progress-line-text{font-size:12px;line-height:14px}.next-progress-circle,.next-progress-circle *,.next-progress-circle :after,.next-progress-circle :before{box-sizing:border-box}.next-progress-circle{position:relative;display:inline-block}.next-progress-circle-underlay{stroke-width:8px;stroke:#ebecf0}.next-progress-circle-overlay{transition:all .3s ease;stroke-linecap:round;stroke-width:8px}.next-progress-circle-overlay-normal{stroke:#5584ff}.next-progress-circle-overlay-success{stroke:#46bc15}.next-progress-circle-overlay-error,.next-progress-circle-overlay-started{stroke:#ff3000}.next-progress-circle-overlay-middle{stroke:#ff9300}.next-progress-circle-overlay-finishing{stroke:#46bc15}.next-progress-circle.next-small{width:100px;height:100px;font-size:20px}.next-progress-circle.next-medium{width:116px;height:116px;font-size:24px}.next-progress-circle.next-large{width:132px;height:132px;font-size:36px}.next-progress-circle-text{display:block;position:absolute;width:100%;top:50%;left:0;text-align:center;line-height:1;-webkit-transform:translateY(-50%);transform:translateY(-50%);transition:transform .3s ease;color:#333}.next-upload-list[dir=rtl].next-upload-list-text .next-upload-list-item{padding:4px 8px 4px 36px}.next-upload-list[dir=rtl].next-upload-list-text .next-icon{left:12px;right:auto}.next-upload-list[dir=rtl].next-upload-list-image .next-icon-close{float:left;margin-left:4px;margin-right:0}.next-upload-list[dir=rtl].next-upload-list-image .next-upload-list-item-thumbnail{float:right;margin-left:8px;margin-right:0}.next-upload-list[dir=rtl].next-upload-list-image .next-upload-list-item-progress{margin-right:56px;margin-left:20px}.next-upload,.next-upload *,.next-upload :after,.next-upload :before{box-sizing:border-box}.next-upload-inner{outline:0;display:inline-block}.next-upload-inner.next-hidden{display:none}.next-upload-list{overflow:hidden}.next-upload-list,.next-upload-list *,.next-upload-list :after,.next-upload-list :before{box-sizing:border-box}.next-upload-list-item{position:relative}.next-upload-list-item.next-hidden{display:none}.next-upload-list-item-name{text-decoration:none}.next-upload.next-disabled{border-color:#e6e7eb!important;color:#ccc!important}.next-upload.next-disabled .next-icon-close{cursor:not-allowed!important}.next-upload.next-disabled .next-upload-inner *{color:#ccc!important;border-color:#e6e7eb!important;cursor:not-allowed!important}.next-upload-list-text .next-upload-list-item{background-color:#f2f3f7;padding:4px 36px 4px 8px;height:40px;line-height:32px;font-size:12px;overflow:hidden;transition:all .1s linear;border-radius:0}.next-upload-list-text .next-upload-list-item:not(:last-child){margin-bottom:4px}.next-upload-list-text .next-upload-list-item-op{position:absolute;top:0;right:12px}.next-upload-list-text .next-upload-list-item .next-icon-close{color:#999;cursor:pointer;text-align:center;transition:all .1s linear;line-height:40px}.next-upload-list-text .next-upload-list-item .next-icon-close .next-icon-remote,.next-upload-list-text .next-upload-list-item .next-icon-close:before{width:12px;font-size:12px;line-height:inherit}.next-upload-list-text .next-upload-list-item:hover{background-color:#f2f3f7}.next-upload-list-text .next-upload-list-item:hover .next-icon{color:#666}.next-upload-list-text .next-upload-list-item-name-wrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin-right:4px}.next-upload-list-text .next-upload-list-item-name{color:#333;transition:all .1s linear}.next-upload-list-text .next-upload-list-item-size{color:#999;margin-left:8px}.next-upload-list-text .next-upload-list-item-uploading{line-height:16px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress{line-height:0;padding-top:4px;padding-bottom:4px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-underlay{height:8px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-overlay{height:8px;margin-top:-4px}.next-upload-list-text .next-upload-list-item-done{line-height:32px}.next-upload-list-text .next-upload-list-item-done:hover .next-upload-list-item-name,.next-upload-list-text .next-upload-list-item-done:hover .next-upload-list-item-size{color:#5584ff}.next-upload-list-text .next-upload-list-item-error{background-color:#ffece4!important}.next-upload-list-text .next-upload-list-item-error.next-upload-list-item-error-with-msg{line-height:16px}.next-upload-list-text .next-upload-list-item-error-msg{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:#ff3000}.next-upload-list-image .next-upload-list-item{box-sizing:content-box;border:1px solid #dcdee3;background-color:#fff;padding:8px;height:48px;line-height:48px;font-size:12px;transition:all .1s linear;overflow:hidden;border-radius:0}.next-upload-list-image .next-upload-list-item:not(:last-child){margin-bottom:4px}.next-upload-list-image .next-upload-list-item:after{visibility:hidden;display:block;height:0;font-size:0;content:"\0020";clear:both}.next-upload-list-image .next-upload-list-item-op{float:right;margin-right:4px}.next-upload-list-image .next-upload-list-item .next-icon-close{cursor:pointer;color:#999;text-align:center}.next-upload-list-image .next-upload-list-item .next-icon-close .next-icon-remote,.next-upload-list-image .next-upload-list-item .next-icon-close:before{width:12px;font-size:12px;line-height:inherit}.next-upload-list-image .next-upload-list-item:hover{border-color:#5584ff}.next-upload-list-image .next-upload-list-item:hover .next-icon-close{color:#666}.next-upload-list-image .next-upload-list-item-name{display:block;color:#333;margin-left:56px;margin-right:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;transition:all .1s linear}.next-upload-list-image .next-upload-list-item-size{color:#999;margin-left:8px}.next-upload-list-image .next-upload-list-item-done:hover .next-upload-list-item-name,.next-upload-list-image .next-upload-list-item-done:hover .next-upload-list-item-size{color:#5584ff}.next-upload-list-image .next-upload-list-item-thumbnail{float:left;width:48px;height:48px;color:#ccc;border:1px solid #dcdee3;border-radius:0;background-color:#f2f3f7;margin-right:8px;vertical-align:middle;text-align:center;overflow:hidden;box-sizing:border-box}.next-upload-list-image .next-upload-list-item-thumbnail img{width:100%;height:100%}.next-upload-list-image .next-upload-list-item-thumbnail .next-icon{display:block;margin:0;line-height:48px}.next-upload-list-image .next-upload-list-item-thumbnail .next-icon .next-icon-remote,.next-upload-list-image .next-upload-list-item-thumbnail .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-upload-list-image .next-upload-list-item-error{border-color:#ff3000!important;background-color:#fff}.next-upload-list-image .next-upload-list-item-uploading{background-color:#fff}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-name{height:24px;line-height:24px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress{margin-left:56px;margin-right:20px;line-height:0;padding-top:8px;padding-bottom:8px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-underlay{height:8px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-overlay{height:8px;margin-top:-4px}.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-error-msg,.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-name{height:24px;line-height:24px}.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-error-msg{margin-left:56px;margin-right:20px;color:#ff3000;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.next-upload-list-card{display:inline-block}.next-upload-list-card .next-upload-list-item{vertical-align:middle;float:left}.next-upload-list-card .next-upload-list-item:not(:last-child){margin-right:12px}.next-upload-list-card .next-upload-list-item-wrapper{position:relative;border:1px solid #c4c6cf;width:100px;height:100px;padding:0;background-color:transparent}.next-upload-list-card .next-upload-list-item-thumbnail{text-align:center;width:100%;height:100%;color:#ccc;font-size:12px}.next-upload-list-card .next-upload-list-item-thumbnail img{max-width:100%;max-height:100%;position:absolute;top:0;right:0;bottom:0;left:0;margin:auto}.next-upload-list-card .next-upload-list-item-thumbnail img:focus{outline:0}.next-upload-list-card .next-upload-list-item-thumbnail .next-icon{width:100%}.next-upload-list-card .next-upload-list-item-thumbnail .next-icon .next-icon-remote,.next-upload-list-card .next-upload-list-item-thumbnail .next-icon:before{width:48px;font-size:48px;line-height:inherit}.next-upload-list-card .next-upload-list-item-handler{margin-top:13px}.next-upload-list-card .next-upload-list-item-handler .next-icon-cry{margin-top:10px}.next-upload-list-card .next-upload-list-item-name{display:block;width:100px;text-align:center;margin-top:4px;font-size:12px;color:#666;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.next-upload-list-card .next-upload-list-item-progress{position:absolute;font-size:0;bottom:0;left:0;width:100%}.next-upload-list-card .next-upload-list-item-progress .next-progress-line-underlay{border-radius:0;height:8px}.next-upload-list-card .next-upload-list-item-progress .next-progress-line-overlay{border-radius:0;height:8px;margin-top:-4px}.next-upload-list-card .next-upload-list-item-uploading .next-upload-list-item-wrapper{background-color:#f7f8fa}.next-upload-list-card .next-upload-list-item:hover .next-upload-tool{opacity:.8}.next-upload-list-card .next-upload-list-item .next-upload-tool{position:absolute;z-index:1;background-color:rgba(0,0,0,.7);transition:all .1s linear;opacity:0;width:100%;height:28px;left:0;bottom:0;display:flex}.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon{line-height:28px;color:#fff;cursor:pointer}.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon .next-icon-remote,.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-upload-list-card .next-upload-list-item .next-upload-tool-item{width:100%;text-align:center}.next-upload-list-card .next-upload-list-item .next-upload-tool-item:not(:last-child){border-right:1px solid #fff}.next-upload-list-card .next-upload-list-item .next-upload-tool-reupload{display:inline-block}.next-upload-list-card .next-upload-list-item-error .next-upload-list-item-wrapper{border-color:#ff3000}.next-upload-list-card.next-upload-ie9 .next-upload-tool{display:table}.next-upload-list-card.next-upload-ie9 .next-upload-tool-item{display:table-cell;width:1%}.next-upload-card{border:1px dashed #c4c6cf;width:100px;height:100px;background-color:#fff;text-align:center;cursor:pointer;transition:border-color .1s linear;display:table-cell;vertical-align:middle}.next-upload-card .next-icon{color:#c4c6cf}.next-upload-card .next-icon .next-icon-remote,.next-upload-card .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-upload-card .next-upload-add-icon:before{content:""}.next-upload-card .next-upload-text{font-size:12px;margin-top:12px;color:#666;outline:none}.next-upload-card:hover{border-color:#5584ff}.next-upload-card:hover .next-icon,.next-upload-card:hover .next-upload-text{color:#5584ff}.next-upload-dragable .next-upload-inner{display:block}.next-upload-dragable .next-upload-drag{border:1px dashed #c4c6cf;transition:border-color .1s linear;cursor:pointer;border-radius:3px;background-color:transparent;text-align:center;margin-bottom:4px}.next-upload-dragable .next-upload-drag-icon{margin:20px 0 0;color:#666}.next-upload-dragable .next-upload-drag-icon .next-upload-drag-upload-icon:before{content:"";font-size:24px}.next-upload-dragable .next-upload-drag-text{margin:12px 0 0;font-size:14px;color:#666}.next-upload-dragable .next-upload-drag-hint{margin:4px 0 20px;font-size:12px;color:#999}.next-upload-dragable .next-upload-drag-over{border-color:#5584ff}.next-collapse[dir=rtl] .next-collapse-panel-title{padding:8px 28px 8px 0}.next-collapse[dir=rtl] .next-collapse-panel-icon{left:inherit;right:12px;transform:rotate(180deg);margin-left:0;margin-right:0}.next-collapse[dir=rtl] .next-collapse-panel-icon .next-icon-remote,.next-collapse[dir=rtl] .next-collapse-panel-icon:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse[dir=rtl] .next-collapse-panel-icon{transform:scale(.5) rotate(180deg);margin-left:-4px;margin-right:-4px}.next-collapse[dir=rtl] .next-collapse-panel-icon:before{width:16px;font-size:16px}}.next-collapse{border:1px solid #dcdee3;border-radius:3px}.next-collapse,.next-collapse *,.next-collapse :after,.next-collapse :before{box-sizing:border-box}.next-collapse:focus,.next-collapse :focus{outline:0}.next-collapse-panel:not(:first-child){border-top:1px solid #dcdee3}.next-collapse .next-collapse-panel-icon{position:absolute;color:#333;transition:transform .1s linear;left:12px;margin-top:-2px;margin-left:0;margin-right:0}.next-collapse .next-collapse-panel-icon .next-icon-remote,.next-collapse .next-collapse-panel-icon:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse .next-collapse-panel-icon{transform:scale(.5);margin-left:-4px;margin-right:-4px}.next-collapse .next-collapse-panel-icon:before{width:16px;font-size:16px}}.next-collapse-panel-title{position:relative;line-height:1.5;background:#f2f3f7;font-size:14px;font-weight:400;color:#333;cursor:pointer;padding:8px 0 8px 28px;transition:background .1s linear}.next-collapse-panel-title:hover{background:#ebecf0;color:#333;font-weight:400}.next-collapse-panel-title:hover .next-collapse-panel-icon{color:#333}.next-collapse-panel-content{height:0;line-height:1.5;padding:0 16px;background:#fff;font-size:12px;color:#666;transition:all .3s ease;opacity:0}.next-collapse-panel-expanded>.next-collapse-panel-content{display:block;padding:12px 16px;height:auto;opacity:1}.next-collapse .next-collapse-unfold-icon:before{content:""}.next-collapse-panel-hidden>.next-collapse-panel-content{overflow:hidden}.next-collapse .next-collapse-panel-icon:before{content:""}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded{transform:rotate(90deg);margin-left:0;margin-right:0}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded .next-icon-remote,.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded{transform:scale(.5) rotate(90deg);margin-left:-4px;margin-right:-4px}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded:before{width:16px;font-size:16px}}.next-collapse-disabled,.next-collapse-panel-disabled:not(:first-child){border-color:#e6e7eb}.next-collapse-panel-disabled>.next-collapse-panel-title{cursor:not-allowed;color:#ccc;background:#f2f3f7}.next-collapse-panel-disabled .next-collapse-panel-icon{color:#ccc}.next-collapse-panel-disabled .next-collapse-panel-title:hover{font-weight:400}.next-collapse-panel-disabled .next-collapse-panel-title:hover .next-collapse-panel-icon{color:#ccc}.next-collapse-panel-disabled:hover{color:#ccc;background:#f2f3f7}.next-menu-btn{display:inline-block;box-shadow:none}.next-menu-btn-spacing-tb{padding:0}.next-menu-btn .next-icon{transition:transform .1s linear}.next-menu-btn .next-menu-btn-arrow:before{content:""}.next-menu-btn.next-expand .next-menu-btn-arrow{transform:rotate(180deg)}.next-menu-btn-symbol-unfold:before{content:""}.next-menu-btn.next-btn-normal .next-menu-btn-arrow{color:#999}.next-menu-btn.next-btn-normal:hover .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-secondary .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-secondary:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.next-btn-secondary.next-btn-text:hover .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-primary .next-menu-btn-arrow,.next-menu-btn.next-btn-primary:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.next-btn-text.next-btn-normal .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-text.next-btn-normal:hover .next-menu-btn-arrow,.next-menu-btn.next-btn-text.next-btn-primary .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-text.next-btn-primary:hover .next-menu-btn-arrow{color:#3e71f7}.next-menu-btn.next-btn-ghost.next-btn-light .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-ghost.next-btn-light:hover .next-menu-btn-arrow{color:#999}.next-menu-btn.next-btn-ghost.next-btn-dark .next-menu-btn-arrow,.next-menu-btn.next-btn-ghost.next-btn-dark:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.disabled .next-menu-btn-arrow,.next-menu-btn.next-btn-text.disabled .next-menu-btn-arrow,.next-menu-btn.next-btn-text[disabled] .next-menu-btn-arrow,.next-menu-btn[disabled] .next-menu-btn-arrow{color:#ccc}.next-menu-btn[disabled].next-btn-ghost.next-btn-dark .next-menu-btn-arrow{color:hsla(0,0%,100%,.4)}.next-menu-btn[disabled].next-btn-ghost.next-btn-light .next-menu-btn-arrow{color:rgba(0,0,0,.1)}.next-search-simple[dir=rtl].next-large .next-search-icon{margin-left:12px;margin-right:0}.next-search-simple[dir=rtl].next-medium .next-search-icon{margin-left:8px;margin-right:0}.next-search-simple[dir=rtl].next-normal .next-search-left .next-search-left-addon{border-left:1px solid #c4c6cf;border-right:none}.next-search-simple[dir=rtl].next-dark .next-search-left{border-color:#c4c6cf}.next-search-simple[dir=rtl].next-dark .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple[dir=rtl].next-dark:hover .next-search-left{border-color:#c4c6cf}.next-search-simple[dir=rtl].next-dark .next-search-icon{color:#999}.next-search-simple[dir=rtl].next-dark .next-search-icon:hover{color:#666}.next-search-normal[dir=rtl] .next-search-left{border-left:none;border-top-right-radius:3px;border-bottom-right-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0}.next-search-normal[dir=rtl] .next-search-btn.next-btn{border-radius:3px 0 0 3px!important}.next-search-normal[dir=rtl] .next-input{border-radius:0 3px 3px 0}.next-search-normal[dir=rtl].next-primary .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-primary .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-secondary .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-secondary .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-normal .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-normal .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-dark .next-search-left .next-search-left-addon{border-left:1px solid #5584ff;border-right:none}.next-search{width:100%;display:inline-block}.next-search,.next-search *,.next-search :after,.next-search :before{box-sizing:border-box}.next-search .next-input,.next-search .next-select{border:none;box-shadow:none}.next-search .next-select .next-input,.next-search .next-select .next-input .next-input-text-field{height:auto}.next-search .next-search-left{border-style:solid;transition:all .1s linear}.next-search .next-search-left-addon .next-input,.next-search .next-search-left-addon .next-select-trigger-search{min-height:100%;border-bottom-right-radius:0;border-top-right-radius:0}.next-search .next-search-left-addon .next-select-values{line-height:1}.next-search .next-search-left-addon.next-input-group-addon .next-select{margin:0}.next-search .next-search-left-addon+.next-search-input .next-input{border-bottom-left-radius:0;border-top-left-radius:0}.next-search .next-search-input{width:100%}.next-search .next-search-btn{box-shadow:none}.next-search .next-search-symbol-icon:before{content:""}.next-search-normal{width:600px}.next-search-normal .next-search-left{border-top-left-radius:3px;border-bottom-left-radius:3px}.next-search-normal .next-input{border-radius:3px 0 0 3px}.next-search-normal .next-btn{border-radius:0 3px 3px 0}.next-search-normal.next-primary .next-search-left{border-color:#5584ff}.next-search-normal.next-primary .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-primary:hover .next-btn,.next-search-normal.next-primary:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-primary .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-primary .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-primary .next-search-btn .next-icon,.next-search-normal.next-primary .next-search-btn .next-icon:hover{color:#fff}.next-search-normal.next-primary.next-large{box-shadow:none}.next-search-normal.next-primary.next-large .next-search-btn,.next-search-normal.next-primary.next-large .next-search-left{border-width:2px;height:60px}.next-search-normal.next-primary.next-large .next-search-input{height:56px;overflow-y:hidden}.next-search-normal.next-primary.next-large .next-search-input input{height:56px;line-height:56px \0}.next-search-normal.next-primary.next-large .next-select{height:56px}.next-search-normal.next-primary.next-large .next-search-btn{font-size:16px}.next-search-normal.next-primary.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-primary.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-primary.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-primary.next-medium{box-shadow:none}.next-search-normal.next-primary.next-medium .next-search-btn,.next-search-normal.next-primary.next-medium .next-search-left{border-width:2px;height:40px}.next-search-normal.next-primary.next-medium .next-search-input{height:36px;overflow-y:hidden}.next-search-normal.next-primary.next-medium .next-search-input input{height:36px;line-height:36px \0}.next-search-normal.next-primary.next-medium .next-select{height:36px}.next-search-normal.next-primary.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-primary.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-primary.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-primary.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-primary .next-input{border-top-left-radius:1px;border-bottom-left-radius:1px}.next-search-normal.next-secondary .next-search-left{border-color:#c4c6cf}.next-search-normal.next-secondary .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-secondary:hover .next-btn,.next-search-normal.next-secondary:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-secondary .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-secondary .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-secondary .next-search-btn .next-icon,.next-search-normal.next-secondary .next-search-btn .next-icon:hover{color:#fff}.next-search-normal.next-secondary.next-large{box-shadow:none}.next-search-normal.next-secondary.next-large .next-search-btn,.next-search-normal.next-secondary.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-secondary.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-secondary.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-secondary.next-large .next-select{height:58px}.next-search-normal.next-secondary.next-large .next-search-btn{font-size:16px}.next-search-normal.next-secondary.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-secondary.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-secondary.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-secondary.next-medium{box-shadow:none}.next-search-normal.next-secondary.next-medium .next-search-btn,.next-search-normal.next-secondary.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-secondary.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-secondary.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-secondary.next-medium .next-select{height:38px}.next-search-normal.next-secondary.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-secondary.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-secondary.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-secondary.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-secondary .next-input{border-top-left-radius:2px;border-bottom-left-radius:2px}.next-search-normal.next-normal .next-search-left{border-color:#c4c6cf}.next-search-normal.next-normal .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-normal:hover .next-btn,.next-search-normal.next-normal:hover .next-search-left{border-color:#a0a2ad}.next-search-normal.next-normal .next-search-btn{background:#f7f8fa;border-color:#c4c6cf;color:#666}.next-search-normal.next-normal .next-search-btn:hover{background:#ebecf0;border-color:#a0a2ad;color:#333}.next-search-normal.next-normal .next-search-btn .next-icon{color:#666}.next-search-normal.next-normal .next-search-btn .next-icon:hover{color:#333}.next-search-normal.next-normal.next-large{box-shadow:none}.next-search-normal.next-normal.next-large .next-search-btn,.next-search-normal.next-normal.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-normal.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-normal.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-normal.next-large .next-select{height:58px}.next-search-normal.next-normal.next-large .next-search-btn{font-size:16px}.next-search-normal.next-normal.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-normal.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-normal.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-normal.next-medium{box-shadow:none}.next-search-normal.next-normal.next-medium .next-search-btn,.next-search-normal.next-normal.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-normal.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-normal.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-normal.next-medium .next-select{height:38px}.next-search-normal.next-normal.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-normal.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-normal.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-normal.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-normal .next-input{border-top-left-radius:2px;border-bottom-left-radius:2px}.next-search-normal.next-dark .next-search-left{border-color:#5584ff}.next-search-normal.next-dark .next-search-left .next-search-left-addon{border-right:1px solid #5584ff}.next-search-normal.next-dark:hover .next-btn,.next-search-normal.next-dark:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-dark .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-dark .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-dark .next-search-btn .next-icon,.next-search-normal.next-dark .next-search-btn .next-icon:hover,.next-search-normal.next-dark .next-select-inner,.next-search-normal.next-dark input{color:#fff}.next-search-normal.next-dark .next-input,.next-search-normal.next-dark .next-select{background:hsla(0,0%,100%,0)}.next-search-normal.next-dark.next-large{box-shadow:none}.next-search-normal.next-dark.next-large .next-search-btn,.next-search-normal.next-dark.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-dark.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-dark.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-dark.next-large .next-select{height:58px}.next-search-normal.next-dark.next-large .next-search-btn{font-size:16px}.next-search-normal.next-dark.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-dark.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-dark.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-dark.next-medium{box-shadow:none}.next-search-normal.next-dark.next-medium .next-search-btn,.next-search-normal.next-dark.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-dark.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-dark.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-dark.next-medium .next-select{height:38px}.next-search-normal.next-dark.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-dark.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-dark.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-dark.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal:not([dir=rtl]) .next-search-left{border-right:none}.next-search-simple{width:300px;box-shadow:none;border-radius:3px}.next-search-simple .next-search-icon{cursor:pointer;transition:all .1s linear}.next-search-simple .next-input,.next-search-simple .next-search-left{border-radius:3px}.next-search-simple.next-large .next-search-icon{margin-right:12px}.next-search-simple.next-medium .next-search-icon{margin-right:8px}.next-search-simple.next-normal .next-search-left{border-color:#c4c6cf}.next-search-simple.next-normal .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple.next-normal:hover .next-search-left{border-color:#a0a2ad}.next-search-simple.next-normal .next-search-icon{color:#999}.next-search-simple.next-normal .next-search-icon:hover{color:#666}.next-search-simple.next-normal .next-search-left{border-width:1px}.next-search-simple.next-normal.next-large .next-search-icon .next-icon-remote,.next-search-simple.next-normal.next-large .next-search-icon:before{width:20px;font-size:20px;line-height:inherit}.next-search-simple.next-normal.next-medium .next-search-icon .next-icon-remote,.next-search-simple.next-normal.next-medium .next-search-icon:before{width:12px;font-size:12px;line-height:inherit}.next-search-simple.next-dark .next-search-left{border-color:#c4c6cf}.next-search-simple.next-dark .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple.next-dark:hover .next-search-left{border-color:#c4c6cf}.next-search-simple.next-dark .next-search-icon{color:#999}.next-search-simple.next-dark .next-search-icon:hover{color:#666}.next-search-simple.next-dark .next-select-inner,.next-search-simple.next-dark input{color:#fff}.next-search-simple.next-dark .next-input,.next-search-simple.next-dark .next-select{background:hsla(0,0%,100%,0)}.next-search-simple.next-dark .next-search-left{border-width:1px}.next-search-simple.next-dark.next-large .next-search-icon .next-icon-remote,.next-search-simple.next-dark.next-large .next-search-icon:before{width:20px;font-size:20px;line-height:inherit}.next-search-simple.next-dark.next-medium .next-search-icon .next-icon-remote,.next-search-simple.next-dark.next-medium .next-search-icon:before{width:12px;font-size:12px;line-height:inherit}.next-search-simple .next-select.next-large{height:38px}.next-search-simple .next-select.next-medium{height:26px}.next-transfer{display:inline-block}.next-transfer,.next-transfer *,.next-transfer :after,.next-transfer :before{box-sizing:border-box}.next-transfer-panel{display:inline-block;border:1px solid #dcdee3;border-radius:3px;background-color:#fff;vertical-align:middle}.next-transfer-panel-header{padding:8px 20px;border-bottom:1px solid #dcdee3;background-color:#f7f8fa;color:#333;font-size:12px}.next-transfer-panel-search{padding:0 4px;margin-top:8px;margin-bottom:0;width:180px}.next-transfer .next-transfer-panel-list{width:180px;height:160px;padding:0;border:none;box-shadow:none;border-radius:0;overflow-y:auto}.next-transfer-panel-not-found-container{display:table;width:100%;height:100%}.next-transfer-panel-not-found{display:table-cell;vertical-align:middle;text-align:center;color:#999;font-size:14px}.next-transfer-panel-item.next-focused{transition:background-color .1s linear}.next-transfer-panel-item:not(.next-disabled).next-simple:hover{color:#5584ff}.next-transfer-panel-item.next-insert-before:before{position:absolute;top:0;left:0;content:"";width:100%;border-top:1px solid #5584ff}.next-transfer-panel-item.next-insert-after:after{position:absolute;left:0;bottom:0;content:"";width:100%;border-bottom:1px solid #5584ff}.next-transfer-panel-footer{position:relative;padding:8px 20px;border-top:1px solid #dcdee3;background-color:#fff;font-size:0;box-shadow:none}.next-transfer-panel-count{margin-left:4px;font-size:12px;vertical-align:middle;color:#333}.next-transfer-panel-move-all{font-size:12px;color:#5584ff;cursor:pointer}.next-transfer-panel-move-all.next-disabled{color:#ccc;cursor:not-allowed}.next-transfer-operations{display:inline-block;vertical-align:middle;margin:0 20px}.next-transfer-move.next-icon{color:#c4c6cf}.next-transfer-move.next-icon:before{content:""}.next-transfer-operation.next-btn{display:block}.next-transfer-operation.next-btn+.next-transfer-operation.next-btn{margin-top:8px}.next-transfer-operation.next-btn .next-icon .next-icon-remote,.next-transfer-operation.next-btn .next-icon:before{width:12px;font-size:12px;line-height:inherit} + */.next-switch:after[dir=rtl]{content:" ";transition:all .1s linear;transform-origin:right center}.next-switch-medium[dir=rtl]:after,.next-switch-small[dir=rtl]:after{right:100%;transform:translateX(100%)}.next-switch-on[dir=rtl]>.next-switch-children{color:#fff}.next-switch-on[disabled][dir=rtl]:after{left:0;right:100%;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12)}.next-switch-off[dir=rtl]:after{right:0;transform:translateX(0);box-shadow:-1px 0 3px 0 rgba(0,0,0,.12)}.next-switch-off.next-switch-small[dir=rtl]>.next-switch-children,.next-switch-off[dir=rtl]>.next-switch-children{right:auto}.next-switch{outline:none;text-align:left;cursor:pointer;vertical-align:middle;user-select:none;overflow:hidden;transition:background .1s cubic-bezier(.4,0,.2,1),border-color .1s cubic-bezier(.4,0,.2,1)}.next-switch,.next-switch *,.next-switch :after,.next-switch :before{box-sizing:border-box}.next-switch-btn{transition:all .15s cubic-bezier(.4,0,.2,1);transform-origin:left center}.next-switch:after{content:""}.next-switch-loading{pointer-events:none}.next-switch-loading .next-icon-loading{color:#5584ff;text-align:center;transform:translate(-1px,-1px)}.next-switch-loading .next-icon-loading.next-switch-inner-icon:before{vertical-align:top}.next-switch-medium{border:2px solid transparent;width:56px;height:28px;border-radius:20px}.next-switch-medium:not([disabled]):active .next-switch-btn{width:31.2px}.next-switch-medium.next-switch-on:not([disabled]):active .next-switch-btn{left:calc(100% - 31.2px)}.next-switch-medium.next-switch-auto-width{min-width:56px;width:auto;overflow:initial}.next-switch-medium:after{content:""}.next-switch-medium>.next-switch-btn{border:1px solid transparent;position:absolute;left:calc(100% - 24px);width:24px;height:24px;border-radius:20px;box-sizing:border-box}.next-switch-medium>.next-switch-children{height:24px;line-height:24px;font-size:12px}.next-switch-medium.next-switch.next-switch-on>.next-switch-children{margin:0 32px 0 8px}.next-switch-medium.next-switch.next-switch-off>.next-switch-children{margin:0 8px 0 32px}.next-switch-medium.next-switch-loading .next-icon-loading{line-height:24px;height:24px;width:24px}.next-switch-medium.next-switch-loading .next-icon-loading .next-icon-remote,.next-switch-medium.next-switch-loading .next-icon-loading:before{width:16px;font-size:16px;line-height:inherit}.next-switch-small{position:relative;display:inline-block;border:2px solid transparent;width:44px;height:24px;border-radius:20px}.next-switch-small:not([disabled]):active .next-switch-btn{width:26px}.next-switch-small.next-switch-on:not([disabled]):active .next-switch-btn{left:calc(100% - 26px)}.next-switch-small.next-switch-auto-width{min-width:44px;width:auto;overflow:initial}.next-switch-small:after{content:""}.next-switch-small>.next-switch-btn{border:1px solid transparent;position:absolute;left:calc(100% - 20px);width:20px;height:20px;border-radius:20px;box-sizing:border-box}.next-switch-small>.next-switch-children{height:20px;line-height:20px;font-size:12px}.next-switch-small.next-switch.next-switch-on>.next-switch-children{margin:0 28px 0 8px}.next-switch-small.next-switch.next-switch-off>.next-switch-children{margin:0 8px 0 28px}.next-switch-small.next-switch-loading .next-icon-loading{line-height:20px;height:20px;width:20px}.next-switch-small.next-switch-loading .next-icon-loading .next-icon-remote,.next-switch-small.next-switch-loading .next-icon-loading:before{width:12px;font-size:12px;line-height:inherit}.next-switch-on{background-color:#5584ff}.next-switch-on .next-switch-btn{box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#fff;border-color:transparent}.next-switch-on.hover,.next-switch-on:focus,.next-switch-on:hover{background-color:#3e71f7}.next-switch-on.hover .next-switch-btn,.next-switch-on:focus .next-switch-btn,.next-switch-on:hover .next-switch-btn{background-color:#fff}.next-switch-on[disabled]{background-color:#ebecf0;cursor:not-allowed}.next-switch-on[disabled] .next-switch-btn{right:0;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#f7f8fa;border-color:transparent}.next-switch-on[disabled]>.next-switch-children{color:#ccc}.next-switch-off,.next-switch-off.hover,.next-switch-off:focus,.next-switch-off:hover{background-color:#ebecf0;border-color:#ebecf0}.next-switch-off .next-switch-btn{left:0;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#fff;border-color:transparent}.next-switch-off.hover .next-switch-btn,.next-switch-off:focus .next-switch-btn,.next-switch-off:hover .next-switch-btn{background-color:#fff}.next-switch-off>.next-switch-children{color:#999}.next-switch-off[disabled]{background-color:#ebecf0;cursor:not-allowed}.next-switch-off[disabled] .next-switch-btn{box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#f7f8fa;border-color:transparent}.next-switch-off[disabled]>.next-switch-children{color:#c4c6cf}.next-progress-circle[dir=rtl] .next-progress-circle-container{transform:scaleX(-1)}.next-progress-line[dir=rtl] .next-progress-line-overlay{left:auto;right:0}.next-progress-line,.next-progress-line *,.next-progress-line :after,.next-progress-line :before{box-sizing:border-box}.next-progress-line{width:100%;display:inline-block;position:relative}.next-progress-line-container{display:inline-block;width:100%;vertical-align:middle}.next-progress-line-underlay{position:relative;overflow:hidden;width:100%;background:#ebecf0}.next-progress-line-overlay{position:absolute;left:0;top:0;transition:all .3s ease}.next-progress-line-overlay-normal{background:#5584ff}.next-progress-line-overlay-success{background:#46bc15}.next-progress-line-overlay-error,.next-progress-line-overlay-started{background:#ff3000}.next-progress-line-overlay-middle{background:#ff9300}.next-progress-line-overlay-finishing{background:#46bc15}.next-progress-line.next-small .next-progress-line-underlay{border-radius:20px;height:4px}.next-progress-line.next-small .next-progress-line-overlay{height:4px;border-radius:20px;top:50%;margin-top:-2px}.next-progress-line.next-small .next-progress-line-text{font-size:12px;line-height:4px}.next-progress-line.next-medium .next-progress-line-underlay{border-radius:20px;height:8px}.next-progress-line.next-medium .next-progress-line-overlay{height:8px;border-radius:20px;top:50%;margin-top:-4px}.next-progress-line.next-medium .next-progress-line-text{font-size:12px;line-height:8px}.next-progress-line.next-large .next-progress-line-underlay{border-radius:20px;height:12px}.next-progress-line.next-large .next-progress-line-overlay{height:12px;border-radius:20px;top:50%;margin-top:-6px}.next-progress-line.next-large .next-progress-line-text{font-size:12px;line-height:12px}.next-progress-line-show-info .next-progress-line-container{padding-right:60px;margin-right:-60px}.next-progress-line-show-info .next-progress-line-text{width:50px;text-align:left;margin-left:10px;vertical-align:middle;display:inline-block;color:#333}.next-progress-line-show-border .next-progress-line-underlay{border:1px solid #dcdee3}.next-progress-line-show-border.next-small .next-progress-line-underlay{border-radius:20px;height:6px}.next-progress-line-show-border.next-small .next-progress-line-overlay{height:4px;border-radius:20px;top:50%;margin-top:-2px}.next-progress-line-show-border.next-small .next-progress-line-text{font-size:12px;line-height:6px}.next-progress-line-show-border.next-medium .next-progress-line-underlay{border-radius:20px;height:10px}.next-progress-line-show-border.next-medium .next-progress-line-overlay{height:8px;border-radius:20px;top:50%;margin-top:-4px}.next-progress-line-show-border.next-medium .next-progress-line-text{font-size:12px;line-height:10px}.next-progress-line-show-border.next-large .next-progress-line-underlay{border-radius:20px;height:14px}.next-progress-line-show-border.next-large .next-progress-line-overlay{height:12px;border-radius:20px;top:50%;margin-top:-6px}.next-progress-line-show-border.next-large .next-progress-line-text{font-size:12px;line-height:14px}.next-progress-circle,.next-progress-circle *,.next-progress-circle :after,.next-progress-circle :before{box-sizing:border-box}.next-progress-circle{position:relative;display:inline-block}.next-progress-circle-underlay{stroke-width:8px;stroke:#ebecf0}.next-progress-circle-overlay{transition:all .3s ease;stroke-linecap:round;stroke-width:8px}.next-progress-circle-overlay-normal{stroke:#5584ff}.next-progress-circle-overlay-success{stroke:#46bc15}.next-progress-circle-overlay-error,.next-progress-circle-overlay-started{stroke:#ff3000}.next-progress-circle-overlay-middle{stroke:#ff9300}.next-progress-circle-overlay-finishing{stroke:#46bc15}.next-progress-circle.next-small{width:100px;height:100px;font-size:20px}.next-progress-circle.next-medium{width:116px;height:116px;font-size:24px}.next-progress-circle.next-large{width:132px;height:132px;font-size:36px}.next-progress-circle-text{display:block;position:absolute;width:100%;top:50%;left:0;text-align:center;line-height:1;-webkit-transform:translateY(-50%);transform:translateY(-50%);transition:transform .3s ease;color:#333}.next-upload-list[dir=rtl].next-upload-list-text .next-upload-list-item{padding:4px 8px 4px 36px}.next-upload-list[dir=rtl].next-upload-list-text .next-icon{left:12px;right:auto}.next-upload-list[dir=rtl].next-upload-list-image .next-icon-close{float:left;margin-left:4px;margin-right:0}.next-upload-list[dir=rtl].next-upload-list-image .next-upload-list-item-thumbnail{float:right;margin-left:8px;margin-right:0}.next-upload-list[dir=rtl].next-upload-list-image .next-upload-list-item-progress{margin-right:56px;margin-left:20px}.next-upload,.next-upload *,.next-upload :after,.next-upload :before{box-sizing:border-box}.next-upload-inner{outline:0;display:inline-block}.next-upload-inner.next-hidden{display:none}.next-upload-list{overflow:hidden}.next-upload-list,.next-upload-list *,.next-upload-list :after,.next-upload-list :before{box-sizing:border-box}.next-upload-list-item{position:relative}.next-upload-list-item.next-hidden{display:none}.next-upload-list-item-name{text-decoration:none}.next-upload.next-disabled{border-color:#e6e7eb!important;color:#ccc!important}.next-upload.next-disabled .next-icon-close{cursor:not-allowed!important}.next-upload.next-disabled .next-upload-inner *{color:#ccc!important;border-color:#e6e7eb!important;cursor:not-allowed!important}.next-upload-list-text .next-upload-list-item{background-color:#f2f3f7;padding:4px 36px 4px 8px;height:40px;line-height:32px;font-size:12px;overflow:hidden;transition:all .1s linear;border-radius:0}.next-upload-list-text .next-upload-list-item:not(:last-child){margin-bottom:4px}.next-upload-list-text .next-upload-list-item-op{position:absolute;top:0;right:12px}.next-upload-list-text .next-upload-list-item .next-icon-close{color:#999;cursor:pointer;text-align:center;transition:all .1s linear;line-height:40px}.next-upload-list-text .next-upload-list-item .next-icon-close .next-icon-remote,.next-upload-list-text .next-upload-list-item .next-icon-close:before{width:12px;font-size:12px;line-height:inherit}.next-upload-list-text .next-upload-list-item:hover{background-color:#f2f3f7}.next-upload-list-text .next-upload-list-item:hover .next-icon{color:#666}.next-upload-list-text .next-upload-list-item-name-wrap{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin-right:4px}.next-upload-list-text .next-upload-list-item-name{color:#333;transition:all .1s linear}.next-upload-list-text .next-upload-list-item-size{color:#999;margin-left:8px}.next-upload-list-text .next-upload-list-item-uploading{line-height:16px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress{line-height:0;padding-top:4px;padding-bottom:4px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-underlay{height:8px}.next-upload-list-text .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-overlay{height:8px;margin-top:-4px}.next-upload-list-text .next-upload-list-item-done{line-height:32px}.next-upload-list-text .next-upload-list-item-done:hover .next-upload-list-item-name,.next-upload-list-text .next-upload-list-item-done:hover .next-upload-list-item-size{color:#5584ff}.next-upload-list-text .next-upload-list-item-error{background-color:#ffece4!important}.next-upload-list-text .next-upload-list-item-error.next-upload-list-item-error-with-msg{line-height:16px}.next-upload-list-text .next-upload-list-item-error-msg{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:#ff3000}.next-upload-list-image .next-upload-list-item{box-sizing:content-box;border:1px solid #dcdee3;background-color:#fff;padding:8px;height:48px;line-height:48px;font-size:12px;transition:all .1s linear;overflow:hidden;border-radius:0}.next-upload-list-image .next-upload-list-item:not(:last-child){margin-bottom:4px}.next-upload-list-image .next-upload-list-item:after{visibility:hidden;display:block;height:0;font-size:0;content:"\0020";clear:both}.next-upload-list-image .next-upload-list-item-op{float:right;margin-right:4px}.next-upload-list-image .next-upload-list-item .next-icon-close{cursor:pointer;color:#999;text-align:center}.next-upload-list-image .next-upload-list-item .next-icon-close .next-icon-remote,.next-upload-list-image .next-upload-list-item .next-icon-close:before{width:12px;font-size:12px;line-height:inherit}.next-upload-list-image .next-upload-list-item:hover{border-color:#5584ff}.next-upload-list-image .next-upload-list-item:hover .next-icon-close{color:#666}.next-upload-list-image .next-upload-list-item-name{display:block;color:#333;margin-left:56px;margin-right:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;transition:all .1s linear}.next-upload-list-image .next-upload-list-item-size{color:#999;margin-left:8px}.next-upload-list-image .next-upload-list-item-done:hover .next-upload-list-item-name,.next-upload-list-image .next-upload-list-item-done:hover .next-upload-list-item-size{color:#5584ff}.next-upload-list-image .next-upload-list-item-thumbnail{float:left;width:48px;height:48px;color:#ccc;border:1px solid #dcdee3;border-radius:0;background-color:#f2f3f7;margin-right:8px;vertical-align:middle;text-align:center;overflow:hidden;box-sizing:border-box}.next-upload-list-image .next-upload-list-item-thumbnail img{width:100%;height:100%}.next-upload-list-image .next-upload-list-item-thumbnail .next-icon{display:block;margin:0;line-height:48px}.next-upload-list-image .next-upload-list-item-thumbnail .next-icon .next-icon-remote,.next-upload-list-image .next-upload-list-item-thumbnail .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-upload-list-image .next-upload-list-item-error{border-color:#ff3000!important;background-color:#fff}.next-upload-list-image .next-upload-list-item-uploading{background-color:#fff}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-name{height:24px;line-height:24px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress{margin-left:56px;margin-right:20px;line-height:0;padding-top:8px;padding-bottom:8px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-underlay{height:8px}.next-upload-list-image .next-upload-list-item-uploading .next-upload-list-item-progress .next-progress-line-overlay{height:8px;margin-top:-4px}.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-error-msg,.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-name{height:24px;line-height:24px}.next-upload-list-image .next-upload-list-item-error-with-msg .next-upload-list-item-error-msg{margin-left:56px;margin-right:20px;color:#ff3000;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.next-upload-list-card{display:inline-block}.next-upload-list-card .next-upload-list-item{vertical-align:middle;float:left}.next-upload-list-card .next-upload-list-item:not(:last-child){margin-right:12px}.next-upload-list-card .next-upload-list-item-wrapper{position:relative;border:1px solid #c4c6cf;width:100px;height:100px;padding:0;background-color:transparent;border-radius:0;overflow:hidden}.next-upload-list-card .next-upload-list-item-thumbnail{text-align:center;width:100%;height:100%;color:#ccc;font-size:12px}.next-upload-list-card .next-upload-list-item-thumbnail img{max-width:100%;max-height:100%;position:absolute;top:0;right:0;bottom:0;left:0;margin:auto}.next-upload-list-card .next-upload-list-item-thumbnail img:focus{outline:0}.next-upload-list-card .next-upload-list-item-thumbnail .next-icon{width:100%}.next-upload-list-card .next-upload-list-item-thumbnail .next-icon .next-icon-remote,.next-upload-list-card .next-upload-list-item-thumbnail .next-icon:before{width:48px;font-size:48px;line-height:inherit}.next-upload-list-card .next-upload-list-item-handler{margin-top:13px}.next-upload-list-card .next-upload-list-item-handler .next-icon-cry{margin-top:10px}.next-upload-list-card .next-upload-list-item-name{display:block;width:100px;text-align:center;margin-top:4px;font-size:12px;color:#666;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.next-upload-list-card .next-upload-list-item-progress{position:absolute;font-size:0;bottom:0;left:0;width:100%}.next-upload-list-card .next-upload-list-item-progress .next-progress-line-underlay{border-radius:0;height:8px}.next-upload-list-card .next-upload-list-item-progress .next-progress-line-overlay{border-radius:0;height:8px;margin-top:-4px}.next-upload-list-card .next-upload-list-item-uploading .next-upload-list-item-wrapper{background-color:#f7f8fa}.next-upload-list-card .next-upload-list-item:hover .next-upload-tool{opacity:.8}.next-upload-list-card .next-upload-list-item .next-upload-tool{position:absolute;z-index:1;background-color:rgba(0,0,0,.7);transition:all .1s linear;opacity:0;width:100%;height:28px;left:0;bottom:0;display:flex}.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon{line-height:28px;color:#fff;cursor:pointer}.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon .next-icon-remote,.next-upload-list-card .next-upload-list-item .next-upload-tool .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-upload-list-card .next-upload-list-item .next-upload-tool-item{width:100%;text-align:center}.next-upload-list-card .next-upload-list-item .next-upload-tool-item:not(:last-child){border-right:1px solid #fff}.next-upload-list-card .next-upload-list-item .next-upload-tool-reupload{display:inline-block}.next-upload-list-card .next-upload-list-item .next-upload-card{display:flex;flex-direction:column;justify-content:center}.next-upload-list-card .next-upload-list-item-error .next-upload-list-item-wrapper{border-color:#ff3000}.next-upload-list-card.next-upload-ie9 .next-upload-tool{display:table}.next-upload-list-card.next-upload-ie9 .next-upload-tool-item{display:table-cell;width:1%}.next-upload-card,.next-upload-list-card.next-upload-ie9 .next-upload-card{display:table-cell}.next-upload-card{border:1px dashed #c4c6cf;width:100px;height:100px;background-color:#fff;text-align:center;cursor:pointer;transition:border-color .1s linear;vertical-align:middle;border-radius:0}.next-upload-card .next-icon{color:#c4c6cf}.next-upload-card .next-icon .next-icon-remote,.next-upload-card .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-upload-card .next-upload-add-icon:before{content:""}.next-upload-card .next-upload-text{font-size:12px;margin-top:12px;color:#666;outline:none}.next-upload-card:hover{border-color:#5584ff}.next-upload-card:hover .next-icon,.next-upload-card:hover .next-upload-text{color:#5584ff}.next-upload-dragable .next-upload-inner{display:block}.next-upload-dragable .next-upload-drag{border:1px dashed #c4c6cf;transition:border-color .1s linear;cursor:pointer;border-radius:3px;background-color:transparent;text-align:center;margin-bottom:4px}.next-upload-dragable .next-upload-drag-icon{margin:20px 0 0;color:#666}.next-upload-dragable .next-upload-drag-icon .next-upload-drag-upload-icon:before{content:"";font-size:24px}.next-upload-dragable .next-upload-drag-text{margin:12px 0 0;font-size:14px;color:#666}.next-upload-dragable .next-upload-drag-hint{margin:4px 0 20px;font-size:12px;color:#999}.next-upload-dragable .next-upload-drag-over{border-color:#5584ff}.next-collapse[dir=rtl] .next-collapse-panel-title{padding:8px 28px 8px 0}.next-collapse[dir=rtl] .next-collapse-panel-icon{left:inherit;right:12px;transform:rotate(180deg);margin-left:0;margin-right:0}.next-collapse[dir=rtl] .next-collapse-panel-icon .next-icon-remote,.next-collapse[dir=rtl] .next-collapse-panel-icon:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse[dir=rtl] .next-collapse-panel-icon{transform:scale(.5) rotate(180deg);margin-left:-4px;margin-right:-4px}.next-collapse[dir=rtl] .next-collapse-panel-icon:before{width:16px;font-size:16px}}.next-collapse{border:1px solid #dcdee3;border-radius:3px}.next-collapse,.next-collapse *,.next-collapse :after,.next-collapse :before{box-sizing:border-box}.next-collapse:focus,.next-collapse :focus{outline:0}.next-collapse-panel:not(:first-child){border-top:1px solid #dcdee3}.next-collapse .next-collapse-panel-icon{position:absolute;color:#333;transition:transform .1s linear;left:12px;margin-top:-2px;margin-left:0;margin-right:0}.next-collapse .next-collapse-panel-icon .next-icon-remote,.next-collapse .next-collapse-panel-icon:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse .next-collapse-panel-icon{transform:scale(.5);margin-left:-4px;margin-right:-4px}.next-collapse .next-collapse-panel-icon:before{width:16px;font-size:16px}}.next-collapse-panel-title{position:relative;line-height:1.5;background:#f2f3f7;font-size:14px;font-weight:400;color:#333;cursor:pointer;padding:8px 0 8px 28px;transition:background .1s linear}.next-collapse-panel-title:hover{background:#ebecf0;color:#333;font-weight:400}.next-collapse-panel-title:hover .next-collapse-panel-icon{color:#333}.next-collapse-panel-content{height:0;line-height:1.5;padding:0 16px;background:#fff;font-size:12px;color:#666;transition:all .3s ease;opacity:0}.next-collapse-panel-expanded>.next-collapse-panel-content{display:block;padding:12px 16px;height:auto;opacity:1}.next-collapse .next-collapse-unfold-icon:before{content:""}.next-collapse-panel-hidden>.next-collapse-panel-content{overflow:hidden}.next-collapse .next-collapse-panel-icon:before{content:""}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded{transform:rotate(90deg);margin-left:0;margin-right:0}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded .next-icon-remote,.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded:before{width:8px;font-size:8px;line-height:inherit}@media (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded{transform:scale(.5) rotate(90deg);margin-left:-4px;margin-right:-4px}.next-collapse .next-collapse-panel-icon.next-collapse-panel-icon-expanded:before{width:16px;font-size:16px}}.next-collapse-disabled,.next-collapse-panel-disabled:not(:first-child){border-color:#e6e7eb}.next-collapse-panel-disabled>.next-collapse-panel-title{cursor:not-allowed;color:#ccc;background:#f2f3f7}.next-collapse-panel-disabled .next-collapse-panel-icon{color:#ccc}.next-collapse-panel-disabled .next-collapse-panel-title:hover{font-weight:400}.next-collapse-panel-disabled .next-collapse-panel-title:hover .next-collapse-panel-icon{color:#ccc}.next-collapse-panel-disabled:hover{color:#ccc;background:#f2f3f7}.next-menu-btn{display:inline-block;box-shadow:none}.next-menu-btn-spacing-tb{padding:0}.next-menu-btn .next-icon{transition:transform .1s linear}.next-menu-btn .next-menu-btn-arrow:before{content:""}.next-menu-btn.next-expand .next-menu-btn-arrow{transform:rotate(180deg)}.next-menu-btn-symbol-unfold:before{content:""}.next-menu-btn.next-btn-normal .next-menu-btn-arrow{color:#999}.next-menu-btn.next-btn-normal:hover .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-secondary .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-secondary:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.next-btn-secondary.next-btn-text:hover .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-primary .next-menu-btn-arrow,.next-menu-btn.next-btn-primary:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.next-btn-text.next-btn-normal .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-text.next-btn-normal:hover .next-menu-btn-arrow,.next-menu-btn.next-btn-text.next-btn-primary .next-menu-btn-arrow{color:#5584ff}.next-menu-btn.next-btn-text.next-btn-primary:hover .next-menu-btn-arrow{color:#3e71f7}.next-menu-btn.next-btn-ghost.next-btn-light .next-menu-btn-arrow{color:#333}.next-menu-btn.next-btn-ghost.next-btn-light:hover .next-menu-btn-arrow{color:#999}.next-menu-btn.next-btn-ghost.next-btn-dark .next-menu-btn-arrow,.next-menu-btn.next-btn-ghost.next-btn-dark:hover .next-menu-btn-arrow{color:#fff}.next-menu-btn.disabled .next-menu-btn-arrow,.next-menu-btn.next-btn-text.disabled .next-menu-btn-arrow,.next-menu-btn.next-btn-text[disabled] .next-menu-btn-arrow,.next-menu-btn[disabled] .next-menu-btn-arrow{color:#ccc}.next-menu-btn[disabled].next-btn-ghost.next-btn-dark .next-menu-btn-arrow{color:hsla(0,0%,100%,.4)}.next-menu-btn[disabled].next-btn-ghost.next-btn-light .next-menu-btn-arrow{color:rgba(0,0,0,.1)}.next-search-simple[dir=rtl].next-large .next-search-icon{margin-left:12px;margin-right:0}.next-search-simple[dir=rtl].next-medium .next-search-icon{margin-left:8px;margin-right:0}.next-search-simple[dir=rtl].next-normal .next-search-left .next-search-left-addon{border-left:1px solid #c4c6cf;border-right:none}.next-search-simple[dir=rtl].next-dark .next-search-left{border-color:#c4c6cf}.next-search-simple[dir=rtl].next-dark .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple[dir=rtl].next-dark:hover .next-search-left{border-color:#c4c6cf}.next-search-simple[dir=rtl].next-dark .next-search-icon{color:#999}.next-search-simple[dir=rtl].next-dark .next-search-icon:hover{color:#666}.next-search-normal[dir=rtl] .next-search-left{border-left:none;border-top-right-radius:3px;border-bottom-right-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0}.next-search-normal[dir=rtl] .next-search-btn.next-btn{border-radius:3px 0 0 3px!important}.next-search-normal[dir=rtl] .next-input{border-radius:0 3px 3px 0}.next-search-normal[dir=rtl].next-primary .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-primary .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-secondary .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-secondary .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-normal .next-input{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:1px;border-bottom-right-radius:1px}.next-search-normal[dir=rtl].next-normal .next-search-left .next-search-left-addon{border-left:1px solid #e6e7eb;border-right:none}.next-search-normal[dir=rtl].next-dark .next-search-left .next-search-left-addon{border-left:1px solid #5584ff;border-right:none}.next-search{width:100%;display:inline-block}.next-search,.next-search *,.next-search :after,.next-search :before{box-sizing:border-box}.next-search .next-input,.next-search .next-select{border:none;box-shadow:none}.next-search .next-select .next-input,.next-search .next-select .next-input .next-input-text-field{height:auto}.next-search .next-search-left{border-style:solid;transition:all .1s linear}.next-search .next-search-left-addon .next-input,.next-search .next-search-left-addon .next-select-trigger-search{min-height:100%;border-bottom-right-radius:0;border-top-right-radius:0}.next-search .next-search-left-addon .next-select-values{line-height:1}.next-search .next-search-left-addon.next-input-group-addon .next-select{margin:0}.next-search .next-search-left-addon+.next-search-input .next-input{border-bottom-left-radius:0;border-top-left-radius:0}.next-search .next-search-input{width:100%}.next-search .next-search-btn{box-shadow:none}.next-search .next-search-symbol-icon:before{content:""}.next-search-normal{width:600px}.next-search-normal .next-search-left{border-top-left-radius:3px;border-bottom-left-radius:3px}.next-search-normal .next-input{border-radius:3px 0 0 3px}.next-search-normal .next-btn{border-radius:0 3px 3px 0}.next-search-normal.next-primary .next-search-left{border-color:#5584ff}.next-search-normal.next-primary .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-primary:hover .next-btn,.next-search-normal.next-primary:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-primary .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-primary .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-primary .next-search-btn .next-icon,.next-search-normal.next-primary .next-search-btn .next-icon:hover{color:#fff}.next-search-normal.next-primary.next-large{box-shadow:none}.next-search-normal.next-primary.next-large .next-search-btn,.next-search-normal.next-primary.next-large .next-search-left{border-width:2px;height:60px}.next-search-normal.next-primary.next-large .next-search-input{height:56px;overflow-y:hidden}.next-search-normal.next-primary.next-large .next-search-input input{height:56px;line-height:56px \0}.next-search-normal.next-primary.next-large .next-select{height:56px}.next-search-normal.next-primary.next-large .next-search-btn{font-size:16px}.next-search-normal.next-primary.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-primary.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-primary.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-primary.next-medium{box-shadow:none}.next-search-normal.next-primary.next-medium .next-search-btn,.next-search-normal.next-primary.next-medium .next-search-left{border-width:2px;height:40px}.next-search-normal.next-primary.next-medium .next-search-input{height:36px;overflow-y:hidden}.next-search-normal.next-primary.next-medium .next-search-input input{height:36px;line-height:36px \0}.next-search-normal.next-primary.next-medium .next-select{height:36px}.next-search-normal.next-primary.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-primary.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-primary.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-primary.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-primary .next-input{border-top-left-radius:1px;border-bottom-left-radius:1px}.next-search-normal.next-secondary .next-search-left{border-color:#c4c6cf}.next-search-normal.next-secondary .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-secondary:hover .next-btn,.next-search-normal.next-secondary:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-secondary .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-secondary .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-secondary .next-search-btn .next-icon,.next-search-normal.next-secondary .next-search-btn .next-icon:hover{color:#fff}.next-search-normal.next-secondary.next-large{box-shadow:none}.next-search-normal.next-secondary.next-large .next-search-btn,.next-search-normal.next-secondary.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-secondary.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-secondary.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-secondary.next-large .next-select{height:58px}.next-search-normal.next-secondary.next-large .next-search-btn{font-size:16px}.next-search-normal.next-secondary.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-secondary.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-secondary.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-secondary.next-medium{box-shadow:none}.next-search-normal.next-secondary.next-medium .next-search-btn,.next-search-normal.next-secondary.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-secondary.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-secondary.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-secondary.next-medium .next-select{height:38px}.next-search-normal.next-secondary.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-secondary.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-secondary.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-secondary.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-secondary .next-input{border-top-left-radius:2px;border-bottom-left-radius:2px}.next-search-normal.next-normal .next-search-left{border-color:#c4c6cf}.next-search-normal.next-normal .next-search-left .next-search-left-addon{border-right:1px solid #e6e7eb}.next-search-normal.next-normal:hover .next-btn,.next-search-normal.next-normal:hover .next-search-left{border-color:#a0a2ad}.next-search-normal.next-normal .next-search-btn{background:#f7f8fa;border-color:#c4c6cf;color:#666}.next-search-normal.next-normal .next-search-btn:hover{background:#ebecf0;border-color:#a0a2ad;color:#333}.next-search-normal.next-normal .next-search-btn .next-icon{color:#666}.next-search-normal.next-normal .next-search-btn .next-icon:hover{color:#333}.next-search-normal.next-normal.next-large{box-shadow:none}.next-search-normal.next-normal.next-large .next-search-btn,.next-search-normal.next-normal.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-normal.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-normal.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-normal.next-large .next-select{height:58px}.next-search-normal.next-normal.next-large .next-search-btn{font-size:16px}.next-search-normal.next-normal.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-normal.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-normal.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-normal.next-medium{box-shadow:none}.next-search-normal.next-normal.next-medium .next-search-btn,.next-search-normal.next-normal.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-normal.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-normal.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-normal.next-medium .next-select{height:38px}.next-search-normal.next-normal.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-normal.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-normal.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-normal.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-normal .next-input{border-top-left-radius:2px;border-bottom-left-radius:2px}.next-search-normal.next-dark .next-search-left{border-color:#5584ff}.next-search-normal.next-dark .next-search-left .next-search-left-addon{border-right:1px solid #5584ff}.next-search-normal.next-dark:hover .next-btn,.next-search-normal.next-dark:hover .next-search-left{border-color:#5584ff}.next-search-normal.next-dark .next-search-btn{background:#5584ff;border-color:#5584ff;color:#fff}.next-search-normal.next-dark .next-search-btn:hover{background:#3e71f7;border-color:#5584ff;color:#fff}.next-search-normal.next-dark .next-search-btn .next-icon,.next-search-normal.next-dark .next-search-btn .next-icon:hover,.next-search-normal.next-dark .next-select-inner,.next-search-normal.next-dark input{color:#fff}.next-search-normal.next-dark .next-input,.next-search-normal.next-dark .next-select{background:hsla(0,0%,100%,0)}.next-search-normal.next-dark.next-large{box-shadow:none}.next-search-normal.next-dark.next-large .next-search-btn,.next-search-normal.next-dark.next-large .next-search-left{border-width:1px;height:60px}.next-search-normal.next-dark.next-large .next-search-input{height:58px;overflow-y:hidden}.next-search-normal.next-dark.next-large .next-search-input input{height:58px;line-height:58px \0}.next-search-normal.next-dark.next-large .next-select{height:58px}.next-search-normal.next-dark.next-large .next-search-btn{font-size:16px}.next-search-normal.next-dark.next-large .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-dark.next-large .next-search-btn .next-icon:before{width:24px;font-size:24px;line-height:inherit}.next-search-normal.next-dark.next-large .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal.next-dark.next-medium{box-shadow:none}.next-search-normal.next-dark.next-medium .next-search-btn,.next-search-normal.next-dark.next-medium .next-search-left{border-width:1px;height:40px}.next-search-normal.next-dark.next-medium .next-search-input{height:38px;overflow-y:hidden}.next-search-normal.next-dark.next-medium .next-search-input input{height:38px;line-height:38px \0}.next-search-normal.next-dark.next-medium .next-select{height:38px}.next-search-normal.next-dark.next-medium .next-search-btn{font-size:16px}.next-search-normal.next-dark.next-medium .next-search-btn .next-icon .next-icon-remote,.next-search-normal.next-dark.next-medium .next-search-btn .next-icon:before{width:16px;font-size:16px;line-height:inherit}.next-search-normal.next-dark.next-medium .next-search-btn .next-search-btn-text{display:inline-block;padding-left:0}.next-search-normal:not([dir=rtl]) .next-search-left{border-right:none}.next-search-simple{width:300px;box-shadow:none;border-radius:3px}.next-search-simple .next-search-icon{cursor:pointer;transition:all .1s linear}.next-search-simple .next-input,.next-search-simple .next-search-left{border-radius:3px}.next-search-simple.next-large .next-search-icon{margin-right:12px}.next-search-simple.next-medium .next-search-icon{margin-right:8px}.next-search-simple.next-normal .next-search-left{border-color:#c4c6cf}.next-search-simple.next-normal .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple.next-normal:hover .next-search-left{border-color:#a0a2ad}.next-search-simple.next-normal .next-search-icon{color:#999}.next-search-simple.next-normal .next-search-icon:hover{color:#666}.next-search-simple.next-normal .next-search-left{border-width:1px}.next-search-simple.next-normal.next-large .next-search-icon .next-icon-remote,.next-search-simple.next-normal.next-large .next-search-icon:before{width:20px;font-size:20px;line-height:inherit}.next-search-simple.next-normal.next-medium .next-search-icon .next-icon-remote,.next-search-simple.next-normal.next-medium .next-search-icon:before{width:12px;font-size:12px;line-height:inherit}.next-search-simple.next-dark .next-search-left{border-color:#c4c6cf}.next-search-simple.next-dark .next-search-left .next-search-left-addon{border-right:1px solid #c4c6cf}.next-search-simple.next-dark:hover .next-search-left{border-color:#c4c6cf}.next-search-simple.next-dark .next-search-icon{color:#999}.next-search-simple.next-dark .next-search-icon:hover{color:#666}.next-search-simple.next-dark .next-select-inner,.next-search-simple.next-dark input{color:#fff}.next-search-simple.next-dark .next-input,.next-search-simple.next-dark .next-select{background:hsla(0,0%,100%,0)}.next-search-simple.next-dark .next-search-left{border-width:1px}.next-search-simple.next-dark.next-large .next-search-icon .next-icon-remote,.next-search-simple.next-dark.next-large .next-search-icon:before{width:20px;font-size:20px;line-height:inherit}.next-search-simple.next-dark.next-medium .next-search-icon .next-icon-remote,.next-search-simple.next-dark.next-medium .next-search-icon:before{width:12px;font-size:12px;line-height:inherit}.next-search-simple .next-select.next-large{height:38px}.next-search-simple .next-select.next-medium{height:26px}.next-transfer{display:inline-block}.next-transfer,.next-transfer *,.next-transfer :after,.next-transfer :before{box-sizing:border-box}.next-transfer-panel{display:inline-block;border:1px solid #dcdee3;border-radius:3px;background-color:#fff;vertical-align:middle}.next-transfer-panel-header{padding:8px 20px;border-bottom:1px solid #dcdee3;background-color:#f7f8fa;color:#333;font-size:12px}.next-transfer-panel-search{padding:0 4px;margin-top:8px;margin-bottom:0;width:180px}.next-transfer .next-transfer-panel-list{width:180px;height:160px;padding:0;border:none;box-shadow:none;border-radius:0;overflow-y:auto}.next-transfer-panel-not-found-container{display:table;width:100%;height:100%}.next-transfer-panel-not-found{display:table-cell;vertical-align:middle;text-align:center;color:#999;font-size:14px}.next-transfer-panel-item.next-focused{transition:background-color .1s linear}.next-transfer-panel-item:not(.next-disabled).next-simple:hover{color:#5584ff}.next-transfer-panel-item.next-insert-before:before{position:absolute;top:0;left:0;content:"";width:100%;border-top:1px solid #5584ff}.next-transfer-panel-item.next-insert-after:after{position:absolute;left:0;bottom:0;content:"";width:100%;border-bottom:1px solid #5584ff}.next-transfer-panel-footer{position:relative;padding:8px 20px;border-top:1px solid #dcdee3;background-color:#fff;font-size:0;box-shadow:none}.next-transfer-panel-count{margin-left:4px;font-size:12px;vertical-align:middle;color:#333}.next-transfer-panel-move-all{font-size:12px;color:#5584ff;cursor:pointer}.next-transfer-panel-move-all.next-disabled{color:#ccc;cursor:not-allowed}.next-transfer-operations{display:inline-block;vertical-align:middle;margin:0 20px}.next-transfer-move.next-icon{color:#c4c6cf}.next-transfer-move.next-icon:before{content:""}.next-transfer-operation.next-btn{display:block}.next-transfer-operation.next-btn+.next-transfer-operation.next-btn{margin-top:8px}.next-transfer-operation.next-btn .next-icon .next-icon-remote,.next-transfer-operation.next-btn .next-icon:before{width:12px;font-size:12px;line-height:inherit} /*! * Copyright 1999-2018 Alibaba Group Holding Ltd. @@ -348,7 +348,7 @@ * 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. - */.next-slick{position:relative;display:block;-webkit-touch-callout:none;user-select:none;-ms-touch-action:pan-y;touch-action:pan-y;-webkit-tap-highlight-color:transparent}.next-slick,.next-slick *,.next-slick :after,.next-slick :before{box-sizing:border-box}.next-slick-initialized .next-slick-slide{display:block}.next-slick-list{position:relative;overflow:hidden;display:block;margin:0;padding:0;transform:translateZ(0)}.next-slick-list:focus{outline:none}.next-slick-list.dragging{cursor:pointer;cursor:hand}.next-slick-track{position:relative;top:0;left:0;display:block;transform:translateZ(0)}.next-slick-slide{float:left;height:100%;min-height:1px;outline:0;transition:all .1s linear}.next-slick[dir=rtl] .next-slick-slide{float:right}.next-slick-slide img{display:block}.next-slick-arrow{display:block;position:absolute;cursor:pointer;text-align:center;transition:all .1s linear}.next-slick-arrow.inner{color:#fff;background:#000;opacity:.2;padding:0;border:none}.next-slick-arrow.inner:focus,.next-slick-arrow.inner:hover{color:#fff;background:#000;opacity:.4}.next-slick-arrow.inner.disabled{color:#ccc;background:#f7f8fa;opacity:.5}.next-slick-arrow.outer{color:#666;background:transparent;opacity:.32;padding:0;border:none;border-radius:0}.next-slick-arrow.outer:focus,.next-slick-arrow.outer:hover{color:#333;background:transparent;opacity:.32}.next-slick-arrow.outer.disabled{color:#ccc;background:transparent;opacity:.32}.next-slick-arrow.disabled{cursor:not-allowed}.next-slick-dots{display:block;position:absolute;margin:0;padding:0}.next-slick-dots-item{position:relative;display:inline-block;cursor:pointer}.next-slick-dots-item button{cursor:pointer;border:0 solid #fff;outline:none;padding:0;height:8px;width:8px;border-radius:50%;background:rgba(0,0,0,.32)}.next-slick-dots-item button:hover{background-color:rgba(0,0,0,.32);border-color:#fff}.next-slick-dots-item button:focus,.next-slick-dots-item button:hover{background:hsla(0,0%,100%,.5)}.next-slick-dots-item.active button{background:#5584ff;border-color:#fff;animation:zoom .3s cubic-bezier(.86,0,.07,1)}.next-slick-dots.hoz{width:100%;bottom:12px;left:0;text-align:center}.next-slick-dots.hoz .next-slick-dots-item{margin:0 4px}.next-slick-dots.ver{width:16px;top:0;right:20px;bottom:0;display:flex;justify-content:center;flex-direction:column}.next-slick-dots.ver .next-slick-dots-item{margin:0}.next-slick.next-slick-hoz.next-slick-outer{padding:0 24px}.next-slick.next-slick-hoz .next-slick-arrow.medium{width:28px;height:56px;line-height:56px}.next-slick.next-slick-hoz .next-slick-arrow.medium .next-icon .next-icon-remote,.next-slick.next-slick-hoz .next-slick-arrow.medium .next-icon:before{width:20px;font-size:20px;line-height:inherit}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner{top:calc(50% - 28px)}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner.next-slick-prev{left:0}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner.next-slick-next{right:0}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer{top:calc(50% - 28px)}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer.next-slick-prev{left:-4px}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer.next-slick-next{right:-4px}.next-slick.next-slick-hoz .next-slick-arrow.large{width:48px;height:96px;line-height:96px}.next-slick.next-slick-hoz .next-slick-arrow.large .next-icon .next-icon-remote,.next-slick.next-slick-hoz .next-slick-arrow.large .next-icon:before{width:32px;font-size:32px;line-height:inherit}.next-slick.next-slick-hoz .next-slick-arrow.large.inner{top:calc(50% - 48px)}.next-slick.next-slick-hoz .next-slick-arrow.large.inner.next-slick-prev{left:0}.next-slick.next-slick-hoz .next-slick-arrow.large.inner.next-slick-next{right:0}.next-slick.next-slick-hoz .next-slick-arrow.large.outer{top:calc(50% - 48px)}.next-slick.next-slick-hoz .next-slick-arrow.large.outer.next-slick-prev{left:-8px}.next-slick.next-slick-hoz .next-slick-arrow.large.outer.next-slick-next{right:-8px}.next-slick.next-slick-ver.next-slick-outer{padding:24px 0}.next-slick.next-slick-ver .next-slick-slide{display:block;height:auto}.next-slick.next-slick-ver .next-slick-arrow.medium{width:56px;height:28px;line-height:28px}.next-slick.next-slick-ver .next-slick-arrow.medium .next-icon .next-icon-remote,.next-slick.next-slick-ver .next-slick-arrow.medium .next-icon:before{width:20px;font-size:20px;line-height:inherit}.next-slick.next-slick-ver .next-slick-arrow.medium.inner{left:calc(50% - 28px)}.next-slick.next-slick-ver .next-slick-arrow.medium.inner.next-slick-prev{top:0}.next-slick.next-slick-ver .next-slick-arrow.medium.inner.next-slick-next{bottom:0}.next-slick.next-slick-ver .next-slick-arrow.medium.outer{left:calc(50% - 28px)}.next-slick.next-slick-ver .next-slick-arrow.medium.outer.next-slick-prev{top:-4px}.next-slick.next-slick-ver .next-slick-arrow.medium.outer.next-slick-next{bottom:-4px}.next-slick.next-slick-ver .next-slick-arrow.large{width:96px;height:48px;line-height:48px}.next-slick.next-slick-ver .next-slick-arrow.large .next-icon .next-icon-remote,.next-slick.next-slick-ver .next-slick-arrow.large .next-icon:before{width:32px;font-size:32px;line-height:inherit}.next-slick.next-slick-ver .next-slick-arrow.large.inner{left:calc(50% - 48px)}.next-slick.next-slick-ver .next-slick-arrow.large.inner.next-slick-prev{top:0}.next-slick.next-slick-ver .next-slick-arrow.large.inner.next-slick-next{bottom:0}.next-slick.next-slick-ver .next-slick-arrow.large.outer{left:calc(50% - 48px)}.next-slick.next-slick-ver .next-slick-arrow.large.outer.next-slick-prev{top:-16px}.next-slick.next-slick-ver .next-slick-arrow.large.outer.next-slick-next{bottom:-16px} + */.next-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;top:0;margin:-1px}.next-slick{position:relative;display:block;-webkit-touch-callout:none;user-select:none;-ms-touch-action:pan-y;touch-action:pan-y;-webkit-tap-highlight-color:transparent}.next-slick,.next-slick *,.next-slick :after,.next-slick :before{box-sizing:border-box}.next-slick-initialized .next-slick-slide{display:block}.next-slick-list{position:relative;overflow:hidden;display:block;margin:0;padding:0;transform:translateZ(0)}.next-slick-list:focus{outline:none}.next-slick-list.dragging{cursor:pointer;cursor:hand}.next-slick-track{position:relative;top:0;left:0;display:block;transform:translateZ(0)}.next-slick-slide{float:left;height:100%;min-height:1px;outline:0;transition:all .1s linear}.next-slick[dir=rtl] .next-slick-slide{float:right}.next-slick-slide img{display:block}.next-slick-arrow{display:block;position:absolute;cursor:pointer;text-align:center;transition:all .1s linear}.next-slick-arrow.inner{color:#fff;background:#000;opacity:.2;padding:0;border:none}.next-slick-arrow.inner:focus,.next-slick-arrow.inner:hover{color:#fff;background:#000;opacity:.4}.next-slick-arrow.inner.disabled{color:#ccc;background:#f7f8fa;opacity:.5}.next-slick-arrow.outer{color:#666;background:transparent;opacity:.32;padding:0;border:none;border-radius:0}.next-slick-arrow.outer:focus,.next-slick-arrow.outer:hover{color:#333;background:transparent;opacity:.32}.next-slick-arrow.outer.disabled{color:#ccc;background:transparent;opacity:.32}.next-slick-arrow.disabled{cursor:not-allowed}.next-slick-dots{display:block;position:absolute;margin:0;padding:0}.next-slick-dots-item{position:relative;display:inline-block;cursor:pointer}.next-slick-dots-item button{cursor:pointer;border:0 solid #fff;outline:none;padding:0;height:8px;width:8px;border-radius:50%;background:rgba(0,0,0,.32)}.next-slick-dots-item button:focus,.next-slick-dots-item button:hover{background-color:hsla(0,0%,100%,.5);border-color:#fff}.next-slick-dots-item.active button{background:#5584ff;border-color:#fff;animation:zoom .3s cubic-bezier(.86,0,.07,1)}.next-slick-dots.hoz{width:100%;bottom:12px;left:0;text-align:center}.next-slick-dots.hoz .next-slick-dots-item{margin:0 4px}.next-slick-dots.ver{width:16px;top:0;right:20px;bottom:0;display:flex;justify-content:center;flex-direction:column}.next-slick-dots.ver .next-slick-dots-item{margin:0}.next-slick.next-slick-hoz.next-slick-outer{padding:0 24px}.next-slick.next-slick-hoz .next-slick-arrow.medium{width:28px;height:56px;line-height:56px}.next-slick.next-slick-hoz .next-slick-arrow.medium .next-icon .next-icon-remote,.next-slick.next-slick-hoz .next-slick-arrow.medium .next-icon:before{width:20px;font-size:20px;line-height:inherit}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner{top:calc(50% - 28px)}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner.next-slick-prev{left:0}.next-slick.next-slick-hoz .next-slick-arrow.medium.inner.next-slick-next{right:0}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer{top:calc(50% - 28px)}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer.next-slick-prev{left:-4px}.next-slick.next-slick-hoz .next-slick-arrow.medium.outer.next-slick-next{right:-4px}.next-slick.next-slick-hoz .next-slick-arrow.large{width:48px;height:96px;line-height:96px}.next-slick.next-slick-hoz .next-slick-arrow.large .next-icon .next-icon-remote,.next-slick.next-slick-hoz .next-slick-arrow.large .next-icon:before{width:32px;font-size:32px;line-height:inherit}.next-slick.next-slick-hoz .next-slick-arrow.large.inner{top:calc(50% - 48px)}.next-slick.next-slick-hoz .next-slick-arrow.large.inner.next-slick-prev{left:0}.next-slick.next-slick-hoz .next-slick-arrow.large.inner.next-slick-next{right:0}.next-slick.next-slick-hoz .next-slick-arrow.large.outer{top:calc(50% - 48px)}.next-slick.next-slick-hoz .next-slick-arrow.large.outer.next-slick-prev{left:-8px}.next-slick.next-slick-hoz .next-slick-arrow.large.outer.next-slick-next{right:-8px}.next-slick.next-slick-ver.next-slick-outer{padding:24px 0}.next-slick.next-slick-ver .next-slick-slide{display:block;height:auto}.next-slick.next-slick-ver .next-slick-arrow.medium{width:56px;height:28px;line-height:28px}.next-slick.next-slick-ver .next-slick-arrow.medium .next-icon .next-icon-remote,.next-slick.next-slick-ver .next-slick-arrow.medium .next-icon:before{width:20px;font-size:20px;line-height:inherit}.next-slick.next-slick-ver .next-slick-arrow.medium.inner{left:calc(50% - 28px)}.next-slick.next-slick-ver .next-slick-arrow.medium.inner.next-slick-prev{top:0}.next-slick.next-slick-ver .next-slick-arrow.medium.inner.next-slick-next{bottom:0}.next-slick.next-slick-ver .next-slick-arrow.medium.outer{left:calc(50% - 28px)}.next-slick.next-slick-ver .next-slick-arrow.medium.outer.next-slick-prev{top:-4px}.next-slick.next-slick-ver .next-slick-arrow.medium.outer.next-slick-next{bottom:-4px}.next-slick.next-slick-ver .next-slick-arrow.large{width:96px;height:48px;line-height:48px}.next-slick.next-slick-ver .next-slick-arrow.large .next-icon .next-icon-remote,.next-slick.next-slick-ver .next-slick-arrow.large .next-icon:before{width:32px;font-size:32px;line-height:inherit}.next-slick.next-slick-ver .next-slick-arrow.large.inner{left:calc(50% - 48px)}.next-slick.next-slick-ver .next-slick-arrow.large.inner.next-slick-prev{top:0}.next-slick.next-slick-ver .next-slick-arrow.large.inner.next-slick-next{bottom:0}.next-slick.next-slick-ver .next-slick-arrow.large.outer{left:calc(50% - 48px)}.next-slick.next-slick-ver .next-slick-arrow.large.outer.next-slick-prev{top:-16px}.next-slick.next-slick-ver .next-slick-arrow.large.outer.next-slick-next{bottom:-16px} /*! * Copyright 1999-2018 Alibaba Group Holding Ltd. @@ -364,7 +364,7 @@ * 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. - */.next-pagination-size-selector{position:static!important}.configuration-table{margin-bottom:20px}.next-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;top:0;margin:-1px}.next-switch:after[dir=rtl]{content:" ";transition:all .1s linear;transform-origin:right center}.next-switch-medium[dir=rtl]:after,.next-switch-small[dir=rtl]:after{right:100%;transform:translateX(100%)}.next-switch-on[dir=rtl]>.next-switch-children{color:#fff}.next-switch-on[disabled][dir=rtl]:after{left:0;right:100%;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12)}.next-switch-off[dir=rtl]:after{right:0;transform:translateX(0);box-shadow:-1px 0 3px 0 rgba(0,0,0,.12)}.next-switch-off.next-switch-small[dir=rtl]>.next-switch-children,.next-switch-off[dir=rtl]>.next-switch-children{right:auto}.next-switch{outline:none;text-align:left;cursor:pointer;vertical-align:middle;user-select:none;overflow:hidden;transition:background .1s cubic-bezier(.4,0,.2,1),border-color .1s cubic-bezier(.4,0,.2,1)}.next-switch,.next-switch *,.next-switch :after,.next-switch :before{box-sizing:border-box}.next-switch-btn{transition:all .15s cubic-bezier(.4,0,.2,1);transform-origin:left center}.next-switch:after{content:""}.next-switch-loading{pointer-events:none}.next-switch-loading .next-icon-loading{color:#5584ff;text-align:center;transform:translate(-1px,-1px)}.next-switch-loading .next-icon-loading.next-switch-inner-icon:before{vertical-align:top}.next-switch-medium{border:2px solid transparent;width:56px;height:28px;border-radius:20px}.next-switch-medium:not([disabled]):active .next-switch-btn{width:31.2px}.next-switch-medium.next-switch-on:not([disabled]):active .next-switch-btn{left:calc(100% - 31.2px)}.next-switch-medium.next-switch-auto-width{min-width:56px;width:auto;overflow:initial}.next-switch-medium:after{content:""}.next-switch-medium>.next-switch-btn{border:1px solid transparent;position:absolute;left:calc(100% - 24px);width:24px;height:24px;border-radius:20px;box-sizing:border-box}.next-switch-medium>.next-switch-children{height:24px;line-height:24px;font-size:12px}.next-switch-medium.next-switch.next-switch-on>.next-switch-children{margin:0 32px 0 8px}.next-switch-medium.next-switch.next-switch-off>.next-switch-children{margin:0 8px 0 32px}.next-switch-medium.next-switch-loading .next-icon-loading{line-height:24px;height:24px;width:24px}.next-switch-medium.next-switch-loading .next-icon-loading .next-icon-remote,.next-switch-medium.next-switch-loading .next-icon-loading:before{width:16px;font-size:16px;line-height:inherit}.next-switch-small{position:relative;display:inline-block;border:2px solid transparent;width:44px;height:24px;border-radius:20px}.next-switch-small:not([disabled]):active .next-switch-btn{width:26px}.next-switch-small.next-switch-on:not([disabled]):active .next-switch-btn{left:calc(100% - 26px)}.next-switch-small.next-switch-auto-width{min-width:44px;width:auto;overflow:initial}.next-switch-small:after{content:""}.next-switch-small>.next-switch-btn{border:1px solid transparent;position:absolute;left:calc(100% - 20px);width:20px;height:20px;border-radius:20px;box-sizing:border-box}.next-switch-small>.next-switch-children{height:20px;line-height:20px;font-size:12px}.next-switch-small.next-switch.next-switch-on>.next-switch-children{margin:0 28px 0 8px}.next-switch-small.next-switch.next-switch-off>.next-switch-children{margin:0 8px 0 28px}.next-switch-small.next-switch-loading .next-icon-loading{line-height:20px;height:20px;width:20px}.next-switch-small.next-switch-loading .next-icon-loading .next-icon-remote,.next-switch-small.next-switch-loading .next-icon-loading:before{width:12px;font-size:12px;line-height:inherit}.next-switch-on{background-color:#5584ff}.next-switch-on .next-switch-btn{box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#fff;border-color:transparent}.next-switch-on.hover,.next-switch-on:focus,.next-switch-on:hover{background-color:#3e71f7}.next-switch-on.hover .next-switch-btn,.next-switch-on:focus .next-switch-btn,.next-switch-on:hover .next-switch-btn{background-color:#fff}.next-switch-on[disabled]{background-color:#ebecf0;cursor:not-allowed}.next-switch-on[disabled] .next-switch-btn{right:0;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#f7f8fa;border-color:transparent}.next-switch-on[disabled]>.next-switch-children{color:#ccc}.next-switch-off,.next-switch-off.hover,.next-switch-off:focus,.next-switch-off:hover{background-color:#ebecf0;border-color:#ebecf0}.next-switch-off .next-switch-btn{left:0;box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#fff;border-color:transparent}.next-switch-off.hover .next-switch-btn,.next-switch-off:focus .next-switch-btn,.next-switch-off:hover .next-switch-btn{background-color:#fff}.next-switch-off>.next-switch-children{color:#999}.next-switch-off[disabled]{background-color:#ebecf0;cursor:not-allowed}.next-switch-off[disabled] .next-switch-btn{box-shadow:1px 1px 3px 0 rgba(0,0,0,.12);background-color:#f7f8fa;border-color:transparent}.next-switch-off[disabled]>.next-switch-children{color:#c4c6cf} + */.next-pagination-size-selector{position:static!important}.configuration-table{margin-bottom:20px} /*! * Copyright 1999-2018 Alibaba Group Holding Ltd. diff --git a/console/src/main/resources/static/index.html b/console/src/main/resources/static/index.html index 56fe54ab539..eb39415aad1 100644 --- a/console/src/main/resources/static/index.html +++ b/console/src/main/resources/static/index.html @@ -35,7 +35,7 @@ - +
@@ -56,6 +56,6 @@ - + diff --git a/console/src/main/resources/static/js/main.js b/console/src/main/resources/static/js/main.js index fe2353e881b..caa0987cfff 100644 --- a/console/src/main/resources/static/js/main.js +++ b/console/src/main/resources/static/js/main.js @@ -1,22 +1,22 @@ -!function(n){var a={};function r(e){if(a[e])return a[e].exports;var t=a[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=a,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=439)}([function(e,t,n){"use strict";e.exports=n(446)},function(e,t,n){"use strict";n.d(t,"b",function(){return E}),n.d(t,"d",function(){return x}),n.d(t,"c",function(){return C});n(52);var t=n(27),u=n.n(t),s=n(70),r=n(85),d=n(60),c=n(31),t=n(103),f=n.n(t),t=n(64),p=n.n(t);function h(){var e=window.location.href,e=(localStorage.removeItem("token"),e.split("#")[0]);console.log("base_url",e),window.location="".concat(e,"#/login")}var l,m,a,o,i,g,y,v,_,b,w,M,n=window,k=(l={},{once:function(e,t){this.listen.call(this,e,t,!0)},listen:function(e,t){var n=2>>0,a;for(a=0;a0)for(n=0;n=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+a}var ie=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,le=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ue={};function a(e,t,n,a){var r=a;if(typeof a==="string")r=function(){return this[a]()};if(e)ue[e]=r;if(t)ue[t[0]]=function(){return h(r.apply(this,arguments),t[1],t[2])};if(n)ue[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)}}function de(e){if(e.match(/\[[\s\S]/))return e.replace(/^\[|\]$/g,"");return e.replace(/\\/g,"")}function ce(a){var r=a.match(ie),e,o;for(e=0,o=r.length;e=0&&le.test(e)){e=e.replace(le,a);le.lastIndex=0;n-=1}return e}var he={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function me(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];if(t||!n)return t;this._longDateFormat[e]=n.match(ie).map(function(e){if(e==="MMMM"||e==="MM"||e==="DD"||e==="dddd")return e.slice(1);return e}).join("");return this._longDateFormat[e]}var ge="Invalid date";function ye(){return this._invalidDate}var ve="%d",_e=/\d{1,2}/;function be(e){return this._ordinal.replace("%d",e)}var we={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Me(e,t,n,a){var r=this._relativeTime[n];return p(r)?r(e,t,n,a):r.replace(/%d/i,e)}function ke(e,t){var n=this._relativeTime[e>0?"future":"past"];return p(n)?n(t):n.replace(/%s/i,t)}var Se={};function t(e,t){var n=e.toLowerCase();Se[n]=Se[n+"s"]=Se[t]=e}function m(e){return typeof e==="string"?Se[e]||Se[e.toLowerCase()]:undefined}function Ee(e){var t={},n,a;for(a in e)if(l(e,a)){n=m(a);if(n)t[n]=e[a]}return t}var xe={};function n(e,t){xe[e]=t}function Ce(e){var t=[],n;for(n in e)if(l(e,n))t.push({unit:n,priority:xe[n]});t.sort(function(e,t){return e.priority-t.priority});return t}function Le(e){return e%4===0&&e%100!==0||e%400===0}function g(e){if(e<0)return Math.ceil(e)||0;else return Math.floor(e)}function y(e){var t=+e,n=0;if(t!==0&&isFinite(t))n=g(t);return n}function Te(t,n){return function(e){if(e!=null){Oe(this,t,e);d.updateOffset(this,n);return this}else return De(this,t)}}function De(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Oe(e,t,n){if(e.isValid()&&!isNaN(n))if(t==="FullYear"&&Le(e.year())&&e.month()===1&&e.date()===29){n=y(n);e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),ot(n,e.month()))}else e._d["set"+(e._isUTC?"UTC":"")+t](n)}function Ne(e){e=m(e);if(p(this[e]))return this[e]();return this}function Pe(e,t){if(typeof e==="object"){e=Ee(e);var n=Ce(e),a;for(a=0;a68?1900:2e3)};var Mt=Te("FullYear",true);function kt(){return Le(this.year())}function St(e,t,n,a,r,o,i){var l;if(e<100&&e>=0){l=new Date(e+400,t,n,a,r,o,i);if(isFinite(l.getFullYear()))l.setFullYear(e)}else l=new Date(e,t,n,a,r,o,i);return l}function Et(e){var t,n;if(e<100&&e>=0){n=Array.prototype.slice.call(arguments);n[0]=e+400;t=new Date(Date.UTC.apply(null,n));if(isFinite(t.getUTCFullYear()))t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function xt(e,t,n){var a=7+t-n,r=(7+Et(e,0,a).getUTCDay()-t)%7;return-r+a-1}function Ct(e,t,n,a,r){var o=(7+n-a)%7,i=xt(e,a,r),l=1+7*(t-1)+o+i,s,u;if(l<=0){s=e-1;u=wt(s)+l}else if(l>wt(e)){s=e+1;u=l-wt(e)}else{s=e;u=l}return{year:s,dayOfYear:u}}function Lt(e,t,n){var a=xt(e.year(),t,n),r=Math.floor((e.dayOfYear()-a-1)/7)+1,o,i;if(r<1){i=e.year()-1;o=r+T(i,t,n)}else if(r>T(e.year(),t,n)){o=r-T(e.year(),t,n);i=e.year()+1}else{i=e.year();o=r}return{week:o,year:i}}function T(e,t,n){var a=xt(e,t,n),r=xt(e+1,t,n);return(wt(e)-a+r)/7}function Tt(e){return Lt(e,this._week.dow,this._week.doy).week}a("w",["ww",2],"wo","week"),a("W",["WW",2],"Wo","isoWeek"),t("week","w"),t("isoWeek","W"),n("week",5),n("isoWeek",5),_("w",v),_("ww",v,r),_("W",v),_("WW",v,r),Ze(["w","ww","W","WW"],function(e,t,n,a){t[a.substr(0,1)]=y(e)});var Dt={dow:0,doy:6};function Ot(){return this._week.dow}function Nt(){return this._week.doy}function Pt(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function jt(e){var t=Lt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}function Yt(e,t){if(typeof e!=="string")return e;if(!isNaN(e))return parseInt(e,10);e=t.weekdaysParse(e);if(typeof e==="number")return e;return null}function It(e,t){if(typeof e==="string")return t.weekdaysParse(e)%7||7;return isNaN(e)?null:e}function Rt(e,t){return e.slice(t,7).concat(e.slice(0,t))}a("d",0,"do","day"),a("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),a("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),a("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),a("e",0,0,"weekday"),a("E",0,0,"isoWeekday"),t("day","d"),t("weekday","e"),t("isoWeekday","E"),n("day",11),n("weekday",11),n("isoWeekday",11),_("d",v),_("e",v),_("E",v),_("dd",function(e,t){return t.weekdaysMinRegex(e)}),_("ddd",function(e,t){return t.weekdaysShortRegex(e)}),_("dddd",function(e,t){return t.weekdaysRegex(e)}),Ze(["dd","ddd","dddd"],function(e,t,n,a){var r=n._locale.weekdaysParse(e,a,n._strict);if(r!=null)t.d=r;else f(n).invalidWeekday=e}),Ze(["d","e","E"],function(e,t,n,a){t[a]=y(e)});var At="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ht="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ft="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),zt=qe,Wt=qe,Vt=qe;function Bt(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&e!==true&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===true?Rt(n,this._week.dow):e?n[e.day()]:n}function Ut(e){return e===true?Rt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Kt(e){return e===true?Rt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Gt(e,t,n){var a,r,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse){this._weekdaysParse=[];this._shortWeekdaysParse=[];this._minWeekdaysParse=[];for(a=0;a<7;++a){o=c([2e3,1]).day(a);this._minWeekdaysParse[a]=this.weekdaysMin(o,"").toLocaleLowerCase();this._shortWeekdaysParse[a]=this.weekdaysShort(o,"").toLocaleLowerCase();this._weekdaysParse[a]=this.weekdays(o,"").toLocaleLowerCase()}}if(n)if(t==="dddd"){r=L.call(this._weekdaysParse,i);return r!==-1?r:null}else if(t==="ddd"){r=L.call(this._shortWeekdaysParse,i);return r!==-1?r:null}else{r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else if(t==="dddd"){r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._shortWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else if(t==="ddd"){r=L.call(this._shortWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else{r=L.call(this._minWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._shortWeekdaysParse,i);return r!==-1?r:null}}function qt(e,t,n){var a,r,o;if(this._weekdaysParseExact)return Gt.call(this,e,t,n);if(!this._weekdaysParse){this._weekdaysParse=[];this._minWeekdaysParse=[];this._shortWeekdaysParse=[];this._fullWeekdaysParse=[]}for(a=0;a<7;a++){r=c([2e3,1]).day(a);if(n&&!this._fullWeekdaysParse[a]){this._fullWeekdaysParse[a]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i");this._shortWeekdaysParse[a]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i");this._minWeekdaysParse[a]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")}if(!this._weekdaysParse[a]){o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,"");this._weekdaysParse[a]=new RegExp(o.replace(".",""),"i")}if(n&&t==="dddd"&&this._fullWeekdaysParse[a].test(e))return a;else if(n&&t==="ddd"&&this._shortWeekdaysParse[a].test(e))return a;else if(n&&t==="dd"&&this._minWeekdaysParse[a].test(e))return a;else if(!n&&this._weekdaysParse[a].test(e))return a}}function $t(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();if(e!=null){e=Yt(e,this.localeData());return this.add(e-t,"d")}else return t}function Jt(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function Xt(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=It(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function Qt(e){if(this._weekdaysParseExact){if(!l(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysStrictRegex;else return this._weekdaysRegex}else{if(!l(this,"_weekdaysRegex"))this._weekdaysRegex=zt;return this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex}}function Zt(e){if(this._weekdaysParseExact){if(!l(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysShortStrictRegex;else return this._weekdaysShortRegex}else{if(!l(this,"_weekdaysShortRegex"))this._weekdaysShortRegex=Wt;return this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}}function en(e){if(this._weekdaysParseExact){if(!l(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysMinStrictRegex;else return this._weekdaysMinRegex}else{if(!l(this,"_weekdaysMinRegex"))this._weekdaysMinRegex=Vt;return this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}}function tn(){function e(e,t){return t.length-e.length}var t=[],n=[],a=[],r=[],o,i,l,s,u;for(o=0;o<7;o++){i=c([2e3,1]).day(o);l=b(this.weekdaysMin(i,""));s=b(this.weekdaysShort(i,""));u=b(this.weekdays(i,""));t.push(l);n.push(s);a.push(u);r.push(l);r.push(s);r.push(u)}t.sort(e);n.sort(e);a.sort(e);r.sort(e);this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i");this._weekdaysShortRegex=this._weekdaysRegex;this._weekdaysMinRegex=this._weekdaysRegex;this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i");this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i");this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function nn(){return this.hours()%12||12}function an(){return this.hours()||24}function rn(e,t){a(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function on(e,t){return t._meridiemParse}function ln(e){return(e+"").toLowerCase().charAt(0)==="p"}a("H",["HH",2],0,"hour"),a("h",["hh",2],0,nn),a("k",["kk",2],0,an),a("hmm",0,0,function(){return""+nn.apply(this)+h(this.minutes(),2)}),a("hmmss",0,0,function(){return""+nn.apply(this)+h(this.minutes(),2)+h(this.seconds(),2)}),a("Hmm",0,0,function(){return""+this.hours()+h(this.minutes(),2)}),a("Hmmss",0,0,function(){return""+this.hours()+h(this.minutes(),2)+h(this.seconds(),2)}),rn("a",true),rn("A",false),t("hour","h"),n("hour",13),_("a",on),_("A",on),_("H",v),_("h",v),_("k",v),_("HH",v,r),_("hh",v,r),_("kk",v,r),_("hmm",Ae),_("hmmss",He),_("Hmm",Ae),_("Hmmss",He),w(["H","HH"],E),w(["k","kk"],function(e,t,n){var a=y(e);t[E]=a===24?0:a}),w(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e);n._meridiem=e}),w(["h","hh"],function(e,t,n){t[E]=y(e);f(n).bigHour=true}),w("hmm",function(e,t,n){var a=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a));f(n).bigHour=true}),w("hmmss",function(e,t,n){var a=e.length-4,r=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a,2));t[C]=y(e.substr(r));f(n).bigHour=true}),w("Hmm",function(e,t,n){var a=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a))}),w("Hmmss",function(e,t,n){var a=e.length-4,r=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a,2));t[C]=y(e.substr(r))});var sn,un=Te("Hours",true);function dn(e,t,n){if(e>11)return n?"pm":"PM";else return n?"am":"AM"}var cn={calendar:re,longDateFormat:he,invalidDate:ge,ordinal:ve,dayOfMonthOrdinalParse:_e,relativeTime:we,months:it,monthsShort:lt,week:Dt,weekdays:At,weekdaysMin:Ft,weekdaysShort:Ht,meridiemParse:/[ap]\.?m?\.?/i},D={},fn={},pn;function hn(e,t){var n,a=Math.min(e.length,t.length);for(n=0;n0){r=yn(o.slice(0,n).join("-"));if(r)return r;if(a&&a.length>=n&&hn(o,a)>=n-1)break;n--}t++}return pn}function yn(t){var e=null,n;if(D[t]===undefined&&typeof ui!=="undefined"&&ui&&ui.exports)try{e=pn._abbr;n=di;ci(513)("./"+t);vn(e)}catch(e){D[t]=null}return D[t]}function vn(e,t){var n;if(e){if(o(t))n=wn(e);else n=_n(e,t);if(n)pn=n;else if(typeof console!=="undefined"&&console.warn)console.warn("Locale "+e+" not found. Did you forget to load it?")}return pn._abbr}function _n(e,t){if(t!==null){var n,a=cn;t.abbr=e;if(D[e]!=null){ee("defineLocaleOverride","use moment.updateLocale(localeName, config) to change "+"an existing locale. moment.defineLocale(localeName, "+"config) should only be used for creating a new locale "+"See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");a=D[e]._config}else if(t.parentLocale!=null)if(D[t.parentLocale]!=null)a=D[t.parentLocale]._config;else{n=yn(t.parentLocale);if(n!=null)a=n._config;else{if(!fn[t.parentLocale])fn[t.parentLocale]=[];fn[t.parentLocale].push({name:e,config:t});return null}}D[e]=new ae(ne(a,t));if(fn[e])fn[e].forEach(function(e){_n(e.name,e.config)});vn(e);return D[e]}else{delete D[e];return null}}function bn(e,t){if(t!=null){var n,a,r=cn;if(D[e]!=null&&D[e].parentLocale!=null)D[e].set(ne(D[e]._config,t));else{a=yn(e);if(a!=null)r=a._config;t=ne(r,t);if(a==null)t.abbr=e;n=new ae(t);n.parentLocale=D[e];D[e]=n}vn(e)}else if(D[e]!=null)if(D[e].parentLocale!=null){D[e]=D[e].parentLocale;if(e===vn())vn(e)}else if(D[e]!=null)delete D[e];return D[e]}function wn(e){var t;if(e&&e._locale&&e._locale._abbr)e=e._locale._abbr;if(!e)return pn;if(!i(e)){t=yn(e);if(t)return t;e=[e]}return gn(e)}function Mn(){return Z(D)}function kn(e){var t,n=e._a;if(n&&f(e).overflow===-2){t=n[k]<0||n[k]>11?k:n[S]<1||n[S]>ot(n[M],n[k])?S:n[E]<0||n[E]>24||n[E]===24&&(n[x]!==0||n[C]!==0||n[tt]!==0)?E:n[x]<0||n[x]>59?x:n[C]<0||n[C]>59?C:n[tt]<0||n[tt]>999?tt:-1;if(f(e)._overflowDayOfYear&&(tS))t=S;if(f(e)._overflowWeeks&&t===-1)t=nt;if(f(e)._overflowWeekday&&t===-1)t=at;f(e).overflow=t}return e}var Sn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,En=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,xn=/Z|[+-]\d\d(?::?\d\d)?/,Cn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,false],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,false],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,false],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,false],["YYYY",/\d{4}/,false]],Ln=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Tn=/^\/?Date\((-?\d+)/i,Dn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,On={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Nn(e){var t,n,a=e._i,r=Sn.exec(a)||En.exec(a),o,i,l,s;if(r){f(e).iso=true;for(t=0,n=Cn.length;twt(i)||e._dayOfYear===0)f(e)._overflowDayOfYear=true;n=Et(i,0,e._dayOfYear);e._a[k]=n.getUTCMonth();e._a[S]=n.getUTCDate()}for(t=0;t<3&&e._a[t]==null;++t)e._a[t]=a[t]=r[t];for(;t<7;t++)e._a[t]=a[t]=e._a[t]==null?t===2?1:0:e._a[t];if(e._a[E]===24&&e._a[x]===0&&e._a[C]===0&&e._a[tt]===0){e._nextDay=true;e._a[E]=0}e._d=(e._useUTC?Et:St).apply(null,a);o=e._useUTC?e._d.getUTCDay():e._d.getDay();if(e._tzm!=null)e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm);if(e._nextDay)e._a[E]=24;if(e._w&&typeof e._w.d!=="undefined"&&e._w.d!==o)f(e).weekdayMismatch=true}function Vn(e){var t,n,a,r,o,i,l,s,u;t=e._w;if(t.GG!=null||t.W!=null||t.E!=null){o=1;i=4;n=Fn(t.GG,e._a[M],Lt(O(),1,4).year);a=Fn(t.W,1);r=Fn(t.E,1);if(r<1||r>7)s=true}else{o=e._locale._week.dow;i=e._locale._week.doy;u=Lt(O(),o,i);n=Fn(t.gg,e._a[M],u.year);a=Fn(t.w,u.week);if(t.d!=null){r=t.d;if(r<0||r>6)s=true}else if(t.e!=null){r=t.e+o;if(t.e<0||t.e>6)s=true}else r=o}if(a<1||a>T(n,o,i))f(e)._overflowWeeks=true;else if(s!=null)f(e)._overflowWeekday=true;else{l=Ct(n,a,r,o,i);e._a[M]=l.year;e._dayOfYear=l.dayOfYear}}function Bn(e){if(e._f===d.ISO_8601){Nn(e);return}if(e._f===d.RFC_2822){An(e);return}e._a=[];f(e).empty=true;var t=""+e._i,n,a,r,o,i,l=t.length,s=0,u;r=pe(e._f,e._locale).match(ie)||[];for(n=0;n0)f(e).unusedInput.push(i);t=t.slice(t.indexOf(a)+a.length);s+=a.length}if(ue[o]){if(a)f(e).empty=false;else f(e).unusedTokens.push(o);et(o,a,e)}else if(e._strict&&!a)f(e).unusedTokens.push(o)}f(e).charsLeftOver=l-s;if(t.length>0)f(e).unusedInput.push(t);if(e._a[E]<=12&&f(e).bigHour===true&&e._a[E]>0)f(e).bigHour=undefined;f(e).parsedDateParts=e._a.slice(0);f(e).meridiem=e._meridiem;e._a[E]=Un(e._locale,e._a[E],e._meridiem);u=f(e).era;if(u!==null)e._a[M]=e._locale.erasConvertYear(u,e._a[M]);Wn(e);kn(e)}function Un(e,t,n){var a;if(n==null)return t;if(e.meridiemHour!=null)return e.meridiemHour(t,n);else if(e.isPM!=null){a=e.isPM(n);if(a&&t<12)t+=12;if(!a&&t===12)t=0;return t}else return t}function Kn(e){var t,n,a,r,o,i,l=false;if(e._f.length===0){f(e).invalidFormat=true;e._d=new Date(NaN);return}for(r=0;rthis?this:e;else return K()});function ea(e,t){var n,a;if(t.length===1&&i(t[0]))t=t[0];if(!t.length)return O();n=t[0];for(a=1;athis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Sa(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e={},t;$(e,this);e=$n(e);if(e._a){t=e._isUTC?c(e._a):O(e._a);this._isDSTShifted=this.isValid()&&ca(e._a,t.toArray())>0}else this._isDSTShifted=false;return this._isDSTShifted}function Ea(){return this.isValid()?!this._isUTC:false}function xa(){return this.isValid()?this._isUTC:false}function Ca(){return this.isValid()?this._isUTC&&this._offset===0:false}d.updateOffset=function(){};var La=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Ta=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function N(e,t){var n=e,a=null,r,o,i;if(ua(e))n={ms:e._milliseconds,d:e._days,M:e._months};else if(s(e)||!isNaN(+e)){n={};if(t)n[t]=+e;else n.milliseconds=+e}else if(a=La.exec(e)){r=a[1]==="-"?-1:1;n={y:0,d:y(a[S])*r,h:y(a[E])*r,m:y(a[x])*r,s:y(a[C])*r,ms:y(da(a[tt]*1e3))*r}}else if(a=Ta.exec(e)){r=a[1]==="-"?-1:1;n={y:Da(a[2],r),M:Da(a[3],r),w:Da(a[4],r),d:Da(a[5],r),h:Da(a[6],r),m:Da(a[7],r),s:Da(a[8],r)}}else if(n==null)n={};else if(typeof n==="object"&&("from"in n||"to"in n)){i=Na(O(n.from),O(n.to));n={};n.ms=i.milliseconds;n.M=i.months}o=new sa(n);if(ua(e)&&l(e,"_locale"))o._locale=e._locale;if(ua(e)&&l(e,"_isValid"))o._isValid=e._isValid;return o}function Da(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Oa(e,t){var n={};n.months=t.month()-e.month()+(t.year()-e.year())*12;if(e.clone().add(n.months,"M").isAfter(t))--n.months;n.milliseconds=+t-+e.clone().add(n.months,"M");return n}function Na(e,t){var n;if(!(e.isValid()&&t.isValid()))return{milliseconds:0,months:0};t=ma(t,e);if(e.isBefore(t))n=Oa(e,t);else{n=Oa(t,e);n.milliseconds=-n.milliseconds;n.months=-n.months}return n}function Pa(r,o){return function(e,t){var n,a;if(t!==null&&!isNaN(+t)){ee(o,"moment()."+o+"(period, number) is deprecated. Please use moment()."+o+"(number, period). "+"See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");a=e;e=t;t=a}n=N(e,t);ja(this,n,r);return this}}function ja(e,t,n,a){var r=t._milliseconds,o=da(t._days),i=da(t._months);if(!e.isValid())return;a=a==null?true:a;if(i)mt(e,De(e,"Month")+i*n);if(o)Oe(e,"Date",De(e,"Date")+o*n);if(r)e._d.setTime(e._d.valueOf()+r*n);if(a)d.updateOffset(e,o||i)}N.fn=sa.prototype,N.invalid=la;var Ya=Pa(1,"add"),Ia=Pa(-1,"subtract");function Ra(e){return typeof e==="string"||e instanceof String}function Aa(e){return u(e)||z(e)||Ra(e)||s(e)||Fa(e)||Ha(e)||e===null||e===undefined}function Ha(e){var t=H(e)&&!F(e),n=false,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,o;for(r=0;rn.valueOf();else return n.valueOf()9999)return fe(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(p(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",fe(n,"Z"));return fe(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function tr(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,a,r,o;if(!this.isLocal()){e=this.utcOffset()===0?"moment.utc":"moment.parseZone";t="Z"}n="["+e+'("]';a=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY";r="-MM-DD[T]HH:mm:ss.SSS";o=t+'[")]';return this.format(n+a+r+o)}function nr(e){if(!e)e=this.isUtc()?d.defaultFormatUtc:d.defaultFormat;var t=fe(this,e);return this.localeData().postformat(t)}function ar(e,t){if(this.isValid()&&(u(e)&&e.isValid()||O(e).isValid()))return N({to:this,from:e}).locale(this.locale()).humanize(!t);else return this.localeData().invalidDate()}function rr(e){return this.from(O(),e)}function or(e,t){if(this.isValid()&&(u(e)&&e.isValid()||O(e).isValid()))return N({from:this,to:e}).locale(this.locale()).humanize(!t);else return this.localeData().invalidDate()}function ir(e){return this.to(O(),e)}function lr(e){var t;if(e===undefined)return this._locale._abbr;else{t=wn(e);if(t!=null)this._locale=t;return this}}d.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",d.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var sr=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){if(e===undefined)return this.localeData();else return this.locale(e)});function ur(){return this._locale}var dr=1e3,cr=60*dr,fr=60*cr,pr=(365*400+97)*24*fr;function hr(e,t){return(e%t+t)%t}function mr(e,t,n){if(e<100&&e>=0)return new Date(e+400,t,n)-pr;else return new Date(e,t,n).valueOf()}function gr(e,t,n){if(e<100&&e>=0)return Date.UTC(e+400,t,n)-pr;else return Date.UTC(e,t,n)}function yr(e){var t,n;e=m(e);if(e===undefined||e==="millisecond"||!this.isValid())return this;n=this._isUTC?gr:mr;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf();t-=hr(t+(this._isUTC?0:this.utcOffset()*cr),fr);break;case"minute":t=this._d.valueOf();t-=hr(t,cr);break;case"second":t=this._d.valueOf();t-=hr(t,dr);break}this._d.setTime(t);d.updateOffset(this,true);return this}function vr(e){var t,n;e=m(e);if(e===undefined||e==="millisecond"||!this.isValid())return this;n=this._isUTC?gr:mr;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf();t+=fr-hr(t+(this._isUTC?0:this.utcOffset()*cr),fr)-1;break;case"minute":t=this._d.valueOf();t+=cr-hr(t,cr)-1;break;case"second":t=this._d.valueOf();t+=dr-hr(t,dr)-1;break}this._d.setTime(t);d.updateOffset(this,true);return this}function _r(){return this._d.valueOf()-(this._offset||0)*6e4}function br(){return Math.floor(this.valueOf()/1e3)}function wr(){return new Date(this.valueOf())}function Mr(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function kr(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Sr(){return this.isValid()?this.toISOString():null}function Er(){return U(this)}function xr(){return V({},f(this))}function Cr(){return f(this).overflow}function Lr(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Tr(e,t){var n,a,r,o=this._eras||wn("en")._eras;for(n=0,a=o.length;n=0)return o[a]}}function Or(e,t){var n=e.since<=e.until?+1:-1;if(t===undefined)return d(e.since).year();else return d(e.since).year()+(t-e.offset)*n}function Nr(){var e,t,n,a=this.localeData().eras();for(e=0,t=a.length;eo)t=o;return Qr.call(this,e,t,n,a,r)}}function Qr(e,t,n,a,r){var o=Ct(e,t,n,a,r),i=Et(o.year,0,o.dayOfYear);this.year(i.getUTCFullYear());this.month(i.getUTCMonth());this.date(i.getUTCDate());return this}function Zr(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}a("N",0,0,"eraAbbr"),a("NN",0,0,"eraAbbr"),a("NNN",0,0,"eraAbbr"),a("NNNN",0,0,"eraName"),a("NNNNN",0,0,"eraNarrow"),a("y",["y",1],"yo","eraYear"),a("y",["yy",2],0,"eraYear"),a("y",["yyy",3],0,"eraYear"),a("y",["yyyy",4],0,"eraYear"),_("N",Hr),_("NN",Hr),_("NNN",Hr),_("NNNN",Fr),_("NNNNN",zr),w(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,a){var r=n._locale.erasParse(e,a,n._strict);if(r)f(n).era=r;else f(n).invalidEra=e}),_("y",Ve),_("yy",Ve),_("yyy",Ve),_("yyyy",Ve),_("yo",Wr),w(["y","yy","yyy","yyyy"],M),w(["yo"],function(e,t,n,a){var r;if(n._locale._eraYearOrdinalRegex)r=e.match(n._locale._eraYearOrdinalRegex);if(n._locale.eraYearOrdinalParse)t[M]=n._locale.eraYearOrdinalParse(e,r);else t[M]=parseInt(e,10)}),a(0,["gg",2],0,function(){return this.weekYear()%100}),a(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Br("gggg","weekYear"),Br("ggggg","weekYear"),Br("GGGG","isoWeekYear"),Br("GGGGG","isoWeekYear"),t("weekYear","gg"),t("isoWeekYear","GG"),n("weekYear",1),n("isoWeekYear",1),_("G",Be),_("g",Be),_("GG",v,r),_("gg",v,r),_("GGGG",ze,Ie),_("gggg",ze,Ie),_("GGGGG",We,Re),_("ggggg",We,Re),Ze(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,a){t[a.substr(0,2)]=y(e)}),Ze(["gg","GG"],function(e,t,n,a){t[a]=d.parseTwoDigitYear(e)}),a("Q",0,"Qo","quarter"),t("quarter","Q"),n("quarter",7),_("Q",je),w("Q",function(e,t){t[k]=(y(e)-1)*3}),a("D",["DD",2],"Do","date"),t("date","D"),n("date",9),_("D",v),_("DD",v,r),_("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),w(["D","DD"],S),w("Do",function(e,t){t[S]=y(e.match(v)[0])});var eo=Te("Date",true);function to(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}a("DDD",["DDDD",3],"DDDo","dayOfYear"),t("dayOfYear","DDD"),n("dayOfYear",4),_("DDD",Fe),_("DDDD",Ye),w(["DDD","DDDD"],function(e,t,n){n._dayOfYear=y(e)}),a("m",["mm",2],0,"minute"),t("minute","m"),n("minute",14),_("m",v),_("mm",v,r),w(["m","mm"],x);var no=Te("Minutes",false),ao=(a("s",["ss",2],0,"second"),t("second","s"),n("second",15),_("s",v),_("ss",v,r),w(["s","ss"],C),Te("Seconds",false)),ro,oo;for(a("S",0,0,function(){return~~(this.millisecond()/100)}),a(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),a(0,["SSS",3],0,"millisecond"),a(0,["SSSS",4],0,function(){return this.millisecond()*10}),a(0,["SSSSS",5],0,function(){return this.millisecond()*100}),a(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),a(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),a(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),a(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),t("millisecond","ms"),n("millisecond",16),_("S",Fe,je),_("SS",Fe,r),_("SSS",Fe,Ye),ro="SSSS";ro.length<=9;ro+="S")_(ro,Ve);function io(e,t){t[tt]=y(("0."+e)*1e3)}for(ro="S";ro.length<=9;ro+="S")w(ro,io);function lo(){return this._isUTC?"UTC":""}function so(){return this._isUTC?"Coordinated Universal Time":""}oo=Te("Milliseconds",false),a("z",0,0,"zoneAbbr"),a("zz",0,0,"zoneName");var P=J.prototype;if(P.add=Ya,P.calendar=Va,P.clone=Ba,P.diff=Xa,P.endOf=vr,P.format=nr,P.from=ar,P.fromNow=rr,P.to=or,P.toNow=ir,P.get=Ne,P.invalidAt=Cr,P.isAfter=Ua,P.isBefore=Ka,P.isBetween=Ga,P.isSame=qa,P.isSameOrAfter=$a,P.isSameOrBefore=Ja,P.isValid=Er,P.lang=sr,P.locale=lr,P.localeData=ur,P.max=Zn,P.min=Qn,P.parsingFlags=xr,P.set=Pe,P.startOf=yr,P.subtract=Ia,P.toArray=Mr,P.toObject=kr,P.toDate=wr,P.toISOString=er,P.inspect=tr,typeof Symbol!=="undefined"&&Symbol.for!=null)P[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"};function uo(e){return O(e*1e3)}function co(){return O.apply(null,arguments).parseZone()}function fo(e){return e}P.toJSON=Sr,P.toString=Za,P.unix=br,P.valueOf=_r,P.creationData=Lr,P.eraName=Nr,P.eraNarrow=Pr,P.eraAbbr=jr,P.eraYear=Yr,P.year=Mt,P.isLeapYear=kt,P.weekYear=Ur,P.isoWeekYear=Kr,P.quarter=P.quarters=Zr,P.month=gt,P.daysInMonth=yt,P.week=P.weeks=Pt,P.isoWeek=P.isoWeeks=jt,P.weeksInYear=$r,P.weeksInWeekYear=Jr,P.isoWeeksInYear=Gr,P.isoWeeksInISOWeekYear=qr,P.date=eo,P.day=P.days=$t,P.weekday=Jt,P.isoWeekday=Xt,P.dayOfYear=to,P.hour=P.hours=un,P.minute=P.minutes=no,P.second=P.seconds=ao,P.millisecond=P.milliseconds=oo,P.utcOffset=ya,P.utc=_a,P.local=ba,P.parseZone=wa,P.hasAlignedHourOffset=Ma,P.isDST=ka,P.isLocal=Ea,P.isUtcOffset=xa,P.isUtc=Ca,P.isUTC=Ca,P.zoneAbbr=lo,P.zoneName=so,P.dates=e("dates accessor is deprecated. Use date instead.",eo),P.months=e("months accessor is deprecated. Use month instead",gt),P.years=e("years accessor is deprecated. Use year instead",Mt),P.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",va),P.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Sa);var j=ae.prototype;function po(e,t,n,a){var r=wn(),o=c().set(a,t);return r[n](o,e)}function ho(e,t,n){if(s(e)){t=e;e=undefined}e=e||"";if(t!=null)return po(e,t,n,"month");var a,r=[];for(a=0;a<12;a++)r[a]=po(e,a,n,"month");return r}function mo(e,t,n,a){if(typeof e==="boolean"){if(s(t)){n=t;t=undefined}t=t||""}else{t=e;n=t;e=false;if(s(t)){n=t;t=undefined}t=t||""}var r=wn(),o=e?r._week.dow:0,i,l=[];if(n!=null)return po(t,(n+o)%7,a,"day");for(i=0;i<7;i++)l[i]=po(t,(i+o)%7,a,"day");return l}function go(e,t){return ho(e,t,"months")}function yo(e,t){return ho(e,t,"monthsShort")}function vo(e,t,n){return mo(e,t,n,"weekdays")}function _o(e,t,n){return mo(e,t,n,"weekdaysShort")}function bo(e,t,n){return mo(e,t,n,"weekdaysMin")}j.calendar=oe,j.longDateFormat=me,j.invalidDate=ye,j.ordinal=be,j.preparse=fo,j.postformat=fo,j.relativeTime=Me,j.pastFuture=ke,j.set=te,j.eras=Tr,j.erasParse=Dr,j.erasConvertYear=Or,j.erasAbbrRegex=Rr,j.erasNameRegex=Ir,j.erasNarrowRegex=Ar,j.months=ct,j.monthsShort=ft,j.monthsParse=ht,j.monthsRegex=_t,j.monthsShortRegex=vt,j.week=Tt,j.firstDayOfYear=Nt,j.firstDayOfWeek=Ot,j.weekdays=Bt,j.weekdaysMin=Kt,j.weekdaysShort=Ut,j.weekdaysParse=qt,j.weekdaysRegex=Qt,j.weekdaysShortRegex=Zt,j.weekdaysMinRegex=en,j.isPM=ln,j.meridiem=dn,vn("en",{eras:[{since:"0001-01-01",until:+Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-Infinity,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=y(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),d.lang=e("moment.lang is deprecated. Use moment.locale instead.",vn),d.langData=e("moment.langData is deprecated. Use moment.localeData instead.",wn);var wo=Math.abs;function Mo(){var e=this._data;this._milliseconds=wo(this._milliseconds);this._days=wo(this._days);this._months=wo(this._months);e.milliseconds=wo(e.milliseconds);e.seconds=wo(e.seconds);e.minutes=wo(e.minutes);e.hours=wo(e.hours);e.months=wo(e.months);e.years=wo(e.years);return this}function ko(e,t,n,a){var r=N(t,n);e._milliseconds+=a*r._milliseconds;e._days+=a*r._days;e._months+=a*r._months;return e._bubble()}function So(e,t){return ko(this,e,t,1)}function Eo(e,t){return ko(this,e,t,-1)}function xo(e){if(e<0)return Math.floor(e);else return Math.ceil(e)}function Co(){var e=this._milliseconds,t=this._days,n=this._months,a=this._data,r,o,i,l,s;if(!(e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0)){e+=xo(To(n)+t)*864e5;t=0;n=0}a.milliseconds=e%1e3;r=g(e/1e3);a.seconds=r%60;o=g(r/60);a.minutes=o%60;i=g(o/60);a.hours=i%24;t+=g(i/24);s=g(Lo(t));n+=s;t-=xo(To(s));l=g(n/12);n%=12;a.days=t;a.months=n;a.years=l;return this}function Lo(e){return e*4800/146097}function To(e){return e*146097/4800}function Do(e){if(!this.isValid())return NaN;var t,n,a=this._milliseconds;e=m(e);if(e==="month"||e==="quarter"||e==="year"){t=this._days+a/864e5;n=this._months+Lo(t);switch(e){case"month":return n;case"quarter":return n/3;case"year":return n/12}}else{t=this._days+Math.round(To(this._months));switch(e){case"week":return t/7+a/6048e5;case"day":return t+a/864e5;case"hour":return t*24+a/36e5;case"minute":return t*1440+a/6e4;case"second":return t*86400+a/1e3;case"millisecond":return Math.floor(t*864e5)+a;default:throw new Error("Unknown unit "+e)}}}function Oo(){if(!this.isValid())return NaN;return this._milliseconds+this._days*864e5+this._months%12*2592e6+y(this._months/12)*31536e6}function No(e){return function(){return this.as(e)}}var Po=No("ms"),jo=No("s"),Yo=No("m"),Io=No("h"),Ro=No("d"),Ao=No("w"),Ho=No("M"),Fo=No("Q"),zo=No("y");function Wo(){return N(this)}function Vo(e){e=m(e);return this.isValid()?this[e+"s"]():NaN}function Bo(e){return function(){return this.isValid()?this._data[e]:NaN}}var Uo=Bo("milliseconds"),Ko=Bo("seconds"),Go=Bo("minutes"),qo=Bo("hours"),$o=Bo("days"),Jo=Bo("months"),Xo=Bo("years");function Qo(){return g(this.days()/7)}var Zo=Math.round,ei={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ti(e,t,n,a,r){return r.relativeTime(t||1,!!n,e,a)}function ni(e,t,n,a){var r=N(e).abs(),o=Zo(r.as("s")),i=Zo(r.as("m")),l=Zo(r.as("h")),s=Zo(r.as("d")),u=Zo(r.as("M")),d=Zo(r.as("w")),c=Zo(r.as("y")),f=o<=n.ss&&["s",o]||o0;f[4]=a;return ti.apply(null,f)}function ai(e){if(e===undefined)return Zo;if(typeof e==="function"){Zo=e;return true}return false}function ri(e,t){if(ei[e]===undefined)return false;if(t===undefined)return ei[e];ei[e]=t;if(e==="s")ei.ss=t-1;return true}function oi(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=false,a=ei,r,o;if(typeof e==="object"){t=e;e=false}if(typeof e==="boolean")n=e;if(typeof t==="object"){a=Object.assign({},ei,t);if(t.s!=null&&t.ss==null)a.ss=t.s-1}r=this.localeData();o=ni(this,!n,a,r);if(n)o=r.pastFuture(+this,o);return r.postformat(o)}var ii=Math.abs;function li(e){return(e>0)-(e<0)||+e}function si(){if(!this.isValid())return this.localeData().invalidDate();var e=ii(this._milliseconds)/1e3,t=ii(this._days),n=ii(this._months),a,r,o,i,l=this.asSeconds(),s,u,d,c;if(!l)return"P0D";a=g(e/60);r=g(a/60);e%=60;a%=60;o=g(n/12);n%=12;i=e?e.toFixed(3).replace(/\.?0+$/,""):"";s=l<0?"-":"";u=li(this._months)!==li(l)?"-":"";d=li(this._days)!==li(l)?"-":"";c=li(this._milliseconds)!==li(l)?"-":"";return s+"P"+(o?u+o+"Y":"")+(n?u+n+"M":"")+(t?d+t+"D":"")+(r||a||e?"T":"")+(r?c+r+"H":"")+(a?c+a+"M":"")+(e?c+i+"S":"")}var Y=sa.prototype;return Y.isValid=ia,Y.abs=Mo,Y.add=So,Y.subtract=Eo,Y.as=Do,Y.asMilliseconds=Po,Y.asSeconds=jo,Y.asMinutes=Yo,Y.asHours=Io,Y.asDays=Ro,Y.asWeeks=Ao,Y.asMonths=Ho,Y.asQuarters=Fo,Y.asYears=zo,Y.valueOf=Oo,Y._bubble=Co,Y.clone=Wo,Y.get=Vo,Y.milliseconds=Uo,Y.seconds=Ko,Y.minutes=Go,Y.hours=qo,Y.days=$o,Y.weeks=Qo,Y.months=Jo,Y.years=Xo,Y.humanize=oi,Y.toISOString=si,Y.toString=si,Y.toJSON=si,Y.locale=lr,Y.localeData=ur,Y.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",si),Y.lang=sr,a("X",0,0,"unix"),a("x",0,0,"valueOf"),_("x",Be),_("X",Ge),w("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),w("x",function(e,t,n){n._d=new Date(y(e))}), +di.exports=function(){"use strict";var I,R;function c(){return I.apply(null,arguments)}function A(e){I=e}function i(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function H(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;else{var t;for(t in e)if(s(e,t))return false;return true}}function l(e){return e===void 0}function u(e){return typeof e==="number"||Object.prototype.toString.call(e)==="[object Number]"}function z(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function W(e,t){var n=[],a,r=e.length;for(a=0;a>>0,a;for(a=0;a0)for(n=0;n=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+a}var ie=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,le=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ue={};function a(e,t,n,a){var r=a;if(typeof a==="string")r=function(){return this[a]()};if(e)ue[e]=r;if(t)ue[t[0]]=function(){return o(r.apply(this,arguments),t[1],t[2])};if(n)ue[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)}}function de(e){if(e.match(/\[[\s\S]/))return e.replace(/^\[|\]$/g,"");return e.replace(/\\/g,"")}function ce(a){var r=a.match(ie),e,o;for(e=0,o=r.length;e=0&&le.test(e)){e=e.replace(le,a);le.lastIndex=0;n-=1}return e}var he={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function me(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];if(t||!n)return t;this._longDateFormat[e]=n.match(ie).map(function(e){if(e==="MMMM"||e==="MM"||e==="DD"||e==="dddd")return e.slice(1);return e}).join("");return this._longDateFormat[e]}var ge="Invalid date";function ye(){return this._invalidDate}var ve="%d",_e=/\d{1,2}/;function be(e){return this._ordinal.replace("%d",e)}var we={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Me(e,t,n,a){var r=this._relativeTime[n];return h(r)?r(e,t,n,a):r.replace(/%d/i,e)}function ke(e,t){var n=this._relativeTime[e>0?"future":"past"];return h(n)?n(t):n.replace(/%s/i,t)}var Se={};function t(e,t){var n=e.toLowerCase();Se[n]=Se[n+"s"]=Se[t]=e}function m(e){return typeof e==="string"?Se[e]||Se[e.toLowerCase()]:undefined}function Ee(e){var t={},n,a;for(a in e)if(s(e,a)){n=m(a);if(n)t[n]=e[a]}return t}var xe={};function n(e,t){xe[e]=t}function Ce(e){var t=[],n;for(n in e)if(s(e,n))t.push({unit:n,priority:xe[n]});t.sort(function(e,t){return e.priority-t.priority});return t}function Le(e){return e%4===0&&e%100!==0||e%400===0}function g(e){if(e<0)return Math.ceil(e)||0;else return Math.floor(e)}function y(e){var t=+e,n=0;if(t!==0&&isFinite(t))n=g(t);return n}function Te(t,n){return function(e){if(e!=null){Oe(this,t,e);c.updateOffset(this,n);return this}else return De(this,t)}}function De(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Oe(e,t,n){if(e.isValid()&&!isNaN(n))if(t==="FullYear"&&Le(e.year())&&e.month()===1&&e.date()===29){n=y(n);e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),ot(n,e.month()))}else e._d["set"+(e._isUTC?"UTC":"")+t](n)}function Ne(e){e=m(e);if(h(this[e]))return this[e]();return this}function Pe(e,t){if(typeof e==="object"){e=Ee(e);var n=Ce(e),a,r=n.length;for(a=0;a68?1900:2e3)};var Mt=Te("FullYear",true);function kt(){return Le(this.year())}function St(e,t,n,a,r,o,i){var l;if(e<100&&e>=0){l=new Date(e+400,t,n,a,r,o,i);if(isFinite(l.getFullYear()))l.setFullYear(e)}else l=new Date(e,t,n,a,r,o,i);return l}function Et(e){var t,n;if(e<100&&e>=0){n=Array.prototype.slice.call(arguments);n[0]=e+400;t=new Date(Date.UTC.apply(null,n));if(isFinite(t.getUTCFullYear()))t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function xt(e,t,n){var a=7+t-n,r=(7+Et(e,0,a).getUTCDay()-t)%7;return-r+a-1}function Ct(e,t,n,a,r){var o=(7+n-a)%7,i=xt(e,a,r),l=1+7*(t-1)+o+i,s,u;if(l<=0){s=e-1;u=wt(s)+l}else if(l>wt(e)){s=e+1;u=l-wt(e)}else{s=e;u=l}return{year:s,dayOfYear:u}}function Lt(e,t,n){var a=xt(e.year(),t,n),r=Math.floor((e.dayOfYear()-a-1)/7)+1,o,i;if(r<1){i=e.year()-1;o=r+T(i,t,n)}else if(r>T(e.year(),t,n)){o=r-T(e.year(),t,n);i=e.year()+1}else{i=e.year();o=r}return{week:o,year:i}}function T(e,t,n){var a=xt(e,t,n),r=xt(e+1,t,n);return(wt(e)-a+r)/7}function Tt(e){return Lt(e,this._week.dow,this._week.doy).week}a("w",["ww",2],"wo","week"),a("W",["WW",2],"Wo","isoWeek"),t("week","w"),t("isoWeek","W"),n("week",5),n("isoWeek",5),_("w",v),_("ww",v,r),_("W",v),_("WW",v,r),Ze(["w","ww","W","WW"],function(e,t,n,a){t[a.substr(0,1)]=y(e)});var Dt={dow:0,doy:6};function Ot(){return this._week.dow}function Nt(){return this._week.doy}function Pt(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function jt(e){var t=Lt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}function Yt(e,t){if(typeof e!=="string")return e;if(!isNaN(e))return parseInt(e,10);e=t.weekdaysParse(e);if(typeof e==="number")return e;return null}function It(e,t){if(typeof e==="string")return t.weekdaysParse(e)%7||7;return isNaN(e)?null:e}function Rt(e,t){return e.slice(t,7).concat(e.slice(0,t))}a("d",0,"do","day"),a("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),a("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),a("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),a("e",0,0,"weekday"),a("E",0,0,"isoWeekday"),t("day","d"),t("weekday","e"),t("isoWeekday","E"),n("day",11),n("weekday",11),n("isoWeekday",11),_("d",v),_("e",v),_("E",v),_("dd",function(e,t){return t.weekdaysMinRegex(e)}),_("ddd",function(e,t){return t.weekdaysShortRegex(e)}),_("dddd",function(e,t){return t.weekdaysRegex(e)}),Ze(["dd","ddd","dddd"],function(e,t,n,a){var r=n._locale.weekdaysParse(e,a,n._strict);if(r!=null)t.d=r;else f(n).invalidWeekday=e}),Ze(["d","e","E"],function(e,t,n,a){t[a]=y(e)});var At="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ht="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ft="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),zt=qe,Wt=qe,Vt=qe;function Bt(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&e!==true&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===true?Rt(n,this._week.dow):e?n[e.day()]:n}function Ut(e){return e===true?Rt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Kt(e){return e===true?Rt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Gt(e,t,n){var a,r,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse){this._weekdaysParse=[];this._shortWeekdaysParse=[];this._minWeekdaysParse=[];for(a=0;a<7;++a){o=d([2e3,1]).day(a);this._minWeekdaysParse[a]=this.weekdaysMin(o,"").toLocaleLowerCase();this._shortWeekdaysParse[a]=this.weekdaysShort(o,"").toLocaleLowerCase();this._weekdaysParse[a]=this.weekdays(o,"").toLocaleLowerCase()}}if(n)if(t==="dddd"){r=L.call(this._weekdaysParse,i);return r!==-1?r:null}else if(t==="ddd"){r=L.call(this._shortWeekdaysParse,i);return r!==-1?r:null}else{r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else if(t==="dddd"){r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._shortWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else if(t==="ddd"){r=L.call(this._shortWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._minWeekdaysParse,i);return r!==-1?r:null}else{r=L.call(this._minWeekdaysParse,i);if(r!==-1)return r;r=L.call(this._weekdaysParse,i);if(r!==-1)return r;r=L.call(this._shortWeekdaysParse,i);return r!==-1?r:null}}function qt(e,t,n){var a,r,o;if(this._weekdaysParseExact)return Gt.call(this,e,t,n);if(!this._weekdaysParse){this._weekdaysParse=[];this._minWeekdaysParse=[];this._shortWeekdaysParse=[];this._fullWeekdaysParse=[]}for(a=0;a<7;a++){r=d([2e3,1]).day(a);if(n&&!this._fullWeekdaysParse[a]){this._fullWeekdaysParse[a]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i");this._shortWeekdaysParse[a]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i");this._minWeekdaysParse[a]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")}if(!this._weekdaysParse[a]){o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,"");this._weekdaysParse[a]=new RegExp(o.replace(".",""),"i")}if(n&&t==="dddd"&&this._fullWeekdaysParse[a].test(e))return a;else if(n&&t==="ddd"&&this._shortWeekdaysParse[a].test(e))return a;else if(n&&t==="dd"&&this._minWeekdaysParse[a].test(e))return a;else if(!n&&this._weekdaysParse[a].test(e))return a}}function $t(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();if(e!=null){e=Yt(e,this.localeData());return this.add(e-t,"d")}else return t}function Jt(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function Xt(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=It(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function Qt(e){if(this._weekdaysParseExact){if(!s(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysStrictRegex;else return this._weekdaysRegex}else{if(!s(this,"_weekdaysRegex"))this._weekdaysRegex=zt;return this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex}}function Zt(e){if(this._weekdaysParseExact){if(!s(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysShortStrictRegex;else return this._weekdaysShortRegex}else{if(!s(this,"_weekdaysShortRegex"))this._weekdaysShortRegex=Wt;return this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}}function en(e){if(this._weekdaysParseExact){if(!s(this,"_weekdaysRegex"))tn.call(this);if(e)return this._weekdaysMinStrictRegex;else return this._weekdaysMinRegex}else{if(!s(this,"_weekdaysMinRegex"))this._weekdaysMinRegex=Vt;return this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}}function tn(){function e(e,t){return t.length-e.length}var t=[],n=[],a=[],r=[],o,i,l,s,u;for(o=0;o<7;o++){i=d([2e3,1]).day(o);l=b(this.weekdaysMin(i,""));s=b(this.weekdaysShort(i,""));u=b(this.weekdays(i,""));t.push(l);n.push(s);a.push(u);r.push(l);r.push(s);r.push(u)}t.sort(e);n.sort(e);a.sort(e);r.sort(e);this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i");this._weekdaysShortRegex=this._weekdaysRegex;this._weekdaysMinRegex=this._weekdaysRegex;this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i");this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i");this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function nn(){return this.hours()%12||12}function an(){return this.hours()||24}function rn(e,t){a(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function on(e,t){return t._meridiemParse}function ln(e){return(e+"").toLowerCase().charAt(0)==="p"}a("H",["HH",2],0,"hour"),a("h",["hh",2],0,nn),a("k",["kk",2],0,an),a("hmm",0,0,function(){return""+nn.apply(this)+o(this.minutes(),2)}),a("hmmss",0,0,function(){return""+nn.apply(this)+o(this.minutes(),2)+o(this.seconds(),2)}),a("Hmm",0,0,function(){return""+this.hours()+o(this.minutes(),2)}),a("Hmmss",0,0,function(){return""+this.hours()+o(this.minutes(),2)+o(this.seconds(),2)}),rn("a",true),rn("A",false),t("hour","h"),n("hour",13),_("a",on),_("A",on),_("H",v),_("h",v),_("k",v),_("HH",v,r),_("hh",v,r),_("kk",v,r),_("hmm",Ae),_("hmmss",He),_("Hmm",Ae),_("Hmmss",He),w(["H","HH"],E),w(["k","kk"],function(e,t,n){var a=y(e);t[E]=a===24?0:a}),w(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e);n._meridiem=e}),w(["h","hh"],function(e,t,n){t[E]=y(e);f(n).bigHour=true}),w("hmm",function(e,t,n){var a=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a));f(n).bigHour=true}),w("hmmss",function(e,t,n){var a=e.length-4,r=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a,2));t[C]=y(e.substr(r));f(n).bigHour=true}),w("Hmm",function(e,t,n){var a=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a))}),w("Hmmss",function(e,t,n){var a=e.length-4,r=e.length-2;t[E]=y(e.substr(0,a));t[x]=y(e.substr(a,2));t[C]=y(e.substr(r))});var sn,un=Te("Hours",true);function dn(e,t,n){if(e>11)return n?"pm":"PM";else return n?"am":"AM"}var cn={calendar:re,longDateFormat:he,invalidDate:ge,ordinal:ve,dayOfMonthOrdinalParse:_e,relativeTime:we,months:it,monthsShort:lt,week:Dt,weekdays:At,weekdaysMin:Ft,weekdaysShort:Ht,meridiemParse:/[ap]\.?m?\.?/i},D={},fn={},pn;function hn(e,t){var n,a=Math.min(e.length,t.length);for(n=0;n0){r=vn(o.slice(0,n).join("-"));if(r)return r;if(a&&a.length>=n&&hn(o,a)>=n-1)break;n--}t++}return pn}function yn(e){return e.match("^[^/\\\\]*$")!=null}function vn(t){var e=null,n;if(D[t]===undefined&&typeof di!=="undefined"&&di&&di.exports&&yn(t))try{e=pn._abbr;n=ci;fi(514)("./"+t);_n(e)}catch(e){D[t]=null}return D[t]}function _n(e,t){var n;if(e){if(l(t))n=Mn(e);else n=bn(e,t);if(n)pn=n;else if(typeof console!=="undefined"&&console.warn)console.warn("Locale "+e+" not found. Did you forget to load it?")}return pn._abbr}function bn(e,t){if(t!==null){var n,a=cn;t.abbr=e;if(D[e]!=null){ee("defineLocaleOverride","use moment.updateLocale(localeName, config) to change "+"an existing locale. moment.defineLocale(localeName, "+"config) should only be used for creating a new locale "+"See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");a=D[e]._config}else if(t.parentLocale!=null)if(D[t.parentLocale]!=null)a=D[t.parentLocale]._config;else{n=vn(t.parentLocale);if(n!=null)a=n._config;else{if(!fn[t.parentLocale])fn[t.parentLocale]=[];fn[t.parentLocale].push({name:e,config:t});return null}}D[e]=new ae(ne(a,t));if(fn[e])fn[e].forEach(function(e){bn(e.name,e.config)});_n(e);return D[e]}else{delete D[e];return null}}function wn(e,t){if(t!=null){var n,a,r=cn;if(D[e]!=null&&D[e].parentLocale!=null)D[e].set(ne(D[e]._config,t));else{a=vn(e);if(a!=null)r=a._config;t=ne(r,t);if(a==null)t.abbr=e;n=new ae(t);n.parentLocale=D[e];D[e]=n}_n(e)}else if(D[e]!=null)if(D[e].parentLocale!=null){D[e]=D[e].parentLocale;if(e===_n())_n(e)}else if(D[e]!=null)delete D[e];return D[e]}function Mn(e){var t;if(e&&e._locale&&e._locale._abbr)e=e._locale._abbr;if(!e)return pn;if(!i(e)){t=vn(e);if(t)return t;e=[e]}return gn(e)}function kn(){return Z(D)}function Sn(e){var t,n=e._a;if(n&&f(e).overflow===-2){t=n[k]<0||n[k]>11?k:n[S]<1||n[S]>ot(n[M],n[k])?S:n[E]<0||n[E]>24||n[E]===24&&(n[x]!==0||n[C]!==0||n[tt]!==0)?E:n[x]<0||n[x]>59?x:n[C]<0||n[C]>59?C:n[tt]<0||n[tt]>999?tt:-1;if(f(e)._overflowDayOfYear&&(tS))t=S;if(f(e)._overflowWeeks&&t===-1)t=nt;if(f(e)._overflowWeekday&&t===-1)t=at;f(e).overflow=t}return e}var En=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,xn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Cn=/Z|[+-]\d\d(?::?\d\d)?/,Ln=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,false],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,false],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,false],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,false],["YYYY",/\d{4}/,false]],Tn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dn=/^\/?Date\((-?\d+)/i,On=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Nn={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Pn(e){var t,n,a=e._i,r=En.exec(a)||xn.exec(a),o,i,l,s,u=Ln.length,d=Tn.length;if(r){f(e).iso=true;for(t=0,n=u;twt(i)||e._dayOfYear===0)f(e)._overflowDayOfYear=true;n=Et(i,0,e._dayOfYear);e._a[k]=n.getUTCMonth();e._a[S]=n.getUTCDate()}for(t=0;t<3&&e._a[t]==null;++t)e._a[t]=a[t]=r[t];for(;t<7;t++)e._a[t]=a[t]=e._a[t]==null?t===2?1:0:e._a[t];if(e._a[E]===24&&e._a[x]===0&&e._a[C]===0&&e._a[tt]===0){e._nextDay=true;e._a[E]=0}e._d=(e._useUTC?Et:St).apply(null,a);o=e._useUTC?e._d.getUTCDay():e._d.getDay();if(e._tzm!=null)e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm);if(e._nextDay)e._a[E]=24;if(e._w&&typeof e._w.d!=="undefined"&&e._w.d!==o)f(e).weekdayMismatch=true}function Bn(e){var t,n,a,r,o,i,l,s,u;t=e._w;if(t.GG!=null||t.W!=null||t.E!=null){o=1;i=4;n=zn(t.GG,e._a[M],Lt(O(),1,4).year);a=zn(t.W,1);r=zn(t.E,1);if(r<1||r>7)s=true}else{o=e._locale._week.dow;i=e._locale._week.doy;u=Lt(O(),o,i);n=zn(t.gg,e._a[M],u.year);a=zn(t.w,u.week);if(t.d!=null){r=t.d;if(r<0||r>6)s=true}else if(t.e!=null){r=t.e+o;if(t.e<0||t.e>6)s=true}else r=o}if(a<1||a>T(n,o,i))f(e)._overflowWeeks=true;else if(s!=null)f(e)._overflowWeekday=true;else{l=Ct(n,a,r,o,i);e._a[M]=l.year;e._dayOfYear=l.dayOfYear}}function Un(e){if(e._f===c.ISO_8601){Pn(e);return}if(e._f===c.RFC_2822){Hn(e);return}e._a=[];f(e).empty=true;var t=""+e._i,n,a,r,o,i,l=t.length,s=0,u,d;r=pe(e._f,e._locale).match(ie)||[];d=r.length;for(n=0;n0)f(e).unusedInput.push(i);t=t.slice(t.indexOf(a)+a.length);s+=a.length}if(ue[o]){if(a)f(e).empty=false;else f(e).unusedTokens.push(o);et(o,a,e)}else if(e._strict&&!a)f(e).unusedTokens.push(o)}f(e).charsLeftOver=l-s;if(t.length>0)f(e).unusedInput.push(t);if(e._a[E]<=12&&f(e).bigHour===true&&e._a[E]>0)f(e).bigHour=undefined;f(e).parsedDateParts=e._a.slice(0);f(e).meridiem=e._meridiem;e._a[E]=Kn(e._locale,e._a[E],e._meridiem);u=f(e).era;if(u!==null)e._a[M]=e._locale.erasConvertYear(u,e._a[M]);Vn(e);Sn(e)}function Kn(e,t,n){var a;if(n==null)return t;if(e.meridiemHour!=null)return e.meridiemHour(t,n);else if(e.isPM!=null){a=e.isPM(n);if(a&&t<12)t+=12;if(!a&&t===12)t=0;return t}else return t}function Gn(e){var t,n,a,r,o,i,l=false,s=e._f.length;if(s===0){f(e).invalidFormat=true;e._d=new Date(NaN);return}for(r=0;rthis?this:e;else return K()});function ta(e,t){var n,a;if(t.length===1&&i(t[0]))t=t[0];if(!t.length)return O();n=t[0];for(a=1;athis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ea(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={},t;$(e,this);e=Jn(e);if(e._a){t=e._isUTC?d(e._a):O(e._a);this._isDSTShifted=this.isValid()&&fa(e._a,t.toArray())>0}else this._isDSTShifted=false;return this._isDSTShifted}function xa(){return this.isValid()?!this._isUTC:false}function Ca(){return this.isValid()?this._isUTC:false}function La(){return this.isValid()?this._isUTC&&this._offset===0:false}c.updateOffset=function(){};var Ta=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Da=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function N(e,t){var n=e,a=null,r,o,i;if(da(e))n={ms:e._milliseconds,d:e._days,M:e._months};else if(u(e)||!isNaN(+e)){n={};if(t)n[t]=+e;else n.milliseconds=+e}else if(a=Ta.exec(e)){r=a[1]==="-"?-1:1;n={y:0,d:y(a[S])*r,h:y(a[E])*r,m:y(a[x])*r,s:y(a[C])*r,ms:y(ca(a[tt]*1e3))*r}}else if(a=Da.exec(e)){r=a[1]==="-"?-1:1;n={y:Oa(a[2],r),M:Oa(a[3],r),w:Oa(a[4],r),d:Oa(a[5],r),h:Oa(a[6],r),m:Oa(a[7],r),s:Oa(a[8],r)}}else if(n==null)n={};else if(typeof n==="object"&&("from"in n||"to"in n)){i=Pa(O(n.from),O(n.to));n={};n.ms=i.milliseconds;n.M=i.months}o=new ua(n);if(da(e)&&s(e,"_locale"))o._locale=e._locale;if(da(e)&&s(e,"_isValid"))o._isValid=e._isValid;return o}function Oa(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Na(e,t){var n={};n.months=t.month()-e.month()+(t.year()-e.year())*12;if(e.clone().add(n.months,"M").isAfter(t))--n.months;n.milliseconds=+t-+e.clone().add(n.months,"M");return n}function Pa(e,t){var n;if(!(e.isValid()&&t.isValid()))return{milliseconds:0,months:0};t=ga(t,e);if(e.isBefore(t))n=Na(e,t);else{n=Na(t,e);n.milliseconds=-n.milliseconds;n.months=-n.months}return n}function ja(r,o){return function(e,t){var n,a;if(t!==null&&!isNaN(+t)){ee(o,"moment()."+o+"(period, number) is deprecated. Please use moment()."+o+"(number, period). "+"See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");a=e;e=t;t=a}n=N(e,t);Ya(this,n,r);return this}}function Ya(e,t,n,a){var r=t._milliseconds,o=ca(t._days),i=ca(t._months);if(!e.isValid())return;a=a==null?true:a;if(i)mt(e,De(e,"Month")+i*n);if(o)Oe(e,"Date",De(e,"Date")+o*n);if(r)e._d.setTime(e._d.valueOf()+r*n);if(a)c.updateOffset(e,o||i)}N.fn=ua.prototype,N.invalid=sa;var Ia=ja(1,"add"),Ra=ja(-1,"subtract");function Aa(e){return typeof e==="string"||e instanceof String}function Ha(e){return p(e)||z(e)||Aa(e)||u(e)||za(e)||Fa(e)||e===null||e===undefined}function Fa(e){var t=H(e)&&!F(e),n=false,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,o,i=a.length;for(r=0;rn.valueOf();else return n.valueOf()9999)return fe(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(h(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",fe(n,"Z"));return fe(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function nr(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,a,r,o;if(!this.isLocal()){e=this.utcOffset()===0?"moment.utc":"moment.parseZone";t="Z"}n="["+e+'("]';a=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY";r="-MM-DD[T]HH:mm:ss.SSS";o=t+'[")]';return this.format(n+a+r+o)}function ar(e){if(!e)e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat;var t=fe(this,e);return this.localeData().postformat(t)}function rr(e,t){if(this.isValid()&&(p(e)&&e.isValid()||O(e).isValid()))return N({to:this,from:e}).locale(this.locale()).humanize(!t);else return this.localeData().invalidDate()}function or(e){return this.from(O(),e)}function ir(e,t){if(this.isValid()&&(p(e)&&e.isValid()||O(e).isValid()))return N({from:this,to:e}).locale(this.locale()).humanize(!t);else return this.localeData().invalidDate()}function lr(e){return this.to(O(),e)}function sr(e){var t;if(e===undefined)return this._locale._abbr;else{t=Mn(e);if(t!=null)this._locale=t;return this}}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ur=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){if(e===undefined)return this.localeData();else return this.locale(e)});function dr(){return this._locale}var cr=1e3,fr=60*cr,pr=60*fr,hr=(365*400+97)*24*pr;function mr(e,t){return(e%t+t)%t}function gr(e,t,n){if(e<100&&e>=0)return new Date(e+400,t,n)-hr;else return new Date(e,t,n).valueOf()}function yr(e,t,n){if(e<100&&e>=0)return Date.UTC(e+400,t,n)-hr;else return Date.UTC(e,t,n)}function vr(e){var t,n;e=m(e);if(e===undefined||e==="millisecond"||!this.isValid())return this;n=this._isUTC?yr:gr;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf();t-=mr(t+(this._isUTC?0:this.utcOffset()*fr),pr);break;case"minute":t=this._d.valueOf();t-=mr(t,fr);break;case"second":t=this._d.valueOf();t-=mr(t,cr);break}this._d.setTime(t);c.updateOffset(this,true);return this}function _r(e){var t,n;e=m(e);if(e===undefined||e==="millisecond"||!this.isValid())return this;n=this._isUTC?yr:gr;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf();t+=pr-mr(t+(this._isUTC?0:this.utcOffset()*fr),pr)-1;break;case"minute":t=this._d.valueOf();t+=fr-mr(t,fr)-1;break;case"second":t=this._d.valueOf();t+=cr-mr(t,cr)-1;break}this._d.setTime(t);c.updateOffset(this,true);return this}function br(){return this._d.valueOf()-(this._offset||0)*6e4}function wr(){return Math.floor(this.valueOf()/1e3)}function Mr(){return new Date(this.valueOf())}function kr(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Sr(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Er(){return this.isValid()?this.toISOString():null}function xr(){return U(this)}function Cr(){return V({},f(this))}function Lr(){return f(this).overflow}function Tr(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Dr(e,t){var n,a,r,o=this._eras||Mn("en")._eras;for(n=0,a=o.length;n=0)return o[a]}}function Nr(e,t){var n=e.since<=e.until?+1:-1;if(t===undefined)return c(e.since).year();else return c(e.since).year()+(t-e.offset)*n}function Pr(){var e,t,n,a=this.localeData().eras();for(e=0,t=a.length;eo)t=o;return Zr.call(this,e,t,n,a,r)}}function Zr(e,t,n,a,r){var o=Ct(e,t,n,a,r),i=Et(o.year,0,o.dayOfYear);this.year(i.getUTCFullYear());this.month(i.getUTCMonth());this.date(i.getUTCDate());return this}function eo(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}a("N",0,0,"eraAbbr"),a("NN",0,0,"eraAbbr"),a("NNN",0,0,"eraAbbr"),a("NNNN",0,0,"eraName"),a("NNNNN",0,0,"eraNarrow"),a("y",["y",1],"yo","eraYear"),a("y",["yy",2],0,"eraYear"),a("y",["yyy",3],0,"eraYear"),a("y",["yyyy",4],0,"eraYear"),_("N",Fr),_("NN",Fr),_("NNN",Fr),_("NNNN",zr),_("NNNNN",Wr),w(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,a){var r=n._locale.erasParse(e,a,n._strict);if(r)f(n).era=r;else f(n).invalidEra=e}),_("y",Ve),_("yy",Ve),_("yyy",Ve),_("yyyy",Ve),_("yo",Vr),w(["y","yy","yyy","yyyy"],M),w(["yo"],function(e,t,n,a){var r;if(n._locale._eraYearOrdinalRegex)r=e.match(n._locale._eraYearOrdinalRegex);if(n._locale.eraYearOrdinalParse)t[M]=n._locale.eraYearOrdinalParse(e,r);else t[M]=parseInt(e,10)}),a(0,["gg",2],0,function(){return this.weekYear()%100}),a(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ur("gggg","weekYear"),Ur("ggggg","weekYear"),Ur("GGGG","isoWeekYear"),Ur("GGGGG","isoWeekYear"),t("weekYear","gg"),t("isoWeekYear","GG"),n("weekYear",1),n("isoWeekYear",1),_("G",Be),_("g",Be),_("GG",v,r),_("gg",v,r),_("GGGG",ze,Ie),_("gggg",ze,Ie),_("GGGGG",We,Re),_("ggggg",We,Re),Ze(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,a){t[a.substr(0,2)]=y(e)}),Ze(["gg","GG"],function(e,t,n,a){t[a]=c.parseTwoDigitYear(e)}),a("Q",0,"Qo","quarter"),t("quarter","Q"),n("quarter",7),_("Q",je),w("Q",function(e,t){t[k]=(y(e)-1)*3}),a("D",["DD",2],"Do","date"),t("date","D"),n("date",9),_("D",v),_("DD",v,r),_("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),w(["D","DD"],S),w("Do",function(e,t){t[S]=y(e.match(v)[0])});var to=Te("Date",true);function no(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}a("DDD",["DDDD",3],"DDDo","dayOfYear"),t("dayOfYear","DDD"),n("dayOfYear",4),_("DDD",Fe),_("DDDD",Ye),w(["DDD","DDDD"],function(e,t,n){n._dayOfYear=y(e)}),a("m",["mm",2],0,"minute"),t("minute","m"),n("minute",14),_("m",v),_("mm",v,r),w(["m","mm"],x);var ao=Te("Minutes",false),ro=(a("s",["ss",2],0,"second"),t("second","s"),n("second",15),_("s",v),_("ss",v,r),w(["s","ss"],C),Te("Seconds",false)),oo,io;for(a("S",0,0,function(){return~~(this.millisecond()/100)}),a(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),a(0,["SSS",3],0,"millisecond"),a(0,["SSSS",4],0,function(){return this.millisecond()*10}),a(0,["SSSSS",5],0,function(){return this.millisecond()*100}),a(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),a(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),a(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),a(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),t("millisecond","ms"),n("millisecond",16),_("S",Fe,je),_("SS",Fe,r),_("SSS",Fe,Ye),oo="SSSS";oo.length<=9;oo+="S")_(oo,Ve);function lo(e,t){t[tt]=y(("0."+e)*1e3)}for(oo="S";oo.length<=9;oo+="S")w(oo,lo);function so(){return this._isUTC?"UTC":""}function uo(){return this._isUTC?"Coordinated Universal Time":""}io=Te("Milliseconds",false),a("z",0,0,"zoneAbbr"),a("zz",0,0,"zoneName");var P=J.prototype;if(P.add=Ia,P.calendar=Ba,P.clone=Ua,P.diff=Qa,P.endOf=_r,P.format=ar,P.from=rr,P.fromNow=or,P.to=ir,P.toNow=lr,P.get=Ne,P.invalidAt=Lr,P.isAfter=Ka,P.isBefore=Ga,P.isBetween=qa,P.isSame=$a,P.isSameOrAfter=Ja,P.isSameOrBefore=Xa,P.isValid=xr,P.lang=ur,P.locale=sr,P.localeData=dr,P.max=ea,P.min=Zn,P.parsingFlags=Cr,P.set=Pe,P.startOf=vr,P.subtract=Ra,P.toArray=kr,P.toObject=Sr,P.toDate=Mr,P.toISOString=tr,P.inspect=nr,typeof Symbol!=="undefined"&&Symbol.for!=null)P[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"};function co(e){return O(e*1e3)}function fo(){return O.apply(null,arguments).parseZone()}function po(e){return e}P.toJSON=Er,P.toString=er,P.unix=wr,P.valueOf=br,P.creationData=Tr,P.eraName=Pr,P.eraNarrow=jr,P.eraAbbr=Yr,P.eraYear=Ir,P.year=Mt,P.isLeapYear=kt,P.weekYear=Kr,P.isoWeekYear=Gr,P.quarter=P.quarters=eo,P.month=gt,P.daysInMonth=yt,P.week=P.weeks=Pt,P.isoWeek=P.isoWeeks=jt,P.weeksInYear=Jr,P.weeksInWeekYear=Xr,P.isoWeeksInYear=qr,P.isoWeeksInISOWeekYear=$r,P.date=to,P.day=P.days=$t,P.weekday=Jt,P.isoWeekday=Xt,P.dayOfYear=no,P.hour=P.hours=un,P.minute=P.minutes=ao,P.second=P.seconds=ro,P.millisecond=P.milliseconds=io,P.utcOffset=va,P.utc=ba,P.local=wa,P.parseZone=Ma,P.hasAlignedHourOffset=ka,P.isDST=Sa,P.isLocal=xa,P.isUtcOffset=Ca,P.isUtc=La,P.isUTC=La,P.zoneAbbr=so,P.zoneName=uo,P.dates=e("dates accessor is deprecated. Use date instead.",to),P.months=e("months accessor is deprecated. Use month instead",gt),P.years=e("years accessor is deprecated. Use year instead",Mt),P.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",_a),P.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ea);var j=ae.prototype;function ho(e,t,n,a){var r=Mn(),o=d().set(a,t);return r[n](o,e)}function mo(e,t,n){if(u(e)){t=e;e=undefined}e=e||"";if(t!=null)return ho(e,t,n,"month");var a,r=[];for(a=0;a<12;a++)r[a]=ho(e,a,n,"month");return r}function go(e,t,n,a){if(typeof e==="boolean"){if(u(t)){n=t;t=undefined}t=t||""}else{t=e;n=t;e=false;if(u(t)){n=t;t=undefined}t=t||""}var r=Mn(),o=e?r._week.dow:0,i,l=[];if(n!=null)return ho(t,(n+o)%7,a,"day");for(i=0;i<7;i++)l[i]=ho(t,(i+o)%7,a,"day");return l}function yo(e,t){return mo(e,t,"months")}function vo(e,t){return mo(e,t,"monthsShort")}function _o(e,t,n){return go(e,t,n,"weekdays")}function bo(e,t,n){return go(e,t,n,"weekdaysShort")}function wo(e,t,n){return go(e,t,n,"weekdaysMin")}j.calendar=oe,j.longDateFormat=me,j.invalidDate=ye,j.ordinal=be,j.preparse=po,j.postformat=po,j.relativeTime=Me,j.pastFuture=ke,j.set=te,j.eras=Dr,j.erasParse=Or,j.erasConvertYear=Nr,j.erasAbbrRegex=Ar,j.erasNameRegex=Rr,j.erasNarrowRegex=Hr,j.months=ct,j.monthsShort=ft,j.monthsParse=ht,j.monthsRegex=_t,j.monthsShortRegex=vt,j.week=Tt,j.firstDayOfYear=Nt,j.firstDayOfWeek=Ot,j.weekdays=Bt,j.weekdaysMin=Kt,j.weekdaysShort=Ut,j.weekdaysParse=qt,j.weekdaysRegex=Qt,j.weekdaysShortRegex=Zt,j.weekdaysMinRegex=en,j.isPM=ln,j.meridiem=dn,_n("en",{eras:[{since:"0001-01-01",until:+Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-Infinity,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=y(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),c.lang=e("moment.lang is deprecated. Use moment.locale instead.",_n),c.langData=e("moment.langData is deprecated. Use moment.localeData instead.",Mn);var Mo=Math.abs;function ko(){var e=this._data;this._milliseconds=Mo(this._milliseconds);this._days=Mo(this._days);this._months=Mo(this._months);e.milliseconds=Mo(e.milliseconds);e.seconds=Mo(e.seconds);e.minutes=Mo(e.minutes);e.hours=Mo(e.hours);e.months=Mo(e.months);e.years=Mo(e.years);return this}function So(e,t,n,a){var r=N(t,n);e._milliseconds+=a*r._milliseconds;e._days+=a*r._days;e._months+=a*r._months;return e._bubble()}function Eo(e,t){return So(this,e,t,1)}function xo(e,t){return So(this,e,t,-1)}function Co(e){if(e<0)return Math.floor(e);else return Math.ceil(e)}function Lo(){var e=this._milliseconds,t=this._days,n=this._months,a=this._data,r,o,i,l,s;if(!(e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0)){e+=Co(Do(n)+t)*864e5;t=0;n=0}a.milliseconds=e%1e3;r=g(e/1e3);a.seconds=r%60;o=g(r/60);a.minutes=o%60;i=g(o/60);a.hours=i%24;t+=g(i/24);s=g(To(t));n+=s;t-=Co(Do(s));l=g(n/12);n%=12;a.days=t;a.months=n;a.years=l;return this}function To(e){return e*4800/146097}function Do(e){return e*146097/4800}function Oo(e){if(!this.isValid())return NaN;var t,n,a=this._milliseconds;e=m(e);if(e==="month"||e==="quarter"||e==="year"){t=this._days+a/864e5;n=this._months+To(t);switch(e){case"month":return n;case"quarter":return n/3;case"year":return n/12}}else{t=this._days+Math.round(Do(this._months));switch(e){case"week":return t/7+a/6048e5;case"day":return t+a/864e5;case"hour":return t*24+a/36e5;case"minute":return t*1440+a/6e4;case"second":return t*86400+a/1e3;case"millisecond":return Math.floor(t*864e5)+a;default:throw new Error("Unknown unit "+e)}}}function No(){if(!this.isValid())return NaN;return this._milliseconds+this._days*864e5+this._months%12*2592e6+y(this._months/12)*31536e6}function Po(e){return function(){return this.as(e)}}var jo=Po("ms"),Yo=Po("s"),Io=Po("m"),Ro=Po("h"),Ao=Po("d"),Ho=Po("w"),Fo=Po("M"),zo=Po("Q"),Wo=Po("y");function Vo(){return N(this)}function Bo(e){e=m(e);return this.isValid()?this[e+"s"]():NaN}function Uo(e){return function(){return this.isValid()?this._data[e]:NaN}}var Ko=Uo("milliseconds"),Go=Uo("seconds"),qo=Uo("minutes"),$o=Uo("hours"),Jo=Uo("days"),Xo=Uo("months"),Qo=Uo("years");function Zo(){return g(this.days()/7)}var ei=Math.round,ti={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ni(e,t,n,a,r){return r.relativeTime(t||1,!!n,e,a)}function ai(e,t,n,a){var r=N(e).abs(),o=ei(r.as("s")),i=ei(r.as("m")),l=ei(r.as("h")),s=ei(r.as("d")),u=ei(r.as("M")),d=ei(r.as("w")),c=ei(r.as("y")),f=o<=n.ss&&["s",o]||o0;f[4]=a;return ni.apply(null,f)}function ri(e){if(e===undefined)return ei;if(typeof e==="function"){ei=e;return true}return false}function oi(e,t){if(ti[e]===undefined)return false;if(t===undefined)return ti[e];ti[e]=t;if(e==="s")ti.ss=t-1;return true}function ii(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=false,a=ti,r,o;if(typeof e==="object"){t=e;e=false}if(typeof e==="boolean")n=e;if(typeof t==="object"){a=Object.assign({},ti,t);if(t.s!=null&&t.ss==null)a.ss=t.s-1}r=this.localeData();o=ai(this,!n,a,r);if(n)o=r.pastFuture(+this,o);return r.postformat(o)}var li=Math.abs;function si(e){return(e>0)-(e<0)||+e}function ui(){if(!this.isValid())return this.localeData().invalidDate();var e=li(this._milliseconds)/1e3,t=li(this._days),n=li(this._months),a,r,o,i,l=this.asSeconds(),s,u,d,c;if(!l)return"P0D";a=g(e/60);r=g(a/60);e%=60;a%=60;o=g(n/12);n%=12;i=e?e.toFixed(3).replace(/\.?0+$/,""):"";s=l<0?"-":"";u=si(this._months)!==si(l)?"-":"";d=si(this._days)!==si(l)?"-":"";c=si(this._milliseconds)!==si(l)?"-":"";return s+"P"+(o?u+o+"Y":"")+(n?u+n+"M":"")+(t?d+t+"D":"")+(r||a||e?"T":"")+(r?c+r+"H":"")+(a?c+a+"M":"")+(e?c+i+"S":"")}var Y=ua.prototype;return Y.isValid=la,Y.abs=ko,Y.add=Eo,Y.subtract=xo,Y.as=Oo,Y.asMilliseconds=jo,Y.asSeconds=Yo,Y.asMinutes=Io,Y.asHours=Ro,Y.asDays=Ao,Y.asWeeks=Ho,Y.asMonths=Fo,Y.asQuarters=zo,Y.asYears=Wo,Y.valueOf=No,Y._bubble=Lo,Y.clone=Vo,Y.get=Bo,Y.milliseconds=Ko,Y.seconds=Go,Y.minutes=qo,Y.hours=$o,Y.days=Jo,Y.weeks=Zo,Y.months=Xo,Y.years=Qo,Y.humanize=ii,Y.toISOString=ui,Y.toString=ui,Y.toJSON=ui,Y.locale=sr,Y.localeData=dr,Y.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ui),Y.lang=ur,a("X",0,0,"unix"),a("x",0,0,"valueOf"),_("x",Be),_("X",Ge),w("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),w("x",function(e,t,n){n._d=new Date(y(e))}), //! moment.js -d.version="2.29.1",A(O),d.fn=P,d.min=ta,d.max=na,d.now=aa,d.utc=c,d.unix=uo,d.months=go,d.isDate=z,d.locale=vn,d.invalid=K,d.duration=N,d.isMoment=u,d.weekdays=vo,d.parseZone=co,d.localeData=wn,d.isDuration=ua,d.monthsShort=yo,d.weekdaysMin=bo,d.defineLocale=_n,d.updateLocale=bn,d.locales=Mn,d.weekdaysShort=_o,d.normalizeUnits=m,d.relativeTimeRounding=ai,d.relativeTimeThreshold=ri,d.calendarFormat=Wa,d.prototype=P,d.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},d}()}.call(this,ci(512)(e))},function(e,t,n){"use strict";t.__esModule=!0;var a=d(n(2)),r=d(n(12)),o=d(n(7)),i=d(n(544)),l=d(n(567)),s=d(n(571)),u=d(n(574)),n=d(n(353));function d(e){return e&&e.__esModule?e:{default:e}}i.default.Item=o.default.config(l.default,{transform:function(e,t){var n;return"validateStatus"in e&&(t("validateStatus","validateState","Form.Item"),n=(t=e).validateStatus,t=(0,r.default)(t,["validateStatus"]),e=(0,a.default)({validateState:n},t)),e}}),i.default.Submit=s.default,i.default.Reset=u.default,i.default.Error=n.default,t.default=o.default.config(i.default,{transform:function(e,t){var n;return"direction"in e&&(t("direction","inline","Form"),n=(t=e).direction,t=(0,r.default)(t,["direction"]),"hoz"===n&&(e=(0,a.default)({inline:!0},t))),e}}),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.pickAttrs=t.datejs=t.htmlId=t.KEYCODE=t.guid=t.focus=t.support=t.str=t.obj=t.log=t.func=t.events=t.env=t.dom=void 0;var a=y(n(198)),r=y(n(201)),o=y(n(495)),i=y(n(496)),l=y(n(200)),s=y(n(91)),u=y(n(199)),d=y(n(504)),c=y(n(505)),f=y(n(506)),p=g(n(507)),h=g(n(203)),m=g(n(152)),n=g(n(508));function g(e){return e&&e.__esModule?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.dom=a,t.env=r,t.events=o,t.func=i,t.log=l,t.obj=s,t.str=u,t.support=d,t.focus=c,t.guid=p.default,t.KEYCODE=h.default,t.htmlId=f,t.datejs=m.default,t.pickAttrs=n.default},function(e,t,n){"use strict";t.__esModule=!0;var a=u(n(2)),r=u(n(12)),o=u(n(7)),i=u(n(356)),l=u(n(577)),s=u(n(578)),n=u(n(358));function u(e){return e&&e.__esModule?e:{default:e}}i.default.Password=o.default.config(l.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),i.default.TextArea=o.default.config(s.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),i.default.Group=n.default,t.default=o.default.config(i.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n,a={};for(n in e)0<=t.indexOf(n)||Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a}},function(e,t,n){var a; +c.version="2.29.3",A(O),c.fn=P,c.min=na,c.max=aa,c.now=ra,c.utc=d,c.unix=co,c.months=yo,c.isDate=z,c.locale=_n,c.invalid=K,c.duration=N,c.isMoment=p,c.weekdays=_o,c.parseZone=fo,c.localeData=Mn,c.isDuration=da,c.monthsShort=vo,c.weekdaysMin=wo,c.defineLocale=bn,c.updateLocale=wn,c.locales=kn,c.weekdaysShort=bo,c.normalizeUnits=m,c.relativeTimeRounding=ri,c.relativeTimeThreshold=oi,c.calendarFormat=Va,c.prototype=P,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c}()}.call(this,fi(513)(e))},function(e,t,n){"use strict";t.__esModule=!0;var a=d(n(2)),r=d(n(12)),o=d(n(7)),i=d(n(545)),l=d(n(568)),s=d(n(572)),u=d(n(575)),n=d(n(354));function d(e){return e&&e.__esModule?e:{default:e}}i.default.Item=o.default.config(l.default,{transform:function(e,t){var n;return"validateStatus"in e&&(t("validateStatus","validateState","Form.Item"),n=(t=e).validateStatus,t=(0,r.default)(t,["validateStatus"]),e=(0,a.default)({validateState:n},t)),e}}),i.default.Submit=s.default,i.default.Reset=u.default,i.default.Error=n.default,t.default=o.default.config(i.default,{transform:function(e,t){var n;return"direction"in e&&(t("direction","inline","Form"),n=(t=e).direction,t=(0,r.default)(t,["direction"]),"hoz"===n&&(e=(0,a.default)({inline:!0},t))),e}}),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.pickAttrs=t.datejs=t.htmlId=t.KEYCODE=t.guid=t.focus=t.support=t.str=t.obj=t.log=t.func=t.events=t.env=t.dom=void 0;var a=y(n(198)),r=y(n(201)),o=y(n(496)),i=y(n(497)),l=y(n(200)),s=y(n(94)),u=y(n(199)),d=y(n(505)),c=y(n(506)),f=y(n(507)),p=g(n(508)),h=g(n(203)),m=g(n(153)),n=g(n(509));function g(e){return e&&e.__esModule?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.dom=a,t.env=r,t.events=o,t.func=i,t.log=l,t.obj=s,t.str=u,t.support=d,t.focus=c,t.guid=p.default,t.KEYCODE=h.default,t.htmlId=f,t.datejs=m.default,t.pickAttrs=n.default},function(e,t,n){"use strict";t.__esModule=!0;var a=u(n(2)),r=u(n(12)),o=u(n(7)),i=u(n(357)),l=u(n(578)),s=u(n(579)),n=u(n(359));function u(e){return e&&e.__esModule?e:{default:e}}i.default.Password=o.default.config(l.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),i.default.TextArea=o.default.config(s.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),i.default.Group=n.default,t.default=o.default.config(i.default,{exportNames:["getInputNode","focus"],transform:function(e,t){var n;return"hasLimitHint"in e&&(t("hasLimitHint","showLimitHint","Input"),n=(t=e).hasLimitHint,t=(0,r.default)(t,["hasLimitHint"]),e=(0,a.default)({showLimitHint:n},t)),e}}),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n,a={};for(n in e)0<=t.indexOf(n)||Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a}},function(e,t,n){var a; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ -!function(){"use strict";var i={}.hasOwnProperty;function l(){for(var e=[],t=0;t")),"shouldUpdatePosition"in r&&(delete t.shouldUpdatePosition,d.log.warning("Warning: [ shouldUpdatePosition ] is deprecated at [ ]")),"minMargin"in r&&o("minMargin","top/bottom",""),"isFullScreen"in r&&(r.overFlowScroll=!r.isFullScreen,delete t.isFullScreen,o("isFullScreen","overFlowScroll","")),t;return["target","offset","beforeOpen","onOpen","afterOpen","beforePosition","onPosition","cache","safeNode","wrapperClassName","container"].forEach(function(e){var t,n,a;e in r&&(o(e,"overlayProps."+e,"Dialog"),t=(n=r).overlayProps,n=(0,l.default)(n,["overlayProps"]),a=(0,i.default)(((a={})[e]=r[e],a),t||{}),delete n[e],r=(0,i.default)({overlayProps:a},n))}),r}n.displayName="Dialog",n.Inner=p.default,n.show=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.show)(e)},n.alert=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.alert)(e)},n.confirm=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.confirm)(e)},n.success=function(e){return(0,h.success)(e)},n.error=function(e){return(0,h.error)(e)},n.notice=function(e){return(0,h.notice)(e)},n.warning=function(e){return(0,h.warning)(e)},n.help=function(e){return(0,h.help)(e)},n.withContext=h.withContext,t.default=u.default.config(n,{transform:v}),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=v(n(2)),l=v(n(12)),a=v(n(7)),r=v(n(634)),o=v(n(639)),s=v(n(642)),u=v(n(643)),d=v(n(644)),c=v(n(645)),f=v(n(647)),p=v(n(648)),h=v(n(649)),m=v(n(652)),g=v(n(389)),y=v(n(390));function v(e){return e&&e.__esModule?e:{default:e}}var _=n(10).env.ieVersion,n=[s.default,f.default,u.default,d.default,c.default,o.default,h.default,m.default],b=n.reduce(function(e,t){return e=t(e)},r.default),n=(f.default._typeMark="lock",d.default._typeMark="expanded",s.default._typeMark="fixed",n.reduce(function(e,t){var n=!_;return e="lock"===t._typeMark?(n?(0,p.default):(0,f.default))(e):"expanded"===t._typeMark?n?(0,d.default)(e,!0):(0,d.default)(e):"fixed"===t._typeMark?n?(0,s.default)(e,!0):(0,s.default)(e):t(e)},r.default));b.Base=r.default,b.fixed=s.default,b.lock=f.default,b.selection=u.default,b.expanded=d.default,b.tree=o.default,b.virtual=c.default,b.list=h.default,b.sticky=m.default,b.GroupHeader=g.default,b.GroupFooter=y.default,b.StickyLock=a.default.config(n,{componentName:"Table"}),t.default=a.default.config(b,{componentName:"Table",transform:function(e,t){var n,a,r,o;return"expandedRowKeys"in e&&(t("expandedRowKeys","openRowKeys","Table"),o=(r=e).expandedRowKeys,r=(0,l.default)(r,["expandedRowKeys"]),e=(0,i.default)({openRowKeys:o},r)),"onExpandedChange"in e&&(t("onExpandedChange","onRowOpen","Table"),r=(o=e).onExpandedChange,o=(0,l.default)(o,["onExpandedChange"]),e=(0,i.default)({onRowOpen:r},o)),"isLoading"in e&&(t("isLoading","loading","Table"),o=(r=e).isLoading,r=(0,l.default)(r,["isLoading"]),e=(0,i.default)({loading:o},r)),"indentSize"in e&&(t("indentSize","indent","Table"),r=(o=e).indentSize,o=(0,l.default)(o,["indentSize"]),e=(0,i.default)({indent:r},o)),"optimization"in e&&(t("optimization","pure","Table"),o=(r=e).optimization,r=(0,l.default)(r,["optimization"]),e=(0,i.default)({pure:o},r)),"getRowClassName"in e&&(t("getRowClassName","getRowProps","Table"),n=(o=e).getRowClassName,a=o.getRowProps,r=(0,l.default)(o,["getRowClassName","getRowProps"]),e=n?(0,i.default)({getRowProps:function(){return(0,i.default)({className:n.apply(void 0,arguments)},a?a.apply(void 0,arguments):{})}},r):(0,i.default)({getRowProps:a},r)),"getRowProps"in e&&(t("getRowProps","rowProps","Table in 1.15.0"),r=(o=e).getRowProps,o=(0,l.default)(o,["getRowProps"]),e=(0,i.default)({rowProps:r},o)),"getCellProps"in e&&(t("getCellProps","cellProps","Table in 1.15.0"),o=(r=e).getCellProps,t=(0,l.default)(r,["getCellProps"]),e=(0,i.default)({cellProps:o},t)),e}}),e.exports=t.default},function(e,t,n){"use strict";n.d(t,"a",function(){return o});var a=n(85);function r(t,e){var n,a=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,n)),a}function o(t){for(var e=1;e 16.8.0")},p.prototype.validate=function(e,t){this.validateCallback(e,t)},p.prototype.reset=function(e){var t=1","Select");t=s(e,t);return e.onInputUpdate&&(t.onSearch=e.onInputUpdate,t.showSearch=!0),t}}),t.default=a.default.config(r.default,{transform:s,exportNames:["focusInput","handleSearchClear"]}),e.exports=t.default},function(e,t,n){"use strict";n.d(t,"f",function(){return a}),n.d(t,"g",function(){return r}),n.d(t,"i",function(){return o}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return l}),n.d(t,"j",function(){return s}),n.d(t,"l",function(){return u}),n.d(t,"k",function(){return d}),n.d(t,"h",function(){return c}),n.d(t,"b",function(){return f}),n.d(t,"a",function(){return p}),n.d(t,"e",function(){return h});var a="docsite_language",r="LANGUAGE_SWITCH",o="__REDUX_DEVTOOLS_EXTENSION__",i="GET_STATE",l="GET_SUBSCRIBERS",s="REMOVE_SUBSCRIBERS",u="USER_LIST",d="ROLE_LIST",c="PERMISSIONS_LIST",f="GET_NAMESPACES",p="GET_CONFIGURATION",h=[10,20,30,50,100]},function(e,t,n){"use strict";function s(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function u(t){this.setState(function(e){return null!=(e=this.constructor.getDerivedStateFromProps(t,e))?e:null}.bind(this))}function d(e,t){try{var n=this.props,a=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,a)}finally{this.props=n,this.state=a}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n,a,r=null,o=null,i=null;if("function"==typeof t.componentWillMount?r="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(r="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?i="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(i="UNSAFE_componentWillUpdate"),null!==r||null!==o||null!==i)throw n=e.displayName||e.name,a="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()",Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+n+" uses "+a+" but also contains the following legacy lifecycles:"+(null!==r?"\n "+r:"")+(null!==o?"\n "+o:"")+(null!==i?"\n "+i:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks");if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=s,t.componentWillReceiveProps=u),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=d;var l=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){n=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;l.call(this,e,t,n)}}return e}n.r(t),n.d(t,"polyfill",function(){return a}),d.__suppressDeprecationWarning=u.__suppressDeprecationWarning=s.__suppressDeprecationWarning=!0},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var a=n(130);function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,r=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(a=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){r=!0,o=e}finally{try{a||null==l.return||l.return()}finally{if(r)throw o}}return n}}(e,t)||Object(a.a)(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t,n){"use strict";n(41),n(536)},function(e,t,n){"use strict";t.__esModule=!0;var v=s(n(2)),a=s(n(4)),r=s(n(5)),o=s(n(6)),_=s(n(0)),i=s(n(3)),b=s(n(13)),w=s(n(61)),l=s(n(7)),M=n(10);function s(e){return e&&e.__esModule?e:{default:e}}u=_.default.Component,(0,o.default)(k,u),k.prototype.render=function(){var e=this.props,t=e.tip,n=e.visible,a=e.children,r=e.className,o=e.style,i=e.indicator,l=e.color,s=e.prefix,u=e.fullScreen,d=e.disableScroll,c=e.onVisibleChange,f=e.tipAlign,p=e.size,h=e.inline,m=e.rtl,e=e.safeNode,g=null,y=s+"loading-dot",p=(g=i||(i=l,p=(0,b.default)(((l={})[s+"loading-fusion-reactor"]=!0,l[s+"loading-medium-fusion-reactor"]="medium"===p,l)),_.default.createElement("div",{className:p,dir:m?"rtl":void 0},_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}))),(0,b.default)(((l={})[s+"loading"]=!0,l[s+"open"]=n,l[s+"loading-inline"]=h,l[r]=r,l))),y=(0,b.default)(((m={})[s+"loading-tip"]=!0,m[s+"loading-tip-fullscreen"]=u,m[s+"loading-right-tip"]="right"===f,m)),i=M.obj.pickOthers(k.propTypes,this.props),l=(0,b.default)(((h={})[s+"loading-component"]=n,h[s+"loading-wrap"]=!0,h));return u?[a,_.default.createElement(w.default,(0,v.default)({key:"overlay",hasMask:!0,align:"cc cc",safeNode:e,disableScroll:d},i,{className:r,style:o,visible:n,onRequestClose:c}),_.default.createElement("div",{className:y},_.default.createElement("div",{className:s+"loading-indicator"},g),_.default.createElement("div",{className:s+"loading-tip-content"},t),_.default.createElement("div",{className:s+"loading-tip-placeholder"},t)))]:_.default.createElement("div",(0,v.default)({className:p,style:o},i),n?_.default.createElement("div",{className:y},_.default.createElement("div",{className:s+"loading-indicator"},g),_.default.createElement("div",{className:s+"loading-tip-content"},t),_.default.createElement("div",{className:s+"loading-tip-placeholder"},t)):null,_.default.createElement("div",{className:l},n?_.default.createElement("div",{className:s+"loading-masker"}):null,a))},o=n=k,n.propTypes=(0,v.default)({},l.default.propTypes,{prefix:i.default.string,tip:i.default.any,tipAlign:i.default.oneOf(["right","bottom"]),visible:i.default.bool,onVisibleChange:i.default.func,className:i.default.string,style:i.default.object,size:i.default.oneOf(["large","medium"]),indicator:i.default.any,color:i.default.string,fullScreen:i.default.bool,disableScroll:i.default.bool,safeNode:i.default.any,children:i.default.any,inline:i.default.bool,rtl:i.default.bool}),n.defaultProps={prefix:"next-",visible:!0,onVisibleChange:M.func.noop,animate:null,tipAlign:"bottom",size:"large",inline:!0,disableScroll:!1};var u,i=o;function k(){return(0,a.default)(this,k),(0,r.default)(this,u.apply(this,arguments))}i.displayName="Loading",t.default=l.default.config(i),e.exports=t.default},function(e,t,n){"use strict";n(73),n(52),n(32),n(41),n(537)},function(e,t,n){"use strict";n(52);var a=n(27),r=n.n(a),o=n(70),a=n(133),a=n.n(a),i=n(411),l=n.n(i),s=n(47),u="Request error, please try again later!";function d(){var e=window.location.href,e=(localStorage.removeItem("token"),e.split("#")[0]);window.location.href="".concat(e,"#/login")}t.a=((i=a.a.create()).interceptors.request.use(function(e){var t=e.url,n=e.params,a=e.data,r=e.method,o=e.headers;if(n||(e.params={}),!t.includes("auth/users/login")){n={};try{n=JSON.parse(localStorage.token)}catch(e){console.log(e),d()}var i=n.accessToken,i=void 0===i?"":i,n=n.username,n=void 0===n?"":n;e.params.accessToken=i,t.includes("auth")||(e.params.username=n),e.headers=Object.assign({},o,{accessToken:i})}return a&&Object(s.d)(a)&&["post","put"].includes(r)&&(e.data=l.a.stringify(a),o||(e.headers={}),e.headers["Content-Type"]="application/x-www-form-urlencoded"),e},function(e){return Promise.reject(e)}),i.interceptors.response.use(function(e){var t=e.data;t.success,t.resultCode,t.resultMessage;return e.data},function(e){var t,n,a;return e.response?(t=void 0===(t=(n=e.response).data)?{}:t,n=n.status,a="HTTP ERROR: ".concat(n),"string"==typeof t?a=t:"object"===Object(o.a)(t)&&(a=t.message),r.a.error(a),[401,403].includes(n)&&["unknown user!","token invalid!","token expired!","authorization failed!"].includes(a)&&d(),Promise.reject(e.response)):(r.a.error(u),Promise.reject(e))}),i)},function(e,t,n){"use strict";t.__esModule=!0;var a=i(n(464)),r=i(n(476)),o="function"==typeof r.default&&"symbol"==typeof a.default?function(e){return typeof e}:function(e){return e&&"function"==typeof r.default&&e.constructor===r.default&&e!==r.default.prototype?"symbol":typeof e};function i(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof r.default&&"symbol"===o(a.default)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof r.default&&e.constructor===r.default&&e!==r.default.prototype?"symbol":void 0===e?"undefined":o(e)}},function(e,t,n){"use strict";n.d(t,"a",function(){return w}),n.d(t,"b",function(){return x}),n.d(t,"c",function(){return m}),n.d(t,"d",function(){return C}),n.d(t,"e",function(){return h}),n.d(t,"f",function(){return E}),n.d(t,"g",function(){return L});function a(e){var t=Object(o.a)();return t.displayName=e,t}var r=n(57),t=n(0),l=n.n(t),s=n(54),o=n(412),u=n(56),d=n(39),t=n(181),c=n.n(t),i=(n(186),n(53)),t=n(97),f=n.n(t),p=a("Router-History"),h=a("Router"),m=function(n){function e(e){var t=n.call(this,e)||this;return t.state={location:e.history.location},t._isMounted=!1,t._pendingLocation=null,e.staticContext||(t.unlisten=e.history.listen(function(e){t._isMounted?t.setState({location:e}):t._pendingLocation=e})),t}Object(r.a)(e,n),e.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var t=e.prototype;return t.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},t.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},t.render=function(){return l.a.createElement(h.Provider,{value:{history:this.props.history,location:this.state.location,match:e.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},l.a.createElement(p.Provider,{children:this.props.children||null,value:this.props.history}))},e}(l.a.Component),g=(l.a.Component,function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(e){this.props.onUpdate&&this.props.onUpdate.call(this,this,e)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},t}(l.a.Component));var y={},v=1e4,_=0;function b(e,t){return void 0===t&&(t={}),"/"===(e=void 0===e?"/":e)?e:function(e){if(y[e])return y[e];var t=c.a.compile(e);return _e?t.splice(e,t.length-e,n):t.push(n),i({action:"PUSH",location:n,index:e,entries:t}))})},replace:function(e,t){var n=O(e,t,l(),u.location);o.confirmTransitionTo(n,"REPLACE",a,function(e){e&&i({action:"REPLACE",location:u.entries[u.index]=n})})},go:s,goBack:function(){s(-1)},goForward:function(){s(1)},canGo:function(e){return 0<=(e=u.index+e)&&ex',"Tag"),"readonly"!==n&&"interactive"!==n||r.log.warning("Warning: [ shape="+n+" ] is deprecated at [ Tag ]"),"secondary"===a&&r.log.warning("Warning: [ type=secondary ] is deprecated at [ Tag ]"),["count","marked","value","onChange"].forEach(function(e){e in t&&r.log.warning("Warning: [ "+e+" ] is deprecated at [ Tag ]")}),("selected"in t||"defaultSelected"in t)&&r.log.warning("Warning: [ selected|defaultSelected ] is deprecated at [ Tag ], use [ checked|defaultChecked ] at [ Tag.Selectable ] instead of it"),"closed"in t&&r.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&&r.log.warning("Warning: [ afterClose ] is deprecated at [ Tag ], use [ afterClose ] at [ Tag.Closeable ] instead of it"),t}});o.Group=a.default.config(i.default),o.Selectable=a.default.config(l.default),o.Closable=a.default.config(n.default),o.Closeable=o.Closable,t.default=o,e.exports=t.default},function(e,t,n){"use strict";n(68),n(443)},function(e,t){e=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(e,t){e=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},function(e,t,n){e.exports=!n(105)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";t.__esModule=!0;var a=o(n(340)),r=o(n(522)),n=o(n(523));function o(e){return e&&e.__esModule?e:{default:e}}a.default.Expand=r.default,a.default.OverlayAnimate=n.default,t.default=a.default,e.exports=t.default},function(e,t,n){"use strict";n(41),n(68),n(122),n(106),n(534)},function(e,t,n){"use strict";n.d(t,"b",function(){return l});var a=n(21),r=n(35),o=n(29),i={namespaces:[]},l=function(e){return function(n){return r.a.get("v1/console/namespaces",{params:e}).then(function(e){var t=e.code,e=e.data;n({type:o.b,data:200===t?e:[]})})}};t.a=function(){var e=0this.menuNode.clientHeight&&(this.menuNode.clientHeight+this.menuNode.scrollTop<(e=this.itemNode.offsetTop+this.itemNode.offsetHeight)?this.menuNode.scrollTop=e-this.menuNode.clientHeight:this.itemNode.offsetTop"===(d=e.charAt(o+1))){r+="(",o++,0[0-9][0-9][0-9][0-9])-(?[0-9][0-9]?)-(?[0-9][0-9]?)(?:(?:[Tt]|[ \t]+)(?[0-9][0-9]?):(?[0-9][0-9]):(?[0-9][0-9])(?:.(?[0-9]*))?(?:[ \t]*(?Z|(?[-+])(?[0-9][0-9]?)(?::(?[0-9][0-9]))?))?)?$","i"),r.LOCAL_TIMEZONE_OFFSET=60*(new Date).getTimezoneOffset()*1e3,r.trim=function(e,t){var n,a;return null==(n=this.REGEX_LEFT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_LEFT_TRIM_BY_CHAR[t]=n=new RegExp("^"+t+t+"*")),n.lastIndex=0,null==(a=this.REGEX_RIGHT_TRIM_BY_CHAR[t])&&(this.REGEX_RIGHT_TRIM_BY_CHAR[t]=a=new RegExp(t+""+t+"*$")),a.lastIndex=0,e.replace(n,"").replace(a,"")},r.ltrim=function(e,t){var n;return null==(n=this.REGEX_LEFT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_LEFT_TRIM_BY_CHAR[t]=n=new RegExp("^"+t+t+"*")),n.lastIndex=0,e.replace(n,"")},r.rtrim=function(e,t){var n;return null==(n=this.REGEX_RIGHT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_RIGHT_TRIM_BY_CHAR[t]=n=new RegExp(t+""+t+"*$")),n.lastIndex=0,e.replace(n,"")},r.isEmpty=function(e){return!e||""===e||"0"===e||e instanceof Array&&0===e.length||this.isEmptyObject(e)},r.isEmptyObject=function(t){var n;return t instanceof Object&&0===function(){var e=[];for(n in t)a.call(t,n)&&e.push(n);return e}().length},r.subStrCount=function(e,t,n,a){var r,o,i,l,s=0;for(e=""+e,t=""+t,null!=n&&(e=e.slice(n)),n=(e=null!=a?e.slice(0,a):e).length,l=t.length,r=o=0,i=n;0<=i?o>6)+t(128|63&e):e<65536?t(224|e>>12)+t(128|e>>6&63)+t(128|63&e):t(240|e>>18)+t(128|e>>12&63)+t(128|e>>6&63)+t(128|63&e)},r.parseBoolean=function(e,t){var n;return null==t&&(t=!0),"string"==typeof e?(n=e.toLowerCase(),!(!t&&"no"===n)&&("0"!==n&&("false"!==n&&""!==n))):!!e},r.isNumeric=function(e){return this.REGEX_SPACES.lastIndex=0,"number"==typeof e||"string"==typeof e&&!isNaN(e)&&""!==e.replace(this.REGEX_SPACES,"")},r.stringToDate=function(e){var t,n,a,r,o,i,l,s,u;if(null==e||!e.length)return null;if(!(e=this.PATTERN_DATE.exec(e)))return null;if(u=parseInt(e.year,10),i=parseInt(e.month,10)-1,n=parseInt(e.day,10),null==e.hour)return t=new Date(Date.UTC(u,i,n));if(r=parseInt(e.hour,10),o=parseInt(e.minute,10),l=parseInt(e.second,10),null!=e.fraction){for(a=e.fraction.slice(0,3);a.length<3;)a+="0";a=parseInt(a,10)}else a=0;return null!=e.tz&&(s=6e4*(60*parseInt(e.tz_hour,10)+(null!=e.tz_minute?parseInt(e.tz_minute,10):0)),"-"===e.tz_sign&&(s*=-1)),t=new Date(Date.UTC(u,i,n,r,o,l,a)),s&&t.setTime(t.getTime()-s),t},r.strRepeat=function(e,t){for(var n="",a=0;ae.length)&&(t=e.length);for(var n=0,a=new Array(t);ndocument.F=Object<\/script>"),e.close(),u=e.F;t--;)delete u[s][i[t]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(a[s]=r(e),n=new a,a[s]=null,n[l]=e):n=u(),void 0===t?n:o(n,t)}},function(e,t,n){var a=n(81).f,r=n(82),o=n(90)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,o)&&a(e,o,{configurable:!0,value:t})}},function(e,t,n){t.f=n(90)},function(e,t,n){var a=n(74),r=n(75),o=n(118),i=n(150),l=n(81).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=!o&&a.Symbol||{});"_"==e.charAt(0)||e in t||l(t,e,{value:i.f(e)})}},function(e,t,n){"use strict";t.__esModule=!0;var a=d(n(202)),r=d(n(497)),o=d(n(498)),i=d(n(499)),l=d(n(500)),s=d(n(501)),u=d(n(502));function d(e){return e&&e.__esModule?e:{default:e}}n(503),a.default.extend(s.default),a.default.extend(l.default),a.default.extend(r.default),a.default.extend(o.default),a.default.extend(i.default),a.default.extend(u.default),a.default.locale("zh-cn");n=a.default;n.isSelf=a.default.isDayjs,a.default.localeData(),t.default=n,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var v=c(n(2)),o=c(n(4)),i=c(n(5)),a=c(n(6)),r=n(0),_=c(r),l=c(n(3)),s=n(30),b=c(n(13)),u=c(n(44)),w=c(n(24)),M=c(n(77)),d=c(n(7)),k=n(10);function c(e){return e&&e.__esModule?e:{default:e}}function f(){}p=r.Component,(0,a.default)(S,p),S.getDerivedStateFromProps=function(e){return"visible"in e?{visible:e.visible}:{}},S.prototype.render=function(){var e,t=this.props,n=t.prefix,a=(t.pure,t.className),r=t.style,o=t.type,i=t.shape,l=t.size,s=t.title,u=t.children,d=(t.defaultVisible,t.visible,t.iconType),c=t.closeable,f=(t.onClose,t.afterClose),p=t.animation,h=t.rtl,t=t.locale,m=(0,v.default)({},k.obj.pickOthers(Object.keys(S.propTypes),this.props)),g=this.state.visible,y=n+"message",o=(0,b.default)(((e={})[y]=!0,e[n+"message-"+o]=o,e[""+n+i]=i,e[""+n+l]=l,e[n+"title-content"]=!!s,e[n+"only-content"]=!s&&!!u,e[a]=a,e)),i=g?_.default.createElement("div",(0,v.default)({role:"alert",style:r},m,{className:o,dir:h?"rtl":void 0}),c?_.default.createElement("a",{role:"button","aria-label":t.closeAriaLabel,className:y+"-close",onClick:this.onClose},_.default.createElement(w.default,{type:"close"})):null,!1!==d?_.default.createElement(w.default,{className:y+"-symbol "+(!d&&y+"-symbol-icon"),type:d}):null,s?_.default.createElement("div",{className:y+"-title"},s):null,u?_.default.createElement("div",{className:y+"-content"},u):null):null;return p?_.default.createElement(M.default.Expand,{animationAppear:!1,afterLeave:f},i):i},r=n=S,n.propTypes={prefix:l.default.string,pure:l.default.bool,className:l.default.string,style:l.default.object,type:l.default.oneOf(["success","warning","error","notice","help","loading"]),shape:l.default.oneOf(["inline","addon","toast"]),size:l.default.oneOf(["medium","large"]),title:l.default.node,children:l.default.node,defaultVisible:l.default.bool,visible:l.default.bool,iconType:!1|l.default.string,closeable:l.default.bool,onClose:l.default.func,afterClose:l.default.func,animation:l.default.bool,locale:l.default.object,rtl:l.default.bool},n.defaultProps={prefix:"next-",pure:!1,type:"success",shape:"inline",size:"medium",defaultVisible:!0,closeable:!1,onClose:f,afterClose:f,animation:!0,locale:u.default.Message};var p,a=r;function S(){var e,t;(0,o.default)(this,S);for(var n=arguments.length,a=Array(n),r=0;r=n.length?(s=!!(c=h(o,u)))&&"get"in c&&!("originalValue"in c.get)?c.get:o[u]:(s=_(o,u),o[u]),s&&!i&&(y[d]=o)}}return o}},function(e,t,n){"use strict";n=n(600);e.exports=Function.prototype.bind||n},function(e,t,n){"use strict";var a=String.prototype.replace,r=/%20/g,o="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return a.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:i}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var d=s(n(2)),a=s(n(4)),r=s(n(5)),o=s(n(6)),c=n(0),f=s(c),i=s(n(3)),p=s(n(13)),h=s(n(24)),l=n(10),m=s(n(94));function s(e){return e&&e.__esModule?e:{default:e}}var u,g=l.func.bindCtx,y=l.obj.pickOthers,i=(u=c.Component,(0,o.default)(v,u),v.prototype.getSelected=function(){var e=this.props,t=e._key,n=e.root,e=e.selected,a=n.props.selectMode,n=n.state.selectedKeys;return e||!!a&&-1e.length&&e.every(function(e,t){return e===n[t]})},t.isAvailablePos=function(e,t,n){var n=n[t],a=n.type,n=n.disabled;return r(e,t)&&("item"===a&&!n||"submenu"===a)});t.getFirstAvaliablelChildKey=function(t,n){var e=Object.keys(n).find(function(e){return a(t+"-0",e,n)});return e?n[e].key:null},t.getChildSelected=function(e){var t=e.selectMode,n=e.selectedKeys,a=e._k2n,e=e._key;if(!a)return!1;var r=(a[e]&&a[e].pos)+"-";return!!t&&n.some(function(e){return a[e]&&0===a[e].pos.indexOf(r)})}},function(e,t,n){"use strict";n(41),n(32),n(622)},function(e,t,n){var o=n(635),i=Object.prototype.hasOwnProperty;function l(e){return Array.isArray(e)?"array":typeof e}function s(e,t){var n,a=0,r=0;for(n in e)if(i.call(e,n)){if("style"===n){if(!o(e[n],t[n]))return!1}else if("children"!==n&&e[n]!==t[n])return!1;a++}for(n in t)i.call(t,n)&&r++;return a===r&&function e(t,n){var a=l(t);if(a!==l(n))return!1;switch(a){case"array":if(t.length!==n.length)return!1;for(var r=0;r=u,u=(0,O.default)(((u={})[n+"upload-inner"]=!0,u[n+"hidden"]=x,u)),C=this.props.children;if("card"===r&&(r=(0,O.default)(((r={})[n+"upload-card"]=!0,r[n+"disabled"]=s,r)),C=D.default.createElement("div",{className:r},D.default.createElement(P.default,{size:"large",type:"add",className:n+"upload-add-icon"}),D.default.createElement("div",{tabIndex:"0",role:"button",className:n+"upload-text"},C))),b)return"function"==typeof w?(b=(0,O.default)(((r={})[n+"form-preview"]=!0,r[o]=!!o,r)),D.default.createElement("div",{style:i,className:b},w(this.state.value,this.props))):t?D.default.createElement(Y.default,{isPreview:!0,listType:t,style:i,className:o,value:this.state.value}):null;n=s?N.func.prevent:p,r=N.obj.pickAttrsWith(this.props,"data-");return D.default.createElement("div",(0,L.default)({className:f,style:i},r),D.default.createElement(j.default,(0,L.default)({},e,{name:M,beforeUpload:c,dragable:a,disabled:s||x,className:u,onSelect:this.onSelect,onDrop:this.onDrop,onProgress:this.onProgress,onSuccess:this.onSuccess,onError:this.onError,ref:this.saveUploaderRef}),C),t||g?D.default.createElement(Y.default,{useDataURL:l,fileNameRender:k,actionRender:S,uploader:this,listType:t,value:this.state.value,closable:d,onRemove:n,progressProps:v,onCancel:h,onPreview:m,extraRender:y,rtl:_,previewOnFileName:E}):null)},i=u=h,u.displayName="Upload",u.propTypes=(0,L.default)({},d.default.propTypes,Y.default.propTypes,{prefix:l.default.string.isRequired,action:l.default.string,value:l.default.array,defaultValue:l.default.array,shape:l.default.oneOf(["card"]),listType:l.default.oneOf(["text","image","card"]),list:l.default.any,name:l.default.string,data:l.default.oneOfType([l.default.object,l.default.func]),formatter:l.default.func,limit:l.default.number,timeout:l.default.number,dragable:l.default.bool,closable:l.default.bool,useDataURL:l.default.bool,disabled:l.default.bool,onSelect:l.default.func,onProgress:l.default.func,onChange:l.default.func,onSuccess:l.default.func,afterSelect:l.default.func,onRemove:l.default.func,onError:l.default.func,beforeUpload:l.default.func,onDrop:l.default.func,className:l.default.string,style:l.default.object,children:l.default.node,autoUpload:l.default.bool,request:l.default.func,progressProps:l.default.object,rtl:l.default.bool,isPreview:l.default.bool,renderPreview:l.default.func,fileKeyName:l.default.string,fileNameRender:l.default.func,actionRender:l.default.func,previewOnFileName:l.default.bool}),u.defaultProps=(0,L.default)({},d.default.defaultProps,{prefix:"next-",limit:1/0,autoUpload:!0,closable:!0,onSelect:n,onProgress:n,onChange:n,onSuccess:n,onRemove:n,onError:n,onDrop:n,beforeUpload:n,afterSelect:n,previewOnFileName:!1}),a=function(){var u=this;this.onSelect=function(e){var t,n,a=u.props,r=a.autoUpload,o=a.afterSelect,i=a.onSelect,a=a.limit,l=u.state.value.length+e.length,s=a-u.state.value.length;s<=0||(t=e=e.map(function(e){e=(0,c.fileToObject)(e);return e.state="selected",e}),n=[],ai||l+a.width>o):t<0||e<0||t+a.height>u.height||e+a.width>u.width}function T(e,t,n,a){var r=a.overlayInfo,a=a.containerInfo,n=n.split("");return 1===n.length&&n.push(""),t<0&&(n=[n[0].replace("t","b"),n[1].replace("b","t")]),e<0&&(n=[n[0].replace("l","r"),n[1].replace("r","l")]),t+r.height>a.height&&(n=[n[0].replace("b","t"),n[1].replace("t","b")]),(n=e+r.width>a.width?[n[0].replace("r","l"),n[1].replace("l","r")]:n).join("")}function D(e,t,n){var a=n.overlayInfo,n=n.containerInfo;return(t=t<0?0:t)+a.height>n.height&&(t=n.height-a.height),{left:e=(e=e<0?0:e)+a.width>n.width?n.width-a.width:e,top:t}}function ve(e){var t=e.target,n=e.overlay,a=e.container,r=e.scrollNode,o=e.placement,i=e.placementOffset,i=void 0===i?0:i,l=e.points,l=void 0===l?["tl","bl"]:l,s=e.offset,s=void 0===s?[0,0]:s,u=e.position,u=void 0===u?"absolute":u,d=e.beforePosition,c=e.autoAdjust,c=void 0===c||c,f=e.autoHideScrollOverflow,f=void 0===f||f,e=e.rtl,p="offsetWidth"in(p=n)&&"offsetHeight"in p?{width:p.offsetWidth,height:p.offsetHeight}:{width:(p=p.getBoundingClientRect()).width,height:p.height},h=p.width,p=p.height;if("fixed"===u)return m={config:{placement:void 0,points:void 0},style:{position:u,left:s[0],top:s[1]}},d?d(m,{overlay:{node:n,width:h,height:p}}):m;var m=t.getBoundingClientRect(),g=m.width,y=m.height,v=m.left,_=m.top,m=x(a),b=m.left,m=m.top,w=a.scrollWidth,M=a.scrollHeight,k=a.scrollTop,S=a.scrollLeft,b={targetInfo:{width:g,height:y,left:v,top:_},containerInfo:{left:b,top:m,width:w,height:M,scrollTop:k,scrollLeft:S},overlayInfo:{width:h,height:p},points:l,placementOffset:i,offset:s,container:a,rtl:e},m=C(o,b),w=m.left,M=m.top,k=m.points,S=function(e){for(var t=e;t;){var n=fe(t,"overflow");if(null!=n&&n.match(/auto|scroll|hidden/))return t;t=t.parentNode}return document.documentElement}(a),E=(c&&o&&L(w,M,S,b)&&(o!==(l=T(w,M,o,b))&&(M=L(s=(i=C(l,b)).left,e=i.top,S,b)&&l!==(m=T(s,e,l,b))?(w=(c=D((a=C(o=m,b)).left,a.top,b)).left,c.top):(o=l,w=s,e)),w=(i=D(w,M,b)).left,M=i.top),{config:{placement:o,points:k},style:{position:u,left:Math.round(w),top:Math.round(M)}});return f&&o&&null!=r&&r.length&&r.forEach(function(e){var e=e.getBoundingClientRect(),t=e.top,n=e.left,a=e.width,e=e.height;E.style.display=_+y=e.length?{done:!0}:{done:!1,value:e[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.clientHeight&&0")),"shouldUpdatePosition"in r&&(delete t.shouldUpdatePosition,d.log.warning("Warning: [ shouldUpdatePosition ] is deprecated at [ ]")),"minMargin"in r&&o("minMargin","top/bottom",""),"isFullScreen"in r&&(r.overFlowScroll=!r.isFullScreen,delete t.isFullScreen,o("isFullScreen","overFlowScroll","")),t;return["target","offset","beforeOpen","onOpen","afterOpen","beforePosition","onPosition","cache","safeNode","wrapperClassName","container"].forEach(function(e){var t,n,a;e in r&&(o(e,"overlayProps."+e,"Dialog"),t=(n=r).overlayProps,n=(0,l.default)(n,["overlayProps"]),a=(0,i.default)(((a={})[e]=r[e],a),t||{}),delete n[e],r=(0,i.default)({overlayProps:a},n))}),r}n.displayName="Dialog",n.Inner=p.default,n.show=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.show)(e)},n.alert=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.alert)(e)},n.confirm=function(e){return!1!==u.default.getContextProps(e,"Dialog").warning&&(e=v(e,d.log.deprecated)),(0,h.confirm)(e)},n.success=function(e){return(0,h.success)(e)},n.error=function(e){return(0,h.error)(e)},n.notice=function(e){return(0,h.notice)(e)},n.warning=function(e){return(0,h.warning)(e)},n.help=function(e){return(0,h.help)(e)},n.withContext=h.withContext,t.default=u.default.config(n,{transform:v}),e.exports=t.default},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",function(){return a})},function(e,t,n){"use strict";function a(e,t){for(var n=0;n 16.8.0")},p.prototype.validate=function(e,t){this.validateCallback(e,t)},p.prototype.reset=function(e){var t=1","Select");t=s(e,t);return e.onInputUpdate&&(t.onSearch=e.onInputUpdate,t.showSearch=!0),t}}),t.default=a.default.config(r.default,{transform:s,exportNames:["focusInput","handleSearchClear"]}),e.exports=t.default},function(e,t,n){"use strict";n.d(t,"f",function(){return a}),n.d(t,"g",function(){return r}),n.d(t,"i",function(){return o}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return l}),n.d(t,"j",function(){return s}),n.d(t,"l",function(){return u}),n.d(t,"k",function(){return d}),n.d(t,"h",function(){return c}),n.d(t,"b",function(){return f}),n.d(t,"a",function(){return p}),n.d(t,"e",function(){return h});var a="docsite_language",r="LANGUAGE_SWITCH",o="__REDUX_DEVTOOLS_EXTENSION__",i="GET_STATE",l="GET_SUBSCRIBERS",s="REMOVE_SUBSCRIBERS",u="USER_LIST",d="ROLE_LIST",c="PERMISSIONS_LIST",f="GET_NAMESPACES",p="GET_CONFIGURATION",h=[10,20,30,50,100]},function(e,t,n){"use strict";function s(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function u(t){this.setState(function(e){return null!=(e=this.constructor.getDerivedStateFromProps(t,e))?e:null}.bind(this))}function d(e,t){try{var n=this.props,a=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,a)}finally{this.props=n,this.state=a}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n,a,r=null,o=null,i=null;if("function"==typeof t.componentWillMount?r="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(r="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?i="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(i="UNSAFE_componentWillUpdate"),null!==r||null!==o||null!==i)throw n=e.displayName||e.name,a="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()",Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+n+" uses "+a+" but also contains the following legacy lifecycles:"+(null!==r?"\n "+r:"")+(null!==o?"\n "+o:"")+(null!==i?"\n "+i:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks");if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=s,t.componentWillReceiveProps=u),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=d;var l=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){n=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;l.call(this,e,t,n)}}return e}n.r(t),n.d(t,"polyfill",function(){return a}),d.__suppressDeprecationWarning=u.__suppressDeprecationWarning=s.__suppressDeprecationWarning=!0},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var a=n(131);function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,r=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(a=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){r=!0,o=e}finally{try{a||null==l.return||l.return()}finally{if(r)throw o}}return n}}(e,t)||Object(a.a)(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t,n){"use strict";n(41),n(537)},function(e,t,n){"use strict";t.__esModule=!0;var v=s(n(2)),a=s(n(4)),r=s(n(5)),o=s(n(6)),_=s(n(0)),i=s(n(3)),b=s(n(13)),w=s(n(61)),l=s(n(7)),M=n(10);function s(e){return e&&e.__esModule?e:{default:e}}u=_.default.Component,(0,o.default)(k,u),k.prototype.render=function(){var e=this.props,t=e.tip,n=e.visible,a=e.children,r=e.className,o=e.style,i=e.indicator,l=e.color,s=e.prefix,u=e.fullScreen,d=e.disableScroll,c=e.onVisibleChange,f=e.tipAlign,p=e.size,h=e.inline,m=e.rtl,e=e.safeNode,g=null,y=s+"loading-dot",p=(g=i||(i=l,p=(0,b.default)(((l={})[s+"loading-fusion-reactor"]=!0,l[s+"loading-medium-fusion-reactor"]="medium"===p,l)),_.default.createElement("div",{className:p,dir:m?"rtl":void 0},_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}),_.default.createElement("span",{className:y,style:{backgroundColor:i}}))),(0,b.default)(((l={})[s+"loading"]=!0,l[s+"open"]=n,l[s+"loading-inline"]=h,l[r]=r,l))),y=(0,b.default)(((m={})[s+"loading-tip"]=!0,m[s+"loading-tip-fullscreen"]=u,m[s+"loading-right-tip"]="right"===f,m)),i=M.obj.pickOthers(k.propTypes,this.props),l=(0,b.default)(((h={})[s+"loading-component"]=n,h[s+"loading-wrap"]=!0,h));return u?[a,_.default.createElement(w.default,(0,v.default)({key:"overlay",hasMask:!0,align:"cc cc",safeNode:e,disableScroll:d},i,{className:r,style:o,visible:n,onRequestClose:c}),_.default.createElement("div",{className:y},_.default.createElement("div",{className:s+"loading-indicator"},g),_.default.createElement("div",{className:s+"loading-tip-content"},t),_.default.createElement("div",{className:s+"loading-tip-placeholder"},t)))]:_.default.createElement("div",(0,v.default)({className:p,style:o},i),n?_.default.createElement("div",{className:y},_.default.createElement("div",{className:s+"loading-indicator"},g),_.default.createElement("div",{className:s+"loading-tip-content"},t),_.default.createElement("div",{className:s+"loading-tip-placeholder"},t)):null,_.default.createElement("div",{className:l},n?_.default.createElement("div",{className:s+"loading-masker"}):null,a))},o=n=k,n.propTypes=(0,v.default)({},l.default.propTypes,{prefix:i.default.string,tip:i.default.any,tipAlign:i.default.oneOf(["right","bottom"]),visible:i.default.bool,onVisibleChange:i.default.func,className:i.default.string,style:i.default.object,size:i.default.oneOf(["large","medium"]),indicator:i.default.any,color:i.default.string,fullScreen:i.default.bool,disableScroll:i.default.bool,safeNode:i.default.any,children:i.default.any,inline:i.default.bool,rtl:i.default.bool}),n.defaultProps={prefix:"next-",visible:!0,onVisibleChange:M.func.noop,animate:null,tipAlign:"bottom",size:"large",inline:!0,disableScroll:!1};var u,i=o;function k(){return(0,a.default)(this,k),(0,r.default)(this,u.apply(this,arguments))}i.displayName="Loading",t.default=l.default.config(i),e.exports=t.default},function(e,t,n){"use strict";n(73),n(52),n(32),n(41),n(538)},function(e,t,n){"use strict";n(52);var a=n(27),r=n.n(a),o=n(70),a=n(134),a=n.n(a),i=n(412),l=n.n(i),s=n(47),u="Request error, please try again later!";function d(){var e=window.location.href,e=(localStorage.removeItem("token"),e.split("#")[0]);window.location.href="".concat(e,"#/login")}t.a=((i=a.a.create()).interceptors.request.use(function(e){var t=e.url,n=e.params,a=e.data,r=e.method,o=e.headers;if(n||(e.params={}),e.params.message=!0,!t.includes("auth/users/login")){n={};try{n=JSON.parse(localStorage.token)}catch(e){console.log(e),d()}var i=n.accessToken,i=void 0===i?"":i,n=n.username,n=void 0===n?"":n;e.params.accessToken=i,t.includes("auth")||(e.params.username=n),e.headers=Object.assign({},o,{accessToken:i})}return a&&Object(s.d)(a)&&["post","put"].includes(r)&&(e.data=l.a.stringify(a),o||(e.headers={}),e.headers["Content-Type"]="application/x-www-form-urlencoded"),e},function(e){return Promise.reject(e)}),i.interceptors.response.use(function(e){var t=e.data;t.success,t.resultCode,t.resultMessage;return e.data},function(e){var t,n,a;return e.response?(t=void 0===(t=(n=e.response).data)?{}:t,n=n.status,a="HTTP ERROR: ".concat(n),"string"==typeof t?a=t:"object"===Object(o.a)(t)&&(a=t.message),r.a.error(a),[401,403].includes(n)&&["unknown user!","token invalid!","token expired!","session expired!"].includes(a)&&d(),Promise.reject(e.response)):(r.a.error(u),Promise.reject(e))}),i)},function(e,t,n){"use strict";t.__esModule=!0;var a=i(n(465)),r=i(n(477)),o="function"==typeof r.default&&"symbol"==typeof a.default?function(e){return typeof e}:function(e){return e&&"function"==typeof r.default&&e.constructor===r.default&&e!==r.default.prototype?"symbol":typeof e};function i(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof r.default&&"symbol"===o(a.default)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof r.default&&e.constructor===r.default&&e!==r.default.prototype?"symbol":void 0===e?"undefined":o(e)}},function(e,t,n){"use strict";n.d(t,"a",function(){return w}),n.d(t,"b",function(){return x}),n.d(t,"c",function(){return m}),n.d(t,"d",function(){return C}),n.d(t,"e",function(){return h}),n.d(t,"f",function(){return E}),n.d(t,"g",function(){return L});function a(e){var t=Object(o.a)();return t.displayName=e,t}var r=n(57),t=n(0),l=n.n(t),s=n(54),o=n(413),u=n(56),d=n(39),t=n(181),c=n.n(t),i=(n(186),n(53)),t=n(99),f=n.n(t),p=a("Router-History"),h=a("Router"),m=function(n){function e(e){var t=n.call(this,e)||this;return t.state={location:e.history.location},t._isMounted=!1,t._pendingLocation=null,e.staticContext||(t.unlisten=e.history.listen(function(e){t._pendingLocation=e})),t}Object(r.a)(e,n),e.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var t=e.prototype;return t.componentDidMount=function(){var t=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen(function(e){t._isMounted&&t.setState({location:e})})),this._pendingLocation&&this.setState({location:this._pendingLocation})},t.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},t.render=function(){return l.a.createElement(h.Provider,{value:{history:this.props.history,location:this.state.location,match:e.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},l.a.createElement(p.Provider,{children:this.props.children||null,value:this.props.history}))},e}(l.a.Component),g=(l.a.Component,function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(e){this.props.onUpdate&&this.props.onUpdate.call(this,this,e)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},t}(l.a.Component));var y={},v=1e4,_=0;function b(e,t){return void 0===t&&(t={}),"/"===(e=void 0===e?"/":e)?e:function(e){if(y[e])return y[e];var t=c.a.compile(e);return _e?t.splice(e,t.length-e,n):t.push(n),i({action:"PUSH",location:n,index:e,entries:t}))})},replace:function(e,t){var n=O(e,t,l(),u.location);o.confirmTransitionTo(n,"REPLACE",a,function(e){e&&i({action:"REPLACE",location:u.entries[u.index]=n})})},go:s,goBack:function(){s(-1)},goForward:function(){s(1)},canGo:function(e){return 0<=(e=u.index+e)&&ex',"Tag"),"readonly"!==n&&"interactive"!==n||r.log.warning("Warning: [ shape="+n+" ] is deprecated at [ Tag ]"),"secondary"===a&&r.log.warning("Warning: [ type=secondary ] is deprecated at [ Tag ]"),["count","marked","value","onChange"].forEach(function(e){e in t&&r.log.warning("Warning: [ "+e+" ] is deprecated at [ Tag ]")}),("selected"in t||"defaultSelected"in t)&&r.log.warning("Warning: [ selected|defaultSelected ] is deprecated at [ Tag ], use [ checked|defaultChecked ] at [ Tag.Selectable ] instead of it"),"closed"in t&&r.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&&r.log.warning("Warning: [ afterClose ] is deprecated at [ Tag ], use [ afterClose ] at [ Tag.Closeable ] instead of it"),t}});o.Group=a.default.config(i.default),o.Selectable=a.default.config(l.default),o.Closable=a.default.config(n.default),o.Closeable=o.Closable,t.default=o,e.exports=t.default},function(e,t,n){"use strict";n(68),n(444)},function(e,t){e=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(e,t){e=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},function(e,t,n){e.exports=!n(106)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";t.__esModule=!0;var a=o(n(341)),r=o(n(523)),n=o(n(524));function o(e){return e&&e.__esModule?e:{default:e}}a.default.Expand=r.default,a.default.OverlayAnimate=n.default,t.default=a.default,e.exports=t.default},function(e,t,n){"use strict";n(41),n(68),n(122),n(107),n(535)},function(e,t,n){"use strict";n.d(t,"b",function(){return l});var a=n(21),r=n(35),o=n(29),i={namespaces:[]},l=function(e){return function(n){return r.a.get("v1/console/namespaces",{params:e}).then(function(e){var t=e.code,e=e.data;n({type:o.b,data:200===t?e:[]})})}};t.a=function(){var e=0this.menuNode.clientHeight&&(this.menuNode.clientHeight+this.menuNode.scrollTop<(e=this.itemNode.offsetTop+this.itemNode.offsetHeight)?this.menuNode.scrollTop=e-this.menuNode.clientHeight:this.itemNode.offsetTop"===(d=e.charAt(o+1))){r+="(",o++,0[0-9][0-9][0-9][0-9])-(?[0-9][0-9]?)-(?[0-9][0-9]?)(?:(?:[Tt]|[ \t]+)(?[0-9][0-9]?):(?[0-9][0-9]):(?[0-9][0-9])(?:.(?[0-9]*))?(?:[ \t]*(?Z|(?[-+])(?[0-9][0-9]?)(?::(?[0-9][0-9]))?))?)?$","i"),r.LOCAL_TIMEZONE_OFFSET=60*(new Date).getTimezoneOffset()*1e3,r.trim=function(e,t){var n,a;return null==(n=this.REGEX_LEFT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_LEFT_TRIM_BY_CHAR[t]=n=new RegExp("^"+t+t+"*")),n.lastIndex=0,null==(a=this.REGEX_RIGHT_TRIM_BY_CHAR[t])&&(this.REGEX_RIGHT_TRIM_BY_CHAR[t]=a=new RegExp(t+""+t+"*$")),a.lastIndex=0,e.replace(n,"").replace(a,"")},r.ltrim=function(e,t){var n;return null==(n=this.REGEX_LEFT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_LEFT_TRIM_BY_CHAR[t]=n=new RegExp("^"+t+t+"*")),n.lastIndex=0,e.replace(n,"")},r.rtrim=function(e,t){var n;return null==(n=this.REGEX_RIGHT_TRIM_BY_CHAR[t=null==t?"\\s":t])&&(this.REGEX_RIGHT_TRIM_BY_CHAR[t]=n=new RegExp(t+""+t+"*$")),n.lastIndex=0,e.replace(n,"")},r.isEmpty=function(e){return!e||""===e||"0"===e||e instanceof Array&&0===e.length||this.isEmptyObject(e)},r.isEmptyObject=function(t){var n;return t instanceof Object&&0===function(){var e=[];for(n in t)a.call(t,n)&&e.push(n);return e}().length},r.subStrCount=function(e,t,n,a){var r,o,i,l,s=0;for(e=""+e,t=""+t,null!=n&&(e=e.slice(n)),n=(e=null!=a?e.slice(0,a):e).length,l=t.length,r=o=0,i=n;0<=i?o>6)+t(128|63&e):e<65536?t(224|e>>12)+t(128|e>>6&63)+t(128|63&e):t(240|e>>18)+t(128|e>>12&63)+t(128|e>>6&63)+t(128|63&e)},r.parseBoolean=function(e,t){var n;return null==t&&(t=!0),"string"==typeof e?(n=e.toLowerCase(),!(!t&&"no"===n)&&("0"!==n&&("false"!==n&&""!==n))):!!e},r.isNumeric=function(e){return this.REGEX_SPACES.lastIndex=0,"number"==typeof e||"string"==typeof e&&!isNaN(e)&&""!==e.replace(this.REGEX_SPACES,"")},r.stringToDate=function(e){var t,n,a,r,o,i,l,s,u;if(null==e||!e.length)return null;if(!(e=this.PATTERN_DATE.exec(e)))return null;if(u=parseInt(e.year,10),i=parseInt(e.month,10)-1,n=parseInt(e.day,10),null==e.hour)return t=new Date(Date.UTC(u,i,n));if(r=parseInt(e.hour,10),o=parseInt(e.minute,10),l=parseInt(e.second,10),null!=e.fraction){for(a=e.fraction.slice(0,3);a.length<3;)a+="0";a=parseInt(a,10)}else a=0;return null!=e.tz&&(s=6e4*(60*parseInt(e.tz_hour,10)+(null!=e.tz_minute?parseInt(e.tz_minute,10):0)),"-"===e.tz_sign&&(s*=-1)),t=new Date(Date.UTC(u,i,n,r,o,l,a)),s&&t.setTime(t.getTime()-s),t},r.strRepeat=function(e,t){for(var n="",a=0;ae.length)&&(t=e.length);for(var n=0,a=new Array(t);ndocument.F=Object<\/script>"),e.close(),u=e.F;t--;)delete u[s][i[t]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(a[s]=r(e),n=new a,a[s]=null,n[l]=e):n=u(),void 0===t?n:o(n,t)}},function(e,t,n){var a=n(82).f,r=n(83),o=n(93)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,o)&&a(e,o,{configurable:!0,value:t})}},function(e,t,n){t.f=n(93)},function(e,t,n){var a=n(74),r=n(75),o=n(118),i=n(151),l=n(82).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=!o&&a.Symbol||{});"_"==e.charAt(0)||e in t||l(t,e,{value:i.f(e)})}},function(e,t,n){"use strict";t.__esModule=!0;var a=d(n(202)),r=d(n(498)),o=d(n(499)),i=d(n(500)),l=d(n(501)),s=d(n(502)),u=d(n(503));function d(e){return e&&e.__esModule?e:{default:e}}n(504),a.default.extend(s.default),a.default.extend(l.default),a.default.extend(r.default),a.default.extend(o.default),a.default.extend(i.default),a.default.extend(u.default),a.default.locale("zh-cn");n=a.default;n.isSelf=a.default.isDayjs,a.default.localeData(),t.default=n,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var v=c(n(2)),o=c(n(4)),i=c(n(5)),a=c(n(6)),r=n(0),_=c(r),l=c(n(3)),s=n(30),b=c(n(13)),u=c(n(44)),w=c(n(24)),M=c(n(77)),d=c(n(7)),k=n(10);function c(e){return e&&e.__esModule?e:{default:e}}function f(){}p=r.Component,(0,a.default)(S,p),S.getDerivedStateFromProps=function(e){return"visible"in e?{visible:e.visible}:{}},S.prototype.render=function(){var e,t=this.props,n=t.prefix,a=(t.pure,t.className),r=t.style,o=t.type,i=t.shape,l=t.size,s=t.title,u=t.children,d=(t.defaultVisible,t.visible,t.iconType),c=t.closeable,f=(t.onClose,t.afterClose),p=t.animation,h=t.rtl,t=t.locale,m=(0,v.default)({},k.obj.pickOthers(Object.keys(S.propTypes),this.props)),g=this.state.visible,y=n+"message",o=(0,b.default)(((e={})[y]=!0,e[n+"message-"+o]=o,e[""+n+i]=i,e[""+n+l]=l,e[n+"title-content"]=!!s,e[n+"only-content"]=!s&&!!u,e[a]=a,e)),i=g?_.default.createElement("div",(0,v.default)({role:"alert",style:r},m,{className:o,dir:h?"rtl":void 0}),c?_.default.createElement("a",{role:"button","aria-label":t.closeAriaLabel,className:y+"-close",onClick:this.onClose},_.default.createElement(w.default,{type:"close"})):null,!1!==d?_.default.createElement(w.default,{className:y+"-symbol "+(!d&&y+"-symbol-icon"),type:d}):null,s?_.default.createElement("div",{className:y+"-title"},s):null,u?_.default.createElement("div",{className:y+"-content"},u):null):null;return p?_.default.createElement(M.default.Expand,{animationAppear:!1,afterLeave:f},i):i},r=n=S,n.propTypes={prefix:l.default.string,pure:l.default.bool,className:l.default.string,style:l.default.object,type:l.default.oneOf(["success","warning","error","notice","help","loading"]),shape:l.default.oneOf(["inline","addon","toast"]),size:l.default.oneOf(["medium","large"]),title:l.default.node,children:l.default.node,defaultVisible:l.default.bool,visible:l.default.bool,iconType:l.default.oneOfType([l.default.string,l.default.bool]),closeable:l.default.bool,onClose:l.default.func,afterClose:l.default.func,animation:l.default.bool,locale:l.default.object,rtl:l.default.bool},n.defaultProps={prefix:"next-",pure:!1,type:"success",shape:"inline",size:"medium",defaultVisible:!0,closeable:!1,onClose:f,afterClose:f,animation:!0,locale:u.default.Message};var p,a=r;function S(){var e,t;(0,o.default)(this,S);for(var n=arguments.length,a=Array(n),r=0;r=n.length?(s=!!(c=h(o,u)))&&"get"in c&&!("originalValue"in c.get)?c.get:o[u]:(s=_(o,u),o[u]),s&&!i&&(y[d]=o)}}return o}},function(e,t,n){"use strict";n=n(601);e.exports=Function.prototype.bind||n},function(e,t,n){"use strict";var a=String.prototype.replace,r=/%20/g,o="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return a.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:i}},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var d=s(n(2)),a=s(n(4)),r=s(n(5)),o=s(n(6)),c=n(0),f=s(c),i=s(n(3)),p=s(n(13)),h=s(n(24)),l=n(10),m=s(n(96));function s(e){return e&&e.__esModule?e:{default:e}}var u,g=l.func.bindCtx,y=l.obj.pickOthers,i=(u=c.Component,(0,o.default)(v,u),v.prototype.getSelected=function(){var e=this.props,t=e._key,n=e.root,e=e.selected,a=n.props.selectMode,n=n.state.selectedKeys;return e||!!a&&-1e.length&&e.every(function(e,t){return e===n[t]})},t.isAvailablePos=function(e,t,n){var n=n[t],a=n.type,n=n.disabled;return r(e,t)&&("item"===a&&!n||"submenu"===a)});t.getFirstAvaliablelChildKey=function(t,n){var e=Object.keys(n).find(function(e){return a(t+"-0",e,n)});return e?n[e].key:null},t.getChildSelected=function(e){var t=e.selectMode,n=e.selectedKeys,a=e._k2n,e=e._key;if(!a)return!1;var r=(a[e]&&a[e].pos)+"-";return!!t&&n.some(function(e){return a[e]&&0===a[e].pos.indexOf(r)})}},function(e,t,n){"use strict";n(41),n(32),n(623)},function(e,t,n){var o=n(636),i=Object.prototype.hasOwnProperty;function l(e){return Array.isArray(e)?"array":typeof e}function s(e,t){var n,a=0,r=0;for(n in e)if(i.call(e,n)){if("style"===n){if(!o(e[n],t[n]))return!1}else if("children"!==n&&e[n]!==t[n])return!1;a++}for(n in t)i.call(t,n)&&r++;return a===r&&function e(t,n){var a=l(t);if(a!==l(n))return!1;switch(a){case"array":if(t.length!==n.length)return!1;for(var r=0;r=u,u=(0,O.default)(((u={})[n+"upload-inner"]=!0,u[n+"hidden"]=x,u)),C=this.props.children;if("card"===r&&(r=(0,O.default)(((r={})[n+"upload-card"]=!0,r[n+"disabled"]=s,r)),C=D.default.createElement("div",{className:r},D.default.createElement(P.default,{size:"large",type:"add",className:n+"upload-add-icon"}),D.default.createElement("div",{tabIndex:"0",role:"button",className:n+"upload-text"},C))),b)return"function"==typeof w?(b=(0,O.default)(((r={})[n+"form-preview"]=!0,r[o]=!!o,r)),D.default.createElement("div",{style:i,className:b},w(this.state.value,this.props))):t?D.default.createElement(Y.default,{isPreview:!0,listType:t,style:i,className:o,value:this.state.value}):null;n=s?N.func.prevent:p,r=N.obj.pickAttrsWith(this.props,"data-");return D.default.createElement("div",(0,L.default)({className:f,style:i},r),D.default.createElement(j.default,(0,L.default)({},e,{name:M,beforeUpload:c,dragable:a,disabled:s||x,className:u,onSelect:this.onSelect,onDrop:this.onDrop,onProgress:this.onProgress,onSuccess:this.onSuccess,onError:this.onError,ref:this.saveUploaderRef}),C),t||g?D.default.createElement(Y.default,{useDataURL:l,fileNameRender:k,actionRender:S,uploader:this,listType:t,value:this.state.value,closable:d,onRemove:n,progressProps:v,onCancel:h,onPreview:m,extraRender:y,rtl:_,previewOnFileName:E}):null)},i=u=h,u.displayName="Upload",u.propTypes=(0,L.default)({},d.default.propTypes,Y.default.propTypes,{prefix:l.default.string.isRequired,action:l.default.string,value:l.default.array,defaultValue:l.default.array,shape:l.default.oneOf(["card"]),listType:l.default.oneOf(["text","image","card"]),list:l.default.any,name:l.default.string,data:l.default.oneOfType([l.default.object,l.default.func]),formatter:l.default.func,limit:l.default.number,timeout:l.default.number,dragable:l.default.bool,closable:l.default.bool,useDataURL:l.default.bool,disabled:l.default.bool,onSelect:l.default.func,onProgress:l.default.func,onChange:l.default.func,onSuccess:l.default.func,afterSelect:l.default.func,onRemove:l.default.func,onError:l.default.func,beforeUpload:l.default.func,onDrop:l.default.func,className:l.default.string,style:l.default.object,children:l.default.node,autoUpload:l.default.bool,request:l.default.func,progressProps:l.default.object,rtl:l.default.bool,isPreview:l.default.bool,renderPreview:l.default.func,fileKeyName:l.default.string,fileNameRender:l.default.func,actionRender:l.default.func,previewOnFileName:l.default.bool}),u.defaultProps=(0,L.default)({},d.default.defaultProps,{prefix:"next-",limit:1/0,autoUpload:!0,closable:!0,onSelect:n,onProgress:n,onChange:n,onSuccess:n,onRemove:n,onError:n,onDrop:n,beforeUpload:n,afterSelect:n,previewOnFileName:!1}),a=function(){var u=this;this.onSelect=function(e){var t,n,a=u.props,r=a.autoUpload,o=a.afterSelect,i=a.onSelect,a=a.limit,l=u.state.value.length+e.length,s=a-u.state.value.length;s<=0||(t=e=e.map(function(e){e=(0,c.fileToObject)(e);return e.state="selected",e}),n=[],ai||l+a.width>o):t<0||e<0||t+a.height>u.height||e+a.width>u.width}function T(e,t,n,a){var r=a.overlayInfo,a=a.containerInfo,n=n.split("");return 1===n.length&&n.push(""),t<0&&(n=[n[0].replace("t","b"),n[1].replace("b","t")]),e<0&&(n=[n[0].replace("l","r"),n[1].replace("r","l")]),t+r.height>a.height&&(n=[n[0].replace("b","t"),n[1].replace("t","b")]),(n=e+r.width>a.width?[n[0].replace("r","l"),n[1].replace("l","r")]:n).join("")}function D(e,t,n){var a=n.overlayInfo,n=n.containerInfo;return(t=t<0?0:t)+a.height>n.height&&(t=n.height-a.height),{left:e=(e=e<0?0:e)+a.width>n.width?n.width-a.width:e,top:t}}function ve(e){var t=e.target,n=e.overlay,a=e.container,r=e.scrollNode,o=e.placement,i=e.placementOffset,i=void 0===i?0:i,l=e.points,l=void 0===l?["tl","bl"]:l,s=e.offset,s=void 0===s?[0,0]:s,u=e.position,u=void 0===u?"absolute":u,d=e.beforePosition,c=e.autoAdjust,c=void 0===c||c,f=e.autoHideScrollOverflow,f=void 0===f||f,e=e.rtl,p="offsetWidth"in(p=n)&&"offsetHeight"in p?{width:p.offsetWidth,height:p.offsetHeight}:{width:(p=p.getBoundingClientRect()).width,height:p.height},h=p.width,p=p.height;if("fixed"===u)return m={config:{placement:void 0,points:void 0},style:{position:u,left:s[0],top:s[1]}},d?d(m,{overlay:{node:n,width:h,height:p}}):m;var m=t.getBoundingClientRect(),g=m.width,y=m.height,v=m.left,_=m.top,m=x(a),b=m.left,m=m.top,w=a.scrollWidth,M=a.scrollHeight,k=a.scrollTop,S=a.scrollLeft,b={targetInfo:{width:g,height:y,left:v,top:_},containerInfo:{left:b,top:m,width:w,height:M,scrollTop:k,scrollLeft:S},overlayInfo:{width:h,height:p},points:l,placementOffset:i,offset:s,container:a,rtl:e},m=C(o,b),w=m.left,M=m.top,k=m.points,S=function(e){for(var t=e;t;){var n=fe(t,"overflow");if(null!=n&&n.match(/auto|scroll|hidden/))return t;t=t.parentNode}return document.documentElement}(a),E=(c&&o&&L(w,M,S,b)&&(o!==(l=T(w,M,o,b))&&(M=L(s=(i=C(l,b)).left,e=i.top,S,b)&&l!==(m=T(s,e,l,b))?(w=(c=D((a=C(o=m,b)).left,a.top,b)).left,c.top):(o=l,w=s,e)),w=(i=D(w,M,b)).left,M=i.top),{config:{placement:o,points:k},style:{position:u,left:Math.round(w),top:Math.round(M)}});return f&&o&&null!=r&&r.length&&r.forEach(function(e){var e=e.getBoundingClientRect(),t=e.top,n=e.left,a=e.width,e=e.height;E.style.display=_+y=e.length?{done:!0}:{done:!1,value:e[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.clientHeight&&0r;)!i(a,n=t[r++])||~s(o,n)||o.push(n);return o}},function(e,t,n){var a=n(192);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==a(e)?e.split(""):Object(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){"use strict";function y(){return this}var v=n(118),_=n(86),b=n(194),w=n(87),M=n(147),k=n(468),S=n(149),E=n(471),x=n(90)("iterator"),C=!([].keys&&"next"in[].keys()),L="values";e.exports=function(e,t,n,a,r,o,i){k(n,t,a);function l(e){if(!C&&e in f)return f[e];switch(e){case"keys":case L:return function(){return new n(this,e)}}return function(){return new n(this,e)}}var s,u,a=t+" Iterator",d=r==L,c=!1,f=e.prototype,p=f[x]||f["@@iterator"]||r&&f[r],h=p||l(r),m=r?d?l("entries"):h:void 0,g="Array"==t&&f.entries||p;if(g&&(g=E(g.call(new e)))!==Object.prototype&&g.next&&(S(g,a,!0),v||"function"==typeof g[x]||w(g,x,y)),d&&p&&p.name!==L&&(c=!0,h=function(){return p.call(this)}),v&&!i||!C&&!c&&f[x]||w(f,x,h),M[t]=h,M[a]=y,r)if(s={values:d?h:l(L),keys:o?h:l("keys"),entries:m},i)for(u in s)u in f||b(f,u,s[u]);else _(_.P+_.F*(C||c),t,s);return s}},function(e,t,n){e.exports=n(87)},function(e,t,n){var a=n(190),r=n(144).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return a(e,r)}},function(e,t,n){var a=n(120),r=n(116),o=n(89),i=n(139),l=n(82),s=n(188),u=Object.getOwnPropertyDescriptor;t.f=n(76)?u:function(e,t){if(e=o(e),t=i(t,!0),s)try{return u(e,t)}catch(e){}if(l(e,t))return r(!a.f.call(e,t),e[t])}},function(e,t,n){"use strict";t.__esModule=!0;var v=a(n(2));t.default=function(e,t,n){var a=e.prefix,r=e.locale,o=(e.defaultPropsConfig,e.pure),i=e.rtl,l=e.device,s=e.popupContainer,e=e.errorBoundary,u=t.nextPrefix,d=t.nextLocale,c=t.nextDefaultPropsConfig,f=t.nextPure,p=t.nextWarning,h=t.nextRtl,m=t.nextDevice,g=t.nextPopupContainer,t=t.nextErrorBoundary,a=a||u,u=void 0,y=n;switch(n){case"DatePicker2":y="DatePicker";break;case"Calendar2":y="Calendar";break;case"TimePicker2":y="TimePicker"}d&&(u=d[y])&&(u.momentLocale=d.momentLocale);n=void 0;r?n=b.obj.deepMerge({},_.default[y],u,r):u&&(n=b.obj.deepMerge({},_.default[y],u));d="boolean"==typeof o?o:f,r="boolean"==typeof i?i:h,u=(0,v.default)({},w(t),w(e));"open"in u||(u.open=!1);return{prefix:a,locale:n,pure:d,rtl:r,warning:p,defaultPropsConfig:c||{},device:l||m||void 0,popupContainer:s||g,errorBoundary:u}};var _=a(n(44)),b=n(10);function a(e){return e&&e.__esModule?e:{default:e}}var w=function(e){return null==e?{}:"boolean"==typeof e?{open:e}:(0,v.default)({open:!0},e)};e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.matches=t.hasDOM=void 0;var a=n(36),r=(a=a)&&a.__esModule?a:{default:a},o=(t.hasClass=s,t.addClass=u,t.removeClass=d,t.toggleClass=function(e,t){if(!l||!e)return!1;{var n;return e.classList?e.classList.toggle(t):(((n=s(e,t))?d:u)(e,t,!0),!n)}},t.getNodeHozWhitespace=function(e){var t=m(e,"paddingLeft"),n=m(e,"paddingRight"),a=m(e,"marginLeft"),e=m(e,"marginRight");return t+n+a+e},t.getStyle=m,t.setStyle=g,t.scrollbar=v,t.hasScroll=function(e){if("hidden"===m(e,"overflow"))return!1;var t=e.parentNode;return t&&t.scrollHeight>t.clientHeight&&0=t?e:""+Array(t+1-a.length).join(n)+e},t={s:o,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),a=Math.floor(n/60),r=n%60;return(t<=0?"+":"-")+o(a,2,"0")+":"+o(r,2,"0")},m:function e(t,n){if(t.date()1)return e(i[0])}else{var l=t.name;S[l]=t,r=l}return!a&&r&&(k=r),r||!a&&k},E=function(e,t){if(a(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new l(n)},x=t,l=(x.l=r,x.i=a,x.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},function(){function e(e){this.$L=r(e.locale,null,!0),this.parse(e)}var t=e.prototype;return t.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(x.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var a=t.match(i);if(a){var r=a[2]-1||0,o=(a[7]||"0").substring(0,3);return n?new Date(Date.UTC(a[1],r,a[3]||1,a[4]||0,a[5]||0,a[6]||0,o)):new Date(a[1],r,a[3]||1,a[4]||0,a[5]||0,a[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return x},t.isValid=function(){return!(this.$d.toString()===w)},t.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return E(e)r;)!i(a,n=t[r++])||~s(o,n)||o.push(n);return o}},function(e,t,n){var a=n(192);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==a(e)?e.split(""):Object(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){"use strict";function y(){return this}var v=n(118),_=n(89),b=n(194),w=n(90),M=n(148),k=n(469),S=n(150),E=n(472),x=n(93)("iterator"),C=!([].keys&&"next"in[].keys()),L="values";e.exports=function(e,t,n,a,r,o,i){k(n,t,a);function l(e){if(!C&&e in f)return f[e];switch(e){case"keys":case L:return function(){return new n(this,e)}}return function(){return new n(this,e)}}var s,u,a=t+" Iterator",d=r==L,c=!1,f=e.prototype,p=f[x]||f["@@iterator"]||r&&f[r],h=p||l(r),m=r?d?l("entries"):h:void 0,g="Array"==t&&f.entries||p;if(g&&(g=E(g.call(new e)))!==Object.prototype&&g.next&&(S(g,a,!0),v||"function"==typeof g[x]||w(g,x,y)),d&&p&&p.name!==L&&(c=!0,h=function(){return p.call(this)}),v&&!i||!C&&!c&&f[x]||w(f,x,h),M[t]=h,M[a]=y,r)if(s={values:d?h:l(L),keys:o?h:l("keys"),entries:m},i)for(u in s)u in f||b(f,u,s[u]);else _(_.P+_.F*(C||c),t,s);return s}},function(e,t,n){e.exports=n(90)},function(e,t,n){var a=n(190),r=n(145).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return a(e,r)}},function(e,t,n){var a=n(120),r=n(116),o=n(92),i=n(140),l=n(83),s=n(188),u=Object.getOwnPropertyDescriptor;t.f=n(76)?u:function(e,t){if(e=o(e),t=i(t,!0),s)try{return u(e,t)}catch(e){}if(l(e,t))return r(!a.f.call(e,t),e[t])}},function(e,t,n){"use strict";t.__esModule=!0;var v=a(n(2));t.default=function(e,t,n){var a=e.prefix,r=e.locale,o=(e.defaultPropsConfig,e.pure),i=e.rtl,l=e.device,s=e.popupContainer,e=e.errorBoundary,u=t.nextPrefix,d=t.nextLocale,c=t.nextDefaultPropsConfig,f=t.nextPure,p=t.nextWarning,h=t.nextRtl,m=t.nextDevice,g=t.nextPopupContainer,t=t.nextErrorBoundary,a=a||u,u=void 0,y=n;switch(n){case"DatePicker2":y="DatePicker";break;case"Calendar2":y="Calendar";break;case"TimePicker2":y="TimePicker"}d&&(u=d[y])&&(u.momentLocale=d.momentLocale);n=void 0;r?n=b.obj.deepMerge({},_.default[y],u,r):u&&(n=b.obj.deepMerge({},_.default[y],u));d="boolean"==typeof o?o:f,r="boolean"==typeof i?i:h,u=(0,v.default)({},w(t),w(e));"open"in u||(u.open=!1);return{prefix:a,locale:n,pure:d,rtl:r,warning:p,defaultPropsConfig:c||{},device:l||m||void 0,popupContainer:s||g,errorBoundary:u}};var _=a(n(44)),b=n(10);function a(e){return e&&e.__esModule?e:{default:e}}var w=function(e){return null==e?{}:"boolean"==typeof e?{open:e}:(0,v.default)({open:!0},e)};e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.matches=t.hasDOM=void 0;var a=n(36),r=(a=a)&&a.__esModule?a:{default:a},o=(t.hasClass=s,t.addClass=u,t.removeClass=d,t.toggleClass=function(e,t){if(!l||!e)return!1;{var n;return e.classList?e.classList.toggle(t):(((n=s(e,t))?d:u)(e,t,!0),!n)}},t.getNodeHozWhitespace=function(e){var t=m(e,"paddingLeft"),n=m(e,"paddingRight"),a=m(e,"marginLeft"),e=m(e,"marginRight");return t+n+a+e},t.getStyle=m,t.setStyle=g,t.scrollbar=v,t.hasScroll=function(e){if("hidden"===m(e,"overflow"))return!1;var t=e.parentNode;return t&&t.scrollHeight>t.clientHeight&&0=t?e:""+Array(t+1-a.length).join(n)+e},t={s:o,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),a=Math.floor(n/60),r=n%60;return(t<=0?"+":"-")+o(a,2,"0")+":"+o(r,2,"0")},m:function e(t,n){if(t.date()1)return e(i[0])}else{var l=t.name;S[l]=t,r=l}return!a&&r&&(k=r),r||!a&&k},E=function(e,t){if(a(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new l(n)},x=t,l=(x.l=r,x.i=a,x.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},function(){function e(e){this.$L=r(e.locale,null,!0),this.parse(e)}var t=e.prototype;return t.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(x.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var a=t.match(i);if(a){var r=a[2]-1||0,o=(a[7]||"0").substring(0,3);return n?new Date(Date.UTC(a[1],r,a[3]||1,a[4]||0,a[5]||0,a[6]||0,o)):new Date(a[1],r,a[3]||1,a[4]||0,a[5]||0,a[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return x},t.isValid=function(){return!(this.$d.toString()===w)},t.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return E(e)=20?"ste":"de")},week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration @@ -54,7 +54,7 @@ function t(e,t,n){var a=e+" ";switch(n){case"ss":if(e===1)a+="sekunda";else if(e //! moment.js locale configuration var t;e.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:true,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(this.hours()!==1?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(this.hours()!==1?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(this.hours()!==1?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(this.hours()!==1?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(this.hours()!==1?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=e===1?"r":e===2?"n":e===3?"r":e===4?"t":"è";if(t==="w"||t==="W")n="a";return e+n},week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration -var t="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),a=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],r=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,o;function i(e){return e>1&&e<5&&~~(e/10)!==1}function l(e,t,n,a){var r=e+" ";switch(n){case"s":return t||a?"pár sekund":"pár sekundami";case"ss":if(t||a)return r+(i(e)?"sekundy":"sekund");else return r+"sekundami";case"m":return t?"minuta":a?"minutu":"minutou";case"mm":if(t||a)return r+(i(e)?"minuty":"minut");else return r+"minutami";case"h":return t?"hodina":a?"hodinu":"hodinou";case"hh":if(t||a)return r+(i(e)?"hodiny":"hodin");else return r+"hodinami";case"d":return t||a?"den":"dnem";case"dd":if(t||a)return r+(i(e)?"dny":"dní");else return r+"dny";case"M":return t||a?"měsíc":"měsícem";case"MM":if(t||a)return r+(i(e)?"měsíce":"měsíců");else return r+"měsíci";case"y":return t||a?"rok":"rokem";case"yy":if(t||a)return r+(i(e)?"roky":"let");else return r+"lety"}}e.defineLocale("cs",{months:t,monthsShort:n,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:a,longMonthsParse:a,shortMonthsParse:a,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:l,ss:l,m:l,mm:l,h:l,hh:l,d:l,dd:l,M:l,MM:l,y:l,yy:l},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; +var t={format:"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),standalone:"ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince".split("_")},n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),a=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],r=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,o;function i(e){return e>1&&e<5&&~~(e/10)!==1}function l(e,t,n,a){var r=e+" ";switch(n){case"s":return t||a?"pár sekund":"pár sekundami";case"ss":if(t||a)return r+(i(e)?"sekundy":"sekund");else return r+"sekundami";case"m":return t?"minuta":a?"minutu":"minutou";case"mm":if(t||a)return r+(i(e)?"minuty":"minut");else return r+"minutami";case"h":return t?"hodina":a?"hodinu":"hodinou";case"hh":if(t||a)return r+(i(e)?"hodiny":"hodin");else return r+"hodinami";case"d":return t||a?"den":"dnem";case"dd":if(t||a)return r+(i(e)?"dny":"dní");else return r+"dny";case"M":return t||a?"měsíc":"měsícem";case"MM":if(t||a)return r+(i(e)?"měsíce":"měsíců");else return r+"měsíci";case"y":return t||a?"rok":"rokem";case"yy":if(t||a)return r+(i(e)?"roky":"let");else return r+"lety"}}e.defineLocale("cs",{months:t,monthsShort:n,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:a,longMonthsParse:a,shortMonthsParse:a,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:l,ss:l,m:l,mm:l,h:l,hh:l,d:l,dd:l,M:l,MM:l,y:l,yy:l},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration var t;e.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(e){var t=/сехет$/i.exec(e)?"рен":/ҫул$/i.exec(e)?"тан":"ран";return e+t},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration @@ -230,9 +230,9 @@ function t(e,t,n,a){var r=e+" ";switch(n){case"s":return t||a?"nekaj sekund":"ne //! moment.js locale configuration var t;e.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:true,meridiemParse:/PD|MD/,isPM:function(e){return e.charAt(0)==="M"},meridiem:function(e,t,n){return e<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration -var r={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return e===1?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,t,n){var a=r.words[n];if(n.length===1)return t?a[0]:a[1];else return e+" "+r.correctGrammaticalCase(e,a)}},t;e.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:true,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var e=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:r.translate,m:r.translate,mm:r.translate,h:r.translate,hh:r.translate,d:"dan",dd:r.translate,M:"mesec",MM:r.translate,y:"godinu",yy:r.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; +var i={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],d:["jedan dan","jednog dana"],dd:["dan","dana","dana"],M:["jedan mesec","jednog meseca"],MM:["mesec","meseca","meseci"],y:["jednu godinu","jedne godine"],yy:["godinu","godine","godina"]},correctGrammaticalCase:function(e,t){if(e%10>=1&&e%10<=4&&(e%100<10||e%100>=20))return e%10===1?t[0]:t[1];return t[2]},translate:function(e,t,n,a){var r=i.words[n],o;if(n.length===1){if(n==="y"&&t)return"jedna godina";return a||t?r[0]:r[1]}o=i.correctGrammaticalCase(e,r);if(n==="yy"&&t&&o==="godinu")return e+" godina";return e+" "+o}},t;e.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:true,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var e=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:i.translate,m:i.translate,mm:i.translate,h:i.translate,hh:i.translate,d:i.translate,dd:i.translate,M:i.translate,MM:i.translate,y:i.translate,yy:i.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration -var r={words:{ss:["секунда","секунде","секунди"],m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(e,t){return e===1?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,t,n){var a=r.words[n];if(n.length===1)return t?a[0]:a[1];else return e+" "+r.correctGrammaticalCase(e,a)}},t;e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:true,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var e=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:r.translate,m:r.translate,mm:r.translate,h:r.translate,hh:r.translate,d:"дан",dd:r.translate,M:"месец",MM:r.translate,y:"годину",yy:r.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; +var i={words:{ss:["секунда","секунде","секунди"],m:["један минут","једног минута"],mm:["минут","минута","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],d:["један дан","једног дана"],dd:["дан","дана","дана"],M:["један месец","једног месеца"],MM:["месец","месеца","месеци"],y:["једну годину","једне године"],yy:["годину","године","година"]},correctGrammaticalCase:function(e,t){if(e%10>=1&&e%10<=4&&(e%100<10||e%100>=20))return e%10===1?t[0]:t[1];return t[2]},translate:function(e,t,n,a){var r=i.words[n],o;if(n.length===1){if(n==="y"&&t)return"једна година";return a||t?r[0]:r[1]}o=i.correctGrammaticalCase(e,r);if(n==="yy"&&t&&o==="годину")return e+" година";return e+" "+o}},t;e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:true,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var e=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return e[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:i.translate,m:i.translate,mm:i.translate,h:i.translate,hh:i.translate,d:i.translate,dd:i.translate,M:i.translate,MM:i.translate,y:i.translate,yy:i.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration var t;e.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:true,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(e,t,n){if(e<11)return"ekuseni";else if(e<15)return"emini";else if(e<19)return"entsambama";else return"ebusuku"},meridiemHour:function(e,t){if(e===12)e=0;if(t==="ekuseni")return e;else if(t==="emini")return e>=11?e:e+12;else if(t==="entsambama"||t==="ebusuku"){if(e===0)return 0;return e+12}},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration @@ -256,7 +256,7 @@ var t;e.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo //! moment.js locale configuration var o="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_"),t;function n(e){var t=e;t=e.indexOf("jaj")!==-1?t.slice(0,-3)+"leS":e.indexOf("jar")!==-1?t.slice(0,-3)+"waQ":e.indexOf("DIS")!==-1?t.slice(0,-3)+"nem":t+" pIq";return t}function a(e){var t=e;t=e.indexOf("jaj")!==-1?t.slice(0,-3)+"Hu’":e.indexOf("jar")!==-1?t.slice(0,-3)+"wen":e.indexOf("DIS")!==-1?t.slice(0,-3)+"ben":t+" ret";return t}function r(e,t,n,a){var r=i(e);switch(n){case"ss":return r+" lup";case"mm":return r+" tup";case"hh":return r+" rep";case"dd":return r+" jaj";case"MM":return r+" jar";case"yy":return r+" DIS"}}function i(e){var t=Math.floor(e%1e3/100),n=Math.floor(e%100/10),a=e%10,r="";if(t>0)r+=o[t]+"vatlh";if(n>0)r+=(r!==""?" ":"")+o[n]+"maH";if(a>0)r+=(r!==""?" ":"")+o[a];return r===""?"pagh":r}e.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:true,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:n,past:a,s:"puS lup",ss:r,m:"wa’ tup",mm:r,h:"wa’ rep",hh:r,d:"wa’ jaj",dd:r,M:"wa’ jar",MM:r,y:"wa’ DIS",yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration -var o={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"},t;e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(e,t,n){if(e<12)return n?"öö":"ÖÖ";else return n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(e){return e==="ös"||e==="ÖS"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e,t){switch(t){case"d":case"D":case"Do":case"DD":return e;default:if(e===0)return e+"'ıncı";var n=e%10,a=e%100-n,r=e>=100?100:null;return e+(o[n]||o[a]||o[r])}},week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; +var o={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"},t;e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pzt_Sal_Çar_Per_Cum_Cmt".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(e,t,n){if(e<12)return n?"öö":"ÖÖ";else return n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(e){return e==="ös"||e==="ÖS"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e,t){switch(t){case"d":case"D":case"Do":case"DD":return e;default:if(e===0)return e+"'ıncı";var n=e%10,a=e%100-n,r=e>=100?100:null;return e+(o[n]||o[a]||o[r])}},week:{dow:1,doy:7}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration var t;function n(e,t,n,a){var r={s:["viensas secunds","'iensas secunds"],ss:[e+" secunds",""+e+" secunds"],m:["'n míut","'iens míut"],mm:[e+" míuts",""+e+" míuts"],h:["'n þora","'iensa þora"],hh:[e+" þoras",""+e+" þoras"],d:["'n ziua","'iensa ziua"],dd:[e+" ziuas",""+e+" ziuas"],M:["'n mes","'iens mes"],MM:[e+" mesen",""+e+" mesen"],y:["'n ar","'iens ar"],yy:[e+" ars",""+e+" ars"]};return a?r[n][0]:t?r[n][0]:r[n][1]}e.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(e){return"d'o"===e.toLowerCase()},meridiem:function(e,t,n){if(e>11)return n?"d'o":"D'O";else return n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration @@ -286,7 +286,7 @@ var t;e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_ //! moment.js locale configuration var t;e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){if(e===12)e=0;if(t==="凌晨"||t==="早上"||t==="上午")return e;else if(t==="中午")return e>=11?e:e+12;else if(t==="下午"||t==="晚上")return e+12},meridiem:function(e,t,n){var a=e*100+t;if(a<600)return"凌晨";else if(a<900)return"早上";else if(a<1130)return"上午";else if(a<1230)return"中午";else if(a<1800)return"下午";else return"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(8))},function(e,t,n){!function(e){"use strict"; //! moment.js locale configuration -var t;e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){if(e===12)e=0;if(t==="凌晨"||t==="早上"||t==="上午")return e;else if(t==="中午")return e>=11?e:e+12;else if(t==="下午"||t==="晚上")return e+12},meridiem:function(e,t,n){var a=e*100+t;if(a<600)return"凌晨";else if(a<900)return"早上";else if(a<1130)return"上午";else if(a<1230)return"中午";else if(a<1800)return"下午";else return"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(8))},function(e,t,n){"use strict";t.__esModule=!0;var g=s(n(2)),y=s(n(12)),a=s(n(36)),r=s(n(4)),o=s(n(5)),i=s(n(6)),v=n(0),_=s(v),l=s(n(3)),b=n(154),w=s(n(521));function s(e){return e&&e.__esModule?e:{default:e}}function u(){}function M(e){return _.default.Children.toArray(e.children)[0]||null}d=v.Component,(0,i.default)(c,d),c.prototype.normalizeNames=function(e){return"string"==typeof e?{appear:e+"-appear",appearActive:e+"-appear-active",enter:e+"-enter",enterActive:e+"-enter-active",leave:e+"-leave",leaveActive:e+"-leave-active"}:"object"===(void 0===e?"undefined":(0,a.default)(e))?{appear:e.appear,appearActive:e.appear+"-active",enter:""+e.enter,enterActive:e.enter+"-active",leave:""+e.leave,leaveActive:e.leave+"-active"}:void 0},c.prototype.render=function(){var t=this,e=this.props,n=e.animation,a=e.children,r=e.animationAppear,o=e.singleMode,i=e.component,l=e.beforeAppear,s=e.onAppear,u=e.afterAppear,d=e.beforeEnter,c=e.onEnter,f=e.afterEnter,p=e.beforeLeave,h=e.onLeave,m=e.afterLeave,e=(0,y.default)(e,["animation","children","animationAppear","singleMode","component","beforeAppear","onAppear","afterAppear","beforeEnter","onEnter","afterEnter","beforeLeave","onLeave","afterLeave"]),a=v.Children.map(a,function(e){return _.default.createElement(w.default,{key:e.key,names:t.normalizeNames(n),onAppear:l,onAppearing:s,onAppeared:u,onEnter:d,onEntering:c,onEntered:f,onExit:p,onExiting:h,onExited:m},e)});return _.default.createElement(b.TransitionGroup,(0,g.default)({appear:r,component:o?M:i},e),a)},i=n=c,n.propTypes={animation:l.default.oneOfType([l.default.string,l.default.object]),animationAppear:l.default.bool,component:l.default.any,singleMode:l.default.bool,children:l.default.oneOfType([l.default.element,l.default.arrayOf(l.default.element)]),beforeAppear:l.default.func,onAppear:l.default.func,afterAppear:l.default.func,beforeEnter:l.default.func,onEnter:l.default.func,afterEnter:l.default.func,beforeLeave:l.default.func,onLeave:l.default.func,afterLeave:l.default.func},n.defaultProps={animationAppear:!0,component:"div",singleMode:!0,beforeAppear:u,onAppear:u,afterAppear:u,beforeEnter:u,onEnter:u,afterEnter:u,beforeLeave:u,onLeave:u,afterLeave:u};var d,l=i;function c(){return(0,r.default)(this,c),(0,o.default)(this,d.apply(this,arguments))}l.displayName="Animate",t.default=l,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=t.EXITING=t.ENTERED=t.ENTERING=t.EXITED=t.UNMOUNTED=void 0;var a=function(e){{if(e&&e.__esModule)return e;var t,n={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&((t=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,a):{}).get||t.set?Object.defineProperty(n,a,t):n[a]=e[a]);return n.default=e,n}}(n(3)),o=l(n(0)),i=l(n(22)),r=n(30);n(342);function l(e){return e&&e.__esModule?e:{default:e}}var s="unmounted",u=(t.UNMOUNTED=s,"exited"),d=(t.EXITED=u,"entering"),c=(t.ENTERING=d,"entered"),f=(t.ENTERED=c,"exiting"),n=(t.EXITING=f,function(r){var e;function t(e,t){var n,a=r.call(this,e,t)||this,t=t.transitionGroup,t=t&&!t.isMounting?e.enter:e.appear;return a.appearStatus=null,e.in?t?(n=u,a.appearStatus=d):n=c:n=e.unmountOnExit||e.mountOnEnter?s:u,a.state={status:n},a.nextCallback=null,a}e=r,(n=t).prototype=Object.create(e.prototype),(n.prototype.constructor=n).__proto__=e;var n=t.prototype;return n.getChildContext=function(){return{transitionGroup:null}},t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===s?{status:u}:null},n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;e!==this.props&&(e=this.state.status,this.props.in?e!==d&&e!==c&&(t=d):e!==d&&e!==c||(t=f)),this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n=this.props.timeout,a=e=t=n;return null!=n&&"number"!=typeof n&&(a=n.exit,e=n.enter,t=void 0!==n.appear?n.appear:e),{exit:a,enter:e,appear:t}},n.updateStatus=function(e,t){var n;void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),n=i.default.findDOMNode(this),t===d?this.performEnter(n,e):this.performExit(n)):this.props.unmountOnExit&&this.state.status===u&&this.setState({status:s})},n.performEnter=function(e,t){var n=this,a=this.props.enter,r=this.context.transitionGroup?this.context.transitionGroup.isMounting:t,o=this.getTimeouts(),i=r?o.appear:o.enter;t||a?(this.props.onEnter(e,r),this.safeSetState({status:d},function(){n.props.onEntering(e,r),n.onTransitionEnd(e,i,function(){n.safeSetState({status:c},function(){n.props.onEntered(e,r)})})})):this.safeSetState({status:c},function(){n.props.onEntered(e)})},n.performExit=function(e){var t=this,n=this.props.exit,a=this.getTimeouts();n?(this.props.onExit(e),this.safeSetState({status:f},function(){t.props.onExiting(e),t.onTransitionEnd(e,a.exit,function(){t.safeSetState({status:u},function(){t.props.onExited(e)})})})):this.safeSetState({status:u},function(){t.props.onExited(e)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(t){var n=this,a=!0;return this.nextCallback=function(e){a&&(a=!1,n.nextCallback=null,t(e))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(e,t,n){this.setNextCallback(n);n=null==t&&!this.props.addEndListener;!e||n?setTimeout(this.nextCallback,0):(this.props.addEndListener&&this.props.addEndListener(e,this.nextCallback),null!=t&&setTimeout(this.nextCallback,t))},n.render=function(){var e=this.state.status;if(e===s)return null;var t=this.props,n=t.children,t=function(e,t){if(null==e)return{};for(var n,a={},r=Object.keys(e),o=0;o 16.8.0"),null;function t(e){j.current=e,ne({})}function a(e,t){N(te,null),"function"==typeof S&&S(e,t)}function n(e){27===e.keyCode&&Y&&!P.current.size&&a("esc",e)}function r(){j.current||(t(!0),he.dom.setStyle(D.current,"display","none"),me.default.unlock(document.body,ee.current),s&&O.current&&(O.current.focus(),O.current=null),I())}var o=e.prefix,o=void 0===o?"next-":o,i=e.afterClose,I=void 0===i?ye:i,i=e.hasMask,l=void 0===i||i,i=e.autoFocus,s=void 0!==i&&i,i=e.className,R=e.title,A=e.children,H=e.footer,F=e.footerAlign,z=e.footerActions,u=e.onOk,u=void 0===u?ye:u,d=e.onCancel,W=e.okProps,V=e.cancelProps,c=e.locale,c=void 0===c?pe.default.Dialog:c,B=e.rtl,f=e.visible,p=e.closeMode,p=void 0===p?["close","esc"]:p,U=e.closeIcon,h=e.animation,h=void 0===h?{in:"fadeInUp",out:"fadeOutUp"}:h,m=e.cache,K=e.wrapperStyle,g=e.popupContainer,y=void 0===g?document.body:g,g=e.dialogRender,v=e.centered,_=e.top,_=void 0===_?v?40:100:_,b=e.bottom,b=void 0===b?40:b,w=e.width,w=void 0===w?520:w,G=e.height,M=e.isFullScreen,k=e.overflowScroll,M=void 0===k?!M:k,k=e.minMargin,S=e.onClose,q=e.style,E=(0,ie.default)(e,["prefix","afterClose","hasMask","autoFocus","className","title","children","footer","footerAlign","footerActions","onOk","onCancel","okProps","cancelProps","locale","rtl","visible","closeMode","closeIcon","animation","cache","wrapperStyle","popupContainer","dialogRender","centered","top","bottom","width","height","isFullScreen","overflowScroll","minMargin","onClose","style"]),x=("isFullScreen"in e&&he.log.deprecated("isFullScreen","overflowScroll","Dialog v2"),"minMargin"in e&&he.log.deprecated("minMargin","top/bottom","Dialog v2"),(0,le.useState)(f||!1)),$=x[0],J=x[1],x=(0,le.useState)(f),C=x[0],X=x[1],Q="string"==typeof y?function(){return document.getElementById(y)}:"function"!=typeof y?function(){return y}:y,x=(0,le.useState)(Q()),L=x[0],Z=x[1],T=(0,le.useRef)(null),D=(0,le.useRef)(null),O=(0,le.useRef)(null),ee=(0,le.useRef)(null),te=(0,le.useState)((0,he.guid)())[0],x=(0,le.useContext)(ge),N=x.setVisibleOverlayToParent,x=(0,ie.default)(x,["setVisibleOverlayToParent"]),P=(0,le.useRef)(new Map),j=(0,le.useRef)(!1),ne=(0,le.useState)()[1],Y=!1,ae=!1,re=!1;(Array.isArray(p)?p:[p]).forEach(function(e){switch(e){case"esc":Y=!0;break;case"mask":ae=!0;break;case"close":re=!0}}),(0,le.useEffect)(function(){"visible"in e&&X(f)},[f]),(0,le.useEffect)(function(){var e;C&&l&&(e={overflow:"hidden"},he.dom.hasScroll(document.body)&&he.dom.scrollbar().width&&(e.paddingRight=he.dom.getStyle(document.body,"paddingRight")+he.dom.scrollbar().width+"px"),ee.current=me.default.lock(document.body,e))},[C&&l]),(0,le.useEffect)(function(){if(C&&Y)return document.body.addEventListener("keydown",n,!1),function(){document.body.removeEventListener("keydown",n,!1)}},[C&&Y]),(0,le.useEffect)(function(){!$&&C&&J(!0)},[C]),(0,le.useEffect)(function(){L||setTimeout(function(){Z(Q())})},[L]);if((0,le.useEffect)(function(){return function(){r()}},[]),!1===$||!L)return null;if(!C&&!m&&j.current)return null;m=(0,de.default)(((p={})[o+"overlay-wrapper"]=!0,p.opened=C,p)),i=(0,de.default)(((p={})[o+"dialog-v2"]=!0,p[i]=!!i,p)),p={},k=void(v?_||b||!k?(_&&(p.marginTop=_),b&&(p.marginBottom=b)):(p.marginTop=k,p.marginBottom=k):(_&&(p.top=_),b&&(p.paddingBottom=b))),M&&(k="calc(100vh - "+(_+b)+"px)"),M={appear:300,enter:300,exit:250},_=se.default.createElement(fe.default.OverlayAnimate,{visible:C,animation:h,timeout:M,onEnter:function(){t(!1),he.dom.setStyle(D.current,"display","")},onEntered:function(){var e;s&&T.current&&T.current.bodyNode&&(0<(e=he.focus.getFocusNodeList(T.current.bodyNode)).length&&e[0]&&(O.current=document.activeElement,e[0].focus())),N(te,D.current)},onExited:r},se.default.createElement(ce.default,(0,oe.default)({},E,{style:v?(0,oe.default)({},p,q):q,v2:!0,ref:T,prefix:o,className:i,title:R,footer:H,footerAlign:F,footerActions:z,onOk:C?u:ye,onCancel:C?function(e){"function"==typeof d?d(e):a("cancelBtn",e)}:ye,okProps:W,cancelProps:V,locale:c,closeable:re,rtl:B,onClose:function(){for(var e=arguments.length,t=Array(e),n=0;n>6]+d[128|63&s]:s<55296||57344<=s?i+=d[224|s>>12]+d[128|s>>6&63]+d[128|63&s]:(l+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(l)),i+=d[240|s>>18]+d[128|s>>12&63]+d[128|s>>6&63]+d[128|63&s])}return i},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(m(e)){for(var n=[],a=0;athis.popupNode.offsetWidth&&p(this.popupNode,"width",l.offsetWidth+"px"),"outside"!==a||"hoz"===r&&1===n||(p(this.popupNode,"height",u.offsetHeight+"px"),this.popupNode.firstElementChild&&p(this.popupNode.firstElementChild,"overflow-y","auto")),this.popupProps);d.onOpen&&d.onOpen()}catch(e){return null}},S.prototype.handlePopupClose=function(){var e=this.props.root.popupNodes,t=e.indexOf(this.popupNode),e=(-1t?r[t+1]:r[0])}),n[a]||(o=r[0]),i.onSort(a,o)},i.keydownHandler=function(e){e.preventDefault(),e.stopPropagation(),e.keyCode===l.KEYCODE.ENTER&&i.handleClick()},i.onSort=function(e,t){var n={};n[e]=t,i.props.onSort(e,t,n)},(0,o.default)(i,e)}i.displayName="Sort",t.default=i,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=c(n(2)),a=c(n(4)),o=c(n(5)),i=c(n(6)),l=c(n(0)),s=c(n(3)),u=c(n(13)),d=c(n(385));function c(e){return e&&e.__esModule?e:{default:e}}f=l.default.Component,(0,i.default)(p,f),p.prototype.render=function(){var e=this.props,t=e.className,n=e.record,e=e.primaryKey,a=this.context.selectedRowKeys,n=(0,u.default)(((a={selected:-1 "+this.message+" (line "+this.parsedLine+": '"+this.snippet+"')":" "+this.message},o}(Error);e.exports=n},function(e,t){var i={}.hasOwnProperty,n=function(e){var t,n=o,a=e;for(t in a)i.call(a,t)&&(n[t]=a[t]);function r(){this.constructor=n}function o(e,t,n){this.message=e,this.parsedLine=t,this.snippet=n}return r.prototype=a.prototype,n.prototype=new r,n.__super__=a.prototype,o.prototype.toString=function(){return null!=this.parsedLine&&null!=this.snippet?" "+this.message+" (line "+this.parsedLine+": '"+this.snippet+"')":" "+this.message},o}(Error);e.exports=n},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var y=m(n(2)),a=m(n(4)),r=m(n(5)),o=m(n(6)),i=n(0),v=m(i),l=n(22),s=m(n(3)),_=m(n(13)),u=n(10),f=m(n(50)),d=m(n(61)),b=m(n(11)),c=m(n(44)),p=m(n(671)),h=m(n(396)),w=n(173);function m(e){return e&&e.__esModule?e:{default:e}}var M=d.default.Popup,g=f.default.Item,k=f.default.Group,n=u.func.noop,S=u.func.bindCtx,E=u.func.makeChain;x=v.default.Component,(0,o.default)(C,x),C.prototype.componentDidMount=function(){var e=this;setTimeout(function(){return e.syncWidth()},0),u.events.on(window,"resize",this.handleResize)},C.prototype.componentDidUpdate=function(e,t){e.label===this.props.label&&t.value===this.state.value||this.syncWidth()},C.prototype.componentWillUnmount=function(){u.events.off(window,"resize",this.handleResize),clearTimeout(this.resizeTimeout)},C.prototype.syncWidth=function(){var e=this,t=this.props,n=t.popupStyle,t=t.popupProps;n&&"width"in n||t&&t.style&&"width"in t.style||(n=u.dom.getStyle(this.selectDOM,"width"))&&this.width!==n&&(this.width=n,this.popupRef&&this.shouldAutoWidth()&&setTimeout(function(){e.popupRef&&u.dom.setStyle(e.popupRef,"width",e.width)},0))},C.prototype.handleResize=function(){var e=this;clearTimeout(this.resizeTimeout),this.state.visible&&(this.resizeTimeout=setTimeout(function(){e.syncWidth()},200))},C.prototype.setDataSource=function(e){var t=e.dataSource,e=e.children;return i.Children.count(e)?this.dataStore.updateByDS(e,!0):Array.isArray(t)?this.dataStore.updateByDS(t,!1):[]},C.prototype.setVisible=function(e,t){this.props.disabled&&e||this.state.visible===e||("visible"in this.props||this.setState({visible:e}),this.props.onVisibleChange(e,t))},C.prototype.setFirstHightLightKeyForMenu=function(e){var t=this.state.highlightKey;this.props.autoHighlightFirstItem&&(this.dataStore.getMenuDS().length&&this.dataStore.getEnableDS().length&&(!t||e)&&(t=""+this.dataStore.getEnableDS()[0].value,this.setState({highlightKey:t}),this.props.onToggleHighlightItem(t,"autoFirstItem")),e&&!this.dataStore.getEnableDS().length&&(this.setState({highlightKey:null}),this.props.onToggleHighlightItem(null,"highlightKeyToNull")))},C.prototype.handleChange=function(e){var t;"value"in this.props||this.setState({value:e});for(var n=arguments.length,a=Array(1e.slidesToShow&&(n=e.slideWidth*e.slidesToShow*-1,o=e.slideHeight*e.slidesToShow*-1),e.slideCount%e.slidesToScroll!=0&&(t=e.slideIndex+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow,(t=e.rtl?(e.slideIndex>=e.slideCount?e.slideCount-e.slideIndex:e.slideIndex)+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow:t)&&(o=e.slideIndex>e.slideCount?(n=(e.slidesToShow-(e.slideIndex-e.slideCount))*e.slideWidth*-1,(e.slidesToShow-(e.slideIndex-e.slideCount))*e.slideHeight*-1):(n=e.slideCount%e.slidesToScroll*e.slideWidth*-1,e.slideCount%e.slidesToScroll*e.slideHeight*-1)))):e.slideCount%e.slidesToScroll!=0&&e.slideIndex+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow&&(n=(e.slidesToShow-e.slideCount%e.slidesToScroll)*e.slideWidth),e.centerMode&&(e.infinite?n+=e.slideWidth*Math.floor(e.slidesToShow/2):n=e.slideWidth*Math.floor(e.slidesToShow/2)),a=e.vertical?e.slideIndex*e.slideHeight*-1+o:e.slideIndex*e.slideWidth*-1+n,!0===e.variableWidth&&(t=void 0,a=(r=e.slideCount<=e.slidesToShow||!1===e.infinite?i.default.findDOMNode(e.trackRef).childNodes[e.slideIndex]:(t=e.slideIndex+e.slidesToShow,i.default.findDOMNode(e.trackRef).childNodes[t]))?-1*r.offsetLeft:0,!0===e.centerMode&&(r=!1===e.infinite?i.default.findDOMNode(e.trackRef).children[e.slideIndex]:i.default.findDOMNode(e.trackRef).children[e.slideIndex+e.slidesToShow+1])&&(a=-1*r.offsetLeft+(e.listWidth-r.offsetWidth)/2)),a)}},function(e,t,n){"use strict";t.__esModule=!0;var p=u(n(2)),h=u(n(12)),o=u(n(4)),i=u(n(5)),a=u(n(6)),m=u(n(0)),r=u(n(3)),g=u(n(13)),l=u(n(7)),y=u(n(24)),s=n(10);function u(e){return e&&e.__esModule?e:{default:e}}d=m.default.Component,(0,a.default)(c,d),c.prototype.render=function(){var e=this.props,t=e.title,n=e.children,a=e.className,r=e.isExpanded,o=e.disabled,i=e.style,l=e.prefix,s=e.onClick,u=e.id,e=(0,h.default)(e,["title","children","className","isExpanded","disabled","style","prefix","onClick","id"]),a=(0,g.default)(((d={})[l+"collapse-panel"]=!0,d[l+"collapse-panel-hidden"]=!r,d[l+"collapse-panel-expanded"]=r,d[l+"collapse-panel-disabled"]=o,d[a]=a,d)),d=(0,g.default)(((d={})[l+"collapse-panel-icon"]=!0,d[l+"collapse-panel-icon-expanded"]=r,d)),c=u?u+"-heading":void 0,f=u?u+"-region":void 0;return m.default.createElement("div",(0,p.default)({className:a,style:i,id:u},e),m.default.createElement("div",{id:c,className:l+"collapse-panel-title",onClick:s,onKeyDown:this.onKeyDown,tabIndex:"0","aria-disabled":o,"aria-expanded":r,"aria-controls":f,role:"button"},m.default.createElement(y.default,{type:"arrow-right",className:d,"aria-hidden":"true"}),t),m.default.createElement("div",{className:l+"collapse-panel-content",role:"region",id:f},n))},a=n=c,n.propTypes={prefix:r.default.string,style:r.default.object,children:r.default.any,isExpanded:r.default.bool,disabled:r.default.bool,title:r.default.node,className:r.default.string,onClick:r.default.func,id:r.default.string},n.defaultProps={prefix:"next-",isExpanded:!1,onClick:s.func.noop},n.isNextPanel=!0;var d,r=a;function c(){var e,n;(0,o.default)(this,c);for(var t=arguments.length,a=Array(t),r=0;r\n com.alibaba.nacos\n nacos-client\n ${version}\n
\n*/\npackage com.alibaba.nacos.example;\n\nimport java.util.Properties;\nimport java.util.concurrent.Executor;\nimport com.alibaba.nacos.api.NacosFactory;\nimport com.alibaba.nacos.api.config.ConfigService;\nimport com.alibaba.nacos.api.config.listener.Listener;\nimport com.alibaba.nacos.api.exception.NacosException;\n\n/**\n * Config service example\n *\n * @author Nacos\n *\n */\npublic class ConfigExample {\n\n\tpublic static void main(String[] args) throws NacosException, InterruptedException {\n\t\tString serverAddr = "localhost";\n\t\tString dataId = "'.concat(e.dataId,'";\n\t\tString group = "').concat(e.group,'";\n\t\tProperties properties = new Properties();\n\t\tproperties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);\n\t\tConfigService configService = NacosFactory.createConfigService(properties);\n\t\tString content = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\t\tconfigService.addListener(dataId, group, new Listener() {\n\t\t\t@Override\n\t\t\tpublic void receiveConfigInfo(String configInfo) {\n\t\t\t\tSystem.out.println("recieve:" + configInfo);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Executor getExecutor() {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\n\t\tboolean isPublishOk = configService.publishConfig(dataId, group, "content");\n\t\tSystem.out.println(isPublishOk);\n\n\t\tThread.sleep(3000);\n\t\tcontent = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\n\t\tboolean isRemoveOk = configService.removeConfig(dataId, group);\n\t\tSystem.out.println(isRemoveOk);\n\t\tThread.sleep(3000);\n\n\t\tcontent = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\t\tThread.sleep(300000);\n\n\t}\n}\n')}},{key:"getNodejsCode",value:function(e){return"TODO"}},{key:"getCppCode",value:function(e){return"TODO"}},{key:"getShellCode",value:function(e){return"TODO"}},{key:"getPythonCode",value:function(e){return"TODO"}},{key:"getCSharpCode",value:function(e){return'/*\nDemo for Basic Nacos Opreation\nApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Nacos.V2;\nusing Nacos.V2.DependencyInjection;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static async Task Main(string[] args)\n {\n string serverAddr = "http://localhost:8848";\n string dataId = "'.concat(e.dataId,'";\n string group = "').concat(e.group,'";\n\n IServiceCollection services = new ServiceCollection();\n\n services.AddNacosV2Config(x =>\n {\n x.ServerAddresses = new List { serverAddr };\n x.Namespace = "cs-test";\n\n // swich to use http or rpc\n x.ConfigUseRpc = true;\n });\n\n IServiceProvider serviceProvider = services.BuildServiceProvider();\n var configSvc = serviceProvider.GetService();\n\n var content = await configSvc.GetConfig(dataId, group, 3000);\n Console.WriteLine(content);\n\n var listener = new ConfigListener();\n\n await configSvc.AddListener(dataId, group, listener);\n\n var isPublishOk = await configSvc.PublishConfig(dataId, group, "content");\n Console.WriteLine(isPublishOk);\n\n await Task.Delay(3000);\n content = await configSvc.GetConfig(dataId, group, 5000);\n Console.WriteLine(content);\n\n var isRemoveOk = await configSvc.RemoveConfig(dataId, group);\n Console.WriteLine(isRemoveOk);\n await Task.Delay(3000);\n\n content = await configSvc.GetConfig(dataId, group, 5000);\n Console.WriteLine(content);\n await Task.Delay(300000);\n }\n\n internal class ConfigListener : IListener\n {\n public void ReceiveConfigInfo(string configInfo)\n {\n Console.WriteLine("recieve:" + configInfo);\n }\n }\n}\n\n/*\nRefer to document: https://github.com/nacos-group/nacos-sdk-csharp/tree/dev/samples/MsConfigApp\nDemo for ASP.NET Core Integration\nMsConfigApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Hosting;\nusing Serilog;\nusing Serilog.Events;\n\npublic class Program\n{\n public static void Main(string[] args)\n {\n Log.Logger = new LoggerConfiguration()\n .Enrich.FromLogContext()\n .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)\n .MinimumLevel.Override("System", LogEventLevel.Warning)\n .MinimumLevel.Debug()\n .WriteTo.Console()\n .CreateLogger();\n\n try\n {\n Log.ForContext().Information("Application starting...");\n CreateHostBuilder(args, Log.Logger).Build().Run();\n }\n catch (System.Exception ex)\n {\n Log.ForContext().Fatal(ex, "Application start-up failed!!");\n }\n finally\n {\n Log.CloseAndFlush();\n }\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args, Serilog.ILogger logger) =>\n Host.CreateDefaultBuilder(args)\n .ConfigureAppConfiguration((context, builder) =>\n {\n var c = builder.Build();\n builder.AddNacosV2Configuration(c.GetSection("NacosConfig"), logAction: x => x.AddSerilog(logger));\n })\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.UseStartup().UseUrls("http://*:8787");\n })\n .UseSerilog();\n}\n ')}},{key:"openDialog",value:function(e){var t=this;this.setState({dialogvisible:!0}),this.record=e,setTimeout(function(){t.getData()})}},{key:"closeDialog",value:function(){this.setState({dialogvisible:!1})}},{key:"createCodeMirror",value:function(e,t){var n=this.refs.codepreview;n&&(n.innerHTML="",this.cm=window.CodeMirror(n,{value:t,mode:e,height:400,width:500,lineNumbers:!0,theme:"xq-light",lint:!0,tabMode:"indent",autoMatchParens:!0,textWrapping:!0,gutters:["CodeMirror-lint-markers"],extraKeys:{F1:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}}}))}},{key:"changeTab",value:function(e,t){var n=this;setTimeout(function(){n[e]=!0,n.createCodeMirror("text/javascript",t)})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e;return E.a.createElement("div",null,E.a.createElement(g.a,{title:e.sampleCode,style:{width:"80%"},visible:this.state.dialogvisible,footer:E.a.createElement("div",null),onClose:this.closeDialog.bind(this)},E.a.createElement("div",{style:{height:500}},E.a.createElement(D.a,{tip:e.loading,style:{width:"100%"},visible:this.state.loading},E.a.createElement(O.a,{shape:"text",style:{height:40,paddingBottom:10}},E.a.createElement(N,{title:"Java",key:1,onClick:this.changeTab.bind(this,"commoneditor1",this.defaultCode)}),E.a.createElement(N,{title:"Spring Boot",key:2,onClick:this.changeTab.bind(this,"commoneditor2",this.sprigboot_code)}),E.a.createElement(N,{title:"Spring Cloud",key:21,onClick:this.changeTab.bind(this,"commoneditor21",this.sprigcloud_code)}),E.a.createElement(N,{title:"Node.js",key:3,onClick:this.changeTab.bind(this,"commoneditor3",this.nodejsCode)}),E.a.createElement(N,{title:"C++",key:4,onClick:this.changeTab.bind(this,"commoneditor4",this.cppCode)}),E.a.createElement(N,{title:"Shell",key:5,onClick:this.changeTab.bind(this,"commoneditor5",this.shellCode)}),E.a.createElement(N,{title:"Python",key:6,onClick:this.changeTab.bind(this,"commoneditor6",this.pythonCode)}),E.a.createElement(N,{title:"C#",key:7,onClick:this.changeTab.bind(this,"commoneditor7",this.csharpCode)})),E.a.createElement("div",{ref:"codepreview"})))))}}]),n}(E.a.Component)).displayName="ShowCodeing",k=k))||k,k=(t(65),t(38)),k=t.n(k),A=(t(710),k.a.Row),P=k.a.Col,H=(0,n.a.config)(((k=function(e){Object(w.a)(n,e);var t=Object(M.a)(n);function n(e){return Object(v.a)(this,n),(e=t.call(this,e)).state={visible:!1,title:"",content:"",isok:!0,dataId:"",group:""},e}return Object(_.a)(n,[{key:"componentDidMount",value:function(){this.initData()}},{key:"initData",value:function(){var e=this.props.locale;this.setState({title:(void 0===e?{}:e).confManagement})}},{key:"openDialog",value:function(e){this.setState({visible:!0,title:e.title,content:e.content,isok:e.isok,dataId:e.dataId,group:e.group,message:e.message})}},{key:"closeDialog",value:function(){this.setState({visible:!1})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e,t=E.a.createElement("div",{style:{textAlign:"right"}},E.a.createElement(d.a,{type:"primary",onClick:this.closeDialog.bind(this)},e.determine));return E.a.createElement("div",null,E.a.createElement(g.a,{visible:this.state.visible,footer:t,style:{width:555},onCancel:this.closeDialog.bind(this),onClose:this.closeDialog.bind(this),title:e.deletetitle},E.a.createElement("div",null,E.a.createElement(A,null,E.a.createElement(P,{span:"4",style:{paddingTop:16}},E.a.createElement(h.a,{type:"".concat(this.state.isok?"success":"delete","-filling"),style:{color:this.state.isok?"green":"red"},size:"xl"})),E.a.createElement(P,{span:"20"},E.a.createElement("div",null,E.a.createElement("h3",null,this.state.isok?e.deletedSuccessfully:e.deleteFailed),E.a.createElement("p",null,E.a.createElement("span",{style:{color:"#999",marginRight:5}},"Data ID:"),E.a.createElement("span",{style:{color:"#c7254e"}},this.state.dataId)),E.a.createElement("p",null,E.a.createElement("span",{style:{color:"#999",marginRight:5}},"Group:"),E.a.createElement("span",{style:{color:"#c7254e"}},this.state.group)),this.state.isok?"":E.a.createElement("p",{style:{color:"red"}},this.state.message)))))))}}]),n}(E.a.Component)).displayName="DeleteDialog",k=k))||k,k=(t(711),t(415)),F=t.n(k),z=(0,n.a.config)(((k=function(e){Object(w.a)(n,e);var t=Object(M.a)(n);function n(){return Object(v.a)(this,n),t.apply(this,arguments)}return Object(_.a)(n,[{key:"render",value:function(){var e=this.props,t=e.data,t=void 0===t?{}:t,n=e.height,e=e.locale,a=void 0===e?{}:e;return E.a.createElement("div",null,"notice"===t.modeType?E.a.createElement("div",{"data-spm-click":"gostr=/aliyun;locaid=notice"},E.a.createElement(F.a,{style:{marginBottom:1l?b.a.createElement(u.a,{className:"pagination",total:i.count,pageSize:l,onChange:function(e){return a.onChangePage(e)}}):null,b.a.createElement(C,{ref:this.editInstanceDialog,serviceName:n,clusterName:t,groupName:e,openLoading:function(){return a.openLoading()},closeLoading:function(){return a.closeLoading()},getInstanceList:function(){return a.getInstanceList()}})):null}}]),n}(b.a.Component)).displayName="InstanceTable",l.defaultProps={filters:new Map},l=l))||l,L=function(e,t){return e.filter(function(e){var n=e.metadata,a=!0;return t.forEach(function(e,t){if(e!==n[t])return a=!1}),a})},T=l,D=t(47),O=t(31),l=(t(171),t(72)),l=t.n(l),N=l.a.Group,P=l.a.Closeable,j=v.a.Item;var R=n.a.config(function(e){function t(){var e;a(),o&&l&&(e=new Map(Array.from(p)).set(o,l),h(e),d(""),f(""),n())}function n(){i(""),s("")}function a(){d(o?"":"error"),f(l?"":"error")}var r=Object(_.useState)(""),o=(r=Object(O.a)(r,2))[0],i=r[1],r=Object(_.useState)(""),l=(r=Object(O.a)(r,2))[0],s=r[1],r=Object(_.useState)(""),u=(r=Object(O.a)(r,2))[0],d=r[1],r=Object(_.useState)(""),c=(r=Object(O.a)(r,2))[0],f=r[1],r=Object(_.useState)(new Map),p=(r=Object(O.a)(r,2))[0],h=r[1],r=void 0===(r=e.locale)?{}:r;return Object(_.useEffect)(function(){e.setFilters(p)},[p]),b.a.createElement(m.a,{contentHeight:"auto",className:"inner-card"},b.a.createElement(v.a,{inline:!0,size:"small"},b.a.createElement(j,{label:r.title},b.a.createElement(j,null,b.a.createElement(y.a,{placeholder:"key",value:o,trim:!0,onChange:function(e){return i(e)},onPressEnter:t,state:u})),b.a.createElement(j,null,b.a.createElement(y.a,{placeholder:"value",value:l,trim:!0,onChange:function(e){return s(e)},onPressEnter:t,state:c})),b.a.createElement(j,{label:""},b.a.createElement(g.a,{type:"primary",onClick:t,style:{marginRight:10}},r.addFilter),0\n com.alibaba.nacos\n nacos-client\n ${latest.version}\n \n*/\npackage com.alibaba.nacos.example;\n\nimport java.util.Properties;\n\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingFactory;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.listener.Event;\nimport com.alibaba.nacos.api.naming.listener.EventListener;\nimport com.alibaba.nacos.api.naming.listener.NamingEvent;\n\n/**\n * @author nkorange\n */\npublic class NamingExample {\n\n public static void main(String[] args) throws NacosException {\n\n Properties properties = new Properties();\n properties.setProperty("serverAddr", System.getProperty("serverAddr"));\n properties.setProperty("namespace", System.getProperty("namespace"));\n\n NamingService naming = NamingFactory.createNamingService(properties);\n\n naming.registerInstance("'.concat(this.record.name,'", "11.11.11.11", 8888, "TEST1");\n\n naming.registerInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n System.out.println(naming.getAllInstances("').concat(this.record.name,'"));\n\n naming.deregisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n System.out.println(naming.getAllInstances("').concat(this.record.name,'"));\n\n naming.subscribe("').concat(this.record.name,'", new EventListener() {\n @Override\n public void onEvent(Event event) {\n System.out.println(((NamingEvent)event).getServiceName());\n System.out.println(((NamingEvent)event).getInstances());\n }\n });\n }\n}')}},{key:"getSpringCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-example/nacos-spring-discovery-example\n* pom.xml\n \n com.alibaba.nacos\n nacos-spring-context\n ${latest.version}\n \n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-example/nacos-spring-discovery-example/src/main/java/com/alibaba/nacos/example/spring\npackage com.alibaba.nacos.example.spring;\n\nimport com.alibaba.nacos.api.annotation.NacosProperties;\nimport com.alibaba.nacos.spring.context.annotation.discovery.EnableNacosDiscovery;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\n@EnableNacosDiscovery(globalProperties = @NacosProperties(serverAddr = "127.0.0.1:8848"))\npublic class NacosConfiguration {\n\n}\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-example/nacos-spring-discovery-example/src/main/java/com/alibaba/nacos/example/spring/controller\npackage com.alibaba.nacos.example.spring.controller;\n\nimport com.alibaba.nacos.api.annotation.NacosInjected;\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.pojo.Instance;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.ResponseBody;\n\nimport java.util.List;\n\nimport static org.springframework.web.bind.annotation.RequestMethod.GET;\n\n@Controller\n@RequestMapping("discovery")\npublic class DiscoveryController {\n\n @NacosInjected\n private NamingService namingService;\n\n @RequestMapping(value = "/get", method = GET)\n @ResponseBody\n public List get(@RequestParam String serviceName) throws NacosException {\n return namingService.getAllInstances(serviceName);\n }\n}'}},{key:"getSpringBootCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example\n* pom.xml\n \n com.alibaba.boot\n nacos-discovery-spring-boot-starter\n ${latest.version}\n \n*/\n/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example/src/main/resources\n* application.properties\n nacos.discovery.server-addr=127.0.0.1:8848\n*/\n// Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example/src/main/java/com/alibaba/nacos/example/spring/boot/controller\n\npackage com.alibaba.nacos.example.spring.boot.controller;\n\nimport com.alibaba.nacos.api.annotation.NacosInjected;\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.pojo.Instance;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.ResponseBody;\n\nimport java.util.List;\n\nimport static org.springframework.web.bind.annotation.RequestMethod.GET;\n\n@Controller\n@RequestMapping("discovery")\npublic class DiscoveryController {\n\n @NacosInjected\n private NamingService namingService;\n\n @RequestMapping(value = "/get", method = GET)\n @ResponseBody\n public List get(@RequestParam String serviceName) throws NacosException {\n return namingService.getAllInstances(serviceName);\n }\n}'}},{key:"getSpringCloudCode",value:function(e){return"/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/\n* pom.xml\n \n org.springframework.cloud\n spring-cloud-starter-alibaba-nacos-discovery\n ${latest.version}\n \n*/\n\n// nacos-spring-cloud-provider-example\n\n/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-provider-example/src/main/resources\n* application.properties\nserver.port=18080\nspring.application.name=".concat(this.record.name,'\nspring.cloud.nacos.discovery.server-addr=127.0.0.1:8848\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-provider-example/src/main/java/com/alibaba/nacos/example/spring/cloud\npackage com.alibaba.nacos.example.spring.cloud;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.cloud.client.discovery.EnableDiscoveryClient;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author xiaojing\n */\n@SpringBootApplication\n@EnableDiscoveryClient\npublic class NacosProviderApplication {\n\n public static void main(String[] args) {\n SpringApplication.run(NacosProviderApplication.class, args);\n}\n\n @RestController\n class EchoController {\n @RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)\n public String echo(@PathVariable String string) {\n return "Hello Nacos Discovery " + string;\n }\n }\n}\n\n// nacos-spring-cloud-consumer-example\n\n/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-consumer-example/src/main/resources\n* application.properties\nspring.application.name=micro-service-oauth2\nspring.cloud.nacos.discovery.server-addr=127.0.0.1:8848\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-consumer-example/src/main/java/com/alibaba/nacos/example/spring/cloud\npackage com.alibaba.nacos.example.spring.cloud;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.cloud.client.discovery.EnableDiscoveryClient;\nimport org.springframework.cloud.client.loadbalancer.LoadBalanced;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.client.RestTemplate;\n\n/**\n * @author xiaojing\n */\n@SpringBootApplication\n@EnableDiscoveryClient\npublic class NacosConsumerApplication {\n\n @LoadBalanced\n @Bean\n public RestTemplate restTemplate() {\n return new RestTemplate();\n }\n\n public static void main(String[] args) {\n SpringApplication.run(NacosConsumerApplication.class, args);\n }\n\n @RestController\n public class TestController {\n\n private final RestTemplate restTemplate;\n\n @Autowired\n public TestController(RestTemplate restTemplate) {this.restTemplate = restTemplate;}\n\n @RequestMapping(value = "/echo/{str}", method = RequestMethod.GET)\n public String echo(@PathVariable String str) {\n return restTemplate.getForObject("http://service-provider/echo/" + str, String.class);\n }\n }\n}')}},{key:"getNodejsCode",value:function(e){return"TODO"}},{key:"getCppCode",value:function(e){return"TODO"}},{key:"getShellCode",value:function(e){return"TODO"}},{key:"getPythonCode",value:function(e){return"TODO"}},{key:"getCSharpCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/\nDemo for Basic Nacos Opreation\nApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Nacos.V2;\nusing Nacos.V2.DependencyInjection;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static async Task Main(string[] args)\n {\n IServiceCollection services = new ServiceCollection();\n\n services.AddNacosV2Naming(x =>\n {\n x.ServerAddresses = new List { "http://localhost:8848/" };\n x.Namespace = "cs-test";\n\n // swich to use http or rpc\n x.NamingUseRpc = true;\n });\n\n IServiceProvider serviceProvider = services.BuildServiceProvider();\n var namingSvc = serviceProvider.GetService();\n\n await namingSvc.RegisterInstance("'.concat(this.record.name,'", "11.11.11.11", 8888, "TEST1");\n\n await namingSvc.RegisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(await namingSvc.GetAllInstances("').concat(this.record.name,'")));\n\n await namingSvc.DeregisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n var listener = new EventListener();\n\n await namingSvc.Subscribe("').concat(this.record.name,'", listener);\n }\n\n internal class EventListener : IEventListener\n {\n public Task OnEvent(IEvent @event)\n {\n Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(@event));\n return Task.CompletedTask;\n }\n }\n}\n\n/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/\nDemo for ASP.NET Core Integration\nApp.csproj\n\n\n \n\n*/\n\n/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/blob/dev/samples/App1/appsettings.json\n* appsettings.json\n{\n "nacos": {\n "ServerAddresses": [ "http://localhost:8848" ],\n "DefaultTimeOut": 15000,\n "Namespace": "cs",\n "ServiceName": "App1",\n "GroupName": "DEFAULT_GROUP",\n "ClusterName": "DEFAULT",\n "Port": 0,\n "Weight": 100,\n "RegisterEnabled": true,\n "InstanceEnabled": true,\n "Ephemeral": true,\n "NamingUseRpc": true,\n "NamingLoadCacheAtStart": ""\n }\n}\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/blob/dev/samples/App1/Startup.cs\nusing Nacos.AspNetCore.V2;\n\npublic class Startup\n{\n public Startup(IConfiguration configuration)\n {\n Configuration = configuration;\n }\n\n public IConfiguration Configuration { get; }\n\n public void ConfigureServices(IServiceCollection services)\n {\n // ....\n services.AddNacosAspNet(Configuration);\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n // ....\n }\n}\n ')}},{key:"openDialog",value:function(e){var t=this;this.setState({dialogvisible:!0}),this.record=e,setTimeout(function(){t.getData()})}},{key:"closeDialog",value:function(){this.setState({dialogvisible:!1})}},{key:"createCodeMirror",value:function(e,t){var n=this.refs.codepreview;n&&(n.innerHTML="",this.cm=window.CodeMirror(n,{value:t,mode:e,height:400,width:500,lineNumbers:!0,theme:"xq-light",lint:!0,tabMode:"indent",autoMatchParens:!0,textWrapping:!0,gutters:["CodeMirror-lint-markers"],extraKeys:{F1:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}}}),this.cm.setSize("auto","490px"))}},{key:"changeTab",value:function(e,t){var n=this;setTimeout(function(){n[e]=!0,n.createCodeMirror("text/javascript",t)})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e;return T.a.createElement("div",null,T.a.createElement(o.a,{title:e.sampleCode,style:{width:"80%"},visible:this.state.dialogvisible,footer:T.a.createElement("div",null),onClose:this.closeDialog.bind(this)},T.a.createElement("div",{style:{height:500}},T.a.createElement(m.a,{tip:e.loading,style:{width:"100%"},visible:this.state.loading},T.a.createElement(g.a,{shape:"text",style:{height:40,paddingBottom:10}},T.a.createElement(y,{title:"Java",key:0,onClick:this.changeTab.bind(this,"commoneditor1",this.defaultCode)}),T.a.createElement(y,{title:"Spring",key:1,onClick:this.changeTab.bind(this,"commoneditor1",this.springCode)}),T.a.createElement(y,{title:"Spring Boot",key:2,onClick:this.changeTab.bind(this,"commoneditor2",this.sprigbootCode)}),T.a.createElement(y,{title:"Spring Cloud",key:21,onClick:this.changeTab.bind(this,"commoneditor21",this.sprigcloudCode)}),T.a.createElement(y,{title:"Node.js",key:3,onClick:this.changeTab.bind(this,"commoneditor3",this.nodejsCode)}),T.a.createElement(y,{title:"C++",key:4,onClick:this.changeTab.bind(this,"commoneditor4",this.cppCode)}),T.a.createElement(y,{title:"Shell",key:5,onClick:this.changeTab.bind(this,"commoneditor5",this.shellCode)}),T.a.createElement(y,{title:"Python",key:6,onClick:this.changeTab.bind(this,"commoneditor6",this.pythonCode)}),T.a.createElement(y,{title:"C#",key:7,onClick:this.changeTab.bind(this,"commoneditor7",this.csharpCode)})),T.a.createElement("div",{ref:"codepreview"})))))}}]),n}(T.a.Component)).displayName="ShowServiceCodeing",p=p))||p,j=(n(733),n(29)),Y=L.a.Item,I=f.a.Row,R=f.a.Col,A=C.a.Column,f=(0,a.a.config)(((p=function(e){Object(d.a)(a,e);var t=Object(c.a)(a);function a(e){var n;return Object(l.a)(this,a),(n=t.call(this,e)).getQueryLater=function(){setTimeout(function(){return n.queryServiceList()})},n.showcode=function(){setTimeout(function(){return n.queryServiceList()})},n.setNowNameSpace=function(e,t){return n.setState({nowNamespaceName:e,nowNamespaceId:t})},n.rowColor=function(e){return{className:e.healthyInstanceCount?"":"row-bg-red"}},n.editServiceDialog=T.a.createRef(),n.showcode=T.a.createRef(),n.state={loading:!1,total:0,pageSize:10,currentPage:1,dataSource:[],search:{serviceName:"",groupName:""},hasIpCount:!("false"===localStorage.getItem("hasIpCount"))},n.field=new i.a(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"openLoading",value:function(){this.setState({loading:!0})}},{key:"closeLoading",value:function(){this.setState({loading:!1})}},{key:"openEditServiceDialog",value:function(){try{this.editServiceDialog.current.getInstance().show(this.state.service)}catch(e){}}},{key:"queryServiceList",value:function(){var n=this,e=this.state,t=e.currentPage,a=e.pageSize,r=e.search,o=e.withInstances,o=void 0!==o&&o,e=e.hasIpCount,e=["hasIpCount=".concat(e),"withInstances=".concat(o),"pageNo=".concat(t),"pageSize=".concat(a),"serviceNameParam=".concat(r.serviceName),"groupNameParam=".concat(r.groupName)];this.openLoading(),Object(h.c)({url:"v1/ns/catalog/services?".concat(e.join("&")),success:function(){var e=0o&&h.a.createElement(s.a,{className:"users-pagination",current:i,total:n.totalCount,pageSize:o,onChange:function(e){return t.setState({pageNo:e},function(){return t.getUsers()})}}),h.a.createElement(S,{visible:l,onOk:function(e){return Object(m.c)(e).then(function(e){return t.setState({pageNo:1},function(){return t.getUsers()}),e})},onCancel:function(){return t.colseCreateUser()}}),h.a.createElement(E.a,{username:e,onOk:function(e){return Object(m.k)(e).then(function(e){return t.getUsers(),e})},onCancel:function(){return t.setState({passwordResetUser:void 0})}}))}}]),n}(h.a.Component)).displayName="UserManagement",n=o))||n)||n;t.a=r},function(e,t,n){"use strict";n(63);var a=n(46),s=n.n(a),a=(n(34),n(19)),u=n.n(a),d=n(31),a=(n(62),n(20)),c=n.n(a),a=(n(32),n(18)),f=n.n(a),i=n(14),l=n(15),p=n(17),h=n(16),a=(n(25),n(7)),a=n.n(a),r=n(0),m=n.n(r),r=n(43),g=n(45),o=n(79),y=n(48),v=(n(49),n(26)),_=n.n(v),b=n(23),v=(n(58),n(28)),w=n.n(v),v=(n(42),n(9)),M=n.n(v),k=M.a.Item,S=w.a.Option,E={labelCol:{fixedSpan:4},wrapperCol:{span:19}},x=Object(r.b)(function(e){return{namespaces:e.namespace.namespaces}},{getNamespaces:o.b,searchRoles:g.l})(v=(0,a.a.config)(((v=function(e){Object(p.a)(o,e);var r=Object(h.a)(o);function o(){var t;Object(i.a)(this,o);for(var e=arguments.length,n=new Array(e),a=0;ai&&m.a.createElement(s.a,{className:"users-pagination",current:l,total:t.totalCount,pageSize:i,onChange:function(e){return a.setState({pageNo:e},function(){return a.getPermissions()})}}),m.a.createElement(x,{visible:n,onOk:function(e){return Object(g.a)(e).then(function(e){return a.setState({pageNo:1},function(){return a.getPermissions()}),e})},onCancel:function(){return a.colseCreatePermission()}}))}}]),n}(m.a.Component)).displayName="PermissionsManagement",n=v))||n)||n);t.a=r},function(e,t,n){"use strict";n(63);var a=n(46),s=n.n(a),a=(n(34),n(19)),u=n.n(a),a=(n(62),n(20)),d=n.n(a),a=(n(32),n(18)),c=n.n(a),i=n(14),l=n(15),f=n(17),p=n(16),a=(n(25),n(7)),a=n.n(a),r=n(0),h=n.n(r),r=n(43),m=n(45),g=n(48),o=(n(58),n(28)),y=n.n(o),o=(n(40),n(11)),v=n.n(o),o=(n(49),n(26)),_=n.n(o),b=n(23),o=(n(42),n(9)),w=n.n(o),M=w.a.Item,k={labelCol:{fixedSpan:4},wrapperCol:{span:19}},S=Object(r.b)(function(e){return{users:e.authority.users}},{searchUsers:m.m})(o=(0,a.a.config)(((o=function(e){Object(f.a)(o,e);var r=Object(p.a)(o);function o(){var t;Object(i.a)(this,o);for(var e=arguments.length,n=new Array(e),a=0;ao&&h.a.createElement(s.a,{className:"users-pagination",current:i,total:t.totalCount,pageSize:o,onChange:function(e){return a.setState({pageNo:e},function(){return a.getRoles()})}}),h.a.createElement(S,{visible:l,onOk:function(e){return Object(m.b)(e).then(function(e){return a.getRoles(),e})},onCancel:function(){return a.colseCreateRole()}}))}}]),n}(h.a.Component)).displayName="RolesManagement",n=o))||n)||n);t.a=r},function(e,t,n){"use strict";n(41);function o(e){var t=void 0===(t=localStorage.token)?"{}":t,t=(Object(y.c)(t)&&JSON.parse(t)||{}).globalAdmin;return["naming"===e?void 0:v,{key:"serviceManagementVirtual",children:[{key:"serviceManagement",url:"/serviceManagement"},{key:"subscriberList",url:"/subscriberList"}]},t?_:void 0,{key:"namespace",url:"/namespace"},{key:"clusterManagementVirtual",children:[{key:"clusterManagement",url:"/clusterManagement"}]}].filter(function(e){return e})}var a=n(24),i=n.n(a),r=n(14),l=n(15),s=n(17),u=n(16),a=(n(25),n(7)),a=n.n(a),d=n(21),c=(n(78),n(50)),f=n.n(c),c=n(0),p=n.n(c),c=n(37),h=n(43),m=n(131),g=n(98),y=n(47),v={key:"configurationManagementVirtual",children:[{key:"configurationManagement",url:"/configurationManagement"},{key:"historyRollback",url:"/historyRollback"},{key:"listeningToQuery",url:"/listeningToQuery"}]},_={key:"authorityControl",children:[{key:"userList",url:"/userManagement"},{key:"roleManagement",url:"/rolesManagement"},{key:"privilegeManagement",url:"/permissionsManagement"}]},b=f.a.SubMenu,w=f.a.Item,c=(n=Object(h.b)(function(e){return Object(d.a)(Object(d.a)({},e.locale),e.base)},{getState:g.b}),h=a.a.config,Object(c.g)(a=n(a=h(((g=function(e){Object(s.a)(n,e);var t=Object(u.a)(n);function n(){return Object(r.a)(this,n),t.apply(this,arguments)}return Object(l.a)(n,[{key:"componentDidMount",value:function(){this.props.getState()}},{key:"goBack",value:function(){this.props.history.goBack()}},{key:"navTo",value:function(e){var t=this.props.location.search;this.props.history.push([e,t].join(""))}},{key:"isCurrentPath",value:function(e){return e===this.props.location.pathname?"current-path":void 0}},{key:"defaultOpenKeys",value:function(){for(var t=this,e=o(this.props.functionMode),n=0,a=e.length;nthis.state.pageSize&&k.a.createElement("div",{style:{marginTop:10,textAlign:"right"}},k.a.createElement(y.a,{current:this.state.pageNo,total:a,pageSize:this.state.pageSize,onChange:function(e){return t.setState({pageNo:e},function(){return t.querySubscriberList()})}}))))}}]),a}(k.a.Component)).displayName="SubscriberList",c=n))||c)||c;t.a=f},function(e,t,n){"use strict";n(51);var a=n(33),f=n.n(a),a=(n(63),n(46)),p=n.n(a),a=(n(171),n(72)),h=n.n(a),a=(n(40),n(11)),m=n.n(a),a=(n(32),n(18)),g=n.n(a),a=(n(34),n(19)),r=n.n(a),a=(n(49),n(26)),o=n.n(a),i=n(14),l=n(15),s=n(23),u=n(17),d=n(16),a=(n(25),n(7)),a=n.n(a),c=(n(399),n(112)),y=n.n(c),c=(n(62),n(20)),v=n.n(c),c=(n(65),n(38)),c=n.n(c),_=(n(42),n(9)),b=n.n(_),_=n(0),w=n.n(_),M=n(1),k=n(48),_=n(133),S=n.n(_),E=(n(736),b.a.Item),x=c.a.Row,C=c.a.Col,L=v.a.Column,T=y.a.Panel,c=(0,a.a.config)(((_=function(e){Object(u.a)(a,e);var t=Object(d.a)(a);function a(e){var n;return Object(i.a)(this,a),(n=t.call(this,e)).getQueryLater=function(){setTimeout(function(){return n.queryClusterStateList()})},n.setNowNameSpace=function(e,t){return n.setState({nowNamespaceName:e,nowNamespaceId:t})},n.rowColor=function(e){return{className:(e.voteFor,"")}},n.state={loading:!1,total:0,pageSize:10,currentPage:1,keyword:"",dataSource:[]},n.field=new o.a(Object(s.a)(n)),n}return Object(l.a)(a,[{key:"openLoading",value:function(){this.setState({loading:!0})}},{key:"closeLoading",value:function(){this.setState({loading:!1})}},{key:"openEditServiceDialog",value:function(){try{this.editServiceDialog.current.getInstance().show(this.state.service)}catch(e){}}},{key:"queryClusterStateList",value:function(){var n=this,e=this.state,t=e.currentPage,a=e.pageSize,r=e.keyword,e=e.withInstances,e=["withInstances=".concat(void 0!==e&&e),"pageNo=".concat(t),"pageSize=".concat(a),"keyword=".concat(r)];Object(M.c)({url:"v1/core/cluster/nodes?".concat(e.join("&")),beforeSend:function(){return n.openLoading()},success:function(){var e=0this.state.pageSize&&w.a.createElement("div",{style:{marginTop:10,textAlign:"right"}},w.a.createElement(p.a,{current:this.state.currentPage,total:this.state.total,pageSize:this.state.pageSize,onChange:function(e){return t.setState({currentPage:e},function(){return t.queryClusterStateList()})}}))))}}]),a}(w.a.Component)).displayName="ClusterNodeList",n=_))||n;t.a=c},function(e,t,F){"use strict";F.r(t),function(e){F(51);var t=F(33),a=F.n(t),t=(F(25),F(7)),r=F.n(t),o=F(14),i=F(15),l=F(17),s=F(16),n=F(21),t=F(0),u=F.n(t),t=F(22),t=F.n(t),d=F(115),c=F(407),f=F(419),p=F(43),h=F(37),m=F(96),g=(F(454),F(428)),y=F(29),v=F(429),_=F(422),b=F(430),w=F(431),M=F(423),k=F(432),S=F(433),E=F(434),x=F(435),C=F(436),L=F(420),T=F(424),D=F(421),O=F(437),N=F(438),P=F(425),j=F(426),I=F(427),R=F(417),Y=F(418),A=F(101),e=(F(739),e.hot,localStorage.getItem(y.f)||localStorage.setItem(y.f,"zh-CN"===navigator.language?"zh-CN":"en-US"),Object(d.b)(Object(n.a)(Object(n.a)({},Y.a),{},{routing:c.routerReducer}))),Y=Object(d.d)(e,Object(d.c)(Object(d.a)(f.a),window[y.i]?window[y.i]():function(e){return e})),H=[{path:"/",exact:!0,render:function(){return u.a.createElement(h.a,{to:"/welcome"})}},{path:"/welcome",component:R.a},{path:"/namespace",component:_.a},{path:"/newconfig",component:b.a},{path:"/configsync",component:w.a},{path:"/configdetail",component:M.a},{path:"/configeditor",component:k.a},{path:"/historyDetail",component:S.a},{path:"/configRollback",component:E.a},{path:"/historyRollback",component:x.a},{path:"/listeningToQuery",component:C.a},{path:"/configurationManagement",component:L.a},{path:"/serviceManagement",component:T.a},{path:"/serviceDetail",component:D.a},{path:"/subscriberList",component:O.a},{path:"/clusterManagement",component:N.a},{path:"/userManagement",component:P.a},{path:"/rolesManagement",component:I.a},{path:"/permissionsManagement",component:j.a}],e=Object(p.b)(function(e){return Object(n.a)({},e.locale)},{changeLanguage:A.a})(c=function(e){Object(l.a)(n,e);var t=Object(s.a)(n);function n(e){return Object(o.a)(this,n),(e=t.call(this,e)).state={shownotice:"none",noticecontent:"",nacosLoading:{}},e}return Object(i.a)(n,[{key:"componentDidMount",value:function(){var e=localStorage.getItem(y.f);this.props.changeLanguage(e)}},{key:"router",get:function(){return u.a.createElement(m.a,null,u.a.createElement(h.d,null,u.a.createElement(h.b,{path:"/login",component:v.a}),u.a.createElement(g.a,null,H.map(function(e){return u.a.createElement(h.b,Object.assign({key:e.path},e))}))))}},{key:"render",value:function(){var e=this.props.locale;return u.a.createElement(a.a,Object.assign({className:"nacos-loading",shape:"flower",tip:"loading...",visible:!1,fullScreen:!0},this.state.nacosLoading),u.a.createElement(r.a,{locale:e},this.router))}}]),n}(u.a.Component))||c;t.a.render(u.a.createElement(p.a,{store:Y},u.a.createElement(e,null)),document.getElementById("root"))}.call(this,F(440)(e))},function(e,t){e.exports=function(e){var t;return e.webpackPolyfill||((t=Object.create(e)).children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1),t}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(I,e,t){"use strict"; +var t;e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){if(e===12)e=0;if(t==="凌晨"||t==="早上"||t==="上午")return e;else if(t==="中午")return e>=11?e:e+12;else if(t==="下午"||t==="晚上")return e+12},meridiem:function(e,t,n){var a=e*100+t;if(a<600)return"凌晨";else if(a<900)return"早上";else if(a<1130)return"上午";else if(a<1230)return"中午";else if(a<1800)return"下午";else return"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n(8))},function(e,t,n){"use strict";t.__esModule=!0;var u=p(n(2)),a=p(n(4)),r=p(n(5)),o=p(n(6)),i=n(0),d=p(i),l=p(n(3)),c=p(n(13)),s=p(n(7)),f=n(10);function p(e){return e&&e.__esModule?e:{default:e}}h=i.Component,(0,o.default)(m,h),m.prototype.render=function(){var e,t=this.props,n=t.prefix,a=t.type,r=t.size,o=t.className,i=t.rtl,l=t.style,t=t.children,s=f.obj.pickOthers((0,u.default)({},m.propTypes),this.props),n=(0,c.default)(((e={})[n+"icon"]=!0,e[n+"icon-"+a]=!!a,e[""+n+r]=!!r&&"string"==typeof r,e[o]=!!o,e)),o=(i&&-1!==["arrow-left","arrow-right","arrow-double-left","arrow-double-right","switch","sorting","descending","ascending"].indexOf(a)&&(s.dir="rtl"),"number"==typeof r?{width:r,height:r,lineHeight:r+"px",fontSize:r}:{});return d.default.createElement("i",(0,u.default)({},s,{style:(0,u.default)({},o,l),className:n}),t)},i=n=m,n.propTypes=(0,u.default)({},s.default.propTypes,{type:l.default.string,children:l.default.node,size:l.default.oneOfType([l.default.oneOf(["xxs","xs","small","medium","large","xl","xxl","xxxl","inherit"]),l.default.number]),className:l.default.string,style:l.default.object}),n.defaultProps={prefix:"next-",size:"medium"},n._typeMark="icon";var h,o=i;function m(){return(0,a.default)(this,m),(0,r.default)(this,h.apply(this,arguments))}o.displayName="Icon",t.default=s.default.config(o),e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var g=s(n(2)),y=s(n(12)),a=s(n(36)),r=s(n(4)),o=s(n(5)),i=s(n(6)),v=n(0),_=s(v),l=s(n(3)),b=n(155),w=s(n(522));function s(e){return e&&e.__esModule?e:{default:e}}function u(){}function M(e){return _.default.Children.toArray(e.children)[0]||null}d=v.Component,(0,i.default)(c,d),c.prototype.normalizeNames=function(e){return"string"==typeof e?{appear:e+"-appear",appearActive:e+"-appear-active",enter:e+"-enter",enterActive:e+"-enter-active",leave:e+"-leave",leaveActive:e+"-leave-active"}:"object"===(void 0===e?"undefined":(0,a.default)(e))?{appear:e.appear,appearActive:e.appear+"-active",enter:""+e.enter,enterActive:e.enter+"-active",leave:""+e.leave,leaveActive:e.leave+"-active"}:void 0},c.prototype.render=function(){var t=this,e=this.props,n=e.animation,a=e.children,r=e.animationAppear,o=e.singleMode,i=e.component,l=e.beforeAppear,s=e.onAppear,u=e.afterAppear,d=e.beforeEnter,c=e.onEnter,f=e.afterEnter,p=e.beforeLeave,h=e.onLeave,m=e.afterLeave,e=(0,y.default)(e,["animation","children","animationAppear","singleMode","component","beforeAppear","onAppear","afterAppear","beforeEnter","onEnter","afterEnter","beforeLeave","onLeave","afterLeave"]),a=v.Children.map(a,function(e){return _.default.createElement(w.default,{key:e.key,names:t.normalizeNames(n),onAppear:l,onAppearing:s,onAppeared:u,onEnter:d,onEntering:c,onEntered:f,onExit:p,onExiting:h,onExited:m},e)});return _.default.createElement(b.TransitionGroup,(0,g.default)({appear:r,component:o?M:i},e),a)},i=n=c,n.propTypes={animation:l.default.oneOfType([l.default.string,l.default.object]),animationAppear:l.default.bool,component:l.default.any,singleMode:l.default.bool,children:l.default.oneOfType([l.default.element,l.default.arrayOf(l.default.element)]),beforeAppear:l.default.func,onAppear:l.default.func,afterAppear:l.default.func,beforeEnter:l.default.func,onEnter:l.default.func,afterEnter:l.default.func,beforeLeave:l.default.func,onLeave:l.default.func,afterLeave:l.default.func},n.defaultProps={animationAppear:!0,component:"div",singleMode:!0,beforeAppear:u,onAppear:u,afterAppear:u,beforeEnter:u,onEnter:u,afterEnter:u,beforeLeave:u,onLeave:u,afterLeave:u};var d,l=i;function c(){return(0,r.default)(this,c),(0,o.default)(this,d.apply(this,arguments))}l.displayName="Animate",t.default=l,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=t.EXITING=t.ENTERED=t.ENTERING=t.EXITED=t.UNMOUNTED=void 0;var a=function(e){{if(e&&e.__esModule)return e;var t,n={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&((t=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,a):{}).get||t.set?Object.defineProperty(n,a,t):n[a]=e[a]);return n.default=e,n}}(n(3)),o=l(n(0)),i=l(n(22)),r=n(30);n(343);function l(e){return e&&e.__esModule?e:{default:e}}var s="unmounted",u=(t.UNMOUNTED=s,"exited"),d=(t.EXITED=u,"entering"),c=(t.ENTERING=d,"entered"),f=(t.ENTERED=c,"exiting"),n=(t.EXITING=f,function(r){var e;function t(e,t){var n,a=r.call(this,e,t)||this,t=t.transitionGroup,t=t&&!t.isMounting?e.enter:e.appear;return a.appearStatus=null,e.in?t?(n=u,a.appearStatus=d):n=c:n=e.unmountOnExit||e.mountOnEnter?s:u,a.state={status:n},a.nextCallback=null,a}e=r,(n=t).prototype=Object.create(e.prototype),(n.prototype.constructor=n).__proto__=e;var n=t.prototype;return n.getChildContext=function(){return{transitionGroup:null}},t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===s?{status:u}:null},n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;e!==this.props&&(e=this.state.status,this.props.in?e!==d&&e!==c&&(t=d):e!==d&&e!==c||(t=f)),this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n=this.props.timeout,a=e=t=n;return null!=n&&"number"!=typeof n&&(a=n.exit,e=n.enter,t=void 0!==n.appear?n.appear:e),{exit:a,enter:e,appear:t}},n.updateStatus=function(e,t){var n;void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),n=i.default.findDOMNode(this),t===d?this.performEnter(n,e):this.performExit(n)):this.props.unmountOnExit&&this.state.status===u&&this.setState({status:s})},n.performEnter=function(e,t){var n=this,a=this.props.enter,r=this.context.transitionGroup?this.context.transitionGroup.isMounting:t,o=this.getTimeouts(),i=r?o.appear:o.enter;t||a?(this.props.onEnter(e,r),this.safeSetState({status:d},function(){n.props.onEntering(e,r),n.onTransitionEnd(e,i,function(){n.safeSetState({status:c},function(){n.props.onEntered(e,r)})})})):this.safeSetState({status:c},function(){n.props.onEntered(e)})},n.performExit=function(e){var t=this,n=this.props.exit,a=this.getTimeouts();n?(this.props.onExit(e),this.safeSetState({status:f},function(){t.props.onExiting(e),t.onTransitionEnd(e,a.exit,function(){t.safeSetState({status:u},function(){t.props.onExited(e)})})})):this.safeSetState({status:u},function(){t.props.onExited(e)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(t){var n=this,a=!0;return this.nextCallback=function(e){a&&(a=!1,n.nextCallback=null,t(e))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(e,t,n){this.setNextCallback(n);n=null==t&&!this.props.addEndListener;!e||n?setTimeout(this.nextCallback,0):(this.props.addEndListener&&this.props.addEndListener(e,this.nextCallback),null!=t&&setTimeout(this.nextCallback,t))},n.render=function(){var e=this.state.status;if(e===s)return null;var t=this.props,n=t.children,t=function(e,t){if(null==e)return{};for(var n,a={},r=Object.keys(e),o=0;o 16.8.0"),null;function t(e){j.current=e,ne({})}function a(e,t){N(te,null),"function"==typeof S&&S(e,t)}function n(e){27===e.keyCode&&Y&&!P.current.size&&a("esc",e)}function r(){j.current||(t(!0),he.dom.setStyle(D.current,"display","none"),me.default.unlock(document.body,ee.current),s&&O.current&&(O.current.focus(),O.current=null),I())}var o=e.prefix,o=void 0===o?"next-":o,i=e.afterClose,I=void 0===i?ye:i,i=e.hasMask,l=void 0===i||i,i=e.autoFocus,s=void 0!==i&&i,i=e.className,R=e.title,A=e.children,H=e.footer,F=e.footerAlign,z=e.footerActions,u=e.onOk,u=void 0===u?ye:u,d=e.onCancel,W=e.okProps,V=e.cancelProps,c=e.locale,c=void 0===c?pe.default.Dialog:c,B=e.rtl,f=e.visible,p=e.closeMode,p=void 0===p?["close","esc"]:p,U=e.closeIcon,h=e.animation,h=void 0===h?{in:"fadeInUp",out:"fadeOutUp"}:h,m=e.cache,K=e.wrapperStyle,g=e.popupContainer,y=void 0===g?document.body:g,g=e.dialogRender,v=e.centered,_=e.top,_=void 0===_?v?40:100:_,b=e.bottom,b=void 0===b?40:b,w=e.width,w=void 0===w?520:w,G=e.height,M=e.isFullScreen,k=e.overflowScroll,M=void 0===k?!M:k,k=e.minMargin,S=e.onClose,q=e.style,E=(0,ie.default)(e,["prefix","afterClose","hasMask","autoFocus","className","title","children","footer","footerAlign","footerActions","onOk","onCancel","okProps","cancelProps","locale","rtl","visible","closeMode","closeIcon","animation","cache","wrapperStyle","popupContainer","dialogRender","centered","top","bottom","width","height","isFullScreen","overflowScroll","minMargin","onClose","style"]),x=("isFullScreen"in e&&he.log.deprecated("isFullScreen","overflowScroll","Dialog v2"),"minMargin"in e&&he.log.deprecated("minMargin","top/bottom","Dialog v2"),(0,le.useState)(f||!1)),$=x[0],J=x[1],x=(0,le.useState)(f),C=x[0],X=x[1],Q="string"==typeof y?function(){return document.getElementById(y)}:"function"!=typeof y?function(){return y}:y,x=(0,le.useState)(Q()),L=x[0],Z=x[1],T=(0,le.useRef)(null),D=(0,le.useRef)(null),O=(0,le.useRef)(null),ee=(0,le.useRef)(null),te=(0,le.useState)((0,he.guid)())[0],x=(0,le.useContext)(ge),N=x.setVisibleOverlayToParent,x=(0,ie.default)(x,["setVisibleOverlayToParent"]),P=(0,le.useRef)(new Map),j=(0,le.useRef)(!1),ne=(0,le.useState)()[1],Y=!1,ae=!1,re=!1;(Array.isArray(p)?p:[p]).forEach(function(e){switch(e){case"esc":Y=!0;break;case"mask":ae=!0;break;case"close":re=!0}}),(0,le.useEffect)(function(){"visible"in e&&X(f)},[f]),(0,le.useEffect)(function(){var e;C&&l&&(e={overflow:"hidden"},he.dom.hasScroll(document.body)&&he.dom.scrollbar().width&&(e.paddingRight=he.dom.getStyle(document.body,"paddingRight")+he.dom.scrollbar().width+"px"),ee.current=me.default.lock(document.body,e))},[C&&l]),(0,le.useEffect)(function(){if(C&&Y)return document.body.addEventListener("keydown",n,!1),function(){document.body.removeEventListener("keydown",n,!1)}},[C&&Y]),(0,le.useEffect)(function(){!$&&C&&J(!0)},[C]),(0,le.useEffect)(function(){L||setTimeout(function(){Z(Q())})},[L]);if((0,le.useEffect)(function(){return function(){r()}},[]),!1===$||!L)return null;if(!C&&!m&&j.current)return null;m=(0,de.default)(((p={})[o+"overlay-wrapper"]=!0,p.opened=C,p)),i=(0,de.default)(((p={})[o+"dialog-v2"]=!0,p[i]=!!i,p)),p={},k=void(v?_||b||!k?(_&&(p.marginTop=_),b&&(p.marginBottom=b)):(p.marginTop=k,p.marginBottom=k):(_&&(p.top=_),b&&(p.paddingBottom=b))),M&&(k="calc(100vh - "+(_+b)+"px)"),M={appear:300,enter:300,exit:250},_=se.default.createElement(fe.default.OverlayAnimate,{visible:C,animation:h,timeout:M,onEnter:function(){t(!1),he.dom.setStyle(D.current,"display","")},onEntered:function(){var e;s&&T.current&&T.current.bodyNode&&(0<(e=he.focus.getFocusNodeList(T.current.bodyNode)).length&&e[0]&&(O.current=document.activeElement,e[0].focus())),N(te,D.current)},onExited:r},se.default.createElement(ce.default,(0,oe.default)({},E,{style:v?(0,oe.default)({},p,q):q,v2:!0,ref:T,prefix:o,className:i,title:R,footer:H,footerAlign:F,footerActions:z,onOk:C?u:ye,onCancel:C?function(e){"function"==typeof d?d(e):a("cancelBtn",e)}:ye,okProps:W,cancelProps:V,locale:c,closeable:re,rtl:B,onClose:function(){for(var e=arguments.length,t=Array(e),n=0;n>6]+d[128|63&s]:s<55296||57344<=s?i+=d[224|s>>12]+d[128|s>>6&63]+d[128|63&s]:(l+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(l)),i+=d[240|s>>18]+d[128|s>>12&63]+d[128|s>>6&63]+d[128|63&s])}return i},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(m(e)){for(var n=[],a=0;athis.popupNode.offsetWidth&&p(this.popupNode,"width",l.offsetWidth+"px"),"outside"!==a||"hoz"===r&&1===n||(p(this.popupNode,"height",u.offsetHeight+"px"),this.popupNode.firstElementChild&&p(this.popupNode.firstElementChild,"overflow-y","auto")),this.popupProps);d.onOpen&&d.onOpen()}catch(e){return null}},S.prototype.handlePopupClose=function(){var e=this.props.root.popupNodes,t=e.indexOf(this.popupNode),e=(-1t?r[t+1]:r[0])}),n[a]||(o=r[0]),i.onSort(a,o)},i.keydownHandler=function(e){e.preventDefault(),e.stopPropagation(),e.keyCode===l.KEYCODE.ENTER&&i.handleClick()},i.onSort=function(e,t){var n={};n[e]=t,i.props.onSort(e,t,n)},(0,o.default)(i,e)}i.displayName="Sort",t.default=i,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=c(n(2)),a=c(n(4)),o=c(n(5)),i=c(n(6)),l=c(n(0)),s=c(n(3)),u=c(n(13)),d=c(n(386));function c(e){return e&&e.__esModule?e:{default:e}}f=l.default.Component,(0,i.default)(p,f),p.prototype.render=function(){var e=this.props,t=e.className,n=e.record,e=e.primaryKey,a=this.context.selectedRowKeys,n=(0,u.default)(((a={selected:-1 "+this.message+" (line "+this.parsedLine+": '"+this.snippet+"')":" "+this.message},o}(Error);e.exports=n},function(e,t){var i={}.hasOwnProperty,n=function(e){var t,n=o,a=e;for(t in a)i.call(a,t)&&(n[t]=a[t]);function r(){this.constructor=n}function o(e,t,n){this.message=e,this.parsedLine=t,this.snippet=n}return r.prototype=a.prototype,n.prototype=new r,n.__super__=a.prototype,o.prototype.toString=function(){return null!=this.parsedLine&&null!=this.snippet?" "+this.message+" (line "+this.parsedLine+": '"+this.snippet+"')":" "+this.message},o}(Error);e.exports=n},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var y=m(n(2)),a=m(n(4)),r=m(n(5)),o=m(n(6)),i=n(0),v=m(i),l=n(22),s=m(n(3)),_=m(n(13)),u=n(10),f=m(n(50)),d=m(n(61)),b=m(n(11)),c=m(n(44)),p=m(n(672)),h=m(n(397)),w=n(174);function m(e){return e&&e.__esModule?e:{default:e}}var M=d.default.Popup,g=f.default.Item,k=f.default.Group,n=u.func.noop,S=u.func.bindCtx,E=u.func.makeChain;x=v.default.Component,(0,o.default)(C,x),C.prototype.componentDidMount=function(){var e=this;setTimeout(function(){return e.syncWidth()},0),u.events.on(window,"resize",this.handleResize)},C.prototype.componentDidUpdate=function(e,t){e.label===this.props.label&&t.value===this.state.value||this.syncWidth()},C.prototype.componentWillUnmount=function(){u.events.off(window,"resize",this.handleResize),clearTimeout(this.resizeTimeout)},C.prototype.syncWidth=function(){var e=this,t=this.props,n=t.popupStyle,t=t.popupProps;n&&"width"in n||t&&t.style&&"width"in t.style||(n=u.dom.getStyle(this.selectDOM,"width"))&&this.width!==n&&(this.width=n,this.popupRef&&this.shouldAutoWidth()&&setTimeout(function(){e.popupRef&&u.dom.setStyle(e.popupRef,"width",e.width)},0))},C.prototype.handleResize=function(){var e=this;clearTimeout(this.resizeTimeout),this.state.visible&&(this.resizeTimeout=setTimeout(function(){e.syncWidth()},200))},C.prototype.setDataSource=function(e){var t=e.dataSource,e=e.children;return i.Children.count(e)?this.dataStore.updateByDS(e,!0):Array.isArray(t)?this.dataStore.updateByDS(t,!1):[]},C.prototype.setVisible=function(e,t){this.props.disabled&&e||this.state.visible===e||("visible"in this.props||this.setState({visible:e}),this.props.onVisibleChange(e,t))},C.prototype.setFirstHightLightKeyForMenu=function(e){var t=this.state.highlightKey;this.props.autoHighlightFirstItem&&(this.dataStore.getMenuDS().length&&this.dataStore.getEnableDS().length&&(!t||e)&&(t=""+this.dataStore.getEnableDS()[0].value,this.setState({highlightKey:t}),this.props.onToggleHighlightItem(t,"autoFirstItem")),e&&!this.dataStore.getEnableDS().length&&(this.setState({highlightKey:null}),this.props.onToggleHighlightItem(null,"highlightKeyToNull")))},C.prototype.handleChange=function(e){var t;"value"in this.props||this.setState({value:e});for(var n=arguments.length,a=Array(1e.slidesToShow&&(n=e.slideWidth*e.slidesToShow*-1,o=e.slideHeight*e.slidesToShow*-1),e.slideCount%e.slidesToScroll!=0&&(t=e.slideIndex+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow,(t=e.rtl?(e.slideIndex>=e.slideCount?e.slideCount-e.slideIndex:e.slideIndex)+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow:t)&&(o=e.slideIndex>e.slideCount?(n=(e.slidesToShow-(e.slideIndex-e.slideCount))*e.slideWidth*-1,(e.slidesToShow-(e.slideIndex-e.slideCount))*e.slideHeight*-1):(n=e.slideCount%e.slidesToScroll*e.slideWidth*-1,e.slideCount%e.slidesToScroll*e.slideHeight*-1)))):e.slideCount%e.slidesToScroll!=0&&e.slideIndex+e.slidesToScroll>e.slideCount&&e.slideCount>e.slidesToShow&&(n=(e.slidesToShow-e.slideCount%e.slidesToScroll)*e.slideWidth),e.centerMode&&(e.infinite?n+=e.slideWidth*Math.floor(e.slidesToShow/2):n=e.slideWidth*Math.floor(e.slidesToShow/2)),a=e.vertical?e.slideIndex*e.slideHeight*-1+o:e.slideIndex*e.slideWidth*-1+n,!0===e.variableWidth&&(t=void 0,a=(r=e.slideCount<=e.slidesToShow||!1===e.infinite?i.default.findDOMNode(e.trackRef).childNodes[e.slideIndex]:(t=e.slideIndex+e.slidesToShow,i.default.findDOMNode(e.trackRef).childNodes[t]))?-1*r.offsetLeft:0,!0===e.centerMode&&(r=!1===e.infinite?i.default.findDOMNode(e.trackRef).children[e.slideIndex]:i.default.findDOMNode(e.trackRef).children[e.slideIndex+e.slidesToShow+1])&&(a=-1*r.offsetLeft+(e.listWidth-r.offsetWidth)/2)),a)}},function(e,t,n){"use strict";t.__esModule=!0;var p=u(n(2)),h=u(n(12)),o=u(n(4)),i=u(n(5)),a=u(n(6)),m=u(n(0)),r=u(n(3)),g=u(n(13)),l=u(n(7)),y=u(n(24)),s=n(10);function u(e){return e&&e.__esModule?e:{default:e}}d=m.default.Component,(0,a.default)(c,d),c.prototype.render=function(){var e=this.props,t=e.title,n=e.children,a=e.className,r=e.isExpanded,o=e.disabled,i=e.style,l=e.prefix,s=e.onClick,u=e.id,e=(0,h.default)(e,["title","children","className","isExpanded","disabled","style","prefix","onClick","id"]),a=(0,g.default)(((d={})[l+"collapse-panel"]=!0,d[l+"collapse-panel-hidden"]=!r,d[l+"collapse-panel-expanded"]=r,d[l+"collapse-panel-disabled"]=o,d[a]=a,d)),d=(0,g.default)(((d={})[l+"collapse-panel-icon"]=!0,d[l+"collapse-panel-icon-expanded"]=r,d)),c=u?u+"-heading":void 0,f=u?u+"-region":void 0;return m.default.createElement("div",(0,p.default)({className:a,style:i,id:u},e),m.default.createElement("div",{id:c,className:l+"collapse-panel-title",onClick:s,onKeyDown:this.onKeyDown,tabIndex:"0","aria-disabled":o,"aria-expanded":r,"aria-controls":f,role:"button"},m.default.createElement(y.default,{type:"arrow-right",className:d,"aria-hidden":"true"}),t),m.default.createElement("div",{className:l+"collapse-panel-content",role:"region",id:f},n))},a=n=c,n.propTypes={prefix:r.default.string,style:r.default.object,children:r.default.any,isExpanded:r.default.bool,disabled:r.default.bool,title:r.default.node,className:r.default.string,onClick:r.default.func,id:r.default.string},n.defaultProps={prefix:"next-",isExpanded:!1,onClick:s.func.noop},n.isNextPanel=!0;var d,r=a;function c(){var e,n;(0,o.default)(this,c);for(var t=arguments.length,a=Array(t),r=0;r\n com.alibaba.nacos\n nacos-client\n ${version}\n \n*/\npackage com.alibaba.nacos.example;\n\nimport java.util.Properties;\nimport java.util.concurrent.Executor;\nimport com.alibaba.nacos.api.NacosFactory;\nimport com.alibaba.nacos.api.config.ConfigService;\nimport com.alibaba.nacos.api.config.listener.Listener;\nimport com.alibaba.nacos.api.exception.NacosException;\n\n/**\n * Config service example\n *\n * @author Nacos\n *\n */\npublic class ConfigExample {\n\n\tpublic static void main(String[] args) throws NacosException, InterruptedException {\n\t\tString serverAddr = "localhost";\n\t\tString dataId = "'.concat(e.dataId,'";\n\t\tString group = "').concat(e.group,'";\n\t\tProperties properties = new Properties();\n\t\tproperties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);\n\t\tConfigService configService = NacosFactory.createConfigService(properties);\n\t\tString content = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\t\tconfigService.addListener(dataId, group, new Listener() {\n\t\t\t@Override\n\t\t\tpublic void receiveConfigInfo(String configInfo) {\n\t\t\t\tSystem.out.println("recieve:" + configInfo);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Executor getExecutor() {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\n\t\tboolean isPublishOk = configService.publishConfig(dataId, group, "content");\n\t\tSystem.out.println(isPublishOk);\n\n\t\tThread.sleep(3000);\n\t\tcontent = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\n\t\tboolean isRemoveOk = configService.removeConfig(dataId, group);\n\t\tSystem.out.println(isRemoveOk);\n\t\tThread.sleep(3000);\n\n\t\tcontent = configService.getConfig(dataId, group, 5000);\n\t\tSystem.out.println(content);\n\t\tThread.sleep(300000);\n\n\t}\n}\n')}},{key:"getNodejsCode",value:function(e){return"TODO"}},{key:"getCppCode",value:function(e){return"TODO"}},{key:"getShellCode",value:function(e){return"TODO"}},{key:"getPythonCode",value:function(e){return"TODO"}},{key:"getCSharpCode",value:function(e){return'/*\nDemo for Basic Nacos Opreation\nApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Nacos.V2;\nusing Nacos.V2.DependencyInjection;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static async Task Main(string[] args)\n {\n string serverAddr = "http://localhost:8848";\n string dataId = "'.concat(e.dataId,'";\n string group = "').concat(e.group,'";\n\n IServiceCollection services = new ServiceCollection();\n\n services.AddNacosV2Config(x =>\n {\n x.ServerAddresses = new List { serverAddr };\n x.Namespace = "cs-test";\n\n // swich to use http or rpc\n x.ConfigUseRpc = true;\n });\n\n IServiceProvider serviceProvider = services.BuildServiceProvider();\n var configSvc = serviceProvider.GetService();\n\n var content = await configSvc.GetConfig(dataId, group, 3000);\n Console.WriteLine(content);\n\n var listener = new ConfigListener();\n\n await configSvc.AddListener(dataId, group, listener);\n\n var isPublishOk = await configSvc.PublishConfig(dataId, group, "content");\n Console.WriteLine(isPublishOk);\n\n await Task.Delay(3000);\n content = await configSvc.GetConfig(dataId, group, 5000);\n Console.WriteLine(content);\n\n var isRemoveOk = await configSvc.RemoveConfig(dataId, group);\n Console.WriteLine(isRemoveOk);\n await Task.Delay(3000);\n\n content = await configSvc.GetConfig(dataId, group, 5000);\n Console.WriteLine(content);\n await Task.Delay(300000);\n }\n\n internal class ConfigListener : IListener\n {\n public void ReceiveConfigInfo(string configInfo)\n {\n Console.WriteLine("recieve:" + configInfo);\n }\n }\n}\n\n/*\nRefer to document: https://github.com/nacos-group/nacos-sdk-csharp/tree/dev/samples/MsConfigApp\nDemo for ASP.NET Core Integration\nMsConfigApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Hosting;\nusing Serilog;\nusing Serilog.Events;\n\npublic class Program\n{\n public static void Main(string[] args)\n {\n Log.Logger = new LoggerConfiguration()\n .Enrich.FromLogContext()\n .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)\n .MinimumLevel.Override("System", LogEventLevel.Warning)\n .MinimumLevel.Debug()\n .WriteTo.Console()\n .CreateLogger();\n\n try\n {\n Log.ForContext().Information("Application starting...");\n CreateHostBuilder(args, Log.Logger).Build().Run();\n }\n catch (System.Exception ex)\n {\n Log.ForContext().Fatal(ex, "Application start-up failed!!");\n }\n finally\n {\n Log.CloseAndFlush();\n }\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args, Serilog.ILogger logger) =>\n Host.CreateDefaultBuilder(args)\n .ConfigureAppConfiguration((context, builder) =>\n {\n var c = builder.Build();\n builder.AddNacosV2Configuration(c.GetSection("NacosConfig"), logAction: x => x.AddSerilog(logger));\n })\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.UseStartup().UseUrls("http://*:8787");\n })\n .UseSerilog();\n}\n ')}},{key:"openDialog",value:function(e){var t=this;this.setState({dialogvisible:!0}),this.record=e,setTimeout(function(){t.getData()})}},{key:"closeDialog",value:function(){this.setState({dialogvisible:!1})}},{key:"createCodeMirror",value:function(e,t){var n=this.refs.codepreview;n&&(n.innerHTML="",this.cm=window.CodeMirror(n,{value:t,mode:e,height:400,width:500,lineNumbers:!0,theme:"xq-light",lint:!0,tabMode:"indent",autoMatchParens:!0,textWrapping:!0,gutters:["CodeMirror-lint-markers"],extraKeys:{F1:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}}}))}},{key:"changeTab",value:function(e,t){var n=this;setTimeout(function(){n[e]=!0,n.createCodeMirror("text/javascript",t)})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e;return x.a.createElement("div",null,x.a.createElement(y.a,{title:e.sampleCode,style:{width:"80%"},visible:this.state.dialogvisible,footer:x.a.createElement("div",null),onClose:this.closeDialog.bind(this)},x.a.createElement("div",{style:{height:500}},x.a.createElement(R.a,{tip:e.loading,style:{width:"100%"},visible:this.state.loading},x.a.createElement(O.a,{shape:"text",style:{height:40,paddingBottom:10}},x.a.createElement(N,{title:"Java",key:1,onClick:this.changeTab.bind(this,"commoneditor1",this.defaultCode)}),x.a.createElement(N,{title:"Spring Boot",key:2,onClick:this.changeTab.bind(this,"commoneditor2",this.sprigboot_code)}),x.a.createElement(N,{title:"Spring Cloud",key:21,onClick:this.changeTab.bind(this,"commoneditor21",this.sprigcloud_code)}),x.a.createElement(N,{title:"Node.js",key:3,onClick:this.changeTab.bind(this,"commoneditor3",this.nodejsCode)}),x.a.createElement(N,{title:"C++",key:4,onClick:this.changeTab.bind(this,"commoneditor4",this.cppCode)}),x.a.createElement(N,{title:"Shell",key:5,onClick:this.changeTab.bind(this,"commoneditor5",this.shellCode)}),x.a.createElement(N,{title:"Python",key:6,onClick:this.changeTab.bind(this,"commoneditor6",this.pythonCode)}),x.a.createElement(N,{title:"C#",key:7,onClick:this.changeTab.bind(this,"commoneditor7",this.csharpCode)})),x.a.createElement("div",{ref:"codepreview"})))))}}]),n}(x.a.Component)).displayName="ShowCodeing",S=S))||S,S=(t(65),t(38)),S=t.n(S),H=(t(712),S.a.Row),P=S.a.Col,F=(0,n.a.config)(((S=function(e){Object(M.a)(n,e);var t=Object(k.a)(n);function n(e){return Object(_.a)(this,n),(e=t.call(this,e)).state={visible:!1,title:"",content:"",isok:!0,dataId:"",group:""},e}return Object(b.a)(n,[{key:"componentDidMount",value:function(){this.initData()}},{key:"initData",value:function(){var e=this.props.locale;this.setState({title:(void 0===e?{}:e).confManagement})}},{key:"openDialog",value:function(e){this.setState({visible:!0,title:e.title,content:e.content,isok:e.isok,dataId:e.dataId,group:e.group,message:e.message})}},{key:"closeDialog",value:function(){this.setState({visible:!1})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e,t=x.a.createElement("div",{style:{textAlign:"right"}},x.a.createElement(d.a,{type:"primary",onClick:this.closeDialog.bind(this)},e.determine));return x.a.createElement("div",null,x.a.createElement(y.a,{visible:this.state.visible,footer:t,style:{width:555},onCancel:this.closeDialog.bind(this),onClose:this.closeDialog.bind(this),title:e.deletetitle},x.a.createElement("div",null,x.a.createElement(H,null,x.a.createElement(P,{span:"4",style:{paddingTop:16}},x.a.createElement(m.a,{type:"".concat(this.state.isok?"success":"delete","-filling"),style:{color:this.state.isok?"green":"red"},size:"xl"})),x.a.createElement(P,{span:"20"},x.a.createElement("div",null,x.a.createElement("h3",null,this.state.isok?e.deletedSuccessfully:e.deleteFailed),x.a.createElement("p",null,x.a.createElement("span",{style:{color:"#999",marginRight:5}},"Data ID:"),x.a.createElement("span",{style:{color:"#c7254e"}},this.state.dataId)),x.a.createElement("p",null,x.a.createElement("span",{style:{color:"#999",marginRight:5}},"Group:"),x.a.createElement("span",{style:{color:"#c7254e"}},this.state.group)),this.state.isok?"":x.a.createElement("p",{style:{color:"red"}},this.state.message)))))))}}]),n}(x.a.Component)).displayName="DeleteDialog",S=S))||S,S=(t(713),t(416)),z=t.n(S),W=(0,n.a.config)(((S=function(e){Object(M.a)(n,e);var t=Object(k.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(b.a)(n,[{key:"render",value:function(){var e=this.props,t=e.data,t=void 0===t?{}:t,n=e.height,e=e.locale,a=void 0===e?{}:e;return x.a.createElement("div",null,"notice"===t.modeType?x.a.createElement("div",{"data-spm-click":"gostr=/aliyun;locaid=notice"},x.a.createElement(z.a,{style:{marginBottom:1l?b.a.createElement(u.a,{className:"pagination",total:i.count,pageSize:l,onChange:function(e){return a.onChangePage(e)}}):null,b.a.createElement(C,{ref:this.editInstanceDialog,serviceName:n,clusterName:t,groupName:e,openLoading:function(){return a.openLoading()},closeLoading:function(){return a.closeLoading()},getInstanceList:function(){return a.getInstanceList()}})):null}}]),n}(b.a.Component)).displayName="InstanceTable",l.defaultProps={filters:new Map},l=l))||l,L=function(e,t){return e.filter(function(e){var n=e.metadata,a=!0;return t.forEach(function(e,t){if(e!==n[t])return a=!1}),a})},T=l,D=t(47),O=t(31),l=(t(172),t(72)),l=t.n(l),N=l.a.Group,P=l.a.Closeable,j=v.a.Item;var R=n.a.config(function(e){function t(){var e;a(),o&&l&&(e=new Map(Array.from(p)).set(o,l),h(e),d(""),f(""),n())}function n(){i(""),s("")}function a(){d(o?"":"error"),f(l?"":"error")}var r=Object(_.useState)(""),o=(r=Object(O.a)(r,2))[0],i=r[1],r=Object(_.useState)(""),l=(r=Object(O.a)(r,2))[0],s=r[1],r=Object(_.useState)(""),u=(r=Object(O.a)(r,2))[0],d=r[1],r=Object(_.useState)(""),c=(r=Object(O.a)(r,2))[0],f=r[1],r=Object(_.useState)(new Map),p=(r=Object(O.a)(r,2))[0],h=r[1],r=void 0===(r=e.locale)?{}:r;return Object(_.useEffect)(function(){e.setFilters(p)},[p]),b.a.createElement(m.a,{contentHeight:"auto",className:"inner-card"},b.a.createElement(v.a,{inline:!0,size:"small"},b.a.createElement(j,{label:r.title},b.a.createElement(j,null,b.a.createElement(y.a,{placeholder:"key",value:o,trim:!0,onChange:function(e){return i(e)},onPressEnter:t,state:u})),b.a.createElement(j,null,b.a.createElement(y.a,{placeholder:"value",value:l,trim:!0,onChange:function(e){return s(e)},onPressEnter:t,state:c})),b.a.createElement(j,{label:""},b.a.createElement(g.a,{type:"primary",onClick:t,style:{marginRight:10}},r.addFilter),0\n com.alibaba.nacos\n nacos-client\n ${latest.version}\n \n*/\npackage com.alibaba.nacos.example;\n\nimport java.util.Properties;\n\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingFactory;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.listener.Event;\nimport com.alibaba.nacos.api.naming.listener.EventListener;\nimport com.alibaba.nacos.api.naming.listener.NamingEvent;\n\n/**\n * @author nkorange\n */\npublic class NamingExample {\n\n public static void main(String[] args) throws NacosException {\n\n Properties properties = new Properties();\n properties.setProperty("serverAddr", System.getProperty("serverAddr"));\n properties.setProperty("namespace", System.getProperty("namespace"));\n\n NamingService naming = NamingFactory.createNamingService(properties);\n\n naming.registerInstance("'.concat(this.record.name,'", "11.11.11.11", 8888, "TEST1");\n\n naming.registerInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n System.out.println(naming.getAllInstances("').concat(this.record.name,'"));\n\n naming.deregisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n System.out.println(naming.getAllInstances("').concat(this.record.name,'"));\n\n naming.subscribe("').concat(this.record.name,'", new EventListener() {\n @Override\n public void onEvent(Event event) {\n System.out.println(((NamingEvent)event).getServiceName());\n System.out.println(((NamingEvent)event).getInstances());\n }\n });\n }\n}')}},{key:"getSpringCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-example/nacos-spring-discovery-example\n* pom.xml\n \n com.alibaba.nacos\n nacos-spring-context\n ${latest.version}\n \n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-example/nacos-spring-discovery-example/src/main/java/com/alibaba/nacos/example/spring\npackage com.alibaba.nacos.example.spring;\n\nimport com.alibaba.nacos.api.annotation.NacosProperties;\nimport com.alibaba.nacos.spring.context.annotation.discovery.EnableNacosDiscovery;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\n@EnableNacosDiscovery(globalProperties = @NacosProperties(serverAddr = "127.0.0.1:8848"))\npublic class NacosConfiguration {\n\n}\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-example/nacos-spring-discovery-example/src/main/java/com/alibaba/nacos/example/spring/controller\npackage com.alibaba.nacos.example.spring.controller;\n\nimport com.alibaba.nacos.api.annotation.NacosInjected;\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.pojo.Instance;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.ResponseBody;\n\nimport java.util.List;\n\nimport static org.springframework.web.bind.annotation.RequestMethod.GET;\n\n@Controller\n@RequestMapping("discovery")\npublic class DiscoveryController {\n\n @NacosInjected\n private NamingService namingService;\n\n @RequestMapping(value = "/get", method = GET)\n @ResponseBody\n public List get(@RequestParam String serviceName) throws NacosException {\n return namingService.getAllInstances(serviceName);\n }\n}'}},{key:"getSpringBootCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example\n* pom.xml\n \n com.alibaba.boot\n nacos-discovery-spring-boot-starter\n ${latest.version}\n \n*/\n/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example/src/main/resources\n* application.properties\n nacos.discovery.server-addr=127.0.0.1:8848\n*/\n// Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-boot-example/nacos-spring-boot-discovery-example/src/main/java/com/alibaba/nacos/example/spring/boot/controller\n\npackage com.alibaba.nacos.example.spring.boot.controller;\n\nimport com.alibaba.nacos.api.annotation.NacosInjected;\nimport com.alibaba.nacos.api.exception.NacosException;\nimport com.alibaba.nacos.api.naming.NamingService;\nimport com.alibaba.nacos.api.naming.pojo.Instance;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.ResponseBody;\n\nimport java.util.List;\n\nimport static org.springframework.web.bind.annotation.RequestMethod.GET;\n\n@Controller\n@RequestMapping("discovery")\npublic class DiscoveryController {\n\n @NacosInjected\n private NamingService namingService;\n\n @RequestMapping(value = "/get", method = GET)\n @ResponseBody\n public List get(@RequestParam String serviceName) throws NacosException {\n return namingService.getAllInstances(serviceName);\n }\n}'}},{key:"getSpringCloudCode",value:function(e){return"/* Refer to document: https://github.com/nacos-group/nacos-examples/blob/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/\n* pom.xml\n \n org.springframework.cloud\n spring-cloud-starter-alibaba-nacos-discovery\n ${latest.version}\n \n*/\n\n// nacos-spring-cloud-provider-example\n\n/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-provider-example/src/main/resources\n* application.properties\nserver.port=18080\nspring.application.name=".concat(this.record.name,'\nspring.cloud.nacos.discovery.server-addr=127.0.0.1:8848\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-provider-example/src/main/java/com/alibaba/nacos/example/spring/cloud\npackage com.alibaba.nacos.example.spring.cloud;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.cloud.client.discovery.EnableDiscoveryClient;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.RestController;\n\n/**\n * @author xiaojing\n */\n@SpringBootApplication\n@EnableDiscoveryClient\npublic class NacosProviderApplication {\n\n public static void main(String[] args) {\n SpringApplication.run(NacosProviderApplication.class, args);\n}\n\n @RestController\n class EchoController {\n @RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)\n public String echo(@PathVariable String string) {\n return "Hello Nacos Discovery " + string;\n }\n }\n}\n\n// nacos-spring-cloud-consumer-example\n\n/* Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-consumer-example/src/main/resources\n* application.properties\nspring.application.name=micro-service-oauth2\nspring.cloud.nacos.discovery.server-addr=127.0.0.1:8848\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-discovery-example/nacos-spring-cloud-consumer-example/src/main/java/com/alibaba/nacos/example/spring/cloud\npackage com.alibaba.nacos.example.spring.cloud;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.cloud.client.discovery.EnableDiscoveryClient;\nimport org.springframework.cloud.client.loadbalancer.LoadBalanced;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.client.RestTemplate;\n\n/**\n * @author xiaojing\n */\n@SpringBootApplication\n@EnableDiscoveryClient\npublic class NacosConsumerApplication {\n\n @LoadBalanced\n @Bean\n public RestTemplate restTemplate() {\n return new RestTemplate();\n }\n\n public static void main(String[] args) {\n SpringApplication.run(NacosConsumerApplication.class, args);\n }\n\n @RestController\n public class TestController {\n\n private final RestTemplate restTemplate;\n\n @Autowired\n public TestController(RestTemplate restTemplate) {this.restTemplate = restTemplate;}\n\n @RequestMapping(value = "/echo/{str}", method = RequestMethod.GET)\n public String echo(@PathVariable String str) {\n return restTemplate.getForObject("http://service-provider/echo/" + str, String.class);\n }\n }\n}')}},{key:"getNodejsCode",value:function(e){return"TODO"}},{key:"getCppCode",value:function(e){return"TODO"}},{key:"getShellCode",value:function(e){return"TODO"}},{key:"getPythonCode",value:function(e){return"TODO"}},{key:"getCSharpCode",value:function(e){return'/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/\nDemo for Basic Nacos Opreation\nApp.csproj\n\n\n \n\n*/\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Nacos.V2;\nusing Nacos.V2.DependencyInjection;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static async Task Main(string[] args)\n {\n IServiceCollection services = new ServiceCollection();\n\n services.AddNacosV2Naming(x =>\n {\n x.ServerAddresses = new List { "http://localhost:8848/" };\n x.Namespace = "cs-test";\n\n // swich to use http or rpc\n x.NamingUseRpc = true;\n });\n\n IServiceProvider serviceProvider = services.BuildServiceProvider();\n var namingSvc = serviceProvider.GetService();\n\n await namingSvc.RegisterInstance("'.concat(this.record.name,'", "11.11.11.11", 8888, "TEST1");\n\n await namingSvc.RegisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(await namingSvc.GetAllInstances("').concat(this.record.name,'")));\n\n await namingSvc.DeregisterInstance("').concat(this.record.name,'", "2.2.2.2", 9999, "DEFAULT");\n\n var listener = new EventListener();\n\n await namingSvc.Subscribe("').concat(this.record.name,'", listener);\n }\n\n internal class EventListener : IEventListener\n {\n public Task OnEvent(IEvent @event)\n {\n Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(@event));\n return Task.CompletedTask;\n }\n }\n}\n\n/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/\nDemo for ASP.NET Core Integration\nApp.csproj\n\n\n \n\n*/\n\n/* Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/blob/dev/samples/App1/appsettings.json\n* appsettings.json\n{\n "nacos": {\n "ServerAddresses": [ "http://localhost:8848" ],\n "DefaultTimeOut": 15000,\n "Namespace": "cs",\n "ServiceName": "App1",\n "GroupName": "DEFAULT_GROUP",\n "ClusterName": "DEFAULT",\n "Port": 0,\n "Weight": 100,\n "RegisterEnabled": true,\n "InstanceEnabled": true,\n "Ephemeral": true,\n "NamingUseRpc": true,\n "NamingLoadCacheAtStart": ""\n }\n}\n*/\n\n// Refer to document: https://github.com/nacos-group/nacos-sdk-csharp/blob/dev/samples/App1/Startup.cs\nusing Nacos.AspNetCore.V2;\n\npublic class Startup\n{\n public Startup(IConfiguration configuration)\n {\n Configuration = configuration;\n }\n\n public IConfiguration Configuration { get; }\n\n public void ConfigureServices(IServiceCollection services)\n {\n // ....\n services.AddNacosAspNet(Configuration);\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n // ....\n }\n}\n ')}},{key:"openDialog",value:function(e){var t=this;this.setState({dialogvisible:!0}),this.record=e,setTimeout(function(){t.getData()})}},{key:"closeDialog",value:function(){this.setState({dialogvisible:!1})}},{key:"createCodeMirror",value:function(e,t){var n=this.refs.codepreview;n&&(n.innerHTML="",this.cm=window.CodeMirror(n,{value:t,mode:e,height:400,width:500,lineNumbers:!0,theme:"xq-light",lint:!0,tabMode:"indent",autoMatchParens:!0,textWrapping:!0,gutters:["CodeMirror-lint-markers"],extraKeys:{F1:function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}}}),this.cm.setSize("auto","490px"))}},{key:"changeTab",value:function(e,t){var n=this;setTimeout(function(){n[e]=!0,n.createCodeMirror("text/javascript",t)})}},{key:"render",value:function(){var e=this.props.locale,e=void 0===e?{}:e;return T.a.createElement("div",null,T.a.createElement(o.a,{title:e.sampleCode,style:{width:"80%"},visible:this.state.dialogvisible,footer:T.a.createElement("div",null),onClose:this.closeDialog.bind(this)},T.a.createElement("div",{style:{height:500}},T.a.createElement(m.a,{tip:e.loading,style:{width:"100%"},visible:this.state.loading},T.a.createElement(g.a,{shape:"text",style:{height:40,paddingBottom:10}},T.a.createElement(y,{title:"Java",key:0,onClick:this.changeTab.bind(this,"commoneditor1",this.defaultCode)}),T.a.createElement(y,{title:"Spring",key:1,onClick:this.changeTab.bind(this,"commoneditor1",this.springCode)}),T.a.createElement(y,{title:"Spring Boot",key:2,onClick:this.changeTab.bind(this,"commoneditor2",this.sprigbootCode)}),T.a.createElement(y,{title:"Spring Cloud",key:21,onClick:this.changeTab.bind(this,"commoneditor21",this.sprigcloudCode)}),T.a.createElement(y,{title:"Node.js",key:3,onClick:this.changeTab.bind(this,"commoneditor3",this.nodejsCode)}),T.a.createElement(y,{title:"C++",key:4,onClick:this.changeTab.bind(this,"commoneditor4",this.cppCode)}),T.a.createElement(y,{title:"Shell",key:5,onClick:this.changeTab.bind(this,"commoneditor5",this.shellCode)}),T.a.createElement(y,{title:"Python",key:6,onClick:this.changeTab.bind(this,"commoneditor6",this.pythonCode)}),T.a.createElement(y,{title:"C#",key:7,onClick:this.changeTab.bind(this,"commoneditor7",this.csharpCode)})),T.a.createElement("div",{ref:"codepreview"})))))}}]),n}(T.a.Component)).displayName="ShowServiceCodeing",p=p))||p,j=(n(734),n(29)),Y=L.a.Item,I=f.a.Row,R=f.a.Col,A=C.a.Column,f=(0,a.a.config)(((p=function(e){Object(d.a)(a,e);var t=Object(c.a)(a);function a(e){var n;return Object(l.a)(this,a),(n=t.call(this,e)).getQueryLater=function(){setTimeout(function(){return n.queryServiceList()})},n.showcode=function(){setTimeout(function(){return n.queryServiceList()})},n.setNowNameSpace=function(e,t){return n.setState({nowNamespaceName:e,nowNamespaceId:t})},n.rowColor=function(e){return{className:e.healthyInstanceCount?"":"row-bg-red"}},n.editServiceDialog=T.a.createRef(),n.showcode=T.a.createRef(),n.state={loading:!1,total:0,pageSize:10,currentPage:1,dataSource:[],search:{serviceName:"",groupName:""},hasIpCount:!("false"===localStorage.getItem("hasIpCount"))},n.field=new i.a(Object(u.a)(n)),n}return Object(s.a)(a,[{key:"openLoading",value:function(){this.setState({loading:!0})}},{key:"closeLoading",value:function(){this.setState({loading:!1})}},{key:"openEditServiceDialog",value:function(){try{this.editServiceDialog.current.getInstance().show(this.state.service)}catch(e){}}},{key:"queryServiceList",value:function(){var n=this,e=this.state,t=e.currentPage,a=e.pageSize,r=e.search,o=e.withInstances,o=void 0!==o&&o,e=e.hasIpCount,e=["hasIpCount=".concat(e),"withInstances=".concat(o),"pageNo=".concat(t),"pageSize=".concat(a),"serviceNameParam=".concat(r.serviceName),"groupNameParam=".concat(r.groupName)];this.openLoading(),Object(h.b)({url:"v1/ns/catalog/services?".concat(e.join("&")),success:function(){var e=0o&&h.a.createElement(u.a,{className:"users-pagination",current:i,total:n.totalCount,pageSize:o,onChange:function(e){return t.setState({pageNo:e},function(){return t.getUsers()})}}),h.a.createElement(S,{visible:l,onOk:function(e){return Object(m.c)(e).then(function(e){return t.setState({pageNo:1},function(){return t.getUsers()}),e})},onCancel:function(){return t.colseCreateUser()}}),h.a.createElement(E.a,{visible:s,username:e,onOk:function(e){return Object(m.k)(e).then(function(e){return t.getUsers(),e})},onCancel:function(){return t.setState({passwordResetUser:void 0,passwordResetUserVisible:!1})}}))}}]),n}(h.a.Component)).displayName="UserManagement",n=o))||n)||n;t.a=r},function(e,t,n){"use strict";n(63);var a=n(46),s=n.n(a),a=(n(34),n(14)),u=n.n(a),d=n(31),a=(n(62),n(20)),c=n.n(a),a=(n(32),n(19)),f=n.n(a),i=n(15),l=n(16),p=n(18),h=n(17),a=(n(25),n(7)),a=n.n(a),r=n(0),m=n.n(r),r=n(43),g=n(45),o=n(79),y=n(48),v=(n(49),n(26)),_=n.n(v),b=n(23),v=(n(58),n(28)),w=n.n(v),v=(n(42),n(9)),M=n.n(v),k=M.a.Item,S=w.a.Option,E={labelCol:{fixedSpan:4},wrapperCol:{span:19}},x=Object(r.b)(function(e){return{namespaces:e.namespace.namespaces}},{getNamespaces:o.b,searchRoles:g.l})(v=(0,a.a.config)(((v=function(e){Object(p.a)(o,e);var r=Object(h.a)(o);function o(){var t;Object(i.a)(this,o);for(var e=arguments.length,n=new Array(e),a=0;ai&&m.a.createElement(s.a,{className:"users-pagination",current:l,total:t.totalCount,pageSize:i,onChange:function(e){return a.setState({pageNo:e},function(){return a.getPermissions()})}}),m.a.createElement(x,{visible:n,onOk:function(e){return Object(g.a)(e).then(function(e){return a.setState({pageNo:1},function(){return a.getPermissions()}),e})},onCancel:function(){return a.colseCreatePermission()}}))}}]),n}(m.a.Component)).displayName="PermissionsManagement",n=v))||n)||n);t.a=r},function(e,t,n){"use strict";n(63);var a=n(46),s=n.n(a),a=(n(34),n(14)),u=n.n(a),a=(n(62),n(20)),d=n.n(a),a=(n(32),n(19)),c=n.n(a),i=n(15),l=n(16),f=n(18),p=n(17),a=(n(25),n(7)),a=n.n(a),r=n(0),h=n.n(r),r=n(43),m=n(45),g=n(48),o=(n(58),n(28)),y=n.n(o),o=(n(40),n(11)),v=n.n(o),o=(n(49),n(26)),_=n.n(o),b=n(23),o=(n(42),n(9)),w=n.n(o),M=w.a.Item,k={labelCol:{fixedSpan:4},wrapperCol:{span:19}},S=Object(r.b)(function(e){return{users:e.authority.users}},{searchUsers:m.m})(o=(0,a.a.config)(((o=function(e){Object(f.a)(o,e);var r=Object(p.a)(o);function o(){var t;Object(i.a)(this,o);for(var e=arguments.length,n=new Array(e),a=0;ao&&h.a.createElement(s.a,{className:"users-pagination",current:i,total:t.totalCount,pageSize:o,onChange:function(e){return a.setState({pageNo:e},function(){return a.getRoles()})}}),h.a.createElement(S,{visible:l,onOk:function(e){return Object(m.b)(e).then(function(e){return a.getRoles(),e})},onCancel:function(){return a.colseCreateRole()}}))}}]),n}(h.a.Component)).displayName="RolesManagement",n=o))||n)||n);t.a=r},function(e,t,n){"use strict";n(41);function o(e){var t=void 0===(t=localStorage.token)?"{}":t,t=(Object(y.c)(t)&&JSON.parse(t)||{}).globalAdmin;return["naming"===e?void 0:v,{key:"serviceManagementVirtual",children:[{key:"serviceManagement",url:"/serviceManagement"},{key:"subscriberList",url:"/subscriberList"}]},t?_:void 0,{key:"namespace",url:"/namespace"},{key:"clusterManagementVirtual",children:[{key:"clusterManagement",url:"/clusterManagement"}]}].filter(function(e){return e})}var a=n(24),i=n.n(a),r=n(15),l=n(16),s=n(18),u=n(17),a=(n(25),n(7)),a=n.n(a),d=n(21),c=(n(78),n(50)),f=n.n(c),c=n(0),p=n.n(c),c=n(37),h=n(43),m=n(132),g=n(100),y=n(47),v={key:"configurationManagementVirtual",children:[{key:"configurationManagement",url:"/configurationManagement"},{key:"historyRollback",url:"/historyRollback"},{key:"listeningToQuery",url:"/listeningToQuery"}]},_={key:"authorityControl",children:[{key:"userList",url:"/userManagement"},{key:"roleManagement",url:"/rolesManagement"},{key:"privilegeManagement",url:"/permissionsManagement"}]},b=f.a.SubMenu,w=f.a.Item,c=(n=Object(h.b)(function(e){return Object(d.a)(Object(d.a)({},e.locale),e.base)},{getState:g.b}),h=a.a.config,Object(c.g)(a=n(a=h(((g=function(e){Object(s.a)(n,e);var t=Object(u.a)(n);function n(){return Object(r.a)(this,n),t.apply(this,arguments)}return Object(l.a)(n,[{key:"componentDidMount",value:function(){this.props.getState()}},{key:"goBack",value:function(){this.props.history.goBack()}},{key:"navTo",value:function(e){var t=this.props.location.search,t=new URLSearchParams(t);t.set("namespace",window.nownamespace),t.set("namespaceShowName",window.namespaceShowName),this.props.history.push([e,"?",t.toString()].join(""))}},{key:"isCurrentPath",value:function(e){return e===this.props.location.pathname?"current-path":void 0}},{key:"defaultOpenKeys",value:function(){for(var t=this,e=o(this.props.functionMode),n=0,a=e.length;nthis.state.pageSize&&k.a.createElement("div",{style:{marginTop:10,textAlign:"right"}},k.a.createElement(y.a,{current:this.state.pageNo,total:a,pageSize:this.state.pageSize,onChange:function(e){return t.setState({pageNo:e},function(){return t.querySubscriberList()})}}))))}}]),a}(k.a.Component)).displayName="SubscriberList",c=n))||c)||c;t.a=f},function(e,t,n){"use strict";n(51);var a=n(33),f=n.n(a),a=(n(63),n(46)),p=n.n(a),a=(n(172),n(72)),h=n.n(a),a=(n(40),n(11)),m=n.n(a),a=(n(32),n(19)),g=n.n(a),a=(n(34),n(14)),r=n.n(a),a=(n(49),n(26)),o=n.n(a),i=n(15),l=n(16),s=n(23),u=n(18),d=n(17),a=(n(25),n(7)),a=n.n(a),c=(n(400),n(113)),y=n.n(c),c=(n(62),n(20)),v=n.n(c),c=(n(65),n(38)),c=n.n(c),_=(n(42),n(9)),b=n.n(_),_=n(0),w=n.n(_),M=n(1),k=n(48),_=n(134),S=n.n(_),E=(n(737),b.a.Item),x=c.a.Row,C=c.a.Col,L=v.a.Column,T=y.a.Panel,c=(0,a.a.config)(((_=function(e){Object(u.a)(a,e);var t=Object(d.a)(a);function a(e){var n;return Object(i.a)(this,a),(n=t.call(this,e)).getQueryLater=function(){setTimeout(function(){return n.queryClusterStateList()})},n.setNowNameSpace=function(e,t){return n.setState({nowNamespaceName:e,nowNamespaceId:t})},n.rowColor=function(e){return{className:(e.voteFor,"")}},n.state={loading:!1,total:0,pageSize:10,currentPage:1,keyword:"",dataSource:[]},n.field=new o.a(Object(s.a)(n)),n}return Object(l.a)(a,[{key:"openLoading",value:function(){this.setState({loading:!0})}},{key:"closeLoading",value:function(){this.setState({loading:!1})}},{key:"openEditServiceDialog",value:function(){try{this.editServiceDialog.current.getInstance().show(this.state.service)}catch(e){}}},{key:"queryClusterStateList",value:function(){var n=this,e=this.state,t=e.currentPage,a=e.pageSize,r=e.keyword,e=e.withInstances,e=["withInstances=".concat(void 0!==e&&e),"pageNo=".concat(t),"pageSize=".concat(a),"keyword=".concat(r)];Object(M.b)({url:"v1/core/cluster/nodes?".concat(e.join("&")),beforeSend:function(){return n.openLoading()},success:function(){var e=0this.state.pageSize&&w.a.createElement("div",{style:{marginTop:10,textAlign:"right"}},w.a.createElement(p.a,{current:this.state.currentPage,total:this.state.total,pageSize:this.state.pageSize,onChange:function(e){return t.setState({currentPage:e},function(){return t.queryClusterStateList()})}}))))}}]),a}(w.a.Component)).displayName="ClusterNodeList",n=_))||n;t.a=c},function(e,t,F){"use strict";F.r(t),function(e){F(51);var t=F(33),a=F.n(t),t=(F(25),F(7)),r=F.n(t),o=F(15),i=F(16),l=F(18),s=F(17),n=F(21),t=F(0),u=F.n(t),t=F(22),t=F.n(t),d=F(115),c=F(408),f=F(420),p=F(43),h=F(37),m=F(98),g=(F(455),F(429)),y=F(29),v=F(430),_=F(423),b=F(431),w=F(432),M=F(424),k=F(433),S=F(434),E=F(435),x=F(436),C=F(437),L=F(421),T=F(425),D=F(422),O=F(438),N=F(439),P=F(426),j=F(427),I=F(428),R=F(418),Y=F(419),A=F(102),e=(F(740),e.hot,localStorage.getItem(y.f)||localStorage.setItem(y.f,"zh-CN"===navigator.language?"zh-CN":"en-US"),Object(d.b)(Object(n.a)(Object(n.a)({},Y.a),{},{routing:c.routerReducer}))),Y=Object(d.d)(e,Object(d.c)(Object(d.a)(f.a),window[y.i]?window[y.i]():function(e){return e})),H=[{path:"/",exact:!0,render:function(){return u.a.createElement(h.a,{to:"/welcome"})}},{path:"/welcome",component:R.a},{path:"/namespace",component:_.a},{path:"/newconfig",component:b.a},{path:"/configsync",component:w.a},{path:"/configdetail",component:M.a},{path:"/configeditor",component:k.a},{path:"/historyDetail",component:S.a},{path:"/configRollback",component:E.a},{path:"/historyRollback",component:x.a},{path:"/listeningToQuery",component:C.a},{path:"/configurationManagement",component:L.a},{path:"/serviceManagement",component:T.a},{path:"/serviceDetail",component:D.a},{path:"/subscriberList",component:O.a},{path:"/clusterManagement",component:N.a},{path:"/userManagement",component:P.a},{path:"/rolesManagement",component:I.a},{path:"/permissionsManagement",component:j.a}],e=Object(p.b)(function(e){return Object(n.a)({},e.locale)},{changeLanguage:A.a})(c=function(e){Object(l.a)(n,e);var t=Object(s.a)(n);function n(e){return Object(o.a)(this,n),(e=t.call(this,e)).state={shownotice:"none",noticecontent:"",nacosLoading:{}},e}return Object(i.a)(n,[{key:"componentDidMount",value:function(){var e=localStorage.getItem(y.f);this.props.changeLanguage(e)}},{key:"router",get:function(){return u.a.createElement(m.a,null,u.a.createElement(h.d,null,u.a.createElement(h.b,{path:"/login",component:v.a}),u.a.createElement(g.a,null,H.map(function(e){return u.a.createElement(h.b,Object.assign({key:e.path},e))}))))}},{key:"render",value:function(){var e=this.props.locale;return u.a.createElement(a.a,Object.assign({className:"nacos-loading",shape:"flower",tip:"loading...",visible:!1,fullScreen:!0},this.state.nacosLoading),u.a.createElement(r.a,{locale:e},this.router))}}]),n}(u.a.Component))||c;t.a.render(u.a.createElement(p.a,{store:Y},u.a.createElement(e,null)),document.getElementById("root"))}.call(this,F(441)(e))},function(e,t){e.exports=function(e){var t;return e.webpackPolyfill||((t=Object.create(e)).children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1),t}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(I,e,t){"use strict"; /** @license React v16.14.0 * react.production.min.js * @@ -302,7 +302,7 @@ var t;e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var w=t(0),y=t(183),r=t(448);function R(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n