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
cf8af114
Commit
cf8af114
authored
Feb 27, 2015
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
9d44bc15
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
5 deletions
+84
-5
views.py
jumpserver/views.py
+2
-2
index.html
templates/index.html
+82
-3
No files found.
jumpserver/views.py
View file @
cf8af114
...
@@ -36,8 +36,8 @@ def index(request):
...
@@ -36,8 +36,8 @@ def index(request):
path1
,
path2
=
u'仪表盘'
,
'Dashboard'
path1
,
path2
=
u'仪表盘'
,
'Dashboard'
dic
=
{}
dic
=
{}
li_date
,
li_str
=
getDaysByNum
(
7
)
li_date
,
li_str
=
getDaysByNum
(
7
)
li_str
=
json
.
dumps
(
li_str
)
#
li_str = json.dumps(li_str)
print
li_str
# print li_str, type(li_str)
today
=
datetime
.
datetime
.
now
()
.
day
today
=
datetime
.
datetime
.
now
()
.
day
from_week
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
7
)
from_week
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
7
)
week_data
=
Log
.
objects
.
filter
(
start_time__range
=
[
from_week
,
datetime
.
datetime
.
now
()])
week_data
=
Log
.
objects
.
filter
(
start_time__range
=
[
from_week
,
datetime
.
datetime
.
now
()])
...
...
templates/index.html
View file @
cf8af114
...
@@ -58,13 +58,14 @@
...
@@ -58,13 +58,14 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div>
{{ li_str }}
</div>
<div
id=
"high"
style=
"width:100%;height:400px;"
></div>
<div
id=
"high"
style=
"width:100%;height:400px;"
></div>
</br>
<div
id=
"dynamic"
style=
"width:100%;height:400px;"
></div>
</div>
</div>
</div>
</div>
<script>
<script>
var
cate
=
{{
li_str
}};
var
cate
=
{{
li_str
|
safe
}};
$
(
function
()
{
$
(
function
()
{
$
(
'#high'
).
highcharts
({
$
(
'#high'
).
highcharts
({
title
:
{
title
:
{
...
@@ -79,7 +80,8 @@ $(function () {
...
@@ -79,7 +80,8 @@ $(function () {
type
:
'datetime'
,
type
:
'datetime'
,
categories
:
cate
categories
:
cate
},
},
yAxis
:
{
yAxis
:{
min
:
0
,
title
:
{
title
:
{
text
:
'登录次数'
text
:
'登录次数'
},
},
...
@@ -105,6 +107,83 @@ $(function () {
...
@@ -105,6 +107,83 @@ $(function () {
{
%
endfor
%
}
{
%
endfor
%
}
]
]
});
});
$
(
document
).
ready
(
function
()
{
Highcharts
.
setOptions
({
global
:
{
useUTC
:
false
}
});
var
chart
;
$
(
'#dynamic'
).
highcharts
({
chart
:
{
type
:
'spline'
,
animation
:
Highcharts
.
svg
,
// don't animate in old IE
marginRight
:
10
,
events
:
{
load
:
function
()
{
// set up the updating of the chart each second
var
series
=
this
.
series
[
0
];
setInterval
(
function
()
{
var
x
=
(
new
Date
()).
getTime
(),
// current time
y
=
Math
.
random
();
series
.
addPoint
([
x
,
y
],
true
,
true
);
},
1000
);
}
}
},
title
:
{
text
:
'Live random data'
},
xAxis
:
{
type
:
'datetime'
,
tickPixelInterval
:
150
},
yAxis
:
{
title
:
{
text
:
'Value'
},
plotLines
:
[{
value
:
0
,
width
:
1
,
color
:
'#808080'
}]
},
tooltip
:
{
formatter
:
function
()
{
return
'<b>'
+
this
.
series
.
name
+
'</b><br/>'
+
Highcharts
.
dateFormat
(
'%Y-%m-%d %H:%M:%S'
,
this
.
x
)
+
'<br/>'
+
Highcharts
.
numberFormat
(
this
.
y
,
2
);
}
},
legend
:
{
enabled
:
false
},
exporting
:
{
enabled
:
false
},
series
:
[{
name
:
'Random data'
,
data
:
(
function
()
{
// generate an array of random data
var
data
=
[],
time
=
(
new
Date
()).
getTime
(),
i
;
for
(
i
=
-
19
;
i
<=
0
;
i
++
)
{
data
.
push
({
x
:
time
+
i
*
1000
,
y
:
Math
.
random
()
});
}
return
data
;
})()
}]
});
});
});
});
</script>
</script>
...
...
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