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
277bbc07
Unverified
Commit
277bbc07
authored
Jul 19, 2019
by
BaiJiangJie
Committed by
GitHub
Jul 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2996 from jumpserver/dev
Dev
parents
fedfbba3
d97654b8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
30 deletions
+33
-30
_asset_user_list.html
apps/assets/templates/assets/_asset_user_list.html
+1
-2
asset_list.html
apps/assets/templates/assets/asset_list.html
+1
-2
adhoc_history.html
apps/ops/templates/ops/adhoc_history.html
+1
-1
task_adhoc.html
apps/ops/templates/ops/task_adhoc.html
+2
-2
task_history.html
apps/ops/templates/ops/task_history.html
+3
-2
jumpserver.js
apps/static/js/jumpserver.js
+15
-13
command_list.html
apps/terminal/templates/terminal/command_list.html
+4
-2
session_list.html
apps/terminal/templates/terminal/session_list.html
+6
-6
No files found.
apps/assets/templates/assets/_asset_user_list.html
View file @
277bbc07
...
...
@@ -51,8 +51,7 @@ function initAssetUserTable() {
}
else
{
innerHtml
=
'<i class="fa fa-circle text-warning"></i>'
}
var
date
=
new
Date
(
cellData
.
datetime
);
var
dateManual
=
date
.
toLocaleString
();
var
dateManual
=
formatDateAsCN
(
cellData
.
datetime
);
var
dataContent
=
testDatetime
+
dateManual
;
innerHtml
=
"<a data-toggle='popover' data-content='"
+
dataContent
+
"'"
+
'data-placement="auto bottom"'
+
">"
+
innerHtml
+
"</a>"
;
$
(
td
).
html
(
innerHtml
);
...
...
apps/assets/templates/assets/asset_list.html
View file @
277bbc07
...
...
@@ -159,8 +159,7 @@ function initTable() {
}
else
{
innerHtml
=
'<i class="fa fa-circle text-warning"></i>'
}
var
date
=
new
Date
(
cellData
.
datetime
);
var
dateManual
=
date
.
toLocaleString
();
var
dateManual
=
formatDateAsCN
(
cellData
.
datetime
);
var
dataContent
=
testDatetime
+
dateManual
;
innerHtml
=
"<a data-toggle='popover' data-content='"
+
dataContent
+
"'"
+
'data-placement="auto bottom"'
+
">"
+
innerHtml
+
"</a>"
;
$
(
td
).
html
(
innerHtml
);
...
...
apps/ops/templates/ops/adhoc_history.html
View file @
277bbc07
...
...
@@ -82,7 +82,7 @@ function initTable() {
select
:
[],
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
d
=
new
Date
(
cellData
);
var
d
=
formatDateAsCN
(
cellData
);
$
(
td
).
html
(
d
);
}},
{
targets
:
2
,
createdCell
:
function
(
td
,
cellData
)
{
...
...
apps/ops/templates/ops/task_adhoc.html
View file @
277bbc07
...
...
@@ -109,8 +109,8 @@ $(document).ready(function () {
}
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
var
d
=
new
Date
(
cellData
);
$
(
td
).
html
(
d
.
toLocaleString
()
)
var
d
=
formatDateAsCN
(
cellData
);
$
(
td
).
html
(
d
)
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a class="btn btn-xs btn-primary m-l-xs btn-run" href="{% url '
ops
:
adhoc
-
detail
' pk=DEFAULT_PK %}">{% trans "Detail" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
...
...
apps/ops/templates/ops/task_history.html
View file @
277bbc07
...
...
@@ -88,8 +88,9 @@ function initTable() {
select
:
[],
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
d
=
new
Date
(
cellData
);
$
(
td
).
html
(
d
.
toLocaleString
());
var
d
=
formatDateAsCN
(
cellData
);
$
(
td
).
html
(
d
);
}},
{
targets
:
2
,
createdCell
:
function
(
td
,
cellData
)
{
var
total
=
"<span>"
+
cellData
.
total
+
"</span>"
;
...
...
apps/static/js/jumpserver.js
View file @
277bbc07
...
...
@@ -305,7 +305,6 @@ function requestApi(props) {
toastr
.
error
(
msg
);
}
if
(
typeof
props
.
error
===
'function'
)
{
console
.
log
(
jqXHR
);
return
props
.
error
(
jqXHR
.
responseText
,
jqXHR
.
status
);
}
});
...
...
@@ -610,7 +609,6 @@ jumpserver.initServerSideDataTable = function (options) {
if
(
kv
.
length
===
2
)
{
var
value
=
kv
[
1
];
value
=
value
.
replace
(
"+"
,
" "
);
console
.
log
(
value
);
search_attr
[
kv
[
0
]]
=
value
}
else
{
search_raw
.
push
(
kv
)
...
...
@@ -654,8 +652,6 @@ jumpserver.initServerSideDataTable = function (options) {
$
.
each
(
rows
,
function
(
id
,
row
)
{
table
.
selected_rows
.
push
(
row
);
if
(
row
.
id
&&
$
.
inArray
(
row
.
id
,
table
.
selected
)
===
-
1
){
console
.
log
(
table
)
console
.
log
(
table
.
selected
);
table
.
selected
.
push
(
row
.
id
)
}
})
...
...
@@ -1095,7 +1091,7 @@ function objectAttrsIsList(obj, attrs) {
function
objectAttrsIsDatetime
(
obj
,
attrs
)
{
attrs
.
forEach
(
function
(
attr
)
{
obj
[
attr
]
=
new
Date
(
obj
[
attr
]).
toISOString
(
);
obj
[
attr
]
=
formatDateAsCN
(
obj
[
attr
]
);
})
}
...
...
@@ -1110,7 +1106,12 @@ function objectAttrsIsBool(obj, attrs) {
}
function
cleanDate
(
d
)
{
if
(
typeof
d
===
'number'
){
return
d
}
if
(
typeof
d
===
'number'
){
return
d
}
if
(
typeof
d
===
"string"
)
{
d
=
d
.
replaceAll
(
'-'
,
'/'
)
}
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
if
(
isNaN
(
Date
.
parse
(
d
)))
{
d
=
d
.
split
(
'+'
)[
0
].
trimRight
();
...
...
@@ -1121,9 +1122,13 @@ function cleanDate(d) {
return
''
}
function
safeDate
(
s
)
{
s
=
cleanDate
(
s
);
return
new
Date
(
s
)
}
function
formatDateAsCN
(
d
)
{
d
=
cleanDate
(
d
);
var
date
=
new
Date
(
d
);
var
date
=
safeDate
(
d
);
var
date_s
=
date
.
toLocaleString
(
navigator
.
language
,
{
hour12
:
false
});
return
date_s
.
split
(
"/"
).
join
(
'-'
)
}
...
...
@@ -1151,10 +1156,8 @@ function getTimeUnits(u) {
}
function
timeOffset
(
a
,
b
)
{
a
=
cleanDate
(
a
);
b
=
cleanDate
(
b
);
var
start
=
new
Date
(
a
);
var
end
=
new
Date
(
b
);
var
start
=
safeDate
(
a
);
var
end
=
safeDate
(
b
);
var
offset
=
(
end
-
start
)
/
1000
;
var
days
=
offset
/
3600
/
24
;
...
...
@@ -1179,7 +1182,6 @@ function readFile(ref) {
var
hasFile
=
files
&&
files
.
length
>
0
;
if
(
hasFile
)
{
var
reader
=
new
FileReader
();
//新建一个FileReader
console
.
log
(
typeof
files
[
0
]);
reader
.
readAsText
(
files
[
0
],
"UTF-8"
);
//读取文件
reader
.
onload
=
function
(
evt
){
//读取完文件之后会回来这里
ref
.
trigger
(
"onload"
,
evt
.
target
.
result
);
...
...
apps/terminal/templates/terminal/command_list.html
View file @
277bbc07
...
...
@@ -89,14 +89,16 @@ $(document).ready(function () {
language
:
navigator
.
language
||
"en"
,
};
dateFromRef
.
datepicker
(
options
).
on
(
"changeDate"
,
function
()
{
var
date
=
new
Date
(
$
(
this
).
val
()
+
' 0:0:0'
);
var
value
=
$
(
this
).
val
()
+
' 0:0:0'
;
var
date
=
safeDate
(
value
);
var
url
=
table
.
ajax
.
url
();
url
=
setUrlParam
(
url
,
"date_from"
,
date
.
getTime
()
/
1000
);
table
.
ajax
.
url
(
url
);
table
.
ajax
.
reload
();
});
dateToRef
.
datepicker
(
options
).
on
(
"changeDate"
,
function
()
{
var
date
=
new
Date
(
$
(
this
).
val
()
+
' 23:59:59'
);
var
value
=
$
(
this
).
val
()
+
' 23:59:59'
;
var
date
=
safeDate
(
value
);
var
url
=
table
.
ajax
.
url
();
url
=
setUrlParam
(
url
,
"date_to"
,
date
.
getTime
()
/
1000
);
table
.
ajax
.
url
(
url
);
...
...
apps/terminal/templates/terminal/session_list.html
View file @
277bbc07
...
...
@@ -104,8 +104,8 @@ var dateFrom = "{{ date_from.timestamp }}";
var
dateTo
=
"{{ date_to.timestamp }}"
;
function
initTable
()
{
dateFrom
=
new
Date
(
dateFrom
*
1000
).
toISOString
(
);
dateTo
=
new
Date
(
dateTo
*
1000
).
toISOString
(
);
dateFrom
=
formatDateAsCN
(
dateFrom
*
1000
);
dateTo
=
formatDateAsCN
(
dateTo
*
1000
);
sessionListUrl
=
setUrlParam
(
sessionListUrl
,
"date_from"
,
dateFrom
);
sessionListUrl
=
setUrlParam
(
sessionListUrl
,
"date_to"
,
dateTo
);
var
options
=
{
...
...
@@ -201,9 +201,9 @@ $(document).ready(function() {
return
}
var
value
=
$
(
this
).
val
()
+
' 0:0:0'
;
var
date
=
new
Date
(
value
);
var
date
=
formatDateAsCN
(
value
);
var
url
=
table
.
ajax
.
url
();
url
=
setUrlParam
(
url
,
"date_from"
,
date
.
toISOString
()
);
url
=
setUrlParam
(
url
,
"date_from"
,
date
);
table
.
ajax
.
url
(
url
);
table
.
ajax
.
reload
();
});
...
...
@@ -212,9 +212,9 @@ $(document).ready(function() {
return
}
var
value
=
$
(
this
).
val
()
+
' 23:59:59'
;
var
date
=
new
Date
(
value
);
var
date
=
formatDateAsCN
(
value
);
var
url
=
table
.
ajax
.
url
();
url
=
setUrlParam
(
url
,
"date_to"
,
date
.
toISOString
()
);
url
=
setUrlParam
(
url
,
"date_to"
,
date
);
table
.
ajax
.
url
(
url
);
table
.
ajax
.
reload
();
});
...
...
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