www-thermferm/js/maintenance_panel.js

Thu, 24 Jul 2014 20:45:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 24 Jul 2014 20:45:15 +0200
changeset 131
528dc0bb81ab
parent 130
25158b08843f
child 132
8bd209d1c020
permissions
-rw-r--r--

Always use uuid to select units and remove numeric record id's.

/*****************************************************************************
 * Copyright (C) 2014
 *   
 * Michiel Broek <mbroek at mbse dot eu>
 *
 * This file is part of ThermFerm
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * ThermFerm is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ThermFerm; see the file COPYING.  If not, write to the Free
 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *****************************************************************************/

$(document).ready(function () {
    /*
     * 1-Wire bus
     */
    var source_bus = {
     	datatype: "json",
     	datafields: [
       	    { name: 'Address', type: 'string' },
       	    { name: 'Refcnt', type: 'int' },
       	    { name: 'Chip', type: 'string' },
       	    { name: 'Description', type: 'string' }
     	],
     	url: 'getbus.php'
    };
    var dataAdapter_bus = new $.jqx.dataAdapter(source_bus);
    $("#jqxgrid_bus").jqxGrid( {
	width: 770, height: 280,
	source: dataAdapter_bus,
	theme: 'ui-redmond',
	columnsresize: true,
	columns: [
	    { text: 'Address', datafield: 'Address', width: 150 },
	    { text: 'References', datafield: 'Refcnt', width: 100 },
	    { text: 'Chipset', datafield: 'Chip', width: 120 },
	    { text: 'Description', datafield: 'Description', minwidth: 120 }
	]
    });

    /*
     * Profiles
     */
    var source_profiles = {
        datatype: "json",
        datafields: [
            { name: 'UUID', type: 'string' },
            { name: 'Name', type: 'string' },
            { name: 'Steps', type: 'int' }
        ],
        url: 'getprofiles.php'
    };
    var dataAdapter_profiles = new $.jqx.dataAdapter(source_profiles);
    $("#jqxgrid_profiles").jqxGrid( {
        width: 770, height: 280,
        source: dataAdapter_profiles,
        theme: 'ui-redmond',
        columnsresize: true,
	editable: true,
        columns: [
            { text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
            { text: 'Name', datafield: 'Name', minwidth: 120 },
            { text: 'Steps', datafield: 'Steps', width: 50 }
        ]
    });

    /*
     * Units
     */
    var source_units = {
        datatype: "json",
        datafields: [
            { name: 'UUID', type: 'string' },
            { name: 'Name', type: 'string' },
            { name: 'Mode', type: 'string' }
        ],
        url: 'getunits.php'
    };
    var dataAdapter_units = new $.jqx.dataAdapter(source_units);
    $("#jqxgrid_units").jqxGrid( {
        width: 770, height: 280,
        source: dataAdapter_units,
        theme: 'ui-redmond',
        columnsresize: true,
	editable: true,
        columns: [
            { text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
            { text: 'Name', datafield: 'Name', minwidth: 120 },
            { text: 'Mode', datafield: 'Mode', width: 70 }
        ]
    });
});

mercurial