/** * Contains BucketClientDebugTab 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, EventEmitter = require( 'events' ).EventEmitter, ClientDebugTab = require( './ClientDebugTab' ); /** * Provides additional information and manipulation options for buckets */ module.exports = Class( 'BucketClientDebugTab' ) .implement( ClientDebugTab ) .extend( EventEmitter, { /** * Current index of bucket monitor * @type {number} */ 'private _bmonIndex': 0, /** * Table representing the bucket monitor * @type {jQuery} */ 'private _$bmonTable': null, /** * Input box used to filter the bmonTable * @type {jQuery} */ 'private _$bmonTableFilter': null, /** * Reference to paint timeout timer * @type {?number} */ 'private _paintTimeout': null, /** * Retrieve tab title * * @return {string} tab title */ 'public getTitle': function() { return 'Bucket'; }, /** * 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 ) { return this._$content = ( this._content || this._createBaseContent( bucket ) ); }, /** * Create content * * @param {StagingBucket} staging bucket * * @return {jQuery} div containing tab content */ 'private _createBaseContent': function( staging ) { this._getBucketMonitorTable(); this._hookBucket( staging ); return $( '
' ) .append( this._getHeader() ) .append( $( '
' ) .append( $( '' ).text( "Staging Bucket" ) ) .append( $( '

' ).text( "The staging bucket contains modified data that has not " + "yet been committed to the quote data bucket in " + "addition to the actual quote data. This " + "bucket will be passed to assertions." ) ) .append( this._getStagingButtons( staging ) ) .append( this._getBucketMonitorLegend() ) .append( this._getBucketMonitorTable() ) ) ; }, /** * Generate tab header text * * @return {jQuery} div containing header paragraphs */ 'private _getHeader': function() { var _self = this; return $( '

' ) .append( $( '

' ).text( "All quote data is contained within the buckets. The Client " + "exists purely to populate the quote data bucket." ) ) .append( $( '

' ).html( "N.B. This tab does not currently bind " + "to the new data bucket on quote change. Please refresh " + "the page when changing quotes if you wish to use this tab." ) ) .append( $( '

' ) .append( $( '' ) .attr( 'type', 'checkbox' ) .attr( 'id', 'field-overlay' ) .change( function() { // trigger toggle event _self.emit( 'fieldOverlayToggle', $( this ).is( ':checked' ) ); } ) ) .append( $( '

' ) .append( $( '