/** * Contains CalcClientDebugTab class * * Copyright (C) 2017 R-T Specialty, LLC. * * This file is part of the Liza Data Collection Framework * * Liza 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 3 of the License, or * (at your option) any later version. * * This program 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 this program. If not, see . */ var Class = require( 'easejs' ).Class, ClientDebugTab = require( './ClientDebugTab' ), calc = require( '../../calc/Calc' ); /** * Monitors client-side assertions */ module.exports = Class( 'CalcClientDebugTab' ) .implement( ClientDebugTab ) .extend( { 'private _$content': null, /** * Retrieve tab title * * @return {string} tab title */ 'public getTitle': function() { return 'Calculated Values'; }, /** * Retrieve tab content * * @param {Client} client active client being debugged * @param {StagingBucket} bucket bucket to reference for data * * @return {jQuery|string} tab content */ 'public getContent': function( client, bucket ) { this._$content = $( '
' ) .append( $( '

' ).text( "Quick-n-dirty calculated value test tool. Select the " + "method to test below, followed by the data and value " + "arguments. See the Calc module for more information." ) ); this._addRow(); this._addButtons(); return this._$content; }, /** * Add calculated value row which will perform the requested calculation * with the provided parameter values * * @return {undefined} */ 'private _addRow': function() { var _self = this, $sel = null, $data = null, $value = null, $result = null, changeCallback = function() { _self._doCalc( $sel.val(), $data.val(), $value.val(), $result ); } ; this._$content.append( $( '

' ) .addClass( 'row' ) .append( $sel = $( '' ) .val( '[]' ) .change( changeCallback ) ) .append( $value = $( '' ) .val( '[]' ) .change( changeCallback ) ) .append( $result = $( '' ) ) ); for ( method in calc ) { $sel.append( $( '