2016-09-17 15:43:41 +00:00
|
|
|
{% extends '_base_list.html' %}
|
2016-11-06 13:29:04 +00:00
|
|
|
{% load i18n static %}
|
2016-11-06 16:39:26 +00:00
|
|
|
{% block table_search %}
|
2016-09-07 16:40:59 +00:00
|
|
|
{% endblock %}
|
2016-11-06 13:29:04 +00:00
|
|
|
{% block table_container %}
|
|
|
|
<div class="uc pull-left m-l-5 m-r-5">
|
2016-11-06 16:39:26 +00:00
|
|
|
<a href="{% url "assets:admin-user-create" %}" class="btn btn-sm btn-primary"> {% trans "Create admin user" %} </a>
|
2016-11-06 13:29:04 +00:00
|
|
|
</div>
|
|
|
|
<table class="table table-striped table-bordered table-hover " id="admin_user_list_table" >
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="text-center">
|
|
|
|
<input type="checkbox" id="check_all" class="ipt_check_all" >
|
|
|
|
</th>
|
|
|
|
<th class="text-center">{% trans 'Name' %}</th>
|
|
|
|
<th class="text-center">{% trans 'Username' %}</th>
|
|
|
|
<th class="text-center">{% trans 'Asset num' %}</th>
|
2017-12-10 16:29:25 +00:00
|
|
|
<th class="text-center">{% trans 'Unreachable' %}</th>
|
2016-11-06 13:29:04 +00:00
|
|
|
<th class="text-center">{% trans 'Comment' %}</th>
|
2016-11-06 16:39:26 +00:00
|
|
|
<th class="text-center">{% trans 'Action' %}</th>
|
2016-11-06 13:29:04 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endblock %}
|
|
|
|
{% block content_bottom_left %}{% endblock %}
|
|
|
|
{% block custom_foot_js %}
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
var options = {
|
|
|
|
ele: $('#admin_user_list_table'),
|
|
|
|
columnDefs: [
|
|
|
|
{targets: 1, createdCell: function (td, cellData, rowData) {
|
2016-11-10 08:59:50 +00:00
|
|
|
var detail_btn = '<a href="{% url "assets:admin-user-detail" pk=99991937 %}">' + cellData + '</a>';
|
2016-11-06 13:29:04 +00:00
|
|
|
$(td).html(detail_btn.replace('99991937', rowData.id));
|
|
|
|
}},
|
2017-12-10 16:29:25 +00:00
|
|
|
{targets: 6, createdCell: function (td, cellData, rowData) {
|
2017-02-25 15:20:20 +00:00
|
|
|
{# var script_btn = '<a href="{% url "assets:admin-user-update" pk=99991937 %}" class="btn btn-xs btn-primary">{% trans "Script" %}</a>'.replace('99991937', cellData);#}
|
2016-11-06 16:39:26 +00:00
|
|
|
var update_btn = '<a href="{% url "assets:admin-user-update" pk=99991937 %}" class="btn btn-xs m-l-xs btn-info">{% trans "Update" %}</a>'.replace('99991937', cellData);
|
2016-11-06 14:45:26 +00:00
|
|
|
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_admin_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'.replace('99991937', cellData);
|
2017-02-25 15:20:20 +00:00
|
|
|
{# $(td).html(script_btn + update_btn + del_btn)#}
|
|
|
|
$(td).html(update_btn + del_btn)
|
2016-11-06 13:29:04 +00:00
|
|
|
}}],
|
2016-11-16 09:45:46 +00:00
|
|
|
ajax_url: '{% url "api-assets:admin-user-list" %}',
|
2017-04-02 16:27:18 +00:00
|
|
|
columns: [{data: function(){return ""}}, {data: "name" }, {data: "username" }, {data: "assets_amount" },
|
2017-12-10 16:29:25 +00:00
|
|
|
{data: "unreachable_amount"}, {data: "comment" }, {data: "id" }]
|
2016-11-06 13:29:04 +00:00
|
|
|
};
|
|
|
|
jumpserver.initDataTable(options);
|
2017-01-06 12:34:24 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
.on('click', '.btn_admin_user_delete', function () {
|
|
|
|
var $this = $(this);
|
|
|
|
var $data_table = $("#admin_user_list_table").DataTable();
|
|
|
|
var name = $(this).closest("tr").find(":nth-child(2)").children('a').html();
|
|
|
|
var uid = $this.data('uid');
|
|
|
|
var the_url = '{% url "api-assets:admin-user-detail" pk=99991937 %}'.replace('99991937', uid);
|
|
|
|
objectDelete($this, name, the_url);
|
2017-02-25 15:20:20 +00:00
|
|
|
setTimeout( function () {
|
|
|
|
$data_table.ajax.reload();
|
|
|
|
}, 3000);
|
2017-01-06 12:34:24 +00:00
|
|
|
|
2016-11-06 13:29:04 +00:00
|
|
|
});
|
|
|
|
</script>
|
2016-09-07 16:40:59 +00:00
|
|
|
{% endblock %}
|
2016-11-06 13:29:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|