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.
 
 
 
 

224 lines
6.2 KiB

{
xtype: 'form',
labelWidth: 40, // label settings here cascade unless overridden
frame: false,
bodyStyle:'padding:5px 5px 0',
defaultType: 'textfield',
items: [{
xtype: 'panel',
height: 100,
html: '<p align="center"><img src="/style/assets/20_node.png"><br/>Ethernet2Serial<br/></p>'
},{
xtype:'fieldset',
//checkboxToggle:true,
collapsible: true,
title: 'Network',
autoHeight: true,
defaults: {
//width: 180
},
collapsed: false,
items :[{
xtype: 'hidden',
id: 'uart_mode',
name: 'uart_mode',
value: '%%%CONTYPE%%%'
},{
xtype: 'hidden',
id: 'uart_ip',
name: 'uart_ip',
value: '%%%ADR_IP%%%'
},{
xtype: 'hidden',
id: 'uart_port',
name: 'uart_port',
value: %%%ADDR_PORT%%%
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%CON_TYPE%%%</p>'
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%ADR_IP%%%</p>'
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%ADDR_PORT%%%</p>'
}]
},{
xtype:'fieldset',
title: 'UART',
collapsible: true,
autoHeight:true,
defaults: {
//width: 168
},
items :[{
xtype: 'hidden',
id: 'uart_speed',
name: 'uart_speed',
value: %%%UART_SPEED%%%
},{
xtype: 'hidden',
id: 'uart_bit',
name: 'uart_bit',
value: %%%UART_BIT%%%
},{
xtype: 'hidden',
id: 'uart_parity',
name: 'uart_parity',
value: '%%%UART_PARITY%%%'
},{
xtype: 'hidden',
id: 'uart_stops',
name: 'uart_stops',
value: %%%UART_STOP%%%
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_SPEED%%%</p>'
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_BIT%%%</p>'
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_PARITY%%%</p>'
},{
xtype: 'panel',
html: '<p align="center" style="padding: 5px; color: yellow; background-color: green;">%%%UART_STOP%%%</p>'
}]
},{
xtype: 'button',
text: 'Change Settings',
width: '100%',
handler: function(){
var wAddSocket = new Ext.Window({
title: 'UART Settings',
width: 450,
//height: 480,
items:[{
xtype: 'form',
labelWidth: 120, // label settings here cascade unless overridden
frame: false,
bodyStyle:'padding:5px 5px 0',
defaultType: 'textfield',
items:[{
xtype: 'combo',
fieldLabel: 'Speed',
id: 'ued_speed',
lazyRender:true,
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['speed'],
data: [[19200], [115200]]
}),
valueField: 'speed',
displayField: 'speed'
},{
xtype: 'combo',
fieldLabel: 'Bits',
id: 'ued_bit',
lazyRender:true,
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['bits'],
data: [[5],[6],[7],[8],[9]]
}),
valueField: 'bits',
displayField: 'bits'
},{
xtype: 'combo',
fieldLabel: 'Stop Bit',
lazyRender:true,
id: 'ued_stops',
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['stops'],
data: [[1],[1.5],[2]]
}),
valueField: 'stops',
displayField: 'stops'
},{
xtype: 'combo',
fieldLabel: 'Parity',
lazyRender:true,
id: 'ued_parity',
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['parity'],
data: [['Odd'], ['Even'],['None']]
}),
valueField: 'parity',
displayField: 'parity'
},{
xtype: 'combo',
fieldLabel: 'Working Mode',
lazyRender: true,
id: 'ued_mode',
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']]
}),
valueField: 'mode',
displayField: 'mode_txt'
},{
fieldLabel: 'IP Address',
id: 'ued_ip'
},{
fieldLabel: 'IP Port',
id: 'ued_port'
}]
}],
buttons:[{
text: 'Cancel',
handler: function(){
wAddSocket.close();
wAddSocket = null;
}
},{
text: 'Apply Settings',
handler: function(){
var val_uart_speed = Ext.getCmp('ued_speed').getValue();
var val_uart_bit = Ext.getCmp('ued_bit').getValue();
var val_uart_stops = Ext.getCmp('ued_stops').getValue();
var val_uart_parity = Ext.getCmp('ued_parity').getValue();
var val_uart_ip = Ext.getCmp('ued_ip').getValue();
var val_uart_port = Ext.getCmp('ued_port').getValue();
var val_uart_mode = Ext.getCmp('ued_mode').getValue();
Ext.Ajax.request({
url: '/lib/controller/updateUartSettings.php',
params: {
UART: %%%UART_ID%%%,
USPD: val_uart_speed,
UBIT: val_uart_bit,
USTP: val_uart_stops,
UPAR: val_uart_parity,
UADR: val_uart_ip,
UPOR: val_uart_port,
UMOD: val_uart_mode
},
success: function( response, opts ){
wAddSocket.close();
wAddSocket = null;
loadNodeProperties( %%%NODE_ID%%% );
},
failure: function( response, opts ) {
}
});
}
}]
});
wAddSocket.show();
Ext.getCmp('ued_speed').setValue( Ext.getCmp('uart_speed').getValue());
Ext.getCmp('ued_bit').setValue( Ext.getCmp('uart_bit').getValue());
Ext.getCmp('ued_stops').setValue( Ext.getCmp('uart_stops').getValue());
switch( Ext.getCmp('uart_parity').getValue() ){
case 'E': Ext.getCmp('ued_parity').setValue( 'Even' ); break;
case 'O': Ext.getCmp('ued_parity').setValue( 'Odd' ); break;
case 'N': Ext.getCmp('ued_parity').setValue( 'None' ); break;
};
Ext.getCmp('ued_ip').setValue( Ext.getCmp('uart_ip').getValue());
Ext.getCmp('ued_port').setValue( Ext.getCmp('uart_port').getValue());
Ext.getCmp('ued_mode').setValue( Ext.getCmp('uart_mode').getValue());
}
}]
}