Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
1d29c52a
Commit
1d29c52a
authored
Nov 04, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update datatable
parent
53e97dac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
214 deletions
+105
-214
proxy_log_list.html
apps/audits/templates/audits/proxy_log_list.html
+52
-102
views.py
apps/audits/views.py
+3
-1
asset_permission_list.html
apps/perms/templates/perms/asset_permission_list.html
+50
-111
No files found.
apps/audits/templates/audits/proxy_log_list.html
View file @
1d29c52a
{% extends '_base_list.html' %}
{% extends '_base_list.html' %}
{% load i18n static %}
{% load i18n %}
{% block custom_head_css_js %}
{% load common_tags %}
{{ block.super }}
<link
href=
"{% static "
css
/
plugins
/
footable
/
footable
.
core
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
layer
/
layer
.
css
"
%}"
rel=
"stylesheet"
>
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
{% block table_head %}
margin-left
:
15px
;
<th
class=
"text-center"
>
{% trans 'ID' %}
</th>
}
<th
class=
"text-center"
>
{% trans 'Username' %}
</th>
</style>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
<th
class=
"text-center"
>
{% trans 'Command' %}
</th>
<th
class=
"text-center"
>
{% trans 'Success' %}
</th>
<th
class=
"text-center"
>
{% trans 'Finished' %}
</th>
<th
class=
"text-center"
>
{% trans 'Date start' %}
</th>
<th
class=
"text-center"
>
{% trans 'Time' %}
</th>
{% endblock %}
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
{% block table_body %}
{#
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create user" %}
</a></div>
#}
{% for proxy_log in proxy_log_list %}
<table
class=
"table table-striped table-bordered table-hover "
id=
"proxy_log_list_table"
>
<tr
class=
"gradeX"
>
<thead>
<td
class=
"text-center"
>
<tr>
<a
href=
"{% url 'audits:proxy-log-detail' pk=proxy_log.id %}"
>
{{ proxy_log.id }}
</a>
<th
class=
"text-center"
>
</td>
<div
class=
"checkbox checkbox-default"
>
<td
class=
"text-center"
>
{{ proxy_log.username }}
</td>
<input
type=
"checkbox"
class=
"ipt_check_all"
>
<td
class=
"text-center"
>
{{ proxy_log.ip }}
</td>
</div>
<td
class=
"text-center"
>
{{ proxy_log.system_user.name }}
</td>
</th>
<td
class=
"text-center"
>
{{ proxy_log.command.count }}
</td>
<th
class=
"text-center"
>
{% trans 'Username' %}
</th>
<td
class=
"text-center"
>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
{% if proxy_log.was_failed %}
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
<i
class=
"fa fa-times text-danger"
></i>
{#
<th
class=
"text-center"
>
{% trans 'Login type' %}
</th>
#}
{% else %}
<th
class=
"text-center"
>
{% trans 'Command' %}
</th>
<i
class=
"fa fa-check text-navy"
></i>
<th
class=
"text-center"
>
{% trans 'Success' %}
</th>
{% endif %}
<th
class=
"text-center"
>
{% trans 'Finished' %}
</th>
</td>
<th
class=
"text-center"
>
{% trans 'Date start' %}
</th>
<td
class=
"text-center"
>
<th
class=
"text-center"
>
{% trans 'Time' %}
</th>
{% if proxy_log.is_finished %}
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
<i
class=
"fa fa-times text-danger"
></i>
</tr>
{% else %}
</thead>
<i
class=
"fa fa-check text-navy"
></i>
<tbody>
{% endif %}
</tbody>
</td>
</table>
<td
class=
"text-center"
>
{{ proxy_log.date_start }}
</td>
<td
class=
"text-center"
>
{{ proxy_log.date_finished }}
</td>
</tr>
{% endfor %}
{% endblock %}
{% endblock %}
{% block custom_foot_js %}
<script
src=
"{% static 'js/jquery.form.min.js' %}"
></script>
<script
src=
"{% static "
js
/
plugins
/
layer
/
layer
.
js
"
%}"
></script>
<script>
$
(
document
).
ready
(
function
(){
var
options
=
{
ele
:
$
(
'#proxy_log_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "users:user-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
'<a url="{% url "audits:proxy-log-commands-list" pk=99991938 %}" class="commands">99991937</a>'
.
replace
(
'99991937'
,
cellData
)
.
replace
(
'99991938'
,
rowData
.
id
))
}
}},
{
targets
:
5
,
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
:
6
,
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
:
9
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "audits:proxy-log-detail" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Detail" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
delete_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_delete" data-uid="99991937" data-name="99991938">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
)
.
replace
(
'99991938'
,
rowData
.
name
);
$
(
td
).
html
(
detail_btn
+
delete_btn
)
}}
],
ajax_url
:
'{% url "audits:proxy-log-list-create-api" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"ip"
},
{
data
:
"system_user"
},
{
data
:
"command_length"
},
{
data
:
'was_failed'
},
{
data
:
"is_finished"
},
{
data
:
"date_start"
},
{
data
:
'time'
},
{
data
:
'id'
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
}).
on
(
'click'
,
'.commands'
,
function
()
{
var
url
=
$
(
this
).
attr
(
'url'
);
layer
.
open
({
type
:
2
,
title
:
'很多时候,我们想最大化看,比如像这个页面。'
,
shadeClose
:
true
,
shade
:
false
,
maxmin
:
true
,
//开启最大化最小化按钮
area
:
[
'893px'
,
'600px'
],
content
:
url
});
})
</script>
{% block custom_foot_js %}
<script>
$
(
document
).
ready
(
function
()
{
$
(
'table'
).
DataTable
({
"searching"
:
false
,
"paging"
:
false
,
"order"
:
[]
})
})
</script>
{% endblock %}
{% endblock %}
apps/audits/views.py
View file @
1d29c52a
...
@@ -11,8 +11,10 @@ from .models import ProxyLog, CommandLog
...
@@ -11,8 +11,10 @@ from .models import ProxyLog, CommandLog
from
.utils
import
AdminUserRequiredMixin
from
.utils
import
AdminUserRequiredMixin
class
ProxyLogListView
(
TemplateView
):
class
ProxyLogListView
(
ListView
):
model
=
ProxyLog
template_name
=
'audits/proxy_log_list.html'
template_name
=
'audits/proxy_log_list.html'
context_object_name
=
'proxy_log_list'
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
ProxyLogListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
ProxyLogListView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
apps/perms/templates/perms/asset_permission_list.html
View file @
1d29c52a
{% extends '_base_list.html' %}
{% extends '_base_list.html' %}
{% load i18n %}
{% load i18n %}
{% load static %}
{% load common_tags %}
{% load common_tags %}
{% block custom_head_css_js %}
{% block content_left_head %}
{{ block.super }}
<a
href=
"{% url 'perms:asset-permission-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create permission" %}
</a>
<style>
{% endblock %}
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
{% block table_head %}
margin-left
:
15px
;
<th
class=
"text-center"
>
{% trans 'ID' %}
</th>
}
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
</style>
<th
class=
"text-center"
>
{% trans 'User' %}
</th>
<th
class=
"text-center"
>
{% trans 'User group' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset group' %}
</th>
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
<th
class=
"text-center"
>
{% trans 'Is valid' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
{% endblock %}
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
{% block table_body %}
<div
class=
"uc pull-left m-l-5 m-r-5"
>
{% for asset_permission in asset_permission_list %}
<a
href=
"{% url 'perms:asset-permission-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create permission" %}
</a>
<tr
class=
"gradeX"
>
</div>
<td
class=
"text-center"
>
{{ asset_permission.id }}
</td>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset-permission-list-table"
>
<td
class=
"text-center"
>
<thead>
<a
href=
"{% url 'perms:asset-permission-detail' pk=asset_permission.id %}"
>
<tr>
{{ asset_permission.name }}
<th
class=
"text-center"
>
</a>
<div
class=
"checkbox checkbox-default"
>
</td>
<input
type=
"checkbox"
class=
"ipt_check_all"
>
<td
class=
"text-center"
>
{{ asset_permission.users.count }}
</td>
</div>
<td
class=
"text-center"
>
{{ asset_permission.user_groups.count }}
</td>
</th>
<td
class=
"text-center"
>
{{ asset_permission.assets.count }}
</td>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<td
class=
"text-center"
>
{{ asset_permission.asset_groups.count }}
</td>
<th
class=
"text-center"
>
{% trans 'User' %}
</th>
<td
class=
"text-center"
>
{{ asset_permission.system_users.count }}
</td>
<th
class=
"text-center"
>
{% trans 'User group' %}
</th>
<td
class=
"text-center"
>
<th
class=
"text-center"
>
{% trans 'Asset' %}
</th>
{% if asset_permission.is_valid %}
<th
class=
"text-center"
>
{% trans 'Asset group' %}
</th>
<i
class=
"fa fa-check text-navy"
></i>
<th
class=
"text-center"
>
{% trans 'System user' %}
</th>
{% else %}
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
{% trans 'Is valid' %}
</a></th>
<i
class=
"fa fa-times text-danger"
></i>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
{% endif %}
</tr>
</td>
</thead>
<td
class=
"text-center"
>
</table>
<a
href=
"{% url 'perms:asset-permission-update' pk=asset_permission.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Update' %}
</a>
<a
href=
"{% url 'perms:asset-permission-delete' pk=asset_permission.id %}"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
</td>
</tr>
{% endfor %}
{% endblock %}
{% endblock %}
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
()
{
function
assetPermissionTableDraw
(
url
)
{
$
(
'table'
).
DataTable
({
var
options
=
{
"searching"
:
false
,
ele
:
$
(
'#asset-permission-list-table'
),
"paging"
:
false
,
buttons
:
[],
"order"
:
[]
columnDefs
:
[
})
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
})
var
detail_btn
=
'<a href="{% url "perms:asset-permission-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
</script>
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
targets
:
2
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
cellData
.
length
)
}
}},
{
targets
:
3
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
cellData
.
length
)
}
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
cellData
.
length
)
}
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
cellData
.
length
)
}
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
)
{
$
(
td
).
html
(
cellData
.
length
)
}
}},
{
targets
:
7
,
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
:
8
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "audits:proxy-log-detail" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Detail" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
delete_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_delete" data-uid="99991937" data-name="99991938">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
)
.
replace
(
'99991938'
,
rowData
.
name
);
$
(
td
).
html
(
detail_btn
+
delete_btn
)
}}
],
ajax_url
:
url
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"users"
},
{
data
:
"user_groups"
},
{
data
:
"assets"
},
{
data
:
'asset_groups'
},
{
data
:
"system_users"
},
{
data
:
"is_active"
},
{
data
:
'id'
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
}
function
searchAssetPermission
()
{
var
value
=
$
(
'.dataTables_filter input'
).
val
();
assetPermissionTableDraw
()
}
$
(
document
).
ready
(
function
(){
assetPermissionTableDraw
(
'{% url "perms:asset-permission-list-create-api" %}'
);
}).
on
(
'keyup'
,
'.dataTables_filter input'
,
function
()
{
searchAssetPermission
()
})
</script>
{% endblock %}
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment