Merge branch 'master' of ssh://git@git.emercit.com/dkoritko/hardwareconfig.git
Showing
55 changed files
with
622 additions
and
144 deletions
| ... | @@ -150,6 +150,13 @@ | ... | @@ -150,6 +150,13 @@ |
| 150 | <version>1.8</version> | 150 | <version>1.8</version> |
| 151 | </dependency> | 151 | </dependency> |
| 152 | 152 | ||
| 153 | |||
| 154 | <dependency> | ||
| 155 | <groupId>org.emercit</groupId> | ||
| 156 | <artifactId>proxymanager</artifactId> | ||
| 157 | <version>1.5</version> | ||
| 158 | </dependency> | ||
| 159 | |||
| 153 | </dependencies> | 160 | </dependencies> |
| 154 | 161 | ||
| 155 | 162 | ... | ... |
No preview for this file type
| 1 | 6e748c16d9079ce336611a59b511a693 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 60f8b8f393c8e7473c414f67fd4c0b33006d0ea1 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.0</version> | ||
| 8 | </project> |
| 1 | d01ad073eb3c61bddaf90f21f8fb5e75 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | c66ba2702c2a8a69db61929a82cdf400183083df | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | ecba97cfde9cdb328b90997bc3506f82 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | aa443ffb1efe591c851713884f0c5e66cf09dc01 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.1</version> | ||
| 8 | </project> |
| 1 | 349be90bd54764dcaff9132517c4394c | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 9781a7bcd3d9bea91d36c86db1e69f82f5565ec5 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 8f34d0021feb122ba45a98947498e41e | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 4e7c2284eee3ca7a23acb7af05b1e93fac8202d7 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.2</version> | ||
| 8 | </project> |
| 1 | 00d5b514394541b928d99955c6abd262 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 06fac3ddaa808258e618750132127adf72225f91 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | e4581e795b0be4fe7d996dc4e4706b74 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 7b2d2f13d18e612abc690d13e7274bdb1d4468f9 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.3</version> | ||
| 8 | </project> |
| 1 | 5d77f14f1fb8d29b1d39da5eb0a87ace | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | b7f6771336e7598032f3341463d4f1c8cc508946 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 2c45f14dab6c4d905d4fceb1484b1956 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | e644cf48f61d417c71f53dc3990c5c8086b80d42 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.4</version> | ||
| 8 | </project> |
| 1 | 4651b3978331f8c656d429c9aa6a89d8 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 7751ffe63a1e1d7d9a7997111d449f2ff697b3fb | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 3b8ca22c5c933274bbeb897ee5e02306 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | ff438544989c58e28f02ee3b5b3ee2be81563321 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <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" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>proxymanager</artifactId> | ||
| 7 | <version>1.5</version> | ||
| 8 | </project> |
| 1 | 6b33a2fc800d3fc8a28a9565ba974db6 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 157f839ee31faa1ea298cfbeddc3c9957285bc01 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <metadata> | ||
| 3 | <groupId>org.emercit</groupId> | ||
| 4 | <artifactId>proxymanager</artifactId> | ||
| 5 | <versioning> | ||
| 6 | <release>1.5</release> | ||
| 7 | <versions> | ||
| 8 | <version>1.0</version> | ||
| 9 | <version>1.1</version> | ||
| 10 | <version>1.2</version> | ||
| 11 | <version>1.3</version> | ||
| 12 | <version>1.4</version> | ||
| 13 | <version>1.5</version> | ||
| 14 | </versions> | ||
| 15 | <lastUpdated>20150716092042</lastUpdated> | ||
| 16 | </versioning> | ||
| 17 | </metadata> |
| 1 | 3310adccea01105b5f5ef7361679cf7d | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 375d779bcb432886a15cc7e0f4441f09ac7e8be4 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | package org.emercit.app; | 1 | package org.emercit.devtools.app; |
| 2 | 2 | ||
| 3 | import java.util.Locale; | 3 | import java.util.Locale; |
| 4 | 4 | ||
| ... | @@ -28,10 +28,8 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -28,10 +28,8 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 28 | 28 | ||
| 29 | import java.util.Vector; | 29 | import java.util.Vector; |
| 30 | 30 | ||
| 31 | import org.emercit.service.DevInfoService; | ||
| 32 | |||
| 33 | |||
| 34 | import org.emercit.devinfo.model.DevInfoBean; | 31 | import org.emercit.devinfo.model.DevInfoBean; |
| 32 | import org.emercit.devtools.service.DevInfoService; | ||
| 35 | 33 | ||
| 36 | 34 | ||
| 37 | 35 | ... | ... |
| 1 | package org.emercit.app; | 1 | package org.emercit.devtools.app; |
| 2 | 2 | ||
| 3 | import java.util.Locale; | 3 | import java.util.Locale; |
| 4 | 4 | ||
| ... | @@ -23,12 +23,10 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -23,12 +23,10 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 23 | import java.util.Vector; | 23 | import java.util.Vector; |
| 24 | 24 | ||
| 25 | import org.emercit.ethmanager.model.EthBean; | 25 | import org.emercit.ethmanager.model.EthBean; |
| 26 | import org.emercit.devtools.service.DnsService; | ||
| 27 | import org.emercit.devtools.service.EthService; | ||
| 26 | import org.emercit.dnsmanager.model.DnsBean; | 28 | import org.emercit.dnsmanager.model.DnsBean; |
| 27 | 29 | ||
| 28 | import org.emercit.service.EthService; | ||
| 29 | import org.emercit.service.DnsService; | ||
| 30 | |||
| 31 | |||
| 32 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
| 33 | import java.util.List; | 31 | import java.util.List; |
| 34 | 32 | ... | ... |
| 1 | package org.emercit.app; | 1 | package org.emercit.devtools.app; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import java.util.Locale; | 4 | import java.util.Locale; |
| ... | @@ -30,11 +30,10 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -30,11 +30,10 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 30 | import java.util.Vector; | 30 | import java.util.Vector; |
| 31 | 31 | ||
| 32 | import org.emercit.ethmanager.model.EthBean; | 32 | import org.emercit.ethmanager.model.EthBean; |
| 33 | import org.emercit.devtools.service.DnsService; | ||
| 34 | import org.emercit.devtools.service.EthService; | ||
| 33 | import org.emercit.dnsmanager.model.DnsBean; | 35 | import org.emercit.dnsmanager.model.DnsBean; |
| 34 | 36 | ||
| 35 | import org.emercit.service.EthService; | ||
| 36 | import org.emercit.service.DnsService; | ||
| 37 | |||
| 38 | 37 | ||
| 39 | 38 | ||
| 40 | @Controller | 39 | @Controller | ... | ... |
| 1 | package org.emercit.devtools.app; | ||
| 2 | |||
| 3 | |||
| 4 | import java.util.Locale; | ||
| 5 | |||
| 6 | import org.slf4j.Logger; | ||
| 7 | import org.slf4j.LoggerFactory; | ||
| 8 | import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | |||
| 12 | import javax.servlet.http.*; | ||
| 13 | import javax.servlet.ServletContext; | ||
| 14 | |||
| 15 | import java.io.*; | ||
| 16 | |||
| 17 | import org.springframework.stereotype.Controller; | ||
| 18 | import org.springframework.validation.BindingResult; | ||
| 19 | import org.springframework.web.bind.annotation.ModelAttribute; | ||
| 20 | import org.springframework.web.bind.annotation.PathVariable; | ||
| 21 | import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | import org.springframework.web.bind.annotation.RequestMethod; | ||
| 23 | import org.springframework.web.bind.annotation.RequestParam; | ||
| 24 | import org.springframework.stereotype.Controller; | ||
| 25 | import org.springframework.web.bind.annotation.RequestMapping; | ||
| 26 | import org.springframework.web.bind.annotation.RequestMethod; | ||
| 27 | import org.springframework.web.bind.annotation.ResponseBody; | ||
| 28 | import org.springframework.web.bind.annotation.RequestBody; | ||
| 29 | |||
| 30 | import java.util.Vector; | ||
| 31 | |||
| 32 | import org.emercit.proxymanager.model.ProxyBean; | ||
| 33 | import org.emercit.devtools.service.DnsService; | ||
| 34 | import org.emercit.devtools.service.ProxyService; | ||
| 35 | import org.emercit.dnsmanager.model.DnsBean; | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | @Controller | ||
| 40 | @RequestMapping("api") | ||
| 41 | public class ProxyController { | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | @RequestMapping(value = "proxy/all", method = RequestMethod.GET) | ||
| 49 | public @ResponseBody Vector<ProxyBean> getAllProxy() { | ||
| 50 | |||
| 51 | try { | ||
| 52 | return ProxyService.INSTANCE.getAllProxyBean(); | ||
| 53 | } | ||
| 54 | catch(Exception e) | ||
| 55 | { | ||
| 56 | return null; | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | |||
| 61 | @RequestMapping(value="proxy/update" , method = RequestMethod.POST) | ||
| 62 | public @ResponseBody boolean update(@RequestBody ProxyBean[] beans) { | ||
| 63 | |||
| 64 | |||
| 65 | Vector<ProxyBean> dbs=new Vector<ProxyBean>(); | ||
| 66 | |||
| 67 | for (ProxyBean d:beans) { | ||
| 68 | |||
| 69 | ProxyBean db=new ProxyBean(); | ||
| 70 | |||
| 71 | |||
| 72 | db.setId(d.getId()); | ||
| 73 | db.setProtocol(d.getProtocol()); | ||
| 74 | db.setHost(d.getHost()); | ||
| 75 | db.setPort(d.getPort()); | ||
| 76 | db.setLogin(d.getLogin()); | ||
| 77 | db.setPass(d.getPass()); | ||
| 78 | db.setEnabled(d.getEnabled()); | ||
| 79 | db.setAuth(d.getAuth()); | ||
| 80 | |||
| 81 | |||
| 82 | dbs.add(db); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | return ProxyService.INSTANCE.Upd(dbs); | ||
| 88 | } | ||
| 89 | |||
| 90 | /* | ||
| 91 | export http_proxy='http://user:password@prox-server:3128' | ||
| 92 | export https_proxy='http://user:password@prox-server:3128' | ||
| 93 | export ftp_proxy='http://user:password@prox-server:3128' | ||
| 94 | |||
| 95 | */ | ||
| 96 | |||
| 97 | /* | ||
| 98 | * | ||
| 99 | */ | ||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | } | ||
| 104 | |||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 |
| 1 | package org.emercit.devtools.service; | ||
| 2 | |||
| 3 | |||
| 4 | import org.emercit.model.IPAddressValidator; | ||
| 5 | |||
| 6 | import java.util.Vector; | ||
| 7 | |||
| 8 | |||
| 9 | import org.emercit.proxymanager.model.ProxyBean; | ||
| 10 | import org.emercit.proxymanager.service.ProxyLinux; | ||
| 11 | import org.emercit.proxymanager.service.ProxyDBImpl; | ||
| 12 | |||
| 13 | |||
| 14 | public enum ProxyService { | ||
| 15 | |||
| 16 | INSTANCE; | ||
| 17 | |||
| 18 | private ProxyLinux proxylinux=new ProxyLinux(); | ||
| 19 | |||
| 20 | private ProxyDBImpl proxydb=new ProxyDBImpl(); | ||
| 21 | |||
| 22 | private Vector<String> vStr; | ||
| 23 | private Vector<ProxyBean> vPb; | ||
| 24 | |||
| 25 | public Vector<ProxyBean> getAllProxyBean() { | ||
| 26 | return proxydb.selectDb(); | ||
| 27 | |||
| 28 | } | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | public boolean Upd(Vector<ProxyBean> beans) { | ||
| 33 | |||
| 34 | return proxylinux.Config(beans); | ||
| 35 | |||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
| 23 | <beans:property name="suffix" value=".jsp" /> | 23 | <beans:property name="suffix" value=".jsp" /> |
| 24 | </beans:bean> | 24 | </beans:bean> |
| 25 | 25 | ||
| 26 | <context:component-scan base-package="org.emercit.app" /> | 26 | <context:component-scan base-package="org.emercit.devtools.app" /> |
| 27 | 27 | ||
| 28 | <!-- Transporting JSON - Data --> | 28 | <!-- Transporting JSON - Data --> |
| 29 | <beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> | 29 | <beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> | ... | ... |
| ... | @@ -20,15 +20,15 @@ Ext.application({ | ... | @@ -20,15 +20,15 @@ Ext.application({ |
| 20 | 'MainConfig', | 20 | 'MainConfig', |
| 21 | 'PingUtil', | 21 | 'PingUtil', |
| 22 | 'DetailDns', | 22 | 'DetailDns', |
| 23 | 'Dns' | 23 | 'Dns', |
| 24 | 'Proxy' | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | ], | 27 | ], |
| 27 | 28 | ||
| 28 | stores : [ | 29 | stores : [ |
| 29 | 'Eth', | 30 | 'Eth', |
| 30 | 'Dns', | 31 | 'Dns' |
| 31 | 'Proxy' | ||
| 32 | 32 | ||
| 33 | ], | 33 | ], |
| 34 | 34 | ... | ... |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | function setModelToForm(proxy) { | ||
| 5 | |||
| 6 | var form=Ext.getCmp("formproxy"); | ||
| 7 | |||
| 8 | var fsProxy = form.down('#fs'+proxy.protocol); | ||
| 9 | |||
| 10 | if (proxy.enabled) { | ||
| 11 | |||
| 12 | fsProxy.checkboxCmp.setValue(true); | ||
| 13 | fsProxy.down('#'+proxy.protocol+'Adress').setValue(proxy.host); | ||
| 14 | fsProxy.down('#'+proxy.protocol+'Port').setValue(proxy.port); | ||
| 15 | |||
| 16 | var fsAuth = fsProxy.down('#fs'+proxy.protocol+'Auth'); | ||
| 17 | |||
| 18 | if (proxy.auth) { | ||
| 19 | fsAuth.checkboxCmp.setValue(true); | ||
| 20 | fsAuth.down('#'+proxy.protocol+'Login').setValue(proxy.login); | ||
| 21 | fsAuth.down('#'+proxy.protocol+'Password').setValue(proxy.pass); | ||
| 22 | |||
| 23 | }else { | ||
| 24 | fsAuth.checkboxCmp.setValue(false); | ||
| 25 | } | ||
| 26 | |||
| 27 | }else { | ||
| 28 | fsProxy.checkboxCmp.setValue(false); | ||
| 29 | } | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | |||
| 34 | Ext.define('App.controller.Proxy', { | ||
| 35 | extend : 'Ext.app.Controller', | ||
| 36 | |||
| 37 | init : function() { | ||
| 38 | this.control({ | ||
| 39 | 'toolbar button[action=saveProxy]' : { | ||
| 40 | click : this.saveProxy | ||
| 41 | }, | ||
| 42 | |||
| 43 | 'toolbar button[action=loadProxy]': { | ||
| 44 | click : this.loadProxy | ||
| 45 | }, | ||
| 46 | |||
| 47 | 'mvvm-ProxyView': { | ||
| 48 | // selectionchange: this.gridSelectionChange, | ||
| 49 | // viewready: this.onViewReady, | ||
| 50 | // select: this.onRowSelect | ||
| 51 | } | ||
| 52 | }); | ||
| 53 | |||
| 54 | this.loadProxy(); | ||
| 55 | |||
| 56 | |||
| 57 | }, | ||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | saveProxy:function() { | ||
| 64 | |||
| 65 | var records = []; | ||
| 66 | |||
| 67 | records.push(this.getModelFromForm(0,"http")); | ||
| 68 | records.push(this.getModelFromForm(1,"https")); | ||
| 69 | records.push(this.getModelFromForm(2,"ftp")); | ||
| 70 | |||
| 71 | var data=Ext.util.JSON.encode(records); | ||
| 72 | |||
| 73 | Ext.Ajax.request({ | ||
| 74 | method: "POST", | ||
| 75 | url: 'api/proxy/update', | ||
| 76 | headers: { | ||
| 77 | 'Accept': 'application/json', | ||
| 78 | 'Content-Type': 'application/json' | ||
| 79 | }, | ||
| 80 | params: data, | ||
| 81 | success: function(response, opts) { | ||
| 82 | |||
| 83 | var Ok = Ext.JSON.decode(response.responseText); | ||
| 84 | if (Ok) { | ||
| 85 | Ext.Msg.alert('Success', 'Сохранение выполнено успешно'); | ||
| 86 | }else { | ||
| 87 | Ext.Msg.alert('Failure', 'Ошибка сохранения'); | ||
| 88 | } | ||
| 89 | |||
| 90 | }, failure: function(response, opts) { | ||
| 91 | |||
| 92 | Ext.Msg.alert('Failure', 'Ошибка сохранения'); | ||
| 93 | } | ||
| 94 | }); | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | }, | ||
| 100 | |||
| 101 | getModelFromForm:function (id,protocol) { | ||
| 102 | |||
| 103 | var host; | ||
| 104 | var port; | ||
| 105 | var login; | ||
| 106 | var pass; | ||
| 107 | var enabled; | ||
| 108 | var auth; | ||
| 109 | |||
| 110 | var proxy; | ||
| 111 | |||
| 112 | var formproxy=Ext.getCmp("formproxy"); | ||
| 113 | |||
| 114 | var fsHttps = formproxy.down('#fs'+protocol); | ||
| 115 | |||
| 116 | |||
| 117 | enabled=fsHttps.checkboxCmp.getValue(); | ||
| 118 | |||
| 119 | host=fsHttps.down('#'+protocol+'Adress').getValue(); | ||
| 120 | port=fsHttps.down('#'+protocol+'Port').getValue(); | ||
| 121 | |||
| 122 | var fsHttpsAuth=fsHttps.down('#fs'+protocol+'Auth'); | ||
| 123 | |||
| 124 | auth=fsHttpsAuth.checkboxCmp.getValue(); | ||
| 125 | |||
| 126 | login=fsHttpsAuth.down('#'+protocol+'Login').getValue(); | ||
| 127 | pass=fsHttpsAuth.down('#'+protocol+'Password').getValue(); | ||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | |||
| 132 | proxy = { | ||
| 133 | id:id, | ||
| 134 | protocol:protocol, | ||
| 135 | host:host, | ||
| 136 | port:parseInt(port), | ||
| 137 | login:login, | ||
| 138 | pass:pass, | ||
| 139 | enabled:enabled, | ||
| 140 | auth:auth | ||
| 141 | }; | ||
| 142 | |||
| 143 | return proxy; | ||
| 144 | }, | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | loadProxy:function() { | ||
| 149 | |||
| 150 | Ext.Ajax.request({ | ||
| 151 | method: "GET", | ||
| 152 | url: 'api/proxy/all', | ||
| 153 | headers: { | ||
| 154 | 'Accept': 'application/json', | ||
| 155 | 'Content-Type': 'application/json' | ||
| 156 | }, | ||
| 157 | |||
| 158 | success: function(response, opts) { | ||
| 159 | |||
| 160 | var result = Ext.JSON.decode(response.responseText); | ||
| 161 | |||
| 162 | for(var i in result){ | ||
| 163 | |||
| 164 | this.setModelToForm(result[i]); | ||
| 165 | } | ||
| 166 | |||
| 167 | |||
| 168 | }, failure: function(response, opts) { | ||
| 169 | } | ||
| 170 | }); | ||
| 171 | |||
| 172 | } | ||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | }); | ||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | |||
| 181 | |||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | |||
| 191 | |||
| 192 | |||
| 193 | |||
| 194 | |||
| 195 | |||
| 196 | |||
| 197 | |||
| 198 | |||
| 199 |
| ... | @@ -4,9 +4,23 @@ Ext.define('App.model.Proxy', { | ... | @@ -4,9 +4,23 @@ Ext.define('App.model.Proxy', { |
| 4 | fields : [{ | 4 | fields : [{ |
| 5 | name:'id', | 5 | name:'id', |
| 6 | type:'int' | 6 | type:'int' |
| 7 | }, | 7 | },{ |
| 8 | { | 8 | name:'protocol', |
| 9 | name:'proxy', | ||
| 10 | type:'string' | 9 | type:'string' |
| 10 | },{ | ||
| 11 | name:'host', | ||
| 12 | type:'string' | ||
| 13 | },{ | ||
| 14 | name:'port', | ||
| 15 | type:'int' | ||
| 16 | },{ | ||
| 17 | name:'login', | ||
| 18 | type:'string' | ||
| 19 | },{ | ||
| 20 | name:'pass' | ||
| 21 | },{ | ||
| 22 | name:'enabled' | ||
| 23 | },{ | ||
| 24 | name:'auth' | ||
| 11 | }] | 25 | }] |
| 12 | }); | 26 | }); |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | |||
| 2 | Ext.define('App.store.Proxy', { | ||
| 3 | extend : 'Ext.data.Store', | ||
| 4 | |||
| 5 | requires : [ | ||
| 6 | 'App.model.Proxy' | ||
| 7 | ], | ||
| 8 | |||
| 9 | storeId : 'Proxy', | ||
| 10 | model : 'App.model.Proxy', | ||
| 11 | autoLoad: true, | ||
| 12 | autoSync: true, | ||
| 13 | alias: 'store.devices', | ||
| 14 | proxy : { | ||
| 15 | type : 'ajax', | ||
| 16 | api: { | ||
| 17 | read: 'api/net/proxy' | ||
| 18 | }, | ||
| 19 | reader : { | ||
| 20 | type : 'json', | ||
| 21 | idProperty : 'id' | ||
| 22 | } | ||
| 23 | } | ||
| 24 | }); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 1 | ||
| 2 | Ext.define('App.view.Proxy', { | 2 | Ext.define('App.view.Proxy', { |
| 3 | extend : 'Ext.grid.Panel', | 3 | extend : 'Ext.form.Panel', |
| 4 | xtype : 'mvvm-ProxyView', | 4 | xtype : 'mvvm-ProxyView', |
| 5 | title : 'Proxy сервера', | ||
| 6 | store : 'Proxy', | ||
| 7 | 5 | ||
| 8 | tbar: [ | 6 | width: 550, |
| 9 | { | 7 | bodyPadding: 10, |
| 10 | text:'Добавить', | ||
| 11 | margin:'5 5 5 5', | ||
| 12 | handler: function(){ | ||
| 13 | 8 | ||
| 14 | if (winaddproxy==null) { | ||
| 15 | var winaddproxy = Ext.create('widget.window', { // создание окна | ||
| 16 | title:'Добавить', | ||
| 17 | 9 | ||
| 18 | maximize: function(){ | 10 | bbar: { |
| 19 | this.callParent([true]); //animate | ||
| 20 | }, | ||
| 21 | 11 | ||
| 22 | restore: function(){ | 12 | items: [ { |
| 23 | this.callParent([true]); //animate | 13 | xtype: 'button', |
| 14 | iconCls:'save', | ||
| 15 | itemId: 'SaveProxyButton', | ||
| 16 | text: 'Сохранить', | ||
| 17 | action: 'saveProxy', | ||
| 18 | disabled:false | ||
| 24 | }, | 19 | }, |
| 25 | |||
| 26 | closeAction: 'hide', | ||
| 27 | items: [ | ||
| 28 | { | 20 | { |
| 29 | xtype : 'mvvm-DetailProxyView', | 21 | xtype: 'button', |
| 30 | 22 | iconCls:'load', | |
| 31 | viewModel : { | 23 | itemId: 'LoadProxyButton', |
| 32 | data : { | 24 | text: 'Обновить', |
| 33 | rec : { | 25 | action: 'loadProxy', |
| 34 | proxy:"http_proxy='http://user:password@proxyserver:7777'" | 26 | disabled:false |
| 35 | } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | 27 | } |
| 39 | ] | 28 | ] |
| 40 | }); | ||
| 41 | 29 | ||
| 42 | winaddproxy.show(); | ||
| 43 | } | ||
| 44 | 30 | ||
| 31 | }, | ||
| 45 | 32 | ||
| 46 | 33 | ||
| 47 | } | ||
| 48 | }] , | ||
| 49 | 34 | ||
| 50 | 35 | ||
| 36 | items: [ | ||
| 51 | 37 | ||
| 52 | columns: [{ | 38 | { |
| 53 | text : '№', | 39 | xtype:'fieldset', |
| 54 | dataIndex : 'id', | 40 | checkboxToggle:true, |
| 55 | flex: 1 | 41 | itemId:'fshttp', |
| 42 | title: 'HTTP', | ||
| 43 | defaultType: 'textfield', | ||
| 44 | collapsed: false, | ||
| 45 | layout: 'anchor', | ||
| 46 | defaults: { | ||
| 47 | anchor: '100%' | ||
| 56 | }, | 48 | }, |
| 49 | items :[ // HTTP | ||
| 57 | { | 50 | { |
| 58 | text : 'Proxy сервер', | 51 | fieldLabel: 'IP адрес', |
| 59 | dataIndex : 'proxy', | 52 | itemId: 'httpAdress', |
| 60 | flex : 5 | 53 | allowBlank:false |
| 54 | },{ | ||
| 55 | fieldLabel: 'Порт', | ||
| 56 | itemId: 'httpPort', | ||
| 57 | allowBlank:false | ||
| 61 | }, | 58 | }, |
| 62 | { | 59 | { |
| 63 | xtype: 'actioncolumn', | 60 | xtype:'fieldset', |
| 64 | text : '#', | 61 | checkboxToggle:true, |
| 65 | flex:1, | 62 | itemId:'fshttpAuth', |
| 66 | dataIndex: 'guid', | 63 | title: 'Авторизация', |
| 67 | items: [{ | 64 | defaultType: 'textfield', |
| 68 | icon: 'resources/img/tools.png', | 65 | collapsed: true, |
| 69 | handler: function (grid, rowIndex, colIndex) { | 66 | layout: 'anchor', |
| 70 | var rec = grid.getStore().getAt(rowIndex); | 67 | defaults: { |
| 71 | 68 | anchor: '100%' | |
| 72 | if (wintoolsproxy==null) { | ||
| 73 | var wintoolsproxy = Ext.create('widget.window', { // создание окна | ||
| 74 | title:'Изменить', | ||
| 75 | |||
| 76 | maximize: function(){ | ||
| 77 | this.callParent([true]); //animate | ||
| 78 | }, | 69 | }, |
| 79 | 70 | items :[{ | |
| 80 | restore: function(){ | 71 | fieldLabel: 'Логин', |
| 81 | this.callParent([true]); //animate | 72 | itemId: 'httpLogin', |
| 73 | allowBlank:false | ||
| 82 | }, | 74 | }, |
| 83 | |||
| 84 | closeAction: 'hide', | ||
| 85 | items: [ | ||
| 86 | { | 75 | { |
| 87 | xtype : 'mvvm-DetailProxyView', | 76 | fieldLabel: 'Пароль', |
| 88 | viewModel : { | 77 | itemId: 'httpPassword', |
| 89 | data : { | 78 | allowBlank:false |
| 90 | rec : rec | 79 | }] |
| 91 | } | ||
| 92 | } | 80 | } |
| 93 | } | ||
| 94 | ] | ||
| 95 | |||
| 96 | }); | ||
| 97 | 81 | ||
| 98 | wintoolsproxy.show(); | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | ], | ||
| 103 | 82 | ||
| 104 | action: 'tools' | 83 | ] |
| 105 | }, | 84 | }, |
| 106 | { | ||
| 107 | xtype: 'actioncolumn', | ||
| 108 | text : '#', | ||
| 109 | flex:1, | ||
| 110 | dataIndex: 'id', | ||
| 111 | items: [{ | ||
| 112 | icon: 'resources/img/delete.png', | ||
| 113 | handler: function (grid, rowIndex, colIndex) { | ||
| 114 | |||
| 115 | |||
| 116 | 85 | ||
| 86 | //HTTPS | ||
| 117 | 87 | ||
| 118 | var selectedRecord = grid.getStore().getAt(rowIndex); | 88 | { |
| 119 | grid.getStore().each(function(rec) { | 89 | xtype:'fieldset', |
| 120 | if (rec == selectedRecord) { | 90 | checkboxToggle:true, |
| 121 | grid.store.remove(rec); | 91 | itemId:'fshttps', |
| 92 | title: 'HTTPS', | ||
| 93 | defaultType: 'textfield', | ||
| 94 | collapsed: true, | ||
| 95 | layout: 'anchor', | ||
| 96 | defaults: { | ||
| 97 | anchor: '100%' | ||
| 98 | }, | ||
| 99 | items :[ { | ||
| 100 | fieldLabel: 'IP адрес', | ||
| 101 | itemId: 'httpsAdress', | ||
| 102 | allowBlank:false | ||
| 103 | },{ | ||
| 104 | fieldLabel: 'Порт', | ||
| 105 | itemId: 'httpsPort', | ||
| 106 | allowBlank:false | ||
| 107 | }, | ||
| 108 | { | ||
| 109 | xtype:'fieldset', | ||
| 110 | checkboxToggle:true, | ||
| 111 | itemId:'fshttpsAuth', | ||
| 112 | title: 'Авторизация', | ||
| 113 | defaultType: 'textfield', | ||
| 114 | collapsed: true, | ||
| 115 | layout: 'anchor', | ||
| 116 | defaults: { | ||
| 117 | anchor: '100%' | ||
| 118 | }, | ||
| 119 | items :[{ | ||
| 120 | fieldLabel: 'Логин', | ||
| 121 | itemId: 'httpsLogin', | ||
| 122 | allowBlank:false | ||
| 123 | }, | ||
| 124 | { | ||
| 125 | fieldLabel: 'Пароль', | ||
| 126 | itemId: 'httpsPassword', | ||
| 127 | allowBlank:false | ||
| 128 | }] | ||
| 122 | } | 129 | } |
| 123 | }); | ||
| 124 | grid.getView().refresh(); | ||
| 125 | |||
| 126 | 130 | ||
| 127 | 131 | ||
| 132 | ] | ||
| 133 | }, | ||
| 128 | 134 | ||
| 135 | //FTP | ||
| 129 | 136 | ||
| 137 | { | ||
| 138 | xtype:'fieldset', | ||
| 139 | checkboxToggle:true, | ||
| 140 | itemId:'fsftp', | ||
| 141 | title: 'FTP', | ||
| 142 | defaultType: 'textfield', | ||
| 143 | collapsed: true, | ||
| 144 | layout: 'anchor', | ||
| 145 | defaults: { | ||
| 146 | anchor: '100%' | ||
| 147 | }, | ||
| 148 | items :[ { | ||
| 149 | fieldLabel: 'IP адрес', | ||
| 150 | itemId: 'ftpAdress', | ||
| 151 | allowBlank:false | ||
| 152 | },{ | ||
| 153 | fieldLabel: 'Порт', | ||
| 154 | itemId: 'ftpPort', | ||
| 155 | allowBlank:false | ||
| 156 | }, | ||
| 157 | { | ||
| 158 | xtype:'fieldset', | ||
| 159 | checkboxToggle:true, | ||
| 160 | title: 'Авторизация', | ||
| 161 | defaultType: 'textfield', | ||
| 162 | itemId:'fsftpAuth', | ||
| 163 | collapsed: true, | ||
| 164 | layout: 'anchor', | ||
| 165 | defaults: { | ||
| 166 | anchor: '100%' | ||
| 167 | }, | ||
| 168 | items :[{ | ||
| 169 | fieldLabel: 'Логин', | ||
| 170 | itemId: 'ftpLogin', | ||
| 171 | allowBlank:false | ||
| 172 | }, | ||
| 173 | { | ||
| 174 | fieldLabel: 'Пароль', | ||
| 175 | itemId: 'ftpPassword', | ||
| 176 | allowBlank:false | ||
| 177 | }] | ||
| 130 | } | 178 | } |
| 131 | }], | ||
| 132 | 179 | ||
| 133 | action: 'delete' | 180 | |
| 181 | ] | ||
| 134 | } | 182 | } |
| 183 | ] | ||
| 135 | 184 | ||
| 136 | 185 | ||
| 137 | 186 | ||
| 138 | ] | ||
| 139 | }); | 187 | }); |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment