Commit 33b1de0d authored by ibuler's avatar ibuler

[Update] 优化一下

parent bcfe82f1
...@@ -263,7 +263,10 @@ function execute() { ...@@ -263,7 +263,10 @@ function execute() {
var editor; var editor;
$(document).ready(function(){ $(document).ready(function(){
systemUserId = $('#system-users-select').val(); systemUserId = $('#system-users-select').val();
$(".select2").select2().on('select2:select', function(evt) { $(".select2").select2({
dropdownAutoWidth : true,
width: 'auto'
}).on('select2:select', function(evt) {
var data = evt.params.data; var data = evt.params.data;
systemUserId = data.id; systemUserId = data.id;
initTree(); initTree();
......
...@@ -3,6 +3,18 @@ ...@@ -3,6 +3,18 @@
{% load static %} {% load static %}
{% load common_tags %} {% load common_tags %}
{% block custom_head_css_js %}
<link href="{% static "css/plugins/footable/footable.core.css" %}" rel="stylesheet">
<link href="{% static 'css/plugins/datepicker/datepicker3.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
<style>
#search_btn {
margin-bottom: 0;
}
</style>
{% endblock %}
{% block content_left_head %} {% block content_left_head %}
{% endblock %} {% endblock %}
...@@ -39,46 +51,49 @@ ...@@ -39,46 +51,49 @@
</form> </form>
{% endblock %} {% endblock %}
{% block table_head %} {% block table_container %}
<th class="text-center"></th> <table class="footable table table-stripped table-bordered toggle-arrow-tiny" data-page="false" >
<th class="text-center">{% trans 'Hosts' %}</th> <thead>
<th class="text-center">{% trans 'User' %}</th> <th class="text-center"></th>
<th class="text-center">{% trans 'Command' %}</th> <th class="text-center">{% trans 'Hosts' %}</th>
<th class="text-center">{% trans 'Run as' %}</th> <th class="text-center">{% trans 'User' %}</th>
<th class="text-center">{% trans 'Output' %}</th> <th class="text-center">{% trans 'Command' %}</th>
<th class="text-center">{% trans 'Finished' %}</th> <th class="text-center">{% trans 'Run as' %}</th>
<th class="text-center">{% trans 'Success' %}</th> <th class="text-center">{% trans 'Output' %}</th>
<th class="text-center">{% trans 'Date start' %}</th> <th class="text-center">{% trans 'Finished' %}</th>
<th class="text-center">{% trans 'Date finished' %}</th> <th class="text-center">{% trans 'Success' %}</th>
{% endblock %} <th class="text-center">{% trans 'Date start' %}</th>
</thead>
{% block table_body %} <tbody>
{% for object in object_list %} {% for object in object_list %}
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center"><input type="checkbox" class="cbx-term"></td> <td>{{ forloop.counter }}</td>
<td class="text-center hosts">{{ object.get_hosts_names }}</td> <td class="text-center hosts" value="{{ object.get_hosts_names }}"></td>
<td class="text-center">{{ object.user }}</td> <td class="text-center">{{ object.user.name }}</td>
<td class="text-center">{{ object.command| truncatechars:16 }}</td> <td class="text-center">{{ object.command| truncatechars:16 }}</td>
<td class="text-center">{{ object.run_as }}</td> <td class="text-center">{{ object.run_as.username }}</td>
<td class="text-center"><a href="{% url "ops:celery-task-log" pk=object.id %}" target="_blank">查看</a></td> <td class="text-center"><a href="{% url "ops:celery-task-log" pk=object.id %}" target="_blank">查看</a></td>
<td class="text-center">{{ object.is_finished | state_show | safe }}</td> <td class="text-center">{{ object.is_finished | state_show | safe }}</td>
<td class="text-center">{{ object.is_success | state_show | safe }}</td> <td class="text-center">{{ object.is_success | state_show | safe }}</td>
<td class="text-center">{{ object.date_start }}</td> <td class="text-center">{{ object.date_start }}</td>
<td class="text-center">{{ object.date_finished }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table>
{% endblock %} {% endblock %}
{% block custom_foot_js %} {% block custom_foot_js %}
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script> <script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script src="{% static "js/plugins/footable/footable.all.min.js" %}"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('table').DataTable({ {#$('table').DataTable({#}
"searching": false, {# "searching": false,#}
"paging": false, {# "paging": false,#}
"bInfo" : false, {# "bInfo" : false,#}
"order": [] {# "order": []#}
}); {# });#}
{#$('.footable').footable();#}
$('.select2').select2({ $('.select2').select2({
dropdownAutoWidth : true, dropdownAutoWidth : true,
width: 'auto' width: 'auto'
...@@ -92,7 +107,7 @@ $(document).ready(function() { ...@@ -92,7 +107,7 @@ $(document).ready(function() {
autoclose: true autoclose: true
}); });
$(".hosts").each(function (i) { $(".hosts").each(function (i) {
var data = $(this).text(); var data = $(this).attr('value');
var data_list = data.split(","); var data_list = data.split(",");
if (data_list.length === 1 && data_list[0] === "") { if (data_list.length === 1 && data_list[0] === "") {
data_list.pop(); data_list.pop();
...@@ -101,7 +116,6 @@ $(document).ready(function() { ...@@ -101,7 +116,6 @@ $(document).ready(function() {
$(this).html(html); $(this).html(html);
}); });
$('[data-toggle="popover"]').popover(); $('[data-toggle="popover"]').popover();
}) })
</script> </script>
{% endblock %} {% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment