提交 711a20e1 编写于 作者: N nzomkxia

api to get all services and apps

上级 ec736b96
......@@ -17,6 +17,7 @@
package org.apache.dubbo.admin.controller;
import com.ctrip.framework.apollo.core.enums.Env;
import com.google.gson.Gson;
import org.apache.dubbo.admin.common.util.ConvertUtil;
import org.apache.dubbo.admin.model.domain.Consumer;
......@@ -26,7 +27,6 @@ import org.apache.dubbo.admin.model.dto.ServiceDetailDTO;
import org.apache.dubbo.admin.service.ConsumerService;
import org.apache.dubbo.admin.service.ProviderService;
import org.apache.dubbo.admin.common.util.Constants;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,7 +38,7 @@ import java.util.regex.Pattern;
@RestController
@RequestMapping("/api/{env}/service")
@RequestMapping("/api/{env}")
public class ServiceController {
private final ProviderService providerService;
......@@ -50,7 +50,7 @@ public class ServiceController {
this.consumerService = consumerService;
}
@RequestMapping(method = RequestMethod.GET)
@RequestMapping( value = "/service", method = RequestMethod.GET)
public Set<ServiceDTO> searchService(@RequestParam String pattern,
@RequestParam String filter,@PathVariable String env) {
return providerService.getServiceDTOS(pattern, filter, env);
......@@ -58,7 +58,7 @@ public class ServiceController {
@RequestMapping(value = "/{service}", method = RequestMethod.GET)
@RequestMapping(value = "/service/{service}", method = RequestMethod.GET)
public ServiceDetailDTO serviceDetail(@PathVariable String service, @PathVariable String env) {
service = service.replace(Constants.ANY_VALUE, Constants.PATH_SEPARATOR);
List<Provider> providers = providerService.findByService(service);
......@@ -84,4 +84,14 @@ public class ServiceController {
}
return serviceDetailDTO;
}
@RequestMapping(value = "/services", method = RequestMethod.GET)
public Set<String> allServices(@PathVariable String env) {
return providerService.findServices();
}
@RequestMapping(value = "/applications", method = RequestMethod.GET)
public Set<String> allApplications(@PathVariable String env) {
return providerService.findApplications();
}
}
......@@ -312,18 +312,19 @@
pattern = 'service'
this.search(this.filter, pattern, true)
}
this.$axios.get('/service', {
params: {
pattern: 'service',
filter: '*'
}
}).then(response => {
let length = response.data.length
for (let i = 0; i < length; i++) {
vm.serviceItem.push(response.data[i].service)
vm.appItem.push(response.data[i].appName)
}
})
this.$axios.get('/services')
.then(response => {
if (response.status === 200) {
vm.serviceItem = response.data
}
})
this.$axios.get('/applications')
.then(response => {
if (response.status === 200) {
vm.appItem = response.data
}
})
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册