<commit_before>Ext.ns("org.systemsbiology.addama.js");

org.systemsbiology.addama.js.AjaxMonitor = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AjaxMonitor.superclass.constructor.call(this);

        this.createGrid();
        Ext.Ajax.on('requestcomplete', this.addResponseToGrid, this);
    },

    createGrid: function() {
        this.gridData = [];

        var gridColumns = [
            { header: "Sequence", width: 25, dataIndex: 'sequence', type: "int", sortable: true },
            { header: "URI", width: 25, dataIndex: 'uri', sortable: true },
            { header: "Date", width: 25, dataIndex: 'sentAt', type: "date", sortable: true, renderer: Ext.util.Format.dateRenderer() },
            { header: "Status Code", width: 25, dataIndex: 'statusCode', sortable: true },
            { header: "Status Text", width: 25, dataIndex: 'statusText' }
        ];
        var storeColumns = [
            { name: "sequence", type: "int"},
            { name: "uri" },
            { name: "sentAt", type: "date" },
            { name: "statusCode" },
            { name: "statusText" },
            { name: "responseText" }
        ];

        this.store = new Ext.data.ArrayStore({
            storeId: "store-ajax-monitor",
            reader: new Ext.data.ArrayReader({}, storeColumns),
            data: this.gridData,
            sortInfo: {field: 'sequence', direction: "DESC"}
        });

        this.grid = new Ext.grid.GridPanel({
            store: this.store,
            columns: gridColumns,
            stripeRows: true,
            columnLines: true,
            frame:true,
            title: "Requests",
            collapsible: false,
            animCollapse: false,
            iconCls: 'icon-grid',
            contentEl: this.contentEl,
            listeners: {
                rowclick: function(g, rowIndex, e) {
                    console.log("rowclick=" + rowIndex);
                }
            }
        });

    },

    addResponseToGrid: function(connection, response) {
         this.gridData.push([ this.incrementedId(), connection.url, new Date(), response.status, response.statusText, response.responseText ]);
    },

    incrementedId: function() {
        if (!this.sequenceId) {
            this.sequenceId = 1;
        } else {<commit_msg>fixing adding grid to panel, adding display of response<commit_after>Ext.ns("org.systemsbiology.addama.js");

org.systemsbiology.addama.js.AjaxMonitor = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AjaxMonitor.superclass.constructor.call(this);

        this.createGrid();
        Ext.Ajax.on('requestcomplete', this.addResponseToGrid, this);
    },

    createGrid: function() {
        var gridColumns = [
            { header: "Sequence", width: 25, dataIndex: 'sequence', type: "int", sortable: true },
            { header: "URI", width: 25, dataIndex: 'uri', sortable: true },
            { header: "Date", width: 25, dataIndex: 'sentAt', type: "date", sortable: true, renderer: Ext.util.Format.dateRenderer() },
            { header: "Status Code", width: 25, dataIndex: 'statusCode', sortable: true },
            { header: "Status Text", width: 25, dataIndex: 'statusText' }
        ];
        var storeColumns = [
            { name: "sequence", type: "int"},
            { name: "uri" },
            { name: "sentAt", type: "date" },
            { name: "statusCode" },
            { name: "statusText" },
            { name: "responseText" }
        ];

        this.store = new Ext.data.ArrayStore({
            storeId: "store-ajax-monitor",
            reader: new Ext.data.ArrayReader({}, storeColumns),
            data: [],
            sortInfo: {field: 'sequence', direction: "DESC"}
        });

        var grid = new Ext.grid.GridPanel({
            region: "center",
            store: this.store,
            columns: gridColumns,
            stripeRows: true,
            columnLines: true,
            frame:true,
            title: "Requests",
            collapsible: false,
            animCollapse: false,
            iconCls: 'icon-grid'
        });
        grid.on("rowclick", this.showResponseContent, this);

        this.responseContent = new Ext.Panel({ title: "Response Content", region: "south" });

        new Ext.Panel({
            layout: "border",
            items: [ grid, this.responseContent ]
        });
    },

    addResponseToGrid: function(connection, response) {
        this.store.add(new Ext.data.Record({
            "id": this.incrementedId(),
            "uri": connection.url,
            "sentAt": new Date(),
            "statusCode": response.status,
            "statusText": response.statusText,
            "responseText": response.responseText
        }));
    },

    showResponseContent: function(g, rowIndex, e) {
        this.responseContent.removeAll();
        this.responseContent.add({html:"rowIndex=" + rowIndex});
    },

    incrementedId: function() {
        if (!this.sequenceId) {
            this.sequenceId = 1;
        } else {
{'fraction_non_alphanumeric': 0.14130855594270228, 'fraction_numerical': 0.004258614014711576, 'mean_word_length': 2.011072261072261, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '7589996', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1433, 'n_words': 320}