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
7e2d627d
Commit
7e2d627d
authored
Jan 15, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 资产列表选择别的页会报错
parent
cc18ad9a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
asset_list.html
apps/assets/templates/assets/asset_list.html
+4
-12
jumpserver.js
apps/static/js/jumpserver.js
+7
-2
No files found.
apps/assets/templates/assets/asset_list.html
View file @
7e2d627d
...
...
@@ -31,8 +31,6 @@
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'Port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Cluster' %}
</th>
<th
class=
"text-center"
>
{% trans 'Type' %}
</th>
<th
class=
"text-center"
>
{% trans 'Env' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hardware' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Reachable' %}
</th>
...
...
@@ -78,22 +76,16 @@ function initTable() {
$
(
td
).
html
(
rowData
.
cluster_name
)
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
$
(
td
).
html
(
rowData
.
get_type_display
)
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
$
(
td
).
html
(
rowData
.
get_env_display
)
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
$
(
td
).
html
(
rowData
.
hardware_info
)
}},
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
)
{
{
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
)
{
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
==
'Unknown'
){
$
(
td
).
html
(
'<i class="fa fa-circle text-warning"></i>'
)
}
else
if
(
!
cellData
)
{
...
...
@@ -102,7 +94,7 @@ function initTable() {
$
(
td
).
html
(
'<i class="fa fa-circle text-navy"></i>'
)
}
}},
{
targets
:
10
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
"{{ DEFAULT_PK }}"
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
...
...
@@ -111,7 +103,7 @@ function initTable() {
ajax_url
:
'{% url "api-assets:asset-list" %}'
,
columns
:
[
{
data
:
"id"
},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"port"
},
{
data
:
"cluster"
},
{
data
:
"type"
},
{
data
:
"env"
},
{
data
:
"cluster"
},
{
data
:
"cpu_cores"
},
{
data
:
"is_active"
,
orderable
:
false
},
{
data
:
"is_connective"
,
orderable
:
false
},
{
data
:
"id"
,
orderable
:
false
}
],
...
...
apps/static/js/jumpserver.js
View file @
7e2d627d
...
...
@@ -373,7 +373,6 @@ jumpserver.initServerSideDataTable = function (options) {
url
:
options
.
ajax_url
,
data
:
function
(
data
)
{
delete
data
.
columns
;
var
length
=
data
.
length
;
if
(
data
.
length
!==
null
){
data
.
limit
=
data
.
length
;
delete
data
.
length
;
...
...
@@ -395,6 +394,12 @@ jumpserver.initServerSideDataTable = function (options) {
data
.
order
=
order
;
}
},
dataFilter
:
function
(
data
){
var
json
=
jQuery
.
parseJSON
(
data
);
json
.
recordsTotal
=
json
.
count
;
json
.
recordsFiltered
=
json
.
count
;
return
JSON
.
stringify
(
json
);
// return JSON string
},
dataSrc
:
"results"
},
columns
:
options
.
columns
||
[],
...
...
@@ -414,7 +419,7 @@ jumpserver.initServerSideDataTable = function (options) {
last
:
"»"
}
},
lengthMenu
:
[[
15
,
25
,
50
,
-
1
],
[
15
,
25
,
50
,
"All"
]]
lengthMenu
:
[[
15
,
25
,
50
],
[
15
,
25
,
50
]]
});
table
.
on
(
'select'
,
function
(
e
,
dt
,
type
,
indexes
)
{
var
$node
=
table
[
type
](
indexes
).
nodes
().
to$
();
...
...
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