<commit_before><div>
    <h2>Database</h2>
    <div class="row" style="margin-bottom:20px">
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#createDbModal">
            Create Database
        </button>
    </div>
    <div class="row">
        <div id="treeview"></div>
    </div>
</div>

<div class="modal fade" id="createDbModal" tabindex="-1" role="dialog" aria-labelledby="createDbModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Create Database</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label for="dbnameInput">Name</label>
                        <input type="text" class="form-control" id="dbnameInput" placeholder="Database name">
                    </div>
                    <div class="form-group">
                        <label for="paramsInput">Params</label>
                        <textarea id="paramsInput" class="form-control">{}</textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" id="createDbBtn">Create</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="modalInfoDb" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="modalInfoDbLabel"></h4>
            </div>
            <div class="modal-body">
                <div>
                    <ul class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active">
                            <a href="#config" aria-controls="config" role="tab" data-toggle="tab">Configuration</a>
                        </li>
                        <li role="presentation">
                            <a href="#statistics" aria-controls="statistics" role="tab" data-toggle="tab">Statistics</a>
                        </li>
                        <li role="presentation">
                            <a href="#upload" aria-controls="upload" role="tab" data-toggle="tab">Upload</a>
                        </li>
                        <li role="presentation">
                            <a href="#imginfo" aria-controls="imginfo" role="tab" data-toggle="tab">Image Information</a>
                        </li>
                    </ul>

                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane active" id="config">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered" border="1" id="tblInfoCfg">
                                    <thead>
                                        <td>Key</td>
                                        <td>Value</td>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="statistics">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered" border="1" id="tblInfoStatistic">
                                    <thead>
                                        <td>Key</td>
                                        <td>Value</td>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="upload">
                            <form>
                                <div class="form-group">
                                    <label for="frmFile">Image</label>
                                    <input type="file" class="form-control" id="frmFile">
                                </div>
                                <div class="form-group">
                                    <label for="frmKey">Key</label>
                                    <input type="text" class="form-control" id="frmKey" placeholder="Image key" value="key1">
                                </div>
                                <div class="form-group">
                                    <label for="frmScript">Upsert</label>
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" id="frmUpsert"> Upsert
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="frmScript">Script</label>
                                    <input type="text" class="form-control" id="frmScript" placeholder="Script" value="grayscale">
                                </div>
                                <button type="button" id="btnUpload" class="btn btn-default">Send</button>
                            </form>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="imginfo">
                            <form class="form-inline">
                                <div class="form-group">
                                    <label class="sr-only" for="imgKey">Image key</label>
                                    <input type="text" class="form-control" id="imgKey" placeholder="Image key">
                                </div>
                                <button type="button" class="btn btn-default" id="btnImageInfo">Search</button>

                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered" border="1" id="tblInfoImage">
                                        <thead>
                                            <td>Key</td>
                                            <td>Value</td>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" id="btnDropDb">Drop Database</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script>
    var _currentDb = null;

    Client.getClient().showDatabases().success(function(r) {
        var nodes = r.content._all.map(function(o) {
            return {
                text: o
            }
        });
        $('#treeview').treeview({
            data: [{
                text: "localhost",
                nodes: nodes
            }],
            onNodeSelected: function(event, data) {
                _currentDb = data.text;
                Client.showInfoModal(data.text);
            }
        });

        $('#createDbBtn').click(function() {
            Client.getClient().createDatabase($('#dbnameInput').val(), $('#paramsInput').val())
                .success(function() {
                    alert('Database created');
                }).error(function() {
                    alert('Could not create database');
                });
        });

        $('#btnUpload').click(function() {
            Client.getClient().uploadImage(_currentDb, $('#frmKey').val(), $('#frmFile'), {
                    upsert: $('#frmUpsert').is(":checked"),
                    script: $('#frmScript').val()
                })
                .success(function() {
                    alert('Image sent');
                }).error(function(r) {
                    alert('Could send image: ' + r.responseJSON.error.join("\n"));
                });
        });

        $('#btnImageInfo').click(function() {
            Client.getClient().imageInfo(_currentDb, $('#imgKey').val())
                .success(function(r) {
                    Object.keys(r.content.data).forEach(function(key) {
                        $('#tblInfoImage').find('tbody')
                            .append('<tr><td>' + key + '</td><td>' + r.content.data[key] + '</td></tr>');
                    });
                }).error(function(r) {
                    alert('Could get image info: ' + r.responseJSON.error.join("\n"));
                });
        });

        $('#btnDropDb').click(function() {
            if (confirm("Press a button") == true) {
                Client.getClient().dropDatabase(_currentDb).success(function(r) {
                    $('#modalInfoDb').modal('hide');
                }).error(function(xhr) {
                    if (xhr.status == 404) {
                        self.changePage('database');
                        return;
                    }
                    alert('Could not drop database')
                });
            }
        });
    });
</script><commit_msg>Update database.html<commit_after><div>
    <h2>Database</h2>
    <div class="row" style="margin-bottom:20px">
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#createDbModal">
            Create Database
        </button>
    </div>
    <div class="row">
        <div id="treeview"></div>
    </div>
</div>

<div class="modal fade" id="createDbModal" tabindex="-1" role="dialog" aria-labelledby="createDbModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Create Database</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label for="dbnameInput">Name</label>
                        <input type="text" class="form-control" id="dbnameInput" placeholder="Database name">
                    </div>
                    <div class="form-group">
                        <label for="paramsInput">Params</label>
                        <textarea id="paramsInput" class="form-control">{}</textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" id="createDbBtn">Create</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="modalInfoDb" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="modalInfoDbLabel"></h4>
            </div>
            <div class="modal-body">
                <div>
                    <ul class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active">
                            <a href="#config" aria-controls="config" role="tab" data-toggle="tab">Configuration</a>
                        </li>
                        <li role="presentation">
                            <a href="#statistics" aria-controls="statistics" role="tab" data-toggle="tab">Statistics</a>
                        </li>
                        <li role="presentation">
                            <a href="#upload" aria-controls="upload" role="tab" data-toggle="tab">Upload</a>
                        </li>
                        <li role="presentation">
                            <a href="#imginfo" aria-controls="imginfo" role="tab" data-toggle="tab">Image Information</a>
                        </li>
                    </ul>

                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane active" id="config">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered" border="1" id="tblInfoCfg">
                                    <thead>
                                        <td>Key</td>
                                        <td>Value</td>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="statistics">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered" border="1" id="tblInfoStatistic">
                                    <thead>
                                        <td>Key</td>
                                        <td>Value</td>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="upload">
                            <form>
                                <div class="form-group">
                                    <label for="frmFile">Image</label>
                                    <input type="file" class="form-control" id="frmFile">
                                </div>
                                <div class="form-group">
                                    <label for="frmKey">Key</label>
                                    <input type="text" class="form-control" id="frmKey" placeholder="Image key" value="key1">
                                </div>
                                <div class="form-group">
                                    <label for="frmScript">Upsert</label>
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" id="frmUpsert"> Upsert
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="frmScript">Script</label>
                                    <input type="text" class="form-control" id="frmScript" placeholder="Script" value="grayscale">
                                </div>
                                <button type="button" id="btnUpload" class="btn btn-default">Send</button>
                            </form>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="imginfo">
                            <form class="form-inline">
                                <div class="form-group">
                                    <label class="sr-only" for="imgKey">Image key</label>
                                    <input type="text" class="form-control" id="imgKey" placeholder="Image key">
                                </div>
                                <button type="button" class="btn btn-default" id="btnImageInfo">Search</button>

                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered" border="1" id="tblInfoImage">
                                        <thead>
                                            <td>Key</td>
                                            <td>Value</td>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" id="btnDropDb">Drop Database</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script>
    var _currentDb = null;

    Client.getClient().showDatabases().success(function(r) {
        var nodes = r.content._all.map(function(o) {
            return {
                text: o
            }
        });
        $('#treeview').treeview({
            data: [{
                text: "localhost",
                nodes: nodes
            }],
            onNodeSelected: function(event, data) {
                _currentDb = data.text;
                Client.showInfoModal(data.text);
            }
        });

        $('#createDbBtn').click(function() {
            Client.getClient().createDatabase($('#dbnameInput').val(), $('#paramsInput').val())
                .success(function() {
                    alert('Database created');
                }).error(function() {
                    alert('Could not create database');
                });
        });

        $('#btnUpload').click(function() {
            Client.getClient().uploadImage(_currentDb, $('#frmKey').val(), $('#frmFile'), {
                    upsert: $('#frmUpsert').is(":checked"),
                    script: $('#frmScript').val()
                })
                .success(function() {
                    alert('Image sent');
                }).error(function(r) {
                    alert('Could send image: ' + r.responseJSON.error.join("\n"));
                });
        });

        $('#btnImageInfo').click(function() {
            Client.getClient().imageInfo(_currentDb, $('#imgKey').val())
                .success(function(r) {
                    Object.keys(r.content.data).forEach(function(key) {
                        $('#tblInfoImage').find('tbody')
                            .append('<tr><td>' + key + '</td><td>' + r.content.data[key] + '</td></tr>');
                    });
                }).error(function(r) {
                    alert('Could get image info: ' + r.responseJSON.error.join("\n"));
                });
        });

        $('#btnDropDb').click(function() {
            if (confirm("Drop " + _currentDb + " ?") == true) {
                Client.getClient().dropDatabase(_currentDb).success(function(r) {
                    $('#modalInfoDb').modal('hide');
                }).error(function(xhr) {
                    if (xhr.status == 404) {
                        self.changePage('database');
                        return;
                    }
                    alert('Could not drop database')
                });
            }
        });
    });
</script>
{'fraction_non_alphanumeric': 0.13966983491745874, 'fraction_numerical': 0.0017008504252126063, 'mean_word_length': 1.061990716864363, 'pattern_counts': {'":': 2, '<': 363, '<?xml version=': 0, '>': 363, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 76, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1970830', 'n_tokens_mistral': 4782, 'n_tokens_neox': 4512, 'n_words': 803}