<template name="fileManagement">
    {{> pageHeading title='File Management' }}

    {{#if isConnected}}
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>File management for {{getConnection.name}}</h5>
                        </div>
                        <div class="ibox-content">
                            <form class="form-horizontal">
                                <div class="form-group">
                                    <label class="col-lg-1 control-label">Bucket Name</label>
                                    <div class="col-lg-11">
                                        <input id="txtBucketName" type="text" class="form-control"
                                               value="fs">
                                    </div>
                                </div>

                                {{>uploadFile}}

                                <div class="form-group">
                                    <div class="col-sm-12">
                                        <button id="btnReloadFiles"
                                                class="btn btn-block btn-outline btn-primary ladda-button"
                                                type="button"
                                                data-style="contract">
                                            <strong>Reload</strong></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>Files</h5>
                        </div>
                        <div class="ibox-content">
                            <div class="dataTables_wrapper form-inline dt-bootstrap">
                                <table id="tblFiles"
                                       class="table table-striped table-bordered table-hover dataTables-example dataTable">
                                    <thead>
                                    <tr>
                                        <th>Id</th>
                                        <th>File name</th>
                                        <th>Chunk size</th>
                                        <th>Upload date</th>
                                        <th>Length</th>
                                        <th>Full File Info</th>
                                        <th>Download</th>
                                        <th>Delete</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <!-- MODAL show meta data-->
        <div class="modal inmodal" id="metaDataModal" tabindex="-1" role="dialog" aria-hidden="true"
             style="display: none;">
            <div class="modal-dialog">
                <div class="modal-content animated flipInY">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                                class="sr-only">Close</span></button>
                        <h4 class="modal-title">Full File Information</h4>
                        <small class="font-bold">contentType, metadata, aliases
                        </small>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div id="jsonEditorOfMetadata" style="width: 100%;height:500px" class="col-lg-12">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button id="btnClose"
                                class="btn btn-block btn-outline btn-primary ladda-button"
                                type="button"
                                data-style="contract"
                                data-dismiss="modal">
                            <strong>Close</strong></button>
                    </div>
                </div>
            </div>
        </div>

        {{> fileInfo}}
    {{/if}}

</template>