2017-04-02 10:09:40 +00:00
{ % extends ' base.html ' % }
2018-09-03 03:24:25 +00:00
{ % load i18n % }
2017-04-02 10:09:40 +00:00
{ % 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 >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Total users ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " ibox-content " >
2020-05-08 07:41:56 +00:00
< h1 class = " no-margins " > < a href = " { % u rl ' users:user-list ' % } " > < span id = " total_count_users " > < / span > < / a > < / h1 >
2018-02-26 09:28:03 +00:00
< small > All users < / small >
2017-04-02 10:09:40 +00:00
< / div >
< / div >
< / div >
< div class = " col-sm-3 " >
< div class = " ibox float-e-margins " >
< div class = " ibox-title " >
2020-05-08 07:41:56 +00:00
< span class = " label label-info pull-right " > Assets < / span >
< h5 > { % trans ' Total assets ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " ibox-content " >
2020-05-08 07:41:56 +00:00
< h1 class = " no-margins " > < a href = " { % u rl ' assets:asset-list ' % } " > < span id = " total_count_assets " > < / span > < / a > < / h1 >
< small > All assets < / small >
2017-04-02 10:09:40 +00:00
< / 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 >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Online users ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " ibox-content " >
2020-05-08 07:41:56 +00:00
< h1 class = " no-margins " > < a href = " { % u rl ' terminal:session-online-list ' % } " > < span id = " total_count_online_users " > < / span > < / a > < / h1 >
2018-02-26 09:28:03 +00:00
< small > Online users < / small >
2017-04-02 10:09:40 +00:00
< / 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 >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Online sessions ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " ibox-content " >
2020-05-08 12:02:00 +00:00
< h1 class = " no-margins " > < a href = " { % u rl ' terminal:session-online-list ' % } " > < span id = " total_count_online_sessions " > < / span > < / a > < / h1 >
2017-12-04 12:15:47 +00:00
< small > Online sessions < / small >
2017-04-02 10:09:40 +00:00
< / div >
< / div >
< / div >
< / div >
< div class = " row " >
< div class = " col-sm-2 border-bottom white-bg dashboard-header " style = " margin-left:15px;height: 346px " >
2020-05-20 11:35:33 +00:00
< small > { % trans ' In the past week, a total of ' % } < span class = " text-info " id = " dates_total_count_login_users " > < / span > { % trans ' users have logged in ' % } < span class = " text-success " id = " dates_total_count_login_times " > < / span > { % trans ' times asset. ' % } < / small >
< ul class = " list-group clear-list m-t " id = " dates_login_times_top5_users " >
2017-04-02 10:09:40 +00:00
< / ul >
< / div >
2020-05-20 11:35:33 +00:00
< div class = " col-sm-7 " id = " dates_metrics_echarts " style = " margin-left: -15px;height: 346px;padding: 15px 0 15px 0; " > < / div >
2017-04-02 10:09:40 +00:00
< div class = " col-sm-3 white-bg " id = " top1 " style = " margin-left: -15px;height: 346px " >
< div class = " statistic-box " >
< h4 >
2018-09-03 03:24:25 +00:00
{ % trans ' Active user asset ratio ' % }
2017-04-02 10:09:40 +00:00
< / h4 >
< p >
2018-09-03 03:24:25 +00:00
{ % trans ' The following graphs describe the percentage of active users per month and assets per user host per month, respectively. ' % }
2017-04-02 10:09:40 +00:00
< / p >
< div class = " row text-center " >
< div class = " col-sm-6 " >
2020-05-20 11:35:33 +00:00
< div id = " dates_total_count_users_pie " style = " width: 140px; height: 140px; " >
2017-04-02 10:09:40 +00:00
< / div >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' User ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " col-sm-6 " >
2020-05-20 11:35:33 +00:00
< div id = " dates_total_count_assets_pie " style = " width: 140px; height: 140px; " > < / div >
2020-05-08 07:41:56 +00:00
< h5 > { % trans ' Asset ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< / 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 " >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Top 10 assets in a week ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< 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 " >
2018-09-03 03:24:25 +00:00
< h3 > < i class = " fa fa-inbox " > < / i > { % trans ' Top 10 assets in a week ' % } < / h3 >
< small > < i class = " fa fa-map-marker " > < / i > { % trans ' Login frequency and last login record. ' % } < / small >
2017-04-02 10:09:40 +00:00
< / div >
2020-05-20 11:35:33 +00:00
< div class = " ibox-content inspinia-timeline " id = " dates_login_times_top10_assets " >
2017-04-02 10:09:40 +00:00
< / div >
< / div >
< / div >
< div class = " col-sm-4 " >
< div class = " ibox float-e-margins " >
< div class = " ibox-title " >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Last 10 login ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< div class = " ibox-tools " >
< span class = " label label-info-light " > 10 Messages < / span >
< / div >
< / div >
< div class = " ibox-content ibox-heading " >
2018-09-03 03:24:25 +00:00
< h3 > < i class = " fa fa-paper-plane-o " > < / i > { % trans ' Login record ' % } < / h3 >
< small > < i class = " fa fa-map-marker " > < / i > { % trans ' Last 10 login records. ' % } < / small >
2017-04-02 10:09:40 +00:00
< / div >
< div class = " ibox-content " >
< div >
2020-05-20 11:35:33 +00:00
< div class = " feed-activity-list " id = " dates_login_record_top10_sessions " >
2017-04-02 10:09:40 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = " col-sm-4 " >
< div class = " ibox float-e-margins " >
< div class = " ibox-title " >
2018-09-03 03:24:25 +00:00
< h5 > { % trans ' Top 10 users in a week ' % } < / h5 >
2017-04-02 10:09:40 +00:00
< 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 " >
2018-09-03 03:24:25 +00:00
< h3 > < i class = " fa fa-user " > < / i > { % trans ' Top 10 users in a week ' % } < / h3 >
< small > < i class = " fa fa-map-marker " > < / i > { % trans ' User login frequency and last login record. ' % } < / small >
2017-04-02 10:09:40 +00:00
< / div >
2020-05-20 11:35:33 +00:00
< div class = " ibox-content inspinia-timeline " id = " dates_login_times_top10_users " >
2017-04-02 10:09:40 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
{ % endblock % }
{ % block custom_foot_js % }
< script src = " { % s tatic ' js/plugins/echarts/echarts.js ' % } " > < / script >
< script >
2020-05-08 07:41:56 +00:00
function requireMonthMetricsECharts ( data ) {
2017-04-02 10:09:40 +00:00
require (
[
' echarts ' ,
' echarts/chart/line '
] ,
function ( ec ) {
2020-05-20 11:35:33 +00:00
var monthMetricsECharts = ec . init ( document . getElementById ( ' dates_metrics_echarts ' ) ) ;
2017-04-02 10:09:40 +00:00
var option = {
title : {
2018-09-03 03:24:25 +00:00
text : " { % trans ' Monthly data overview ' % } " ,
subtext : " { % trans ' History summary in one month ' % } " ,
2017-04-02 10:09:40 +00:00
x : ' center '
} ,
tooltip : {
trigger : ' axis '
} ,
backgroundColor : ' #fff ' ,
legend : {
2018-09-03 03:24:25 +00:00
data : [ " { % trans ' Login count ' % } " , " { % trans ' Active users ' % } " , " { % trans ' Active assets ' % } " ] ,
2017-04-02 10:09:40 +00:00
y : ' bottom '
} ,
toolbox : {
show : false ,
feature : {
magicType : { show : true , type : [ ' line ' , ' bar ' ] }
}
} ,
calculable : true ,
xAxis : [
{
type : ' category ' ,
boundaryGap : false ,
2020-05-20 11:35:33 +00:00
data : data [ ' dates_metrics_date ' ] ,
2017-04-02 10:09:40 +00:00
}
] ,
yAxis : [
{
type : ' value '
}
] ,
series : [
{
2020-03-12 08:24:38 +00:00
name : " { % trans ' Login count ' % } " ,
2017-04-02 10:09:40 +00:00
type : ' line ' ,
2020-03-12 08:24:38 +00:00
smooth : true ,
2017-04-02 10:09:40 +00:00
itemStyle : { normal : { areaStyle : { type : ' default ' } } } ,
2020-05-20 11:35:33 +00:00
data : data [ ' dates_metrics_total_count_login ' ]
2017-04-02 10:09:40 +00:00
} ,
{
2020-03-12 08:24:38 +00:00
name : " { % trans ' Active users ' % } " ,
type : ' line ' ,
smooth : true ,
2017-04-02 10:09:40 +00:00
itemStyle : { normal : { areaStyle : { type : ' default ' } } } ,
2020-05-20 11:35:33 +00:00
data : data [ ' dates_metrics_total_count_active_users ' ]
2017-04-02 10:09:40 +00:00
} ,
{
2018-09-03 03:24:25 +00:00
name : " { % trans ' Active assets ' % } " ,
2017-04-02 10:09:40 +00:00
type : ' line ' ,
smooth : true ,
itemStyle : { normal : { areaStyle : { type : ' default ' } } } ,
2020-05-20 11:35:33 +00:00
data : data [ ' dates_metrics_total_count_active_assets ' ]
2017-04-02 10:09:40 +00:00
}
]
} ;
2020-05-08 07:41:56 +00:00
monthMetricsECharts . setOption ( option ) ;
2017-04-02 10:09:40 +00:00
}
) ;
2020-05-08 07:41:56 +00:00
}
function requireMonthTotalCountUsersPie ( data ) {
2017-04-02 10:09:40 +00:00
require (
[
' echarts ' ,
' echarts/chart/pie '
] ,
function ( ec ) {
2020-05-20 11:35:33 +00:00
var monthTotalCountUsersPie = ec . init ( document . getElementById ( ' dates_total_count_users_pie ' ) ) ;
2017-04-02 10:09:40 +00:00
var option = {
tooltip : {
trigger : ' item ' ,
2020-05-08 07:41:56 +00:00
formatter : " {b} <br> {c} <br> ( {d} % ) "
2017-04-02 10:09:40 +00:00
} ,
legend : {
show : false ,
orient : ' vertical ' ,
x : ' left ' ,
2018-09-03 03:24:25 +00:00
data : [ " { % trans ' Monthly active users ' % } " , " { % trans ' Disable user ' % } " , " { % trans ' Month not logged in user ' % } " ]
2017-04-02 10:09:40 +00:00
} ,
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 : [
{
2018-09-03 03:24:25 +00:00
name : " { % trans ' Access to the source ' % } " ,
2017-04-02 10:09:40 +00:00
type : ' pie ' ,
radius : [ ' 50 % ' , ' 70 % ' ] ,
2020-05-08 07:41:56 +00:00
avoidLabelOverlap : false ,
2017-04-02 10:09:40 +00:00
itemStyle : {
normal : {
label : {
show : false
} ,
labelLine : {
show : false
}
} ,
emphasis : {
label : {
show : true ,
position : ' center ' ,
textStyle : {
fontSize : ' 5 ' ,
fontWeight : ' bold '
}
}
}
} ,
data : [
2020-05-20 11:35:33 +00:00
{ value : data [ ' dates_total_count_active_users ' ] , name : " { % trans ' Monthly active users ' % } " } ,
{ value : data [ ' dates_total_count_disabled_users ' ] , name : " { % trans ' Disable user ' % } " } ,
{ value : data [ ' dates_total_count_inactive_users ' ] , name : " { % trans ' Month not logged in user ' % } " }
2017-04-02 10:09:40 +00:00
]
}
]
} ;
2020-05-08 07:41:56 +00:00
monthTotalCountUsersPie . setOption ( option ) ;
2017-04-02 10:09:40 +00:00
}
) ;
2020-05-08 07:41:56 +00:00
}
function requireMonthTotalCountAssetsPie ( data ) {
2017-04-02 10:09:40 +00:00
require (
[
' echarts ' ,
' echarts/chart/pie '
] ,
function ( ec ) {
2020-05-20 11:35:33 +00:00
var monthTotalCountAssetsPie = ec . init ( document . getElementById ( ' dates_total_count_assets_pie ' ) ) ;
2017-04-02 10:09:40 +00:00
var option = {
tooltip : {
trigger : ' item ' ,
2020-05-08 07:41:56 +00:00
formatter : " {b} <br> {c} <br> ( {d} % ) "
2017-04-02 10:09:40 +00:00
} ,
legend : {
show : false ,
orient : ' vertical ' ,
x : ' left ' ,
2020-05-08 07:41:56 +00:00
data : [ " { % trans ' Month is logged into the asset ' % } " , " { % trans ' Disable host ' % } " , " { % trans ' Month not logged on host ' % } " ]
2017-04-02 10:09:40 +00:00
} ,
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 : [
{
2018-09-03 03:24:25 +00:00
name : " { % trans ' Access to the source ' % } " ,
2017-04-02 10:09:40 +00:00
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 : [
2020-05-20 11:35:33 +00:00
{ value : data [ ' dates_total_count_active_assets ' ] , name : " { % trans ' Month is logged into the host ' % } " } ,
{ value : data [ ' dates_total_count_disabled_assets ' ] , name : " { % trans ' Disable host ' % } " } ,
{ value : data [ ' dates_total_count_inactive_assets ' ] , name : " { % trans ' Month not logged on host ' % } " }
2017-04-02 10:09:40 +00:00
]
}
]
} ;
2020-05-08 07:41:56 +00:00
monthTotalCountAssetsPie . setOption ( option ) ;
2017-04-02 10:09:40 +00:00
}
) ;
2020-05-08 07:41:56 +00:00
}
var indexUrl = " /api/v1/index/ " ;
function renderRequestApi ( query , success , error ) {
var url = indexUrl + " ? " + query ;
if ( ! error ) {
error = function ( ) { console . log ( " Request url error: " + url ) }
}
requestApi ( {
url : url ,
method : " GET " ,
success : success ,
error : error ,
flash_message : false ,
} )
}
function renderTotalCount ( ) {
var success = function ( data ) {
$ ( ' #total_count_assets ' ) . html ( data [ ' total_count_assets ' ] ) ;
$ ( ' #total_count_users ' ) . html ( data [ ' total_count_users ' ] ) ;
$ ( ' #total_count_online_users ' ) . html ( data [ ' total_count_online_users ' ] ) ;
2020-05-08 12:02:00 +00:00
$ ( ' #total_count_online_sessions ' ) . html ( data [ ' total_count_online_sessions ' ] ) ;
2020-05-08 07:41:56 +00:00
} ;
renderRequestApi ( ' total_count=1 ' , success ) ;
}
function renderMonthMetricsECharts ( ) {
var success = function ( data ) {
requireMonthMetricsECharts ( data )
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_metrics=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderMonthTotalCountUsersPie ( ) {
var success = function ( data ) {
requireMonthTotalCountUsersPie ( data )
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_total_count_users=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderMonthTotalCountAssetsPie ( ) {
var success = function ( data ) {
requireMonthTotalCountAssetsPie ( data )
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_total_count_assets=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderWeekTotalCount ( ) {
var success = function ( data ) {
2020-05-20 11:35:33 +00:00
$ ( ' #dates_total_count_login_users ' ) . html ( data [ ' dates_total_count_login_users ' ] ) ;
$ ( ' #dates_total_count_login_times ' ) . html ( data [ ' dates_total_count_login_times ' ] )
2020-05-08 07:41:56 +00:00
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_total_count=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderWeekLoginTimesTop5Users ( ) {
var success = function ( data ) {
var html = " " ;
var html_cell = " " +
" <li class= \" list-group-item fist-item \" > " +
" <span class= \" pull-right \" > " +
" {TOTAL} { % trans ' times/week ' % } " +
" </span> " +
" <span class= \" label \" > {INDEX} </span> {USER} " +
" </li> " ;
2020-05-20 11:35:33 +00:00
$ . each ( data [ ' dates_login_times_top5_users ' ] , function ( index , value ) {
2020-05-08 07:41:56 +00:00
html + = html_cell . replace ( ' {TOTAL} ' , value [ ' total ' ] )
. replace ( ' {USER} ' , value [ ' user ' ] )
. replace ( ' {INDEX} ' , index + 1 )
} ) ;
2020-05-20 11:35:33 +00:00
$ ( ' #dates_login_times_top5_users ' ) . html ( html )
2020-05-08 07:41:56 +00:00
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_login_times_top5_users=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderWeekLoginTimesTop10Assets ( ) {
var success = function ( data ) {
var html = " " ;
var html_cell = " " +
" <div class= \" timeline-item \" > " +
" <div class= \" row \" > " +
" <div class= \" col-xs-5 date ellipsis \" > " +
" <i class= \" fa fa-info-circle \" ></i> " +
" <strong data-toggle= \" tooltip \" title= \" {ASSET} \" > {ASSET} </strong> " +
" <br/> " +
" <small class= \" text-navy \" > {TOTAL} { % trans ' times ' % }</small> " +
" </div> " +
" <div class= \" col-xs-7 content no-top-border \" > " +
" <p class= \" m-b-xs \" > { % trans ' The time last logged in ' % }</p> " +
" <p> { % trans ' At ' % } {DATE_LAST} </p> " +
" </div> " +
" </div> " +
" </div> " ;
2020-05-20 11:35:33 +00:00
var assets = data [ ' dates_login_times_top10_assets ' ] ;
2020-05-08 07:41:56 +00:00
if ( assets . length != = 0 ) {
$ . each ( assets , function ( index , value ) {
html + = html_cell
. replaceAll ( ' {ASSET} ' , value [ ' asset ' ] )
. replace ( ' {TOTAL} ' , value [ ' total ' ] )
. replace ( ' {DATE_LAST} ' , toSafeLocalDateStr ( value [ ' last ' ] ) )
} ) ;
}
else {
html + = " <p class= \" text-center \" > { % trans ' (No) ' % }</p> "
}
2020-05-20 11:35:33 +00:00
$ ( ' #dates_login_times_top10_assets ' ) . html ( html )
2020-05-08 07:41:56 +00:00
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_login_times_top10_assets=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderWeekLoginTimesTop10Users ( ) {
var success = function ( data ) {
var html = " " ;
var html_cell = " " +
" <div class= \" timeline-item \" > " +
" <div class= \" row \" > " +
" <div class= \" col-xs-5 date ellipsis \" > " +
" <i class= \" fa fa-info-circle \" ></i> " +
" <strong data-toggle= \" tooltip \" title= \" {USER} \" > {USER} </strong> " +
" <br/> " +
" <small class= \" text-navy \" > {TOTAL} { % trans ' times ' % }</small> " +
" </div> " +
" <div class= \" col-xs-7 content no-top-border \" > " +
" <p class= \" m-b-xs \" > { % trans ' The time last logged in ' % }</p> " +
" <p> { % trans ' At ' % } {DATE_LAST} </p> " +
" </div> " +
" </div> " +
" </div> " ;
2020-05-20 11:35:33 +00:00
var users = data [ ' dates_login_times_top10_users ' ] ;
2020-05-08 07:41:56 +00:00
if ( users . length != = 0 ) {
$ . each ( users , function ( index , value ) {
html + = html_cell . replaceAll ( ' {USER} ' , value [ ' user ' ] )
. replace ( ' {TOTAL} ' , value [ ' total ' ] )
. replace ( ' {DATE_LAST} ' , toSafeLocalDateStr ( value [ ' last ' ] ) )
} ) ;
}
else {
html + = " <p class= \" text-center \" > { % trans ' (No) ' % }</p> "
}
2020-05-20 11:35:33 +00:00
$ ( ' #dates_login_times_top10_users ' ) . html ( html )
2020-05-08 07:41:56 +00:00
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_login_times_top10_users=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderWeekLoginRecordTop10Sessions ( ) {
var success = function ( data ) {
var html = " " ;
var html_cell = " " +
" <div class= \" feed-element \" > " +
" <a href= \" # \" class= \" pull-left \" > " +
" <img alt= \" image \" class= \" img-circle \" src= \" { % s tatic ' img/avatar/user.png ' % } \" > " +
" </a> " +
" <div class= \" media-body \" > " +
" <small class= \" pull-right {TEXT_NAVY} \" > {TIMESINCE} { % trans ' Before ' % }</small> " +
" <strong> {USER} </strong> { % trans ' Login in ' % } {ASSET} <br> " +
" <small class= \" text-muted \" > {DATE_START} </small> " +
" </div> " +
" </div> " ;
2020-05-20 11:35:33 +00:00
var users = data [ ' dates_login_record_top10_sessions ' ] ;
2020-05-08 07:41:56 +00:00
if ( users . length != = 0 ) {
$ . each ( users , function ( index , value ) {
console . log ( value [ ' is_finished ' ] )
html + = html_cell . replaceAll ( ' {USER} ' , value [ ' user ' ] )
. replace ( ' {ASSET} ' , value [ ' asset ' ] )
. replace ( ' {DATE_START} ' , toSafeLocalDateStr ( value [ ' date_start ' ] ) )
. replace ( ' {TEXT_NAVY} ' , value [ ' is_finished ' ] ? ' ' : ' text-navy ' )
. replace ( ' {TIMESINCE} ' , value [ ' timesince ' ] )
} ) ;
}
else {
html + = " <p class= \" text-center \" > { % trans ' (No) ' % }</p> "
}
2020-05-20 11:35:33 +00:00
$ ( ' #dates_login_record_top10_sessions ' ) . html ( html )
2020-05-08 07:41:56 +00:00
} ;
2020-05-20 11:35:33 +00:00
renderRequestApi ( ' dates_login_record_top10_sessions=1 ' , success )
2020-05-08 07:41:56 +00:00
}
function renderData ( ) {
renderTotalCount ( ) ;
renderMonthMetricsECharts ( ) ;
renderMonthTotalCountUsersPie ( ) ;
renderMonthTotalCountAssetsPie ( ) ;
renderWeekTotalCount ( ) ;
renderWeekLoginTimesTop5Users ( ) ;
renderWeekLoginTimesTop10Assets ( ) ;
renderWeekLoginRecordTop10Sessions ( ) ;
renderWeekLoginTimesTop10Users ( ) ;
}
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 '
}
} ) ;
$ ( document ) . ready ( function ( ) {
$ ( ' #show ' ) . click ( function ( ) {
$ ( ' #show ' ) . css ( ' display ' , ' none ' ) ;
$ ( ' #more ' ) . css ( ' display ' , ' block ' ) ;
} ) ;
$ ( " [data-toggle= ' tooltip ' ] " ) . tooltip ( ) ;
renderData ( )
} ) ;
2017-04-02 10:09:40 +00:00
< / script >
2019-12-05 07:09:25 +00:00
{ % endblock % }