Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
6.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. {
  2. xtype: 'form',
  3. labelWidth: 40, // label settings here cascade unless overridden
  4. frame: false,
  5. bodyStyle:'padding:5px 5px 0',
  6. defaultType: 'textfield',
  7. items: [{
  8. xtype: 'panel',
  9. height: 100,
  10. html: '<p align="center"><img src="/style/assets/20_node.png"><br/>Ethernet2Serial<br/></p>'
  11. },{
  12. xtype:'fieldset',
  13. //checkboxToggle:true,
  14. collapsible: true,
  15. title: 'Network',
  16. autoHeight: true,
  17. defaults: {
  18. //width: 180
  19. },
  20. collapsed: false,
  21. items :[{
  22. xtype: 'hidden',
  23. id: 'uart_mode',
  24. name: 'uart_mode',
  25. value: '%%%CONTYPE%%%'
  26. },{
  27. xtype: 'hidden',
  28. id: 'uart_ip',
  29. name: 'uart_ip',
  30. value: '%%%ADR_IP%%%'
  31. },{
  32. xtype: 'hidden',
  33. id: 'uart_port',
  34. name: 'uart_port',
  35. value: %%%ADDR_PORT%%%
  36. },{
  37. xtype: 'panel',
  38. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%CON_TYPE%%%</p>'
  39. },{
  40. xtype: 'panel',
  41. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%ADR_IP%%%</p>'
  42. },{
  43. xtype: 'panel',
  44. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%ADDR_PORT%%%</p>'
  45. }]
  46. },{
  47. xtype:'fieldset',
  48. title: 'UART',
  49. collapsible: true,
  50. autoHeight:true,
  51. defaults: {
  52. //width: 168
  53. },
  54. items :[{
  55. xtype: 'hidden',
  56. id: 'uart_speed',
  57. name: 'uart_speed',
  58. value: %%%UART_SPEED%%%
  59. },{
  60. xtype: 'hidden',
  61. id: 'uart_bit',
  62. name: 'uart_bit',
  63. value: %%%UART_BIT%%%
  64. },{
  65. xtype: 'hidden',
  66. id: 'uart_parity',
  67. name: 'uart_parity',
  68. value: '%%%UART_PARITY%%%'
  69. },{
  70. xtype: 'hidden',
  71. id: 'uart_stops',
  72. name: 'uart_stops',
  73. value: %%%UART_STOP%%%
  74. },{
  75. xtype: 'panel',
  76. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_SPEED%%%</p>'
  77. },{
  78. xtype: 'panel',
  79. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_BIT%%%</p>'
  80. },{
  81. xtype: 'panel',
  82. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_PARITY%%%</p>'
  83. },{
  84. xtype: 'panel',
  85. html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_STOP%%%</p>'
  86. }]
  87. },{
  88. xtype: 'button',
  89. text: 'Change Settings',
  90. width: '100%',
  91. handler: function(){
  92. var wAddSocket = new Ext.Window({
  93. title: 'UART Settings',
  94. width: 450,
  95. //height: 480,
  96. items:[{
  97. xtype: 'form',
  98. labelWidth: 120, // label settings here cascade unless overridden
  99. frame: false,
  100. bodyStyle:'padding:5px 5px 0',
  101. defaultType: 'textfield',
  102. items:[{
  103. xtype: 'combo',
  104. fieldLabel: 'Speed',
  105. id: 'ued_speed',
  106. lazyRender:true,
  107. mode: 'local',
  108. store: new Ext.data.ArrayStore({
  109. fields: ['speed'],
  110. data: [[19200], [115200]]
  111. }),
  112. valueField: 'speed',
  113. displayField: 'speed'
  114. },{
  115. xtype: 'combo',
  116. fieldLabel: 'Bits',
  117. id: 'ued_bit',
  118. lazyRender:true,
  119. mode: 'local',
  120. store: new Ext.data.ArrayStore({
  121. fields: ['bits'],
  122. data: [[5],[6],[7],[8],[9]]
  123. }),
  124. valueField: 'bits',
  125. displayField: 'bits'
  126. },{
  127. xtype: 'combo',
  128. fieldLabel: 'Stop Bit',
  129. lazyRender:true,
  130. id: 'ued_stops',
  131. mode: 'local',
  132. store: new Ext.data.ArrayStore({
  133. fields: ['stops'],
  134. data: [[1],[1.5],[2]]
  135. }),
  136. valueField: 'stops',
  137. displayField: 'stops'
  138. },{
  139. xtype: 'combo',
  140. fieldLabel: 'Parity',
  141. lazyRender:true,
  142. id: 'ued_parity',
  143. mode: 'local',
  144. store: new Ext.data.ArrayStore({
  145. fields: ['parity'],
  146. data: [['Odd'], ['Even'],['None']]
  147. }),
  148. valueField: 'parity',
  149. displayField: 'parity'
  150. },{
  151. xtype: 'combo',
  152. fieldLabel: 'Working Mode',
  153. lazyRender: true,
  154. id: 'ued_mode',
  155. mode: 'local',
  156. store: new Ext.data.ArrayStore({
  157. fields: ['mode','mode_txt'],
  158. data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']]
  159. }),
  160. valueField: 'mode',
  161. displayField: 'mode_txt'
  162. },{
  163. fieldLabel: 'IP Address',
  164. id: 'ued_ip'
  165. },{
  166. fieldLabel: 'IP Port',
  167. id: 'ued_port'
  168. }]
  169. }],
  170. buttons:[{
  171. text: 'Cancel',
  172. handler: function(){
  173. wAddSocket.close();
  174. wAddSocket = null;
  175. }
  176. },{
  177. text: 'Apply Settings',
  178. handler: function(){
  179. var val_uart_speed = Ext.getCmp('ued_speed').getValue();
  180. var val_uart_bit = Ext.getCmp('ued_bit').getValue();
  181. var val_uart_stops = Ext.getCmp('ued_stops').getValue();
  182. var val_uart_parity = Ext.getCmp('ued_parity').getValue();
  183. var val_uart_ip = Ext.getCmp('ued_ip').getValue();
  184. var val_uart_port = Ext.getCmp('ued_port').getValue();
  185. var val_uart_mode = Ext.getCmp('ued_mode').getValue();
  186. Ext.Ajax.request({
  187. url: '/lib/controller/updateUartSettings.php',
  188. params: {
  189. UART: %%%UART_ID%%%,
  190. USPD: val_uart_speed,
  191. UBIT: val_uart_bit,
  192. USTP: val_uart_stops,
  193. UPAR: val_uart_parity,
  194. UADR: val_uart_ip,
  195. UPOR: val_uart_port,
  196. UMOD: val_uart_mode
  197. },
  198. success: function( response, opts ){
  199. wAddSocket.close();
  200. wAddSocket = null;
  201. loadNodeProperties( %%%NODE_ID%%% );
  202. },
  203. failure: function( response, opts ) {
  204. }
  205. });
  206. }
  207. }]
  208. });
  209. wAddSocket.show();
  210. Ext.getCmp('ued_speed').setValue( Ext.getCmp('uart_speed').getValue());
  211. Ext.getCmp('ued_bit').setValue( Ext.getCmp('uart_bit').getValue());
  212. Ext.getCmp('ued_stops').setValue( Ext.getCmp('uart_stops').getValue());
  213. switch( Ext.getCmp('uart_parity').getValue() ){
  214. case 'E': Ext.getCmp('ued_parity').setValue( 'Even' ); break;
  215. case 'O': Ext.getCmp('ued_parity').setValue( 'Odd' ); break;
  216. case 'N': Ext.getCmp('ued_parity').setValue( 'None' ); break;
  217. };
  218. Ext.getCmp('ued_ip').setValue( Ext.getCmp('uart_ip').getValue());
  219. Ext.getCmp('ued_port').setValue( Ext.getCmp('uart_port').getValue());
  220. Ext.getCmp('ued_mode').setValue( Ext.getCmp('uart_mode').getValue());
  221. }
  222. }]
  223. }