提交 d985458c 编写于 作者: L liangfei0201

DUBBO-489 修改页面

上级 a989a203
...@@ -18,4 +18,8 @@ public interface OwnerService { ...@@ -18,4 +18,8 @@ public interface OwnerService {
Owner findById(Long id); Owner findById(Long id);
void saveOwner(Owner owner);
void deleteOwner(Owner owner);
} }
package com.alibaba.dubbo.governance.service.impl; package com.alibaba.dubbo.governance.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.governance.service.ConsumerService; import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.OverrideService;
import com.alibaba.dubbo.governance.service.OwnerService; import com.alibaba.dubbo.governance.service.OwnerService;
import com.alibaba.dubbo.governance.service.ProviderService; import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.registry.common.domain.Consumer; import com.alibaba.dubbo.registry.common.domain.Override;
import com.alibaba.dubbo.registry.common.domain.Owner; import com.alibaba.dubbo.registry.common.domain.Owner;
import com.alibaba.dubbo.registry.common.domain.Provider; import com.alibaba.dubbo.registry.common.domain.Provider;
...@@ -18,7 +22,7 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService { ...@@ -18,7 +22,7 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService {
ProviderService providerService; ProviderService providerService;
@Autowired @Autowired
ConsumerService consumerService; OverrideService overrideService;
public List<String> findAllServiceNames() { public List<String> findAllServiceNames() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -37,17 +41,13 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService { ...@@ -37,17 +41,13 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService {
public List<Owner> findByService(String serviceName) { public List<Owner> findByService(String serviceName) {
List<Provider> pList = providerService.findByService(serviceName); List<Provider> pList = providerService.findByService(serviceName);
List<Override> cList = overrideService.findByServiceAndAddress(serviceName, Constants.ANYHOST_VALUE);
List<Consumer> cList = consumerService.findByService(serviceName);
return toOverrideLiset(pList,cList); return toOverrideLiset(pList,cList);
} }
public List<Owner> findAll() { public List<Owner> findAll() {
List<Provider> pList = providerService.findAll(); List<Provider> pList = providerService.findAll();
List<Override> cList = overrideService.findAll();
List<Consumer> cList = consumerService.findAll();
return toOverrideLiset(pList,cList); return toOverrideLiset(pList,cList);
} }
...@@ -56,26 +56,85 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService { ...@@ -56,26 +56,85 @@ public class OwnerServiceImpl extends AbstractService implements OwnerService {
return null; return null;
} }
private List<Owner> toOverrideLiset(List<Provider> pList , List<Consumer> cList){ private List<Owner> toOverrideLiset(List<Provider> pList, List<Override> cList){
List<Owner> oList = new ArrayList<Owner>(); Map<String, Owner> oList = new HashMap<String, Owner>();
for(Provider p : pList){ for(Provider p : pList){
if(p.getUsername() != null){ if(p.getUsername() != null){
Owner o = new Owner(); Owner o = new Owner();
o.setService(p.getService()); o.setService(p.getService());
o.setUsername(p.getUsername()); o.setUsername(p.getUsername());
oList.add(o); oList.put(o.getService() + "/" + o.getUsername(), o);
} }
} }
for(Override c : cList){
for(Consumer c : cList){ Map<String, String> params = StringUtils.parseQueryString(c.getParams());
if(c.getUsername() != null){ String usernames = params.get("owner");
Owner o = new Owner(); if(usernames != null && usernames.length() > 0){
o.setService(c.getService()); for (String username : Constants.COMMA_SPLIT_PATTERN.split(usernames)) {
o.setUsername(c.getUsername()); Owner o = new Owner();
oList.add(o); o.setService(c.getService());
o.setUsername(username);
oList.put(o.getService() + "/" + o.getUsername(), o);
}
} }
} }
return oList; return new ArrayList<Owner>(oList.values());
} }
public void saveOwner(Owner owner) {
List<Override> overrides = overrideService.findByServiceAndAddress(owner.getService(), Constants.ANYHOST_VALUE);
if (overrides == null || overrides.size() == 0) {
Override override = new Override();
override.setAddress(Constants.ANYHOST_VALUE);
override.setService(owner.getService());
override.setEnabled(true);
override.setParams("owner=" + owner.getUsername());
overrideService.saveOverride(override);
} else {
for(Override override : overrides){
Map<String, String> params = StringUtils.parseQueryString(override.getParams());
String usernames = params.get("owner");
if (usernames == null || usernames.length() == 0) {
usernames = owner.getUsername();
} else {
usernames = usernames + "," + owner.getUsername();
}
params.put("owner", usernames);
override.setParams(StringUtils.toQueryString(params));
overrideService.updateOverride(override);
}
}
}
public void deleteOwner(Owner owner) {
List<Override> overrides = overrideService.findByServiceAndAddress(owner.getService(), Constants.ANYHOST_VALUE);
if (overrides == null || overrides.size() == 0) {
Override override = new Override();
override.setAddress(Constants.ANYHOST_VALUE);
override.setService(owner.getService());
override.setEnabled(true);
override.setParams("owner=" + owner.getUsername());
overrideService.saveOverride(override);
} else {
for(Override override : overrides){
Map<String, String> params = StringUtils.parseQueryString(override.getParams());
String usernames = params.get("owner");
if (usernames != null && usernames.length() > 0) {
if (usernames.equals(owner.getUsername())) {
params.remove("owner");
} else {
usernames = usernames.replace(owner.getUsername() + ",", "").replace("," + owner.getUsername(), "");
params.put("owner", usernames);
}
if (params.size() > 0) {
override.setParams(StringUtils.toQueryString(params));
overrideService.updateOverride(override);
} else {
overrideService.deleteOverride(override.getId());
}
}
}
}
}
} }
...@@ -82,7 +82,7 @@ public class Tool { ...@@ -82,7 +82,7 @@ public class Tool {
public static String getHostPrefix(String address) { public static String getHostPrefix(String address) {
if (address != null && address.length() > 0) { if (address != null && address.length() > 0) {
String hostname = getHostName(address); String hostname = getHostName(address);
if (! address.equals(hostname)) { if (! address.startsWith(hostname)) {
return "(" + hostname + ")"; return "(" + hostname + ")";
} }
} }
......
...@@ -7,14 +7,17 @@ ...@@ -7,14 +7,17 @@
*/ */
package com.alibaba.dubbo.governance.web.governance.module.screen; package com.alibaba.dubbo.governance.web.governance.module.screen;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.governance.service.OwnerService; import com.alibaba.dubbo.governance.service.OwnerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful; import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Owner; import com.alibaba.dubbo.registry.common.domain.Owner;
import com.alibaba.dubbo.registry.common.util.Tool;
/** /**
* Providers. URI: /services/$service/owners * Providers. URI: /services/$service/owners
...@@ -25,6 +28,9 @@ public class Owners extends Restful { ...@@ -25,6 +28,9 @@ public class Owners extends Restful {
@Autowired @Autowired
private OwnerService ownerService; private OwnerService ownerService;
@Autowired
private ProviderService providerService;
public void index(Map<String, Object> context) { public void index(Map<String, Object> context) {
String service = (String) context.get("service"); String service = (String) context.get("service");
...@@ -38,10 +44,46 @@ public class Owners extends Restful { ...@@ -38,10 +44,46 @@ public class Owners extends Restful {
} }
public void add(Map<String, Object> context) { public void add(Map<String, Object> context) {
String service = (String) context.get("service");
if (service == null || service.length() == 0) {
List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
context.put("serviceList", serviceList);
}
} }
public void create(Owner owner, Map<String, Object> context) { public boolean create(Owner owner, Map<String, Object> context) {
owner.getUsername(); String service = owner.getService();
String username = owner.getUsername();
if (service == null || service.length() == 0
|| username == null || username.length() == 0){
context.put("message", getMessage("NoSuchOperationData"));
return false;
}
if (! super.currentUser.hasServicePrivilege(service)) {
context.put("message", getMessage("HaveNoServicePrivilege", service));
return false;
}
ownerService.saveOwner(owner);
return true;
}
public boolean delete(Long[] ids, Map<String, Object> context) {
String service = (String) context.get("service");
String username = (String) context.get("username");
Owner owner = new Owner();
owner.setService(service);
owner.setUsername(username);
if (service == null || service.length() == 0
|| username == null || username.length() == 0){
context.put("message", getMessage("NoSuchOperationData"));
return false;
}
if (! super.currentUser.hasServicePrivilege(service)) {
context.put("message", getMessage("HaveNoServicePrivilege", service));
return false;
}
ownerService.deleteOwner(owner);
return true;
} }
} }
...@@ -186,7 +186,7 @@ public class User extends Entity { ...@@ -186,7 +186,7 @@ public class User extends Entity {
public boolean hasServicePrivilege(String service) { public boolean hasServicePrivilege(String service) {
if (service == null || service.length() == 0) if (service == null || service.length() == 0)
throw new IllegalArgumentException("service == null"); return false;
if (role == null || GUEST.equalsIgnoreCase(role)) { if (role == null || GUEST.equalsIgnoreCase(role)) {
return false; return false;
} }
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
#set($tabs = ["services", "addresses", "overrides"]) #set($tabs = ["services", "addresses", "overrides"])
#else #else
#if($_type != "services" && $_type != "applications" && $_type != "addresses") #if($_type != "services" && $_type != "applications" && $_type != "addresses")
#set($tabs = ["accesses", "weights", "loadbalances", "routes", "owners", "overrides"]) #set($tabs = ["routes", "overrides", "accesses", "weights", "loadbalances", "owners"])
#end #end
#end #end
#if($tabs.size() > 0) #if($tabs.size() > 0)
......
...@@ -6,22 +6,21 @@ ...@@ -6,22 +6,21 @@
<table cellpadding="0" cellspacing="0" class="info"> <table cellpadding="0" cellspacing="0" class="info">
<tr> <tr>
<th width="100">$i18n.get("service")&nbsp;&nbsp;<font color='red'>*</font></th> <th width="100">$i18n.get("service")&nbsp;&nbsp;<font color='red'>*</font></th>
<td width="300"> <td>
#if($service) #if($service)
<input type="hidden" id="serviceName" name="service" value="$service" />$service <input type="hidden" id="serviceName" name="service" value="$service" />$service
#else #else
<textarea id="serviceName" name="service" style="ime-mode:disabled" rows="8" cols="40"></textarea> <textarea id="serviceName" name="service" style="ime-mode:disabled" rows="2" cols="40"></textarea>
#if ($serviceList && $serviceList.size() > 0) #if ($serviceList && $serviceList.size() > 0)
<select id="selectService" name="selectService" onchange="fnSetService(this)"> <select id="selectService" name="selectService" onchange="fnSetService(this)">
<option value="">$i18n.get("Choose")</option> <option value="">$i18n.get("Choose")</option>
#foreach ($s in $serviceList) #foreach ($s in $serviceList)
<option value="$s">$s</option> <option value="$s">$tool.getSimpleName($s)</option>
#end #end
</select> </select>
#end #end
#end #end
</td> </td>
<td></td>
</tr> </tr>
<tr> <tr>
<th style="width: 100px;">$i18n.get("ConsumerAddress"):&nbsp;&nbsp;<font color='red'>*</font></th> <th style="width: 100px;">$i18n.get("ConsumerAddress"):&nbsp;&nbsp;<font color='red'>*</font></th>
...@@ -29,10 +28,10 @@ ...@@ -29,10 +28,10 @@
#if($address) #if($address)
<input type="hidden" id="address" name="address" value="$tool.getIP($address)" />$tool.getIP($address) <input type="hidden" id="address" name="address" value="$tool.getIP($address)" />$tool.getIP($address)
#else #else
<textarea id="consumerAddress" name="consumerAddress" rows="10" cols="40"></textarea> <textarea id="consumerAddress" name="consumerAddress" rows="2" cols="40"></textarea>
#end #end
<font color="blue">$i18n.get("BatchAddressTip")</font>
</td> </td>
<td><font color="blue">$i18n.get("BatchAddressTip")</font></td>
</tr> </tr>
<tr> <tr>
<th>$i18n.get("status"):</th> <th>$i18n.get("status"):</th>
...@@ -41,13 +40,12 @@ ...@@ -41,13 +40,12 @@
<option value="false" selected="selected">$i18n.get("Forbidden")</option> <option value="false" selected="selected">$i18n.get("Forbidden")</option>
<option value="true">$i18n.get("Allowed")</option> <option value="true">$i18n.get("Allowed")</option>
</select> </select>
<font color="blue">$i18n.get("AccessControlTip")</font>
</td> </td>
<td><font color="blue">$i18n.get("AccessControlTip")</font></td>
</tr> </tr>
<tr> <tr>
<th><div class="btn"><a href="#" onclick="if(check()){document.getElementById('accessesForm').submit();}">$i18n.get("save")</a></div></th> <th><div class="btn"><a href="#" onclick="if(check()){document.getElementById('accessesForm').submit();}">$i18n.get("save")</a></div></th>
<td></td> <td></td>
<td></td>
</tr> </tr>
</table> </table>
</form> </form>
......
...@@ -71,8 +71,9 @@ ...@@ -71,8 +71,9 @@
<font color="red">$i18n.get("NoProvider")</font> <font color="red">$i18n.get("NoProvider")</font>
#end #end
</td> </td>
#if($currentUser.hasServicePrivilege($consumer.service)) #if($currentUser.role != "G")
<td> <td>
#if($currentUser.hasServicePrivilege($consumer.service))
<a href="consumers/$consumer.id/edit"><img src="$rootContextPath.getURI("images/ico_edit.png")" width="12" height="12" /><span class="ico_font">$i18n.get("edit")</span></a> <a href="consumers/$consumer.id/edit"><img src="$rootContextPath.getURI("images/ico_edit.png")" width="12" height="12" /><span class="ico_font">$i18n.get("edit")</span></a>
<span class="ico_line">|</span> <span class="ico_line">|</span>
#if($tool.isInBlackList($consumer)) #if($tool.isInBlackList($consumer))
...@@ -94,6 +95,7 @@ ...@@ -94,6 +95,7 @@
<span class="ico_line">|</span> <span class="ico_line">|</span>
<a href="#" onclick="showConfirm('$i18n.get("confirm.fail.mock")', '$consumer.address -&gt; $tool.getSimpleName($consumer.service)', 'consumers/$consumer.id/tolerant'); return false;"><img src="$rootContextPath.getURI("images/ico_run.png")" width="12" height="12" /><span class="ico_font">$i18n.get("fail.mock")</span></a> <a href="#" onclick="showConfirm('$i18n.get("confirm.fail.mock")', '$consumer.address -&gt; $tool.getSimpleName($consumer.service)', 'consumers/$consumer.id/tolerant'); return false;"><img src="$rootContextPath.getURI("images/ico_run.png")" width="12" height="12" /><span class="ico_font">$i18n.get("fail.mock")</span></a>
#end #end
#end
</td> </td>
#end #end
</tr> </tr>
......
<div class="ico_btn"> <div class="ico_btn">
<a href="#if($id)../#end../providers"><img src="$rootContextPath.getURI("images/ico_back.png")" width="12" height="12" /><span class="ico_font">$i18n.get("back")</span></a> <a href="../owners"><img src="$rootContextPath.getURI("images/ico_back.png")" width="12" height="12" /><span class="ico_font">$i18n.get("back")</span></a>
</div> </div>
<br/> <br/>
<form id="providerForm" action="#if($id)../#end../providers" method="POST"> <form id="df" action="../owners" method="POST">
<table cellpadding="0" cellspacing="0" class="info"> <table cellpadding="0" cellspacing="0" class="info">
#if(! $service)
#if($provider.service)
<input type="hidden" id="service" name="service" value="$!provider.service" />
#else
<tr>
<th style="width: 100px;">$i18n.get("service"):</th>
<td style="width: 300px;"><input id="service" type="text" name="service" class="setting_input" style="width: 200px;" />
<select onchange="fnSetService(this)">
<option value="">$i18n.get("Choose")</option>
#foreach($s in $serviceList)
<option value="$s">$s</option>
#end
</select>
</td>
</tr>
#end
#end
<tr> <tr>
<th style="width: 100px;">$i18n.get("url"):</th> <th style="width: 150px;">$i18n.get("service")&nbsp;&nbsp;<font color='red'>*</font></th>
<td><input type="text" id="url" name="url" value="#if($provider.url)$!provider.url?$!provider.parameters#{else}dubbo://#if($address)$address#{else}0.0.0.0:20880#end/#if($service)$service#{else}com.xxx.XxxService#end?application=#if($application)$application#{else}xxx#end&version=1.0.0#end" class="setting_input" style="width: 700px;" maxlength="2000"/></td>
</tr>
<tr>
<th>$i18n.get("type"):</th>
<td><font color="blue">$i18n.get("static")</font></td>
</tr>
<tr>
<th>$i18n.get("status"): </th>
<td> <td>
<select name="enabled"> #if($service)
<option value="true">$i18n.get("enable")</option> <input type="hidden" id="serviceName" name="service" value="$service" />$service
<option value="false" selected="selected">$i18n.get("disable")</option> #else
</select> <input id="serviceName" name="service" rows="5" cols="40" maxlength="200">
#if ($serviceList && $serviceList.size() > 0)
<select id="selectService" name="selectService" onchange="fnSetService(this)">
<option value="">$i18n.get("Choose")</option>
#foreach ($s in $serviceList)
<option value="$s">$tool.getSimpleName($s)</option>
#end
</select>
#end
#end
</td> </td>
</tr> </tr>
<tr> <tr>
<th><div class="btn"><a href="#" onclick="if(check()){document.getElementById('providerForm').submit();}">$i18n.get("save")</a></div></th> <th style="width: 150px;">$i18n.get("Username")&nbsp;&nbsp;<font color='red'>*</font></th>
<td><input type="text" id="username" name="username" style="ime-mode:disabled" value="$operator" maxlength="100"/></td>
</tr>
<tr>
<th><div class="btn"><a href="#" onclick="if(check()){document.getElementById('df').submit();}">$i18n.get("save")</a></div></th>
<td></td>
</tr> </tr>
</table> </table>
</form> </form>
<script language="javascript">
function check(){
<script type="text/javascript"> var username = byId('username').value.trim();
//通过服务名后面的选择框,快速设置service_name的值 if(username == ''){
function fnSetService(obj){ showAlert("$i18n.get("PleaseInput")$i18n.get("Username")", 'username');
if(obj.value != ''){
var old = document.getElementById('service').value;
if (old == '') {
old = "com.xxx.XxxService";
}
byId('url').value = byId('url').value.replace(old, obj.value);
document.getElementById('service').value = obj.value;
}
}
function check(){
#if(! $service)
var service = byId('service').value.trim();
if(service == '') {
showAlert("$i18n.get("PleaseInput")$i18n.get("service")", 'service');
return false;
}
#end
var url = byId('url').value.trim();
if(url == '' || url.indexOf('0.0.0.0') > 0 || url.indexOf('com.xxx.XxxService') > 0 || url.indexOf('application=xxx') > 0){
showAlert("$i18n.get("PleaseInput")$i18n.get("url")", 'url');
return false; return false;
} }
return true; return true;
} }
function fnSetService(obj){
if(obj.value!=''){
byId('serviceName').value = obj.value;
}
}
</script> </script>
\ No newline at end of file
<div class="ico_btn">
#if($currentUser.role != "G")
<a href="owners/add"><img src="$rootContextPath.getURI("images/ico_add.png")" width="12" height="12" /><span class="ico_font">$i18n.get("add")</span></a>
#end
</div>
<br/> <br/>
<table cellpadding="0" cellspacing="0" class="list list_dubbo" id="table_o"> <table cellpadding="0" cellspacing="0" class="list list_dubbo" id="table_o">
<tr> <tr>
...@@ -5,6 +10,7 @@ ...@@ -5,6 +10,7 @@
#if(! $service) #if(! $service)
<th>$i18n.get("service"): <input type="text" onkeyup="searchTable('table_o', 2, this.value);" onclick="searchTable('table_o', 2, this.value);" />&nbsp;<img src="$rootContextPath.getURI("images/ico_search.png")" width="12" height="12" /></th> <th>$i18n.get("service"): <input type="text" onkeyup="searchTable('table_o', 2, this.value);" onclick="searchTable('table_o', 2, this.value);" />&nbsp;<img src="$rootContextPath.getURI("images/ico_search.png")" width="12" height="12" /></th>
#end #end
#if($currentUser.role != "G")<th>$i18n.get("operation")</th>#end
</tr> </tr>
#foreach($owner in $owners) #foreach($owner in $owners)
<tr> <tr>
...@@ -12,6 +18,13 @@ ...@@ -12,6 +18,13 @@
#if(! $service) #if(! $service)
<td><a href="services/$owner.service/owners">$owner.service</a></td> <td><a href="services/$owner.service/owners">$owner.service</a></td>
#end #end
#if($currentUser.role != "G")
<td>
#if($currentUser.hasServicePrivilege($owner.service))
<a href="#" onclick="showConfirm('$i18n.get("confirm.delete")', '$owner.username', 'owners/0/delete?username=$owner.username#if(! $service)&service=$owner.service#end'); return false;"><img src="$rootContextPath.getURI("images/ico_delete.png")" width="12" height="12" /><span class="ico_font">$i18n.get("delete")</span></a>
#end
</td>
#end
</tr> </tr>
#end #end
</table> </table>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<select onchange="fnSetService(this)"> <select onchange="fnSetService(this)">
<option value="">$i18n.get("Choose")</option> <option value="">$i18n.get("Choose")</option>
#foreach($s in $serviceList) #foreach($s in $serviceList)
<option value="$s">$s</option> <option value="$s">$tool.getSimpleName($s)</option>
#end #end
</select> </select>
</td> </td>
......
...@@ -64,8 +64,9 @@ ...@@ -64,8 +64,9 @@
<font color="green">$i18n.get("ok")</font> <font color="green">$i18n.get("ok")</font>
#end #end
</td> </td>
#if($currentUser.hasServicePrivilege($provider.service)) #if($currentUser.role != "G")
<td> <td>
#if($currentUser.hasServicePrivilege($provider.service))
<a href="providers/$provider.id/edit"><img src="$rootContextPath.getURI("images/ico_edit.png")" width="12" height="12" /><span class="ico_font">$i18n.get("edit")</span></a> <a href="providers/$provider.id/edit"><img src="$rootContextPath.getURI("images/ico_edit.png")" width="12" height="12" /><span class="ico_font">$i18n.get("edit")</span></a>
<span class="ico_line">|</span> <span class="ico_line">|</span>
<a href="providers/$provider.id/add"><img src="$rootContextPath.getURI("images/ico_add.png")" width="12" height="12" /><span class="ico_font">$i18n.get("copy")</span></a> <a href="providers/$provider.id/add"><img src="$rootContextPath.getURI("images/ico_add.png")" width="12" height="12" /><span class="ico_font">$i18n.get("copy")</span></a>
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
<span class="ico_line">|</span> <span class="ico_line">|</span>
<a href="#" onclick="showConfirm('$i18n.get("confirm.delete")', '$provider.url', 'providers/$provider.id/delete'); return false;"><img src="$rootContextPath.getURI("images/ico_delete.png")" width="12" height="12" /><span class="ico_font">$i18n.get("delete")</span></a> <a href="#" onclick="showConfirm('$i18n.get("confirm.delete")', '$provider.url', 'providers/$provider.id/delete'); return false;"><img src="$rootContextPath.getURI("images/ico_delete.png")" width="12" height="12" /><span class="ico_font">$i18n.get("delete")</span></a>
#end #end
#end
</td> </td>
#end #end
</tr> </tr>
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#if($service) #if($service)
<input type="hidden" id="multiservice" name="service" value="$service" />$service <input type="hidden" id="multiservice" name="service" value="$service" />$service
#else #else
<textarea id="service" name="multiservice" style="ime-mode:disabled" rows="10" cols="40"></textarea> <textarea id="service" name="multiservice" style="ime-mode:disabled" rows="2" cols="40"></textarea>
#if ($serviceList && $serviceList.size() > 0) #if ($serviceList && $serviceList.size() > 0)
<select id="selectService" name="selectService" onchange="fnSetService(this)"> <select id="selectService" name="selectService" onchange="fnSetService(this)">
<option value="">$i18n.get("Choose")</option> <option value="">$i18n.get("Choose")</option>
#foreach ($s in $serviceList) #foreach ($s in $serviceList)
<option value="$s">$s</option> <option value="$s">$tool.getSimpleName($s)</option>
#end #end
</select> </select>
#end #end
...@@ -28,15 +28,16 @@ ...@@ -28,15 +28,16 @@
#if($address) #if($address)
<input type="hidden" id="address" name="address" value="$tool.getIP($address)" />$tool.getIP($address) <input type="hidden" id="address" name="address" value="$tool.getIP($address)" />$tool.getIP($address)
#else #else
<textarea id="address" name="address" rows="10" cols="30"></textarea><font color="blue">$i18n.get("BatchAddressTip")</font> <textarea id="address" name="address" rows="2" cols="40"></textarea>
#if ($addressList && $addressList.size() > 0) #if ($addressList && $addressList.size() > 0)
<select id="selectAddeess" name="selectAddeess" onchange="fnSetService(this,'address')"> <select id="selectAddeess" name="selectAddeess" onchange="fnSetAddress(this)">
<option value="">$i18n.get("Choose")</option> <option value="">$i18n.get("Choose")</option>
#foreach ($s in $addressList) #foreach ($s in $addressList)
<option value="$s">$tool.getHostPrefix($s)$s</option> <option value="$s">$tool.getHostPrefix($s)$s</option>
#end #end
</select> </select>
#end #end
<font color="blue">$i18n.get("BatchAddressTip")</font>
#end #end
</td> </td>
</tr> </tr>
...@@ -64,6 +65,12 @@ function fnSetService(obj){ ...@@ -64,6 +65,12 @@ function fnSetService(obj){
} }
} }
function fnSetAddress(obj){
if(obj.value!=''){
byId('address').value = (byId('address').value.length > 0 ? byId('address').value + "\n" : "" ) + obj.value;
}
}
function checkService(service) { function checkService(service) {
//if(service.indexOf(',') != -1) return false; //if(service.indexOf(',') != -1) return false;
......
...@@ -54,12 +54,12 @@ ...@@ -54,12 +54,12 @@
<li id="unique_tab1" ><a href="$rootContextPath.getURI("/")">$i18n.get("home")</a></li> <li id="unique_tab1" ><a href="$rootContextPath.getURI("/")">$i18n.get("home")</a></li>
<li id="unique_tab2" class="sub_nav"><a href="#" onclick="return false;" style="cursor:default;">$i18n.get("governance")</a> <li id="unique_tab2" class="sub_nav"><a href="#" onclick="return false;" style="cursor:default;">$i18n.get("governance")</a>
<ul> <ul>
#if($tool.checkUrl($currentUser,"/governance/routes"))<li><a href="$rootContextPath.getURI("/governance/routes")">$i18n.get("routes")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/overrides"))<li><a href="$rootContextPath.getURI("/governance/overrides")">$i18n.get("overrides")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/accesses"))<li><a href="$rootContextPath.getURI("/governance/accesses")">$i18n.get("accesses")</a></li>#end #if($tool.checkUrl($currentUser,"/governance/accesses"))<li><a href="$rootContextPath.getURI("/governance/accesses")">$i18n.get("accesses")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/weights"))<li><a href="$rootContextPath.getURI("/governance/weights")">$i18n.get("weights")</a></li>#end #if($tool.checkUrl($currentUser,"/governance/weights"))<li><a href="$rootContextPath.getURI("/governance/weights")">$i18n.get("weights")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/loadbalances"))<li><a href="$rootContextPath.getURI("/governance/loadbalances")">$i18n.get("loadbalances")</a></li>#end #if($tool.checkUrl($currentUser,"/governance/loadbalances"))<li><a href="$rootContextPath.getURI("/governance/loadbalances")">$i18n.get("loadbalances")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/routes"))<li><a href="$rootContextPath.getURI("/governance/routes")">$i18n.get("routes")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/owners"))<li><a href="$rootContextPath.getURI("/governance/owners")">$i18n.get("owners")</a></li>#end #if($tool.checkUrl($currentUser,"/governance/owners"))<li><a href="$rootContextPath.getURI("/governance/owners")">$i18n.get("owners")</a></li>#end
#if($tool.checkUrl($currentUser,"/governance/overrides"))<li><a href="$rootContextPath.getURI("/governance/overrides")">$i18n.get("overrides")</a></li>#end
</ul> </ul>
</li> </li>
<li id="unique_tab3" class="sub_nav"><a href="#" onclick="return false;" style="cursor:default;">$i18n.get("system.management")</a> <li id="unique_tab3" class="sub_nav"><a href="#" onclick="return false;" style="cursor:default;">$i18n.get("system.management")</a>
......
...@@ -124,11 +124,11 @@ $control.setTemplate("home:menu.vm") ...@@ -124,11 +124,11 @@ $control.setTemplate("home:menu.vm")
<td style="padding-left: 10px;"> <td style="padding-left: 10px;">
<a href="$rootContextPath.getURI("governance/providers/add")">$i18n.get("providers")</a>&nbsp; <a href="$rootContextPath.getURI("governance/providers/add")">$i18n.get("providers")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/routes/add")">$i18n.get("routes")</a>&nbsp; <a href="$rootContextPath.getURI("governance/routes/add")">$i18n.get("routes")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/overrides/add")">$i18n.get("overrides")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/accesses/add")">$i18n.get("accesses")</a>&nbsp; <a href="$rootContextPath.getURI("governance/accesses/add")">$i18n.get("accesses")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/weights/add")">$i18n.get("weights")</a>&nbsp; <a href="$rootContextPath.getURI("governance/weights/add")">$i18n.get("weights")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/loadbalances/add")">$i18n.get("loadbalances")</a>&nbsp; <a href="$rootContextPath.getURI("governance/loadbalances/add")">$i18n.get("loadbalances")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/owners/add")">$i18n.get("owners")</a>&nbsp; <a href="$rootContextPath.getURI("governance/owners/add")">$i18n.get("owners")</a>&nbsp;
<a href="$rootContextPath.getURI("governance/overrides/add")">$i18n.get("overrides")</a>&nbsp;
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -164,7 +164,7 @@ $control.setTemplate("home:menu.vm") ...@@ -164,7 +164,7 @@ $control.setTemplate("home:menu.vm")
|| keyword == '$i18n.get("please.input.address")') { || keyword == '$i18n.get("please.input.address")') {
keyword = '*'; keyword = '*';
} }
window.location.href = 'governance/' + searchType + '?keyword=' + keyword; window.location.href = '$rootContextPath.getURI("governance")/' + searchType + '?keyword=' + keyword;
} }
function setTab2(name, cursel, n) { function setTab2(name, cursel, n) {
var obj = document.getElementById('searchContent'); var obj = document.getElementById('searchContent');
......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
<script type="text/javascript">
window.location.href='index/'
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册