<commit_before>/**
 * This view is used to simplify many of the boilerplate operations necessary to run the various Network Toolkit view.
 * 
 * This includes:
 * 
 *   1) Wiring up the cell renderer
 *   2) Wiring up the execute button
 *   3) Running a search to get the last result and replacing it with another search when the user wants to generate a new result
 *   4) Automatically running a test if the URL contains an argument
 */
require.config({
    paths: {
    	network_tools_cell_renderer: '../app/network_tools/NetworkToolsCellRenderer'
    }
});

define([
    'jquery',
    'underscore',
    'splunkjs/mvc',
    'splunkjs/mvc/tokenutils',
    'splunkjs/mvc/simplesplunkview',
    'network_tools_cell_renderer',
    'bootstrap.tab',
    'splunkjs/mvc/simplexml/ready!'
], function(
    $,
    _,
    mvc,
    TokenUtils,
    SimpleSplunkView,
    NetworkToolsCellRenderer
){
	
    // Define the custom view class
    var NetworkToolsView = SimpleSplunkView.extend({
        className: "NetworkToolsView",
        
        defaults: {
        	execute_button_id: "#execute_input",
            cell_renderer_id: null,

            default_search: null,
            fresh_search: null,
            search_token: null,

            // The name of the token to set from the input
            token_name: null,
            token_input_id: null

        },
        
        /**
         * Initialize the class.
         */
        initialize: function() {
        	this.options = _.extend({}, this.defaults, this.options);
        	
            // Handle a click event from the execute button and force the search command to execute.
            $(this.options.execute_button_id).click(this.runTest.bind(this));

            // By default, show the most recent nslookup result. To do this, we will set the nslookup search token to be a historical search.
            var tokens = mvc.Components.getInstance("submitted");
            tokens.set(this.options.search_token, this.options.default_search);

            // Start the test if the URLs parameters acall for it.
            this.startTestIfNecessary();

            this.renderCellRenderer();
        },

        /**
         * Render the ell renderer
         */
        renderCellRenderer: function(){

            if(this.options.cell_renderer_id !== null){<commit_msg>Cleaning up the code a bit<commit_after>/**
 * This view is used to simplify many of the boilerplate operations necessary to run the various Network Toolkit view.
 * 
 * This includes:
 * 
 *   1) Wiring up the cell renderer
 *   2) Wiring up the execute button
 *   3) Running a search to get the last result and replacing it with another search when the user wants to generate a new result
 *   4) Automatically running a test if the URL contains an argument
 */
require.config({
    paths: {
    	network_tools_cell_renderer: '../app/network_tools/NetworkToolsCellRenderer'
    }
});

define([
    'jquery',
    'underscore',
    'splunkjs/mvc',
    'splunkjs/mvc/tokenutils',
    'splunkjs/mvc/simplesplunkview',
    'network_tools_cell_renderer',
    'bootstrap.tab',
    'splunkjs/mvc/simplexml/ready!'
], function(
    $,
    _,
    mvc,
    TokenUtils,
    SimpleSplunkView,
    NetworkToolsCellRenderer
){
	
    // Define the custom view class
    var NetworkToolsView = SimpleSplunkView.extend({
        className: "NetworkToolsView",
        
        defaults: {
        	execute_button_id: "#execute_input",
            cell_renderer_id: null,

            default_search: null,
            fresh_search: null,
            search_token: null,

            // The name of the token to set from the input
            token_name: null,
            token_input_id: null

        },
        
        /**
         * Initialize the class.
         */
        initialize: function() {
        	this.options = _.extend({}, this.defaults, this.options);
        	
            // Handle a click event from the execute button and force the search command to execute.
            $(this.options.execute_button_id).click(this.runTest.bind(this));

            // By default, show the most recent nslookup result. To do this, we will set the nslookup search token to be a historical search.
            var tokens = mvc.Components.getInstance("submitted");
            tokens.set(this.options.search_token, this.options.default_search);

            // Start the test if the URLs parameters call for it.
            this.startTestIfNecessary();

            this.renderCellRenderer();
        },

        /**
         * Render the ell renderer
         */
        renderCellRenderer: function(){

            if(this.options.cell_renderer_id !== null){
{'fraction_non_alphanumeric': 0.08962868117797695, 'fraction_numerical': 0.0017072129748186087, 'mean_word_length': 2.18843537414966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1881944', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1265, 'n_words': 394}