diff --git a/dubbo-admin-distribution/src/LICENSE b/dubbo-admin-distribution/src/LICENSE index 18c5d21be7789409209b945f60ed576eea7d50e6..46bfdf869916223ddf72ad97bf7fc16225eccfa9 100644 --- a/dubbo-admin-distribution/src/LICENSE +++ b/dubbo-admin-distribution/src/LICENSE @@ -276,6 +276,7 @@ The text of each license is the standard Apache 2.0 license. * Apache: dubbo 2.7.0 https://raw.githubusercontent.com/apache/incubator-dubbo/dubbo-2.7.0/LICENSE Apache 2.0 - dubbo-2.7.0.jar + - dubbo-serialization-kryo-2.7.0.jar * Google: gson 2.8.4 https://raw.githubusercontent.com/google/gson/gson-parent-2.8.4/LICENSE Apache 2.0 - gson-2.8.4.jar @@ -412,6 +413,7 @@ The text of each license is also included at licenses/LICENSE-[project]. * vuejs: vue-router 3.0.1 https://raw.githubusercontent.com/vuejs/vue-router/v3.0.1/LICENSE MIT * vuetifyjs: vuetify 1.2.2 https://raw.githubusercontent.com/vuetifyjs/vuetify/v1.2.2/LICENSE MIT * vuejs: vuex 3.0.1 https://raw.githubusercontent.com/vuejs/vuex/v3.0.1/LICENSE MIT + * lodash: lodash 4.17.11 https://raw.githubusercontent.com/lodash/lodash/4.17.11/LICENSE MIT ======================================================================== diff --git a/dubbo-admin-distribution/src/licenses/LICENSE-lodash b/dubbo-admin-distribution/src/licenses/LICENSE-lodash new file mode 100644 index 0000000000000000000000000000000000000000..8a5ea5e5ee540dadd1fbade800cef596ac209172 --- /dev/null +++ b/dubbo-admin-distribution/src/licenses/LICENSE-lodash @@ -0,0 +1,49 @@ +The MIT License + +Copyright JS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/dubbo-admin-server/pom.xml b/dubbo-admin-server/pom.xml index f7e11259fabb25a0fb29a512d0e47f6055f166c1..d968143ac12a1b3a7065c3fe303be3568ee4aefd 100644 --- a/dubbo-admin-server/pom.xml +++ b/dubbo-admin-server/pom.xml @@ -129,6 +129,11 @@ netty-all + + org.apache.dubbo + dubbo-serialization-kryo + + org.mockito mockito-core diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java index 0e0a0db238c31815b5cc51da35b01f1e1911af49..508e90e8a4cd32aff7472cddd2108980bf83e486 100644 --- a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java +++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/GenericServiceImpl.java @@ -23,7 +23,6 @@ import org.apache.dubbo.config.ReferenceConfig; import org.apache.dubbo.config.RegistryConfig; import org.apache.dubbo.registry.Registry; import org.apache.dubbo.rpc.service.GenericService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @@ -31,8 +30,11 @@ import javax.annotation.PostConstruct; @Component public class GenericServiceImpl { private ApplicationConfig applicationConfig; - @Autowired - private Registry registry; + private final Registry registry; + + public GenericServiceImpl(Registry registry) { + this.registry = registry; + } @PostConstruct public void init() { @@ -42,7 +44,6 @@ public class GenericServiceImpl { applicationConfig = new ApplicationConfig(); applicationConfig.setName("dubbo-admin"); applicationConfig.setRegistry(registryConfig); - } public Object invoke(String service, String method, String[] parameterTypes, Object[] params) { @@ -57,6 +58,7 @@ public class GenericServiceImpl { reference.setVersion(version); reference.setGroup(group); GenericService genericService = reference.get(); + return genericService.$invoke(method, parameterTypes, params); } } diff --git a/dubbo-admin-ui/package.json b/dubbo-admin-ui/package.json index 7604a584ace6eea50fc571687b43c060eb6c55fe..ed9a87b82b8706b7c55c51736b0bdd7e93e9abb0 100644 --- a/dubbo-admin-ui/package.json +++ b/dubbo-admin-ui/package.json @@ -16,6 +16,7 @@ "http-status": "^1.2.0", "js-yaml": "^3.12.0", "jsoneditor": "^5.26.2", + "lodash": "^4.17.11", "vue": "^2.5.2", "vue-clipboard2": "^0.2.1", "vue-i18n": "^8.6.0", diff --git a/dubbo-admin-ui/src/components/test/TestMethod.vue b/dubbo-admin-ui/src/components/test/TestMethod.vue index 32aa0e712f83b1c548fd1da7f20a8b31b12e12df..116d8071e698581c3171d58266d50573aa911a28 100644 --- a/dubbo-admin-ui/src/components/test/TestMethod.vue +++ b/dubbo-admin-ui/src/components/test/TestMethod.vue @@ -52,6 +52,8 @@ import JsonEditor from '@/components/public/JsonEditor' import Breadcrumb from '@/components/public/Breadcrumb' import axios from 'axios' + import set from 'lodash/set' + import util from '@/util' export default { name: 'TestMethod', @@ -110,11 +112,13 @@ }, convertType (params, types) { - for (let i = 0; i < params.length; i++) { - if (typeof types[i] === 'string' && typeof params[i] !== 'string') { - params[i] = String(params[i]) + const p = util.flattenObject(params) + const t = util.flattenObject(types) + Object.keys(p).forEach(key => { + if (typeof t[key] === 'string' && typeof p[key] !== 'string') { + set(params, key, String(p[key])) } - } + }) } }, mounted () { diff --git a/dubbo-admin-ui/src/util/index.js b/dubbo-admin-ui/src/util/index.js index 5cdd02be7dc4981feb5b447bc55ec273e36fce6c..03a9a3cb21a18695516cf37e9e38c37cc224a65b 100644 --- a/dubbo-admin-ui/src/util/index.js +++ b/dubbo-admin-ui/src/util/index.js @@ -36,8 +36,35 @@ const toggleFullScreen = () => { } } +// Flatten all nested keys of an object to one level with values, whose keys can be parameter of lodash.set +// e.g.: [{username: 'a', age: 3}, {username: 'b', age: 4}] => {'0.username': 'a', '0.age': 3, '1.username': 'b', '1.age': 4} +const flattenObject = obj => { + const toReturn = {} + + for (let i in obj) { + if (!obj.hasOwnProperty(i)) { + continue + } + + if ((typeof obj[i]) === 'object' && obj[i] !== null) { + const flatObject = flattenObject(obj[i]) + for (let x in flatObject) { + if (!flatObject.hasOwnProperty(x)) { + continue + } + + toReturn[i + '.' + x] = flatObject[x] + } + } else { + toReturn[i] = obj[i] + } + } + return toReturn +} + export default { randomElement, toggleFullScreen, - kebab + kebab, + flattenObject } diff --git a/pom.xml b/pom.xml index dfb727ce2d23b3165563b21cc43e0ee12ee5283f..e153dc7571fb1e38abd5f73f49e4e2bc686b4703 100644 --- a/pom.xml +++ b/pom.xml @@ -113,6 +113,12 @@ ${dubbo-version} + + org.apache.dubbo + dubbo-serialization-kryo + ${dubbo-version} + + org.apache.curator curator-framework