<commit_before>Ext.namespace('LABKEY.ext');

LABKEY.ext.MonitorIS = Ext.extend( Ext.Panel, {

    constructor : function(config) {

        /////////////////////////////////////
        //            Variables            //
        /////////////////////////////////////

        var
            me                  = this,
            maskReport          = undefined,
            fieldWidth          = 240,
            flagCohortSelect    = undefined
            ;
        // Help strings
        var plotType_help = 'The type of plot: barplots and line are available.'

        // Stores
        var strPlotType = new Ext.data.ArrayStore({
            data: [
                [ 'Barplot', 'bar' ],
                [ 'Lineplot', 'line' ]
            ],
            fields: [ 'display', 'value' ]
        });

        // Dropdown
        var cbPlotType = new Ext.ux.form.ExtendedComboBox({
            allowBlank: false,
            displayField: 'display',
            fieldLabel: 'Plot type',
            id: 'cbPlotType',
            lazyInit: false,
            store: strPlotType,
            value: 'bar',
            valueField: 'value',
            width: fieldWidth
        });
        var startDate = new Ext.form.DateField({
            fieldLabel: 'From',
            width: fieldWidth
        });
        var endDate = new Ext.form.DateField({
            fieldLabel: 'To',
            width: fieldWidth,
            value: new Date()
        });

        /////////////////////////////////////
        //    Buttons and Radio Groups     //
        /////////////////////////////////////

        var btnRun = new Ext.Button({
            disabled: false,
            handler: function(){
                cnfReport.inputParams = {
                    plotType: cbPlotType.getValue(),
                    from: startDate.getValue(),
                    to: endDate.getValue()
                };
                setReportRunning( true );
                LABKEY.Report.execute( cnfReport );
            },
            text: 'Run'
        });


        /////////////////////////////////////
        //      Back-end Configuration     //
        /////////////////////////////////////

        var cnfReport = {
            failure: function( errorInfo, options, responseObj ){
                setReportRunning( false );

                LABKEY.ext.ISCore.onFailure( errorInfo, options, responseObj );
            },
            reportId: 'module:MonitorIS/MonitorIS.Rmd',
            success: function( result ){
                setReportRunning( false );

                var errors = result.errors;
                var outputParams = result.outputParams;

                if ( errors && errors.length > 0 ){
                    LABKEY.ext.ISCore.onFailure({
                        exception: errors.join('\n')
                    });
                } else {
                    var p = outputParams[0];

                    cntReport.update( p.value );
                    cntEmptyPnlView.setVisible( false );
                    cntReport.setVisible( true );

                    pnlTabs.setActiveTab( 1 );
                }
            }
        };


        /////////////////////////////////////
        //  Panels, Containers, Components //
        /////////////////////////////////////

        var tlbrButtons = new Ext.Toolbar({
            defaults: {
                style: 'padding-top: 1px; padding-bottom: 1px;',
                width: 45
            },
            enableOverflow: true,
            items: [ btnRun ],
            style: 'padding-right: 2px; padding-left: 2px;'
        });

        var pnlInput = new Ext.form.FormPanel({
            bodyStyle: { paddingTop: '1px' },
            defaults: {
                autoHeight: true,
                forceLayout: true,
                hideMode: 'offsets'
            },
            deferredRender: false,
            items: [
                //Info message at the top
                {<commit_msg>Render HTMLWidgets in MonitorIS.js<commit_after>Ext.namespace('LABKEY.ext');

LABKEY.ext.MonitorIS = Ext.extend( Ext.Panel, {

    constructor : function(config) {

        /////////////////////////////////////
        //            Variables            //
        /////////////////////////////////////

        var
            me                  = this,
            maskReport          = undefined,
            fieldWidth          = 240,
            flagCohortSelect    = undefined
            ;
        // Help strings
        var plotType_help = 'The type of plot: barplots and line are available.'

        // Stores
        var strPlotType = new Ext.data.ArrayStore({
            data: [
                [ 'Barplot', 'bar' ],
                [ 'Lineplot', 'line' ]
            ],
            fields: [ 'display', 'value' ]
        });

        // Dropdown
        var cbPlotType = new Ext.ux.form.ExtendedComboBox({
            allowBlank: false,
            displayField: 'display',
            fieldLabel: 'Plot type',
            id: 'cbPlotType',
            lazyInit: false,
            store: strPlotType,
            value: 'bar',
            valueField: 'value',
            width: fieldWidth
        });
        var startDate = new Ext.form.DateField({
            fieldLabel: 'From',
            width: fieldWidth
        });
        var endDate = new Ext.form.DateField({
            fieldLabel: 'To',
            width: fieldWidth,
            value: new Date()
        });

        /////////////////////////////////////
        //    Buttons and Radio Groups     //
        /////////////////////////////////////

        var btnRun = new Ext.Button({
            disabled: false,
            handler: function(){
                cnfReport.inputParams = {
                    plotType: cbPlotType.getValue(),
                    from: startDate.getValue(),
                    to: endDate.getValue()
                };
                setReportRunning( true );
                LABKEY.Report.execute( cnfReport );
            },
            text: 'Run'
        });


        /////////////////////////////////////
        //      Back-end Configuration     //
        /////////////////////////////////////

        var cnfReport = {
            failure: function( errorInfo, options, responseObj ){
                setReportRunning( false );

                LABKEY.ext.ISCore.onFailure( errorInfo, options, responseObj );
            },
            reportId: 'module:MonitorIS/MonitorIS.Rmd',
            success: function( result ){
                setReportRunning( false );

                var errors = result.errors;
                var outputParams = result.outputParams;

                if ( errors && errors.length > 0 ){
                    LABKEY.ext.ISCore.onFailure({
                        exception: errors.join('\n')
                    });
                } else {
                    var p = outputParams[0];

                    cntReport.update( p.value );
                    cntEmptyPnlView.setVisible( false );
                    cntReport.setVisible( true );

                    pnlTabs.setActiveTab( 1 );
                    
                    window.HTMLWidgets.staticRender();
                }
            }
        };


        /////////////////////////////////////
        //  Panels, Containers, Components //
        /////////////////////////////////////

        var tlbrButtons = new Ext.Toolbar({
            defaults: {
                style: 'padding-top: 1px; padding-bottom: 1px;',
                width: 45
            },
            enableOverflow: true,
            items: [ btnRun ],
            style: 'padding-right: 2px; padding-left: 2px;'
        });

        var pnlInput = new Ext.form.FormPanel({
            bodyStyle: { paddingTop: '1px' },
            defaults: {
                autoHeight: true,
                forceLayout: true,
                hideMode: 'offsets'
            },
            deferredRender: false,
            items: [
                //Info message at the top
                {
{'fraction_non_alphanumeric': 0.16441077859182912, 'fraction_numerical': 0.0032286104557307837, 'mean_word_length': 0.9217370555953233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6928434', 'n_tokens_mistral': 1954, 'n_tokens_neox': 1805, 'n_words': 410}