Commit a6ed56a3 a6ed56a3882d051c6949c2bb05c84513d37d1467 by root
2 parents 15305f31 f931954b
Showing 55 changed files with 622 additions and 144 deletions
......@@ -150,6 +150,13 @@
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
......
6e748c16d9079ce336611a59b511a693
\ No newline at end of file
60f8b8f393c8e7473c414f67fd4c0b33006d0ea1
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.0</version>
</project>
d01ad073eb3c61bddaf90f21f8fb5e75
\ No newline at end of file
c66ba2702c2a8a69db61929a82cdf400183083df
\ No newline at end of file
ecba97cfde9cdb328b90997bc3506f82
\ No newline at end of file
aa443ffb1efe591c851713884f0c5e66cf09dc01
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.1</version>
</project>
349be90bd54764dcaff9132517c4394c
\ No newline at end of file
9781a7bcd3d9bea91d36c86db1e69f82f5565ec5
\ No newline at end of file
8f34d0021feb122ba45a98947498e41e
\ No newline at end of file
4e7c2284eee3ca7a23acb7af05b1e93fac8202d7
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.2</version>
</project>
00d5b514394541b928d99955c6abd262
\ No newline at end of file
06fac3ddaa808258e618750132127adf72225f91
\ No newline at end of file
e4581e795b0be4fe7d996dc4e4706b74
\ No newline at end of file
7b2d2f13d18e612abc690d13e7274bdb1d4468f9
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.3</version>
</project>
5d77f14f1fb8d29b1d39da5eb0a87ace
\ No newline at end of file
b7f6771336e7598032f3341463d4f1c8cc508946
\ No newline at end of file
2c45f14dab6c4d905d4fceb1484b1956
\ No newline at end of file
e644cf48f61d417c71f53dc3990c5c8086b80d42
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.4</version>
</project>
4651b3978331f8c656d429c9aa6a89d8
\ No newline at end of file
7751ffe63a1e1d7d9a7997111d449f2ff697b3fb
\ No newline at end of file
3b8ca22c5c933274bbeb897ee5e02306
\ No newline at end of file
ff438544989c58e28f02ee3b5b3ee2be81563321
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.5</version>
</project>
6b33a2fc800d3fc8a28a9565ba974db6
\ No newline at end of file
157f839ee31faa1ea298cfbeddc3c9957285bc01
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<versioning>
<release>1.5</release>
<versions>
<version>1.0</version>
<version>1.1</version>
<version>1.2</version>
<version>1.3</version>
<version>1.4</version>
<version>1.5</version>
</versions>
<lastUpdated>20150716092042</lastUpdated>
</versioning>
</metadata>
3310adccea01105b5f5ef7361679cf7d
\ No newline at end of file
375d779bcb432886a15cc7e0f4441f09ac7e8be4
\ No newline at end of file
package org.emercit.app;
package org.emercit.devtools.app;
import java.util.Locale;
......@@ -28,10 +28,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.Vector;
import org.emercit.service.DevInfoService;
import org.emercit.devinfo.model.DevInfoBean;
import org.emercit.devtools.service.DevInfoService;
......
package org.emercit.app;
package org.emercit.devtools.app;
import java.util.Locale;
......@@ -23,12 +23,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.Vector;
import org.emercit.ethmanager.model.EthBean;
import org.emercit.devtools.service.DnsService;
import org.emercit.devtools.service.EthService;
import org.emercit.dnsmanager.model.DnsBean;
import org.emercit.service.EthService;
import org.emercit.service.DnsService;
import java.util.ArrayList;
import java.util.List;
......
package org.emercit.app;
package org.emercit.devtools.app;
import java.util.Locale;
......@@ -30,11 +30,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.Vector;
import org.emercit.ethmanager.model.EthBean;
import org.emercit.devtools.service.DnsService;
import org.emercit.devtools.service.EthService;
import org.emercit.dnsmanager.model.DnsBean;
import org.emercit.service.EthService;
import org.emercit.service.DnsService;
@Controller
......
package org.emercit.devtools.app;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.*;
import javax.servlet.ServletContext;
import java.io.*;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Vector;
import org.emercit.proxymanager.model.ProxyBean;
import org.emercit.devtools.service.DnsService;
import org.emercit.devtools.service.ProxyService;
import org.emercit.dnsmanager.model.DnsBean;
@Controller
@RequestMapping("api")
public class ProxyController {
@RequestMapping(value = "proxy/all", method = RequestMethod.GET)
public @ResponseBody Vector<ProxyBean> getAllProxy() {
try {
return ProxyService.INSTANCE.getAllProxyBean();
}
catch(Exception e)
{
return null;
}
}
@RequestMapping(value="proxy/update" , method = RequestMethod.POST)
public @ResponseBody boolean update(@RequestBody ProxyBean[] beans) {
Vector<ProxyBean> dbs=new Vector<ProxyBean>();
for (ProxyBean d:beans) {
ProxyBean db=new ProxyBean();
db.setId(d.getId());
db.setProtocol(d.getProtocol());
db.setHost(d.getHost());
db.setPort(d.getPort());
db.setLogin(d.getLogin());
db.setPass(d.getPass());
db.setEnabled(d.getEnabled());
db.setAuth(d.getAuth());
dbs.add(db);
}
return ProxyService.INSTANCE.Upd(dbs);
}
/*
export http_proxy='http://user:password@prox-server:3128'
export https_proxy='http://user:password@prox-server:3128'
export ftp_proxy='http://user:password@prox-server:3128'
*/
/*
*
*/
}
package org.emercit.service;
package org.emercit.devtools.service;
import org.emercit.model.IPAddressValidator;
......
package org.emercit.service;
package org.emercit.devtools.service;
import org.emercit.model.IPAddressValidator;
......
package org.emercit.service;
package org.emercit.devtools.service;
import org.emercit.model.IPAddressValidator;
......
package org.emercit.devtools.service;
import org.emercit.model.IPAddressValidator;
import java.util.Vector;
import org.emercit.proxymanager.model.ProxyBean;
import org.emercit.proxymanager.service.ProxyLinux;
import org.emercit.proxymanager.service.ProxyDBImpl;
public enum ProxyService {
INSTANCE;
private ProxyLinux proxylinux=new ProxyLinux();
private ProxyDBImpl proxydb=new ProxyDBImpl();
private Vector<String> vStr;
private Vector<ProxyBean> vPb;
public Vector<ProxyBean> getAllProxyBean() {
return proxydb.selectDb();
}
public boolean Upd(Vector<ProxyBean> beans) {
return proxylinux.Config(beans);
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="org.emercit.app" />
<context:component-scan base-package="org.emercit.devtools.app" />
<!-- Transporting JSON - Data -->
<beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
......
......@@ -20,15 +20,15 @@ Ext.application({
'MainConfig',
'PingUtil',
'DetailDns',
'Dns'
'Dns',
'Proxy'
],
stores : [
'Eth',
'Dns',
'Proxy'
'Dns'
],
......
function setModelToForm(proxy) {
var form=Ext.getCmp("formproxy");
var fsProxy = form.down('#fs'+proxy.protocol);
if (proxy.enabled) {
fsProxy.checkboxCmp.setValue(true);
fsProxy.down('#'+proxy.protocol+'Adress').setValue(proxy.host);
fsProxy.down('#'+proxy.protocol+'Port').setValue(proxy.port);
var fsAuth = fsProxy.down('#fs'+proxy.protocol+'Auth');
if (proxy.auth) {
fsAuth.checkboxCmp.setValue(true);
fsAuth.down('#'+proxy.protocol+'Login').setValue(proxy.login);
fsAuth.down('#'+proxy.protocol+'Password').setValue(proxy.pass);
}else {
fsAuth.checkboxCmp.setValue(false);
}
}else {
fsProxy.checkboxCmp.setValue(false);
}
}
Ext.define('App.controller.Proxy', {
extend : 'Ext.app.Controller',
init : function() {
this.control({
'toolbar button[action=saveProxy]' : {
click : this.saveProxy
},
'toolbar button[action=loadProxy]': {
click : this.loadProxy
},
'mvvm-ProxyView': {
// selectionchange: this.gridSelectionChange,
// viewready: this.onViewReady,
// select: this.onRowSelect
}
});
this.loadProxy();
},
saveProxy:function() {
var records = [];
records.push(this.getModelFromForm(0,"http"));
records.push(this.getModelFromForm(1,"https"));
records.push(this.getModelFromForm(2,"ftp"));
var data=Ext.util.JSON.encode(records);
Ext.Ajax.request({
method: "POST",
url: 'api/proxy/update',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
params: data,
success: function(response, opts) {
var Ok = Ext.JSON.decode(response.responseText);
if (Ok) {
Ext.Msg.alert('Success', 'Сохранение выполнено успешно');
}else {
Ext.Msg.alert('Failure', 'Ошибка сохранения');
}
}, failure: function(response, opts) {
Ext.Msg.alert('Failure', 'Ошибка сохранения');
}
});
},
getModelFromForm:function (id,protocol) {
var host;
var port;
var login;
var pass;
var enabled;
var auth;
var proxy;
var formproxy=Ext.getCmp("formproxy");
var fsHttps = formproxy.down('#fs'+protocol);
enabled=fsHttps.checkboxCmp.getValue();
host=fsHttps.down('#'+protocol+'Adress').getValue();
port=fsHttps.down('#'+protocol+'Port').getValue();
var fsHttpsAuth=fsHttps.down('#fs'+protocol+'Auth');
auth=fsHttpsAuth.checkboxCmp.getValue();
login=fsHttpsAuth.down('#'+protocol+'Login').getValue();
pass=fsHttpsAuth.down('#'+protocol+'Password').getValue();
proxy = {
id:id,
protocol:protocol,
host:host,
port:parseInt(port),
login:login,
pass:pass,
enabled:enabled,
auth:auth
};
return proxy;
},
loadProxy:function() {
Ext.Ajax.request({
method: "GET",
url: 'api/proxy/all',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
success: function(response, opts) {
var result = Ext.JSON.decode(response.responseText);
for(var i in result){
this.setModelToForm(result[i]);
}
}, failure: function(response, opts) {
}
});
}
});
......@@ -4,9 +4,23 @@ Ext.define('App.model.Proxy', {
fields : [{
name:'id',
type:'int'
},
{
name:'proxy',
},{
name:'protocol',
type:'string'
},{
name:'host',
type:'string'
},{
name:'port',
type:'int'
},{
name:'login',
type:'string'
},{
name:'pass'
},{
name:'enabled'
},{
name:'auth'
}]
});
\ No newline at end of file
......
Ext.define('App.store.Proxy', {
extend : 'Ext.data.Store',
requires : [
'App.model.Proxy'
],
storeId : 'Proxy',
model : 'App.model.Proxy',
autoLoad: true,
autoSync: true,
alias: 'store.devices',
proxy : {
type : 'ajax',
api: {
read: 'api/net/proxy'
},
reader : {
type : 'json',
idProperty : 'id'
}
}
});
\ No newline at end of file
Ext.define('App.view.Proxy', {
extend : 'Ext.grid.Panel',
extend : 'Ext.form.Panel',
xtype : 'mvvm-ProxyView',
title : 'Proxy сервера',
store : 'Proxy',
tbar: [
{
text:'Добавить',
margin:'5 5 5 5',
handler: function(){
width: 550,
bodyPadding: 10,
if (winaddproxy==null) {
var winaddproxy = Ext.create('widget.window', { // создание окна
title:'Добавить',
maximize: function(){
this.callParent([true]); //animate
},
bbar: {
restore: function(){
this.callParent([true]); //animate
items: [ {
xtype: 'button',
iconCls:'save',
itemId: 'SaveProxyButton',
text: 'Сохранить',
action: 'saveProxy',
disabled:false
},
closeAction: 'hide',
items: [
{
xtype : 'mvvm-DetailProxyView',
viewModel : {
data : {
rec : {
proxy:"http_proxy='http://user:password@proxyserver:7777'"
}
}
}
xtype: 'button',
iconCls:'load',
itemId: 'LoadProxyButton',
text: 'Обновить',
action: 'loadProxy',
disabled:false
}
]
});
winaddproxy.show();
}
},
}
}] ,
items: [
columns: [{
text : '№',
dataIndex : 'id',
flex: 1
{
xtype:'fieldset',
checkboxToggle:true,
itemId:'fshttp',
title: 'HTTP',
defaultType: 'textfield',
collapsed: false,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items :[ // HTTP
{
text : 'Proxy сервер',
dataIndex : 'proxy',
flex : 5
fieldLabel: 'IP адрес',
itemId: 'httpAdress',
allowBlank:false
},{
fieldLabel: 'Порт',
itemId: 'httpPort',
allowBlank:false
},
{
xtype: 'actioncolumn',
text : '#',
flex:1,
dataIndex: 'guid',
items: [{
icon: 'resources/img/tools.png',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
if (wintoolsproxy==null) {
var wintoolsproxy = Ext.create('widget.window', { // создание окна
title:'Изменить',
maximize: function(){
this.callParent([true]); //animate
xtype:'fieldset',
checkboxToggle:true,
itemId:'fshttpAuth',
title: 'Авторизация',
defaultType: 'textfield',
collapsed: true,
layout: 'anchor',
defaults: {
anchor: '100%'
},
restore: function(){
this.callParent([true]); //animate
items :[{
fieldLabel: 'Логин',
itemId: 'httpLogin',
allowBlank:false
},
closeAction: 'hide',
items: [
{
xtype : 'mvvm-DetailProxyView',
viewModel : {
data : {
rec : rec
}
fieldLabel: 'Пароль',
itemId: 'httpPassword',
allowBlank:false
}]
}
}
]
});
wintoolsproxy.show();
}
}
}
],
action: 'tools'
]
},
{
xtype: 'actioncolumn',
text : '#',
flex:1,
dataIndex: 'id',
items: [{
icon: 'resources/img/delete.png',
handler: function (grid, rowIndex, colIndex) {
//HTTPS
var selectedRecord = grid.getStore().getAt(rowIndex);
grid.getStore().each(function(rec) {
if (rec == selectedRecord) {
grid.store.remove(rec);
{
xtype:'fieldset',
checkboxToggle:true,
itemId:'fshttps',
title: 'HTTPS',
defaultType: 'textfield',
collapsed: true,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items :[ {
fieldLabel: 'IP адрес',
itemId: 'httpsAdress',
allowBlank:false
},{
fieldLabel: 'Порт',
itemId: 'httpsPort',
allowBlank:false
},
{
xtype:'fieldset',
checkboxToggle:true,
itemId:'fshttpsAuth',
title: 'Авторизация',
defaultType: 'textfield',
collapsed: true,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items :[{
fieldLabel: 'Логин',
itemId: 'httpsLogin',
allowBlank:false
},
{
fieldLabel: 'Пароль',
itemId: 'httpsPassword',
allowBlank:false
}]
}
});
grid.getView().refresh();
]
},
//FTP
{
xtype:'fieldset',
checkboxToggle:true,
itemId:'fsftp',
title: 'FTP',
defaultType: 'textfield',
collapsed: true,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items :[ {
fieldLabel: 'IP адрес',
itemId: 'ftpAdress',
allowBlank:false
},{
fieldLabel: 'Порт',
itemId: 'ftpPort',
allowBlank:false
},
{
xtype:'fieldset',
checkboxToggle:true,
title: 'Авторизация',
defaultType: 'textfield',
itemId:'fsftpAuth',
collapsed: true,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items :[{
fieldLabel: 'Логин',
itemId: 'ftpLogin',
allowBlank:false
},
{
fieldLabel: 'Пароль',
itemId: 'ftpPassword',
allowBlank:false
}]
}
}],
action: 'delete'
]
}
]
]
});
\ No newline at end of file
......