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.
 
 
 
 

267 lines
7.3 KiB

var netwodkData = {
edges: null,
nodes: null
};
var selectedConnection = null;
var selectedNode = null;
var selected_A_socket = null;
var selected_B_socket = null;
var addConnectionDialog = null;
var networkObj = null;
var ARGUS_SERVER = 0;
var ARGUS_ALS_SENSOR = 1;
var ARGUS_LFS_SENSOR = 2;
var ARGUS_PLS_200_SENSOR = 3;
var ARGUS_PLS_360_SENSOR = 4;
var ARGUS_3D_SENSOR = 5;
var ARGUS_NET_PLS_200 = 6;
var ARGUS_ANALOG_STATIC_CAMERA = 10;
var ARGUS_ANALOG_PTZ_CAMERA = 11;
var ARGUS_IP_STATIC_CAMERA = 12;
var ARGUS_IP_PTZ_CAMERA = 13;
var ARGUS_IP_UART_GATEWAY = 20;
var ARGUS_JAMER = 40;
var ARGUS_IP_VIDEO_SERVER = 50;
var ARGUS_DRONE_CONTROL = 60;
var ARGUS_UNKNOWN = 255;
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT = 1;
var ARGUS_NODE_SOCK_TYPE_NET4 = 2;
var ARGUS_NODE_SOCK_TYPE_DC = 3;
var ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER = 4;
var ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER = 5;
var ARGUS_NODE_SOCK_TYPE_IPV = 6;
var ARGUS_NODE_SOCK_TYPE_DVR = 7;
var ARGUS_NODE_SOCK_TYPE_NET6 = 8;
function sockTypeRenderer( r ){
switch( r ){
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT: return 'UART';
case ARGUS_NODE_SOCK_TYPE_NET4: return 'NET4';
case ARGUS_NODE_SOCK_TYPE_NET6: return 'NET6';
case ARGUS_NODE_SOCK_TYPE_DC: return 'DC';
case ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER: return 'A-V';
case ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER: return 'A-A';
case ARGUS_NODE_SOCK_TYPE_IPV: return 'IPV';
case ARGUS_NODE_SOCK_TYPE_DVR: return 'DVR';
default: return 'TBD';
};
};
function sockModeRenderer( r ){
switch( r ){
case 1: return 'IN';
case 2: return 'OUT';
case 3: return 'IN/OUT';
default: return 'TBD';
};
};
var A_socketsListStore = new Ext.data.JsonStore({
root: 'nodes',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'name',
type: 'string'
},{
name: 'mode',
type: 'int'
},{
name: 'type',
type: 'int'
},{
name: 'binded',
type: 'int'
}]
});
var A_socketSelModel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function( sm, row, rec ) {
selected_A_socket = rec.data;
if( selected_B_socket != null ){
switch( selected_A_socket.type ){
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){
if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) {
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_NET4:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_IPV:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_DVR:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
default: Ext.getCmp('con_to_src').disable();
};
};
}
}
});
var B_socketsListStore = new Ext.data.JsonStore({
root: 'nodes',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'name',
type: 'string'
},{
name: 'mode',
type: 'int'
},{
name: 'type',
type: 'int'
},{
name: 'binded',
type: 'int'
}]
});
var B_socketSelModel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function( sm, row, rec ) {
selected_B_socket = rec.data;
if( selected_A_socket != null ){
switch( selected_A_socket.type ){
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){
if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) {
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_NET4:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_IPV:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
case ARGUS_NODE_SOCK_TYPE_DVR:{
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){
Ext.getCmp('con_to_src').enable();
} else {
Ext.getCmp('con_to_src').disable();
};
break;
};
default: Ext.getCmp('con_to_src').disable();
};
};
}
}
});
var socketListColModel = new Ext.grid.ColumnModel({
columns: [
{header: "id", width: 30, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "", width: 30, dataIndex: 'binded' },
{header: "", width: 70, renderer: sockModeRenderer, dataIndex: 'mode' },
{header: "Type",width: 50, sortable: false, fixed: true, renderer: sockTypeRenderer, dataIndex: 'type' },
{header: "Name",width: 185, dataIndex: 'name' }
],
defaults: {
sortable: false,
menuDisabled: true
}
});
var InConnectEditMode = false;
var InComponentRemoveMode = false;
var networkOpts = {
interaction:{
hover: true
},
manipulation: {
enabled: false,
addNode: function (data, callback) {
// filling in the popup DOM elements
//console.log('add', data);
},
editNode: function (data, callback) {
// filling in the popup DOM elements
//console.log('edit', data);
},
addEdge: function (data, callback) {
//console.log('add edge', data);
if (data.from == data.to) {
var r = confirm("Do you want to connect the node to itself?");
if (r === true) {
createConnection( data.from, data.to );
};
} else {
createConnection( data.from, data.to );
};
networkObj.disableEditMode();
}
}
};
function startCreateConnection(){
//if( networkObj!= null ){
networkObj.addEdgeMode();
//};
};
function stopCreateConnection(){
//if( networkObj!= null ){
networkObj.disableEditMode();
//};
};
function loadLinkProperties( EdgeID, From, To ){
//alert( 'Edge: ' + EdgeID );
};