<commit_before><html>

<head>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> </link>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"></link>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
</head>

<body>
    <div class="tabContent table-responsive" id="instanceListDiv">
        <table class="table table-hover table-bordered text-center" id="instanceLogTable">
            <thead>
                <tr>
                    <th class="text-center">InstanceId</th>
                    <th class="text-center">Provider</th>
                    <th class="text-center">OS</th>
                    <th class="text-center">Time</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Size</th>
                    <th class="text-center">User</th>
                    <th class="text-center">Org</th>
                    <th class="text-center">BU</th>
                    <th class="text-center">Project</th>
                    <th class="text-center">Environment</th>
                    <th class="text-center">Data</th>
                    <th class="text-center">Log</th>
                </tr>
            </thead>
            <tbody class="instanceLogTrail">
            </tbody>
        </table>
    </div>
    <script>
    $(document).ready(function(e) {
        if (!$.fn.dataTable.isDataTable('#instanceLogTable')) {
            var $instanceLogDatatable = $('#instanceLogTable').DataTable({
                "pagingType": "full_numbers",
                "bInfo": true,
                "bLengthChange": true,
                "paging": true,
                "bFilter": true,
                "aoColumns": [{
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }, {
                    "bSortable": false
                }]

            });
        }
        getInstances();
    });

    function createInstanceLogTable(managnedData) {
        $instanceLogDatatable.clear().draw();
        var $tbody = $('#instanceLogTrail tbody').empty();
        for (var i = 0; i < managnedData.length; i++) {
            var $tr = $('<tr class="instanceLogTrail"></tr>').attr('data-id', managnedData[i]._id);
            var $tdId = $('<td></td>').append(managnedData[i].platformId);
            $tr.append($tdId);

            var $tdOs = $('<td></td>').append(managnedData.managedInstances[i].hardware.os);
            $tr.append($tdOs);

            var $tdIpAddress = $('<td></td>').append(managnedData.managedInstances[i].instanceIP);
            $tr.append($tdIpAddress);

            var region = managnedData.managedInstances[i].region;
            var $tdRegion = $('<td></td>').append(region);
            $tr.append($tdRegion);
            var $tdStatus = $('<td></td>').append(managnedData.managedInstances[i].instanceState);
            $tr.append($tdStatus);

            var $projectName = $('<td></td>').append(managnedData.managedInstances[i].projectName);
            $tr.append($projectName);
            var $environmentName = $('<td></td>').append(managnedData.managedInstances[i].environmentName);
            $tr.append($environmentName);

            //var $button = '';

            /*if (managnedData.managedInstances[i].instanceState === 'terminated') {

                $button = $('<div class="btn-group marginleft14"><button class="btn btn-danger pull-left btn-sg tableactionbutton globalTrackUrlRemove" data-placement="top" value="Remove" title="Delete"><i class="ace-icon fa fa-trash-o bigger-120"></i></button></div>');
                $button.click(function() {
                    var $this = $(this);
                    var $tr = $this.parents('tr.managedInstance');
                    var id = $this.parents('tr').attr('data-id');
                    bootbox.confirm({
                        message: 'Are you sure you want to Delete Managed Instance -&nbsp;',
                        title: "Warning",
                        callback: function(result) {
                            if (result) {
                                $.ajax({
                                    url: '/instances/' + id,
                                    method: 'DELETE',
                                    success: function() {
                                        $instanceManagedDatatable.row($tr).remove().draw(false);
                                    },
                                    error: function(jxhr) {
                                        bootbox.alert(result);
                                        var msg = "Unable to Delete Managed Instances please try again later";
                                        if (jxhr.responseJSON && jxhr.responseJSON.message) {
                                            msg = jxhr.responseJSON.message;
                                        } else if (jxhr.responseText) {
                                            msg = jxhr.responseText;
                                        }
                                        bootbox.alert(msg);
                                    }
                                });
                            } else {
                                return;
                            }
                        }
                    });
                    return false;
                });
            }*/
            var $tdAction = $('<td></td>').append($button);
            $tr.append($tdAction);
            $tbody.append($tr);
            $instanceLogDatatable.row.add($tr).draw();
        }
    }

    function getInstances() {
        $.get('/instances', function(instances) {
            createInstanceLogTable(instances);
        }).fail(function(jxhr) {
            var msg = "Unable to fetch Instances.";
            if (jxhr.responseJSON && jxhr.responseJSON.message) {
                msg = jxhr.responseJSON.message;
            } else if (jxhr.responseText) {
                msg = jxhr.responseText;
            }
            bootbox.alert(msg);<commit_msg>Integration UI code for instance log<commit_after><html>

<head>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> </link>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"></link>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
</head>

<body>
    <div class="tabContent table-responsive" id="instanceListDiv">
        <table class="table table-hover table-bordered text-center" id="instanceLogTable">
            <thead>
                <tr>
                    <th class="text-center">InstanceId</th>
                    <th class="text-center">Provider</th>
                    <th class="text-center">OS</th>
                    <th class="text-center">Time</th>
                    <th class="text-center">Status</th>
                    <th class="text-center">Size</th>
                    <th class="text-center">User</th>
                    <th class="text-center">Org</th>
                    <th class="text-center">BU</th>
                    <th class="text-center">Project</th>
                    <th class="text-center">Environment</th>
                    <th class="text-center">Data</th>
                    <th class="text-center">Log</th>
                </tr>
            </thead>
            <tbody class="instanceLogTrail">
            </tbody>
        </table>
    </div>
    <script>
    if (!$.fn.dataTable.isDataTable('#instanceLogTable')) {
        var $instanceLogDatatable = $('#instanceLogTable').DataTable({
            "pagingType": "full_numbers",
            "bInfo": true,
            "bLengthChange": true,
            "paging": true,
            "bFilter": true,
            "aoColumns": [{
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }, {
                "bSortable": false
            }]

        });
    }
    $(document).ready(function(e) {
        getInstances();
    });

    function createInstanceLogTable(managnedData) {
        $instanceLogDatatable.clear().draw();
        var $tbody = $('#instanceLogTrail tbody').empty();
        for (var i = 0; i < managnedData.length; i++) {
            var $tr = $('<tr class="instanceLogTrail"></tr>').attr('data-id', managnedData[i]._id);
            var $tdId = $('<td></td>').append(managnedData[i].platformId);
            $tr.append($tdId);
            var $tdProvider = $('<td></td>').append(managnedData[i].providerId);
            $tr.append($tdProvider);
            var $tdOs = $('<td></td>').append(managnedData[i].hardware.os);
            $tr.append($tdOs);
            var createdOn = managnedData[i].createdOn;
            var $tdCreatedOn = $('<td></td>').append(createdOn);
            $tr.append($tdCreatedOn);
            var $tdStatus = $('<td></td>').append(managnedData[i].instanceState);
            $tr.append($tdStatus);

            var $tdSize = $('<td></td>').append(managnedData[i].instanceType);
            $tr.append($tdSize);
            var $tdUser = $('<td></td>').append(managnedData[i].catUser);
            $tr.append($tdUser);
            var $tdOrg = $('<td></td>').append(managnedData[i].orgName);
            $tr.append($tdOrg);
            var $tdBG = $('<td></td>').append(managnedData[i].bgName);
            $tr.append($tdBG);

            var $projectName = $('<td></td>').append(managnedData[i].projectName);
            $tr.append($projectName);
            var $environmentName = $('<td></td>').append(managnedData[i].environmentName);
            $tr.append($environmentName);

            var $tdData = $('<td></td>').append(managnedData[i].runlist);
            $tr.append($tdData);
            var $tdLog = $('<td></td>').append(managnedData[i].instanceState);
            $tr.append($tdLog);

            //var $button = '';

            /*if (managnedData.managedInstances[i].instanceState === 'terminated') {

                $button = $('<div class="btn-group marginleft14"><button class="btn btn-danger pull-left btn-sg tableactionbutton globalTrackUrlRemove" data-placement="top" value="Remove" title="Delete"><i class="ace-icon fa fa-trash-o bigger-120"></i></button></div>');
                $button.click(function() {
                    var $this = $(this);
                    var $tr = $this.parents('tr.managedInstance');
                    var id = $this.parents('tr').attr('data-id');
                    bootbox.confirm({
                        message: 'Are you sure you want to Delete Managed Instance -&nbsp;',
                        title: "Warning",
                        callback: function(result) {
                            if (result) {
                                $.ajax({
                                    url: '/instances/' + id,
                                    method: 'DELETE',
                                    success: function() {
                                        $instanceManagedDatatable.row($tr).remove().draw(false);
                                    },
                                    error: function(jxhr) {
                                        bootbox.alert(result);
                                        var msg = "Unable to Delete Managed Instances please try again later";
                                        if (jxhr.responseJSON && jxhr.responseJSON.message) {
                                            msg = jxhr.responseJSON.message;
                                        } else if (jxhr.responseText) {
                                            msg = jxhr.responseText;
                                        }
                                        bootbox.alert(msg);
                                    }
                                });
                            } else {
                                return;
                            }
                        }
                    });
                    return false;
                });
            }*/
            //var $tdAction = $('<td></td>').append($button);
            //$tr.append($tdAction);
            $tbody.append($tr);
            $instanceLogDatatable.row.add($tr).draw();
        }
    }

    function getInstances() {
        $.get('/instances', function(instances) {
            createInstanceLogTable(instances);
        }).fail(function(jxhr) {
            var msg = "Unable to fetch Instances.";
            if (jxhr.responseJSON && jxhr.responseJSON.message) {
                msg = jxhr.responseJSON.message;
            } else if (jxhr.responseText) {
                msg = jxhr.responseText;
            }
            bootbox.alert(msg);
{'fraction_non_alphanumeric': 0.14930863020230228, 'fraction_numerical': 0.003950684558272597, 'mean_word_length': 1.3540163540163541, 'pattern_counts': {'":': 38, '<': 169, '<?xml version=': 0, '>': 167, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 42, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7041413', 'n_tokens_mistral': 3982, 'n_tokens_neox': 3787, 'n_words': 588}