Nathan Chen b7a0f46685 Collect filesystem initial commit
This tool is used for storing large collect files when reporting bugs
via Launchpad. Simply use the tool to upload a file and then add its URL
location into the Launchpad bug.  You no longer need to split up large
collect files and attach multiple files to your bugs.
This tool is designed using Flask Web Framework, meanwhile docker is
used for easy deployment.
The directory /app holds the Flask application, /db contains the script
for database initialization. Bash file start.sh includes the commands
used for the first time docker deployment.
The file update.sh let developers push their changes to the docker
repository. Change the repository's name and tag accordingly, in this
case it is nchen1windriver/collect and demo.
A config file was added for security purpose in this commit.

Change-Id: I192c3fca541f99773e0395418a9f11e01c27a5a7
Signed-off-by: Nathan Chen <nathan.chen@windriver.com>
2020-02-21 14:57:37 -06:00

73 lines
3.1 KiB
HTML

{% extends "layout.html" %}
{% block body %}
<!--<script type=text/javascript">-->
<!-- function ConfirmDelete(elem) {-->
<!-- document.getElementById("demo").innerHTML = "Hello World";-->
<!-- localStorage.setItem('deleteId', $(elem).attr('data-id'));-->
<!-- $('#deleteModal').modal();-->
<!--}-->
<!--</script>-->
<h2>Files</h2>
<div>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search this blog" id="search_input_label">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" onclick="search();">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
{% if user_files|length %}
<table class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Launchpad</th>
<th onclick="revert();" style="cursor: pointer;" title="Click to sort the files by launchpad id">
LP Files <i id="table_order" class="fa fa-caret-square-o-down"></i>
</th>
<th>Last Modified</th>
<th></th>
</tr>
</thead>
{% for user_file in user_files %}
<tr>
<td><a href="{{ url_for('download_file', file_id=user_file['id']) }}">{{ user_file['name'] }}</a></td>
<td>{{ user_file['title'] }}</td>
<td>
<a href="{{ url_for('list_files_under_a_launchpad', launchpad_id=user_file['launchpad_id']) }}">#{{ user_file['launchpad_id'] }}</a>
</td>
<td>{{ user_file['modified_date'] }} </td>
<td>
<!-- <span><a data-id=${user_file['id']} onclick="file_id(this)" >Edit</a></span>-->
<button data-id="{{ user_file['id'] }}" class="btn btn-secondary btn-sm" onclick="window.location.href=`{{ url_for('edit_file', file_id=user_file['id']) }}`">
Edit
</button>
<!-- <span><a data-id=${Id} onclick="ConfirmDelete(this)" ><span class="glyphicon glyphicon-trash"></span></a></span>-->
<!-- <span><a href="{{ url_for('delete_file', file_id=user_file['id']) }}">Delete</a></span>-->
<button data-id="{{ user_file['id'] }}" onclick="ConfirmDelete(this)" class="btn btn-danger btn-sm" >Delete</button>
</td>
</tr>
{% endfor %}
</table>
{% else %}
<div>You have not upload anything yet</div>
{% endif %}
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="text-align:center;">
<h4 class="modal-title" style="color:red;" id="deleteModalLabel">Are you sure you want to delete this file?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" onclick="Delete()">Delete</button>
</div>
</div>
</div>
</div>
<script type=text/javascript src="{{url_for('static', filename='main.js') }}"></script>
{% endblock %}