mirror of https://github.com/jumpserver/jumpserver
[Fixture] 添加首页
parent
66a2262ee9
commit
709552f14c
|
@ -254,3 +254,6 @@ class SystemUser(models.Model):
|
|||
except IntegrityError:
|
||||
print('Error continue')
|
||||
continue
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -225,6 +225,41 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-info-circle"></i> {% trans 'System users' %}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table group_edit" id="add-asset2systemuser">
|
||||
<tbody>
|
||||
<form>
|
||||
<tr class="no-borders-tr">
|
||||
<td colspan="2">
|
||||
<select data-placeholder="{% trans 'Select system user' %}" class="select2" style="width: 100%" multiple="" tabindex="4">
|
||||
{% for system_user in system_users_remain %}
|
||||
<option value="{{ system_user.id }}" id="opt_{{ system_user.id }}">{{ system_user.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="no-borders-tr">
|
||||
<td colspan="2">
|
||||
<button type="button" class="btn btn-warning btn-sm btn-system-user">{% trans 'Associate' %}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
{% for system_user in system_users %}
|
||||
<tr>
|
||||
<td ><b class="bdg_group" data-sid={{ system_user.id }}>{{ system_user.name }}</b></td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-xs pull-right btn_leave_system" type="button" style="float: right;"><i class="fa fa-minus"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load bootstrap %}
|
||||
{% block custom_head_css_js %}
|
||||
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
|
||||
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
|
||||
<style>
|
||||
div.dataTables_wrapper div.dataTables_filter,
|
||||
.dataTables_length {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> {{ action }}</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-body">
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="ibox float-e-margins tab-pane active"></div>
|
||||
<form id="tagForm" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<h3 class="widget-head-color-box">基本信息</h3>
|
||||
{{ form.name|bootstrap_horizontal }}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" id="asset_on_count">关联的资产({{ assets_count }})</label>
|
||||
<div class="col-sm-9" id="asset_sed">
|
||||
<div class="form-asset-on" id="add_asset">
|
||||
<p id="asset_on_p">
|
||||
{% for asset in assets_on_list %}
|
||||
<button name='asset_hostname' title='{{ asset.ip}}' type='button' class='btn btn-default btn-xs'>{{ asset.hostname }}</button>
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-white" type="reset"> 重置 </button>
|
||||
<button class="btn btn-primary" type="submit"> 提交 </button>
|
||||
<div id='box2'> </div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content" id="box">
|
||||
<!--此部分为主体内容,将远程加载进来-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_foot_js %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('.select2').select2();
|
||||
$('.select2-system-user').select2();
|
||||
})
|
||||
|
||||
$('#add_asset').on('click',function(){
|
||||
$('#modal').modal('show');
|
||||
});
|
||||
|
||||
$('#modal').modal({
|
||||
show: false,
|
||||
backdrop: 'static',
|
||||
keyboard: 'false',
|
||||
remote:"{% url 'assets:asset-modal-list' %}?tag_id={{ tag_id }}",
|
||||
});
|
||||
|
||||
$('#modal').on('show.bs.modal',function(){
|
||||
//alert('当调用show方法时,立即触发;')
|
||||
});
|
||||
|
||||
$('#modal').on('shown.bs.modal',function(){
|
||||
//alert('当弹窗完全加载完后,再触发;')
|
||||
});
|
||||
|
||||
$('#modal').on('hide.bs.modal',function(){
|
||||
//alert('当关闭时,立即触发;')
|
||||
});
|
||||
|
||||
$('#modal').on('hidden.bs.modal',function(){
|
||||
//alert('当关完全关闭后,再触发;')
|
||||
});
|
||||
|
||||
$('#modal').on('loaded.bs.modal',function(){
|
||||
//alert('当远程数据加载完毕后,再触发;')
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,277 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block custom_head_css_js %}
|
||||
<link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
|
||||
<script src="{% static "js/plugins/select2/select2.full.min.js" %}"></script>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Detail' %} </a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div class="col-sm-7" style="padding-left: 0;">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="label"><b>{{ asset_tag.name }}</b></span>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr class="no-borders-tr">
|
||||
<td>{% trans 'Tag Name' %}:</td>
|
||||
<td><b>{{ asset_tag.name }}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans 'Created by' %}:</td>
|
||||
<td><b>{{ asset_tag.created_by }}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans 'Date created' %}:</td>
|
||||
<td><b>{{ asset_tag.created_time|date:"Y-m-d H:i:s" }}</b></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span style="float: left"></span>{% trans 'Asset list of ' %} <b>{{ asset_tag.name }}</b></span>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<table class="table table-striped table-bordered table-hover " id="tag_assets_table" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Hostname' %}</th>
|
||||
<th>{% trans 'IP' %}</th>
|
||||
<th>{% trans 'Port' %}</th>
|
||||
<th>{% trans 'Type' %}</th>
|
||||
<th>{% trans 'Valid' %}</th>
|
||||
<th>{% trans 'Action' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5" style="padding-left: 0;padding-right: 0">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-info-circle"></i> {% trans 'Add asset to this tag' %}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<form>
|
||||
<tr class="no-borders-tr">
|
||||
<td colspan="2">
|
||||
<select data-placeholder="{% trans 'Select asset' %}" class="select2" style="width: 100%" multiple="" tabindex="4">
|
||||
{% for asset in assets_remain %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}:{{ asset.port }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="no-borders-tr">
|
||||
<td colspan="2">
|
||||
<button type="button" class="btn btn-info btn-sm btn-tag-asset-add">{% trans 'Add' %}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block custom_foot_js %}
|
||||
<script>
|
||||
jumpserver.assets_selected = {};
|
||||
|
||||
function updateTagAssets(assets) {
|
||||
var the_url = "{% url 'api-assets:tag-update-assets' pk=tag.id %}";
|
||||
var body = {
|
||||
assets: Object.assign([], assets)
|
||||
};
|
||||
var $data_table = $("#tag_assets_table").DataTable();
|
||||
var success = function(data) {
|
||||
$('.select2-selection__rendered').empty();
|
||||
$.map(jumpserver.assets_selected, function(asset_ip, index) {
|
||||
$('#opt_' + index).remove();
|
||||
$data_table.ajax.reload();
|
||||
});
|
||||
jumpserver.groups_selected = {};
|
||||
};
|
||||
APIUpdateAttr({
|
||||
url: the_url,
|
||||
body: JSON.stringify(body),
|
||||
method: 'PUT',
|
||||
success: success
|
||||
});
|
||||
}
|
||||
function deleteTagAssets(obj, name, url, data) {
|
||||
function doDelete() {
|
||||
var body = data;
|
||||
var success = function() {
|
||||
swal('Deleted!', "[ "+name+"]"+" has been deleted ", "success");
|
||||
$(obj).parent().parent().remove();
|
||||
};
|
||||
var fail = function() {
|
||||
swal("Failed", "Delete"+"[ "+name+" ]"+"failed", "error");
|
||||
};
|
||||
APIUpdateAttr({
|
||||
url: url,
|
||||
body: JSON.stringify(body),
|
||||
method: 'PATCH',
|
||||
success: success,
|
||||
error: fail
|
||||
});
|
||||
}
|
||||
swal({
|
||||
title: 'Are you sure delete ?',
|
||||
text: " [" + name + "] ",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
cancelButtonText: 'Cancel',
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: 'Confirm',
|
||||
closeOnConfirm: false
|
||||
}, function () {
|
||||
doDelete()
|
||||
});
|
||||
}
|
||||
Array.prototype.remove = function(val) {
|
||||
var index = this.indexOf(val);
|
||||
if (index > -1) {
|
||||
this.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.select2').select2()
|
||||
.on("select2:select", function (evt) {
|
||||
var data = evt.params.data;
|
||||
jumpserver.assets_selected[data.id] = data.text;
|
||||
})
|
||||
.on('select2:unselect', function(evt) {
|
||||
var data = evt.params.data;
|
||||
delete jumpserver.assets_selected[data.id];
|
||||
});
|
||||
var options = {
|
||||
ele: $('#tag_assets_table'),
|
||||
buttons: [],
|
||||
order: [],
|
||||
columnDefs: [
|
||||
{targets: 0, createdCell: function (td, cellData, rowData) {
|
||||
var detail_btn = '<a href="{% url "assets:asset-detail" pk=99991937 %}" data-aid="'+rowData.id+'">' + cellData + '</a>';
|
||||
$(td).html(detail_btn.replace('99991937', rowData.id));
|
||||
}},
|
||||
{targets: 4, createdCell: function (td, cellData) {
|
||||
if (!cellData) {
|
||||
$(td).html('<i class="fa fa-times text-danger"></i>')
|
||||
} else {
|
||||
$(td).html('<i class="fa fa-check text-navy"></i>')
|
||||
}
|
||||
}},
|
||||
{targets: 5, createdCell: function (td, cellData, rowData) {
|
||||
var update_btn = '<a href="{% url "assets:asset-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'.replace('99991937', rowData.id);
|
||||
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-aid="99991937">{% trans "Delete" %}</a>'.replace('99991937', rowData.id);
|
||||
$(td).html(update_btn + del_btn)
|
||||
}}
|
||||
|
||||
],
|
||||
ajax_url: '{% url "api-assets:asset-list" %}?tag_id={{ tag.id }}',
|
||||
columns: [{data: "hostname" }, {data: "ip" }, {data: "port" },
|
||||
{data: "type" }, {data: "is_active" }, {data: "id"}],
|
||||
op_html: $('#actions').html()
|
||||
};
|
||||
jumpserver.initDataTable(options);
|
||||
})
|
||||
|
||||
.on('click', '.btn-tag-asset-add', function () {
|
||||
if (Object.keys(jumpserver.assets_selected).length === 0) {
|
||||
return false;
|
||||
}
|
||||
var assets=[];
|
||||
var $data_table = $("#tag_assets_table").DataTable();
|
||||
$.ajax({
|
||||
url: '{% url "api-assets:asset-list" %}',
|
||||
method: 'GET',
|
||||
data: {"tag_id": {{ tag.id }}},
|
||||
dataType: 'json',
|
||||
success: function (result) {
|
||||
for(var i in result){
|
||||
if (!isNaN(parseInt(result[i]['id']))) {
|
||||
assets.push(parseInt(result[i]['id']))
|
||||
}
|
||||
}
|
||||
$.map(jumpserver.assets_selected, function(value, index) {
|
||||
assets.push(parseInt(index));
|
||||
});
|
||||
updateTagAssets(assets);
|
||||
$data_table.ajax().reload();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
.on('click', '.btn_asset_delete', function () {
|
||||
var $this = $(this);
|
||||
var the_url = "{% url 'api-assets:tag-update-assets' pk=tag.id %}";
|
||||
var name = $(this).closest("tr").find(":nth-child(1) > a").html();
|
||||
var assets = [];
|
||||
$('#tag_assets_table > tbody > tr').map(function () {
|
||||
assets.push(parseInt($(this).closest("tr").find(":nth-child(1) > a").attr("data-aid")))
|
||||
});
|
||||
var delete_asset_id = $(this).data('aid');
|
||||
assets.remove(delete_asset_id);
|
||||
var data = {"assets": assets};
|
||||
deleteTagAssets($this, name, the_url, data);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,125 +0,0 @@
|
|||
{% extends '_base_list.html' %}
|
||||
{% load i18n static %}
|
||||
{% block custom_head_css_js %}
|
||||
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
|
||||
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
|
||||
{% endblock %}
|
||||
{#{% block content_left_head %}#}
|
||||
{# <a href="{% url 'assets:asset-tag-create' %}" class="btn btn-sm btn-primary "> {% trans "Create tag" %}</a>#}
|
||||
{#{% endblock %}#}
|
||||
{#{% block table_head %}#}
|
||||
{# <th class="text-center">#}
|
||||
{# <input type="checkbox" id="check_all" onclick="checkAll('check_all', 'checked')">#}
|
||||
{# </th>#}
|
||||
{# <th class="text-center"><a href="{% url 'assets:asset-tag-list' %}?sort=name">{% trans 'Tag Name' %}</a></th>#}
|
||||
{# <th class="text-center">{% trans 'Asset num' %}</th>#}
|
||||
{# <th class="text-center"></th>#}
|
||||
{#{% endblock %}#}
|
||||
{#{% block table_body %}#}
|
||||
{# {% for asset_tag in asset_tags_list %}#}
|
||||
{# <tr class="gradeX">#}
|
||||
{# <td class="text-center">#}
|
||||
{# <input type="checkbox" name="checked" value="{{ asset_tag.id }}">#}
|
||||
{# </td>#}
|
||||
{# <td class="text-center">#}
|
||||
{# <a href="{% url 'assets:asset-tag-detail' pk=asset_tag.id %}">#}
|
||||
{# {{ asset_tag.name }}#}
|
||||
{# </a>#}
|
||||
{# </td>#}
|
||||
{# <td class="text-center">{{ asset_tag.asset_set.count }}</td>#}
|
||||
{# <td class="text-center">#}
|
||||
{# <a href="{% url 'assets:asset-tag-update' pk=asset_tag.id %}" class="btn btn-xs btn-info">{% trans 'Update' %}</a>#}
|
||||
{# <a onclick="objectDelete(this,'{{ asset_tag.name }}','{% url 'assets:asset-tag-delete' asset_tag.id %}')" class="btn btn-xs btn-danger del">{% trans 'Delete' %}</a>#}
|
||||
{# </td>#}
|
||||
{# </tr>#}
|
||||
{# {% endfor %}#}
|
||||
{#{% endblock %}#}
|
||||
{#{% block content_bottom_left %}#}
|
||||
{# <form id="" method="get" action="" class=" mail-search">#}
|
||||
{# <div class="input-group">#}
|
||||
{# <select class="form-control m-b" style="width: auto">#}
|
||||
{# <option>{% trans 'Delete selected' %}</option>#}
|
||||
{# <option>{% trans 'Update selected' %}</option>#}
|
||||
{# <option>{% trans 'Deactive selected' %}</option>#}
|
||||
{# <option>{% trans 'Export selected' %}</option>#}
|
||||
{# </select>#}
|
||||
{# <div class="input-group-btn pull-left" style="padding-left: 5px;">#}
|
||||
{# <button id='search_btn' type="submit" style="height: 32px;" class="btn btn-sm btn-primary">#}
|
||||
{# {% trans 'Submit' %}#}
|
||||
{# </button>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </form>#}
|
||||
{#{% endblock %}#}
|
||||
{% block table_search %}{% endblock %}
|
||||
{% block table_container %}
|
||||
<div class="uc pull-left m-l-5 m-r-5">
|
||||
<a href="{% url "assets:asset-tag-create" %}" class="btn btn-sm btn-primary"> {% trans "Create Tag" %} </a>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-hover " id="tag_list_table" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"><input type="checkbox" class="ipt_check_all"></th>
|
||||
<th class="text-center">{% trans 'TagName' %}</th>
|
||||
<th class="text-center">{% trans 'Asset num' %}</th>
|
||||
<th class="text-center">{% trans 'Action' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="actions" class="hide">
|
||||
<div class="input-group">
|
||||
<select class="form-control m-b" style="width: auto" id="slct_bulk_update">
|
||||
<option value="delete">{% trans 'Delete selected' %}</option>
|
||||
<option value="update">{% trans 'Update selected' %}</option>
|
||||
</select>
|
||||
<div class="input-group-btn pull-left" style="padding-left: 5px;">
|
||||
<button id='btn_bulk_update' style="height: 32px;" class="btn btn-sm btn-primary">
|
||||
{% trans 'Submit' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_foot_js %}
|
||||
<script src="{% static 'js/jquery.form.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var options = {
|
||||
ele: $("#tag_list_table"),
|
||||
columnDefs:[
|
||||
{targets: 1, createdCell: function (td, cellData, rowData) {
|
||||
var detail_btn = '<a href="{% url 'assets:asset-tag-detail' pk=99991937 %}">' + cellData + '</a>';
|
||||
$(td).html(detail_btn.replace('99991937', rowData.id));
|
||||
}},
|
||||
{targets: 3, createdCell: function (td, cellData, rowData) {
|
||||
var update_btn = '<a href="{% url 'assets:asset-tag-detail' pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'.replace('99991937', cellData);
|
||||
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_tag_delete" data-uid="99991937">{% trans "Delete" %}</a>'.replace('99991937', cellData);
|
||||
$(td).html(update_btn + del_btn)
|
||||
}}
|
||||
],
|
||||
ajax_url: '{% url "api-assets:asset-tag-list" %}',
|
||||
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" },{data: "id"}]
|
||||
};
|
||||
jumpserver.initDataTable(options);
|
||||
})
|
||||
|
||||
.on('click', '.btn_tag_delete', function () {
|
||||
var $this = $(this);
|
||||
var $data_table = $('#tag_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:asset-tag-detail" pk=99991937 %}'.replace('99991937', uid);
|
||||
objectDelete($this, name, the_url);
|
||||
$data_table.ajax.reload();
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -46,7 +46,6 @@
|
|||
<h3>{% trans 'Other' %}</h3>
|
||||
{{ form.status|bootstrap_horizontal }}
|
||||
{{ form.env|bootstrap_horizontal }}
|
||||
{{ form.tags|bootstrap_horizontal }}
|
||||
{{ form.comment|bootstrap_horizontal }}
|
||||
{{ form.is_active|bootstrap_horizontal }}
|
||||
|
||||
|
|
|
@ -19,12 +19,13 @@ Including another URLconf
|
|||
from django.conf.urls import url, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
from .views import IndexView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^captcha/', include('captcha.urls')),
|
||||
url(r'^$', TemplateView.as_view(template_name='base.html'), name='index'),
|
||||
url(r'^$', IndexView.as_view(), name='index'),
|
||||
url(r'^users/', include('users.urls.views_urls', namespace='users')),
|
||||
url(r'^assets/', include('assets.urls.views_urls', namespace='assets')),
|
||||
url(r'^perms/', include('perms.urls.views_urls', namespace='perms')),
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
from django.views.generic import TemplateView
|
||||
from django.utils import timezone
|
||||
from django.db.models import Count
|
||||
|
||||
from users.utils import AdminUserRequiredMixin
|
||||
from users.models import User
|
||||
from assets.models import Asset
|
||||
from audits.models import ProxyLog
|
||||
|
||||
|
||||
class IndexView(AdminUserRequiredMixin, TemplateView):
|
||||
template_name = 'index.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
seven_days_ago = timezone.now() - timezone.timedelta(days=7)
|
||||
month_ago = timezone.now() - timezone.timedelta(days=30)
|
||||
proxy_log_seven_days = ProxyLog.objects.filter(date_start__gt=seven_days_ago, is_failed=False)
|
||||
proxy_log_month = ProxyLog.objects.filter(date_start__gt=month_ago, is_failed=False)
|
||||
month_dates = proxy_log_month.dates('date_start', 'day')
|
||||
month_total_visit = [ProxyLog.objects.filter(date_start__date=d) for d in month_dates]
|
||||
month_str = [d.strftime('%m-%d') for d in month_dates]
|
||||
month_total_visit_count = [p.count() for p in month_total_visit]
|
||||
month_user = [p.values('user').distinct().count() for p in month_total_visit]
|
||||
month_asset = [p.values('asset').distinct().count() for p in month_total_visit]
|
||||
month_user_active = User.objects.filter(last_login__gt=month_ago).count()
|
||||
month_user_inactive = User.objects.filter(last_login__lt=month_ago).count()
|
||||
month_user_disabled = User.objects.filter(is_active=False).count()
|
||||
month_asset_active = proxy_log_month.values('asset').distinct().count()
|
||||
month_asset_inactive = Asset.objects.all().count() - month_asset_active
|
||||
month_asset_disabled = Asset.objects.filter(is_active=False).count()
|
||||
week_asset_hot_ten = list(proxy_log_seven_days.values('asset').annotate(total=Count('asset')).order_by('-total')[:10])
|
||||
for p in week_asset_hot_ten:
|
||||
last_login = ProxyLog.objects.filter(asset=p['asset']).order_by('date_start').last()
|
||||
p['last'] = last_login
|
||||
last_login_ten = ProxyLog.objects.all().order_by('-date_start')[:10]
|
||||
for p in last_login_ten:
|
||||
try:
|
||||
p.avatar_url = User.objects.get(username=p.user).avatar_url()
|
||||
except User.DoesNotExist:
|
||||
p.avatar_url = User.objects.first().avatar_url()
|
||||
week_user_hot_ten = list(proxy_log_seven_days.values('user').annotate(total=Count('user')).order_by('-total')[:10])
|
||||
for p in week_user_hot_ten:
|
||||
last_login = ProxyLog.objects.filter(user=p['user']).order_by('date_start').last()
|
||||
p['last'] = last_login
|
||||
|
||||
context = {
|
||||
'assets_count': Asset.objects.count(),
|
||||
'users_count': User.objects.filter(role__in=('Admin', 'User')).count(),
|
||||
'online_user_count': ProxyLog.objects.filter(is_finished=False).values('user').distinct().count(),
|
||||
'online_asset_count': ProxyLog.objects.filter(is_finished=False).values('asset').distinct().count(),
|
||||
'user_visit_count_weekly': proxy_log_seven_days.values('user').distinct().count(),
|
||||
'asset_visit_count_weekly': proxy_log_seven_days.count(),
|
||||
'user_visit_count_top_five': proxy_log_seven_days.values('user').annotate(total=Count('user')).order_by('-total')[:5],
|
||||
'month_str': month_str,
|
||||
'month_total_visit_count': month_total_visit_count,
|
||||
'month_user': month_user,
|
||||
'mouth_asset': month_asset,
|
||||
'month_user_active': month_user_active,
|
||||
'month_user_inactive': month_user_inactive,
|
||||
'month_user_disabled': month_user_disabled,
|
||||
'month_asset_active': month_asset_active,
|
||||
'month_asset_inactive': month_asset_inactive,
|
||||
'month_asset_disabled': month_asset_disabled,
|
||||
'week_asset_hot_ten': week_asset_hot_ten,
|
||||
'last_login_ten': last_login_ten,
|
||||
'week_user_hot_ten': week_user_hot_ten,
|
||||
}
|
||||
|
||||
kwargs.update(context)
|
||||
return super(IndexView, self).get_context_data(**kwargs)
|
|
@ -73,7 +73,7 @@
|
|||
{% else %}
|
||||
<td>
|
||||
<div class="progress progress-striped active">
|
||||
<div style="width: 50%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75" role="progressbar" class="progress-bar progress-bar-danger">
|
||||
<div style="width: 50%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75" role="progressbar" class="progress-bar progress-bar-primary">
|
||||
<span class="sr-only">40% Complete (success)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -197,7 +197,7 @@ class MyAssetGroupAssetsApi(ListAPIView):
|
|||
permission_classes = (IsValidUser,)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
asset_groups = {}
|
||||
asset_groups = dict()
|
||||
asset_groups[0] = {
|
||||
'id': 0, 'name': 'ungrouped', 'assets': []
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class MyAssetGroupAssetsApi(ListAPIView):
|
|||
asset_json = asset.to_json()
|
||||
asset_json['system_users'] = [su.to_json() for su in system_users]
|
||||
if not asset.groups.all():
|
||||
asset_groups[0][assets].append(asset_json)
|
||||
asset_groups[0]['assets'].append(asset_json)
|
||||
continue
|
||||
for asset_group in asset.groups.all():
|
||||
if asset_group.id in asset_groups:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block custom_head_css_js %}
|
||||
<link href="{% static "css/plugins/dataTables/dataTables.min.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/dataTables/datatables.min.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.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>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load i18n %}
|
||||
<li id="index">
|
||||
<a href="">
|
||||
<a href="{% url 'index' %}">
|
||||
<i class="fa fa-dashboard"></i> <span class="nav-label">{% trans 'Home' %}</span><span class="label label-info pull-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,478 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="label label-success pull-right">Users</span>
|
||||
<h5>用户总数</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<h1 class="no-margins"><a href="{% url 'users:user-list' %}">{{ users_count }}</a></h1>
|
||||
<small>All user</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="label label-info pull-right">Hosts</span>
|
||||
<h5>主机总数</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<h1 class="no-margins"><a href="{% url 'assets:asset-list' %}">{{ assets_count }}</a></h1>
|
||||
<small>All host</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="label label-primary pull-right">Online</span>
|
||||
<h5>在线用户</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<h1 class="no-margins"><a href="{% url 'audits:proxy-log-online-list' %}"> <span id="online_users"></span>{{ online_user_count }}</a></h1>
|
||||
<small>Online user</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="label label-danger pull-right">Connected</span>
|
||||
<h5>已连接服务器</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<h1 class="no-margins"><a href="{% url 'audits:proxy-log-online-list' %}"> <span id="online_hosts"></span>{{ online_asset_count }}</a></h1>
|
||||
<small>Connected host</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-2 border-bottom white-bg dashboard-header" style="margin-left:15px;height: 346px">
|
||||
<h2>活跃用户TOP5</h2>
|
||||
<small>过去一周共有<span class="text-info">{{ user_visit_count_weekly }}</span>位用户登录<span class="text-success">{{ asset_visit_count_weekly }}</span>次服务器.</small>
|
||||
<ul class="list-group clear-list m-t">
|
||||
{% for data in user_visit_count_top_five %}
|
||||
<li class="list-group-item fist-item">
|
||||
<span class="pull-right">
|
||||
{{ data.total }}次/周
|
||||
</span>
|
||||
<span class="label ">{{ forloop.counter }}</span> {{ data.user }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-7" id="top10" style="margin-left: -15px;height: 346px;padding: 15px 0 15px 0;"></div>
|
||||
<div class="col-sm-3 white-bg" id="top1" style="margin-left: -15px;height: 346px">
|
||||
<div class="statistic-box">
|
||||
<h4>
|
||||
活跃用户资产占比
|
||||
</h4>
|
||||
<p>
|
||||
以下图形分别描述一个月活跃用户和资产占所有用户主机的百分比
|
||||
</p>
|
||||
<div class="row text-center">
|
||||
<div class="col-sm-6">
|
||||
<div id="activeUser" style="width: 140px; height: 140px;">
|
||||
|
||||
</div>
|
||||
<h5>用户</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div id="activeAsset" style="width: 140px; height: 140px;"></div>
|
||||
<h5>主机</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-t">
|
||||
<small></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>一周Top10资产</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user"></ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3><i class="fa fa-inbox"></i> 一周Top10资产 </h3>
|
||||
<small><i class="fa fa-map-marker"></i> 登录次数及最近一次登录记录. </small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% if week_asset_hot_ten %}
|
||||
{% for data in week_asset_hot_ten %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 date">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<strong>{{ data.asset }}</strong>
|
||||
<br/>
|
||||
<small class="text-navy">{{ data.total }}次</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs">最近一次登录用户</p>
|
||||
<p>{{ data.last.user }}</p>
|
||||
<p>于{{ data.last.date_start |date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>最近十次登录</h5>
|
||||
<div class="ibox-tools">
|
||||
<span class="label label-info-light">10 Messages</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3><i class="fa fa-paper-plane-o"></i> 登录记录 </h3>
|
||||
<small><i class="fa fa-map-marker"></i> 最近十次登录记录. </small>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div>
|
||||
<div class="feed-activity-list">
|
||||
{% if last_login_ten %}
|
||||
{% for login in last_login_ten %}
|
||||
<div class="feed-element">
|
||||
<a href="#" class="pull-left">
|
||||
<img alt="image" class="img-circle" src="/static/img/root.png">
|
||||
</a>
|
||||
<div class="media-body ">
|
||||
{% ifequal login.is_finished 0 %}
|
||||
<small class="pull-right text-navy">{{ login.date_start|timesince }} ago</small>
|
||||
{% else %}
|
||||
<small class="pull-right">{{ login.date_start|timesince }} ago</small>
|
||||
{% endifequal %}
|
||||
<strong>{{ login.user }}</strong> 登录了{{ login.asset }} <br>
|
||||
<small class="text-muted">{{ login.date_start }}</small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>一周Top10用户</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user"></ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3><i class="fa fa-user"></i> 一周Top10用户 </h3>
|
||||
<small><i class="fa fa-map-marker"></i> 用户登录次数及最近一次登录记录. </small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% if week_user_hot_ten %}
|
||||
{% for data in week_user_hot_ten %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 date">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<strong>{{ data.user }}</strong>
|
||||
<br/>
|
||||
<small class="text-navy">{{ data.total }}次</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs">最近一次登录主机</p>
|
||||
<p>{{ data.last.asset }}</p>
|
||||
<p>于{{ data.last.date_start |date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_foot_js %}
|
||||
<script src="{% static 'js/plugins/echarts/echarts.js' %}"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#show').click(function(){
|
||||
$('#show').css('display', 'none');
|
||||
$('#more').css('display', 'block');
|
||||
})
|
||||
});
|
||||
require.config({
|
||||
paths: {
|
||||
'echarts': '/static/js/plugins/echarts/chart/',
|
||||
'echarts/chart/line': '/static/js/plugins/echarts/chart/line',
|
||||
'echarts/chart/pie': '/static/js/plugins/echarts/chart/pie'
|
||||
}
|
||||
});
|
||||
require(
|
||||
[
|
||||
'echarts',
|
||||
'echarts/chart/line'
|
||||
],
|
||||
function (ec) {
|
||||
var top10Chart = ec.init(document.getElementById('top10'));
|
||||
var option = {
|
||||
title : {
|
||||
text: '月数据总览',
|
||||
subtext: '一个月内历史汇总',
|
||||
x: 'center'
|
||||
},
|
||||
tooltip : {
|
||||
trigger: 'axis'
|
||||
},
|
||||
backgroundColor: '#fff',
|
||||
legend: {
|
||||
data:['登陆次数', '活跃用户','活跃资产'],
|
||||
y: 'bottom'
|
||||
},
|
||||
toolbox: {
|
||||
show : false,
|
||||
feature : {
|
||||
magicType : {show: true, type: ['line', 'bar']}
|
||||
}
|
||||
},
|
||||
calculable : true,
|
||||
xAxis : [
|
||||
{
|
||||
type : 'category',
|
||||
boundaryGap : false,
|
||||
data : {{ month_str|safe}}
|
||||
}
|
||||
],
|
||||
yAxis : [
|
||||
{
|
||||
type : 'value'
|
||||
}
|
||||
],
|
||||
series : [
|
||||
{
|
||||
name:'登陆次数',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
||||
data: {{ month_total_visit_count|safe}}
|
||||
},
|
||||
{
|
||||
name:'活跃用户',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
||||
data: {{ month_user|safe }}
|
||||
},
|
||||
{
|
||||
name:'活跃资产',
|
||||
type:'line',
|
||||
smooth:true,
|
||||
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
||||
data: {{ mouth_asset|safe }}
|
||||
}
|
||||
]
|
||||
};
|
||||
top10Chart.setOption(option);
|
||||
}
|
||||
);
|
||||
require(
|
||||
[
|
||||
'echarts',
|
||||
'echarts/chart/pie'
|
||||
],
|
||||
function (ec) {
|
||||
var auChart = ec.init(document.getElementById('activeUser'));
|
||||
var option = {
|
||||
tooltip : {
|
||||
trigger: 'item',
|
||||
formatter: "{b} <br> {c} ({d}%)"
|
||||
},
|
||||
legend: {
|
||||
show: false,
|
||||
orient : 'vertical',
|
||||
x : 'left',
|
||||
data:['月活跃用户','禁用用户','月未登陆用户']
|
||||
},
|
||||
toolbox: {
|
||||
show : false,
|
||||
feature : {
|
||||
mark : {show: true},
|
||||
dataView : {show: true, readOnly: false},
|
||||
magicType : {
|
||||
show: true,
|
||||
type: ['pie', 'funnel'],
|
||||
option: {
|
||||
funnel: {
|
||||
x: '25%',
|
||||
width: '50%',
|
||||
funnelAlign: 'center',
|
||||
max: 1548
|
||||
}
|
||||
}
|
||||
},
|
||||
restore : {show: true},
|
||||
saveAsImage : {show: true}
|
||||
}
|
||||
},
|
||||
calculable : true,
|
||||
series : [
|
||||
{
|
||||
name:'访问来源',
|
||||
type:'pie',
|
||||
radius : ['50%', '70%'],
|
||||
itemStyle : {
|
||||
normal : {
|
||||
label : {
|
||||
show : false
|
||||
},
|
||||
labelLine : {
|
||||
show : false
|
||||
}
|
||||
},
|
||||
emphasis : {
|
||||
label : {
|
||||
show : true,
|
||||
position : 'center',
|
||||
textStyle : {
|
||||
fontSize : '5',
|
||||
fontWeight : 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{value:{{ month_user_active }}, name:'月活跃用户'},
|
||||
{value:{{ month_user_disabled }}, name:'禁用用户'},
|
||||
{value:{{ month_user_inactive }}, name:'月未登陆用户'}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
auChart.setOption(option);
|
||||
}
|
||||
);
|
||||
require(
|
||||
[
|
||||
'echarts',
|
||||
'echarts/chart/pie'
|
||||
],
|
||||
function (ec) {
|
||||
var aaChart = ec.init(document.getElementById('activeAsset'));
|
||||
var option = {
|
||||
tooltip : {
|
||||
trigger: 'item',
|
||||
formatter: "{b} <br> {c} ({d}%)"
|
||||
},
|
||||
legend: {
|
||||
show: false,
|
||||
orient : 'vertical',
|
||||
x : 'left',
|
||||
data:['月被登陆主机','禁用主机','月未登陆主机']
|
||||
},
|
||||
toolbox: {
|
||||
show : false,
|
||||
feature : {
|
||||
mark : {show: true},
|
||||
dataView : {show: true, readOnly: false},
|
||||
magicType : {
|
||||
show: true,
|
||||
type: ['pie', 'funnel'],
|
||||
option: {
|
||||
funnel: {
|
||||
x: '25%',
|
||||
width: '50%',
|
||||
funnelAlign: 'center',
|
||||
max: 1548
|
||||
}
|
||||
}
|
||||
},
|
||||
restore : {show: true},
|
||||
saveAsImage : {show: true}
|
||||
}
|
||||
},
|
||||
calculable : true,
|
||||
series : [
|
||||
{
|
||||
name:'访问来源',
|
||||
type:'pie',
|
||||
radius : ['50%', '70%'],
|
||||
itemStyle : {
|
||||
normal : {
|
||||
label : {
|
||||
show : false
|
||||
},
|
||||
labelLine : {
|
||||
show : false
|
||||
}
|
||||
},
|
||||
emphasis : {
|
||||
label : {
|
||||
show : true,
|
||||
position : 'center',
|
||||
textStyle : {
|
||||
fontSize : '5',
|
||||
fontWeight : 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{value:{{ month_asset_active }}, name:'月被登陆主机'},
|
||||
{value:{{ month_asset_disabled }}, name:'禁用主机'},
|
||||
{value:{{ month_asset_inactive }}, name:'月未登陆主机'}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
aaChart.setOption(option);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -5,7 +5,7 @@
|
|||
{% block custom_head_css_js %}
|
||||
<link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/sweetalert/sweetalert.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/dataTables/dataTables.min.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/dataTables/datatables.min.css" %}" rel="stylesheet">
|
||||
<link href="{% static "css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" %}" rel="stylesheet">
|
||||
<script src="{% static "js/plugins/select2/select2.full.min.js" %}"></script>
|
||||
<script src="{% static "js/plugins/sweetalert/sweetalert.min.js" %}"></script>
|
||||
|
|
|
@ -7,7 +7,7 @@ ForgeryPy==0.1
|
|||
openpyxl==2.4.0
|
||||
celery==3.1.23
|
||||
paramiko==2.1.1
|
||||
ansible==2.1.2.0
|
||||
ansible==2.2.2.0
|
||||
django-simple-captcha==0.5.2
|
||||
django-formtools==1.0
|
||||
sshpubkeys==2.2.0
|
||||
|
@ -20,4 +20,3 @@ tornado==4.4.2
|
|||
eventlet==0.20.1
|
||||
django-filter==1.0.0
|
||||
passlib==1.7.1
|
||||
sshpass
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
#
|
||||
|
||||
for app in users assets perms audits ops applications;do
|
||||
rm -f ../apps/$app/migrations/000*
|
||||
rm -f ../apps/$app/migrations/00*
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue