Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
111
Issues
111
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
d248a0f8
Commit
d248a0f8
authored
Apr 12, 2016
by
Leigh Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beef up the usage summary, show the user's 30 day rank.
Also add an admin option from the Class page.
parent
a5ff53ac
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
2 deletions
+163
-2
www/aptui/js/user-dashboard.js
www/aptui/js/user-dashboard.js
+68
-1
www/aptui/server-ajax.php
www/aptui/server-ajax.php
+7
-1
www/aptui/template/user-dashboard.html
www/aptui/template/user-dashboard.html
+4
-0
www/aptui/user-dashboard.ajax
www/aptui/user-dashboard.ajax
+84
-0
No files found.
www/aptui/js/user-dashboard.js
View file @
d248a0f8
...
...
@@ -39,11 +39,46 @@ function (_, sup, moment, mainString,
window
.
location
.
hash
=
e
.
target
.
hash
;
});
LoadUsage
();
LoadExperimentTab
();
// Should we do these on demand?
LoadProfileListTab
();
LoadProjectsTab
();
LoadProfileTab
();
/*
* Handlers for inline operations.
*/
$
(
'
#sendtestmessage
'
).
click
(
function
()
{
SendTestMessage
();
});
}
function
LoadUsage
()
{
var
callback
=
function
(
json
)
{
console
.
info
(
json
);
if
(
json
.
code
)
{
console
.
info
(
json
.
value
);
return
;
}
var
blob
=
json
.
value
;
if
(
blob
.
rank
)
{
var
html
=
"
<div>
"
+
blob
.
rankdays
+
"
Day Usage Ranking: #
"
+
blob
.
rank
+
"
of
"
+
blob
.
ranktotal
+
"
active users
"
+
"
</div>
"
;
$
(
'
#usage-summary
'
).
html
(
html
);
}
}
var
xmlthing
=
sup
.
CallServerMethod
(
null
,
"
user-dashboard
"
,
"
UsageSummary
"
,
{
"
uid
"
:
window
.
TARGET_USER
});
xmlthing
.
done
(
callback
);
}
function
LoadExperimentTab
()
...
...
@@ -121,7 +156,25 @@ function (_, sup, moment, mainString,
var
table
=
$
(
'
#profiles_table
'
)
.
tablesorter
({
theme
:
'
green
'
,
widgets
:
[
"
filter
"
],
widgetOptions
:
{
// include child row content while filtering, if true
filter_childRows
:
true
,
// include all columns in the search.
filter_anyMatch
:
true
,
// class name applied to filter row and each input
filter_cssFilter
:
'
form-control
'
,
// search from beginning
filter_startsWith
:
false
,
// Set this option to false for case sensitive search
filter_ignoreCase
:
true
,
// Only one search box.
filter_columnFilters
:
false
,
// Search as typing
filter_liveSearch
:
true
,
},
});
$
.
tablesorter
.
filter
.
bindSearch
(
table
,
$
(
'
#profile_search
'
));
}
var
xmlthing
=
sup
.
CallServerMethod
(
null
,
"
user-dashboard
"
,
"
ProfileList
"
,
...
...
@@ -131,7 +184,6 @@ function (_, sup, moment, mainString,
function
ShowTopology
(
profile
)
{
var
profile
;
var
index
;
var
callback
=
function
(
json
)
{
...
...
@@ -244,5 +296,20 @@ function (_, sup, moment, mainString,
callback
);
}
function
SendTestMessage
()
{
var
callback
=
function
(
json
)
{
if
(
json
.
code
)
{
alert
(
"
Test message could not be sent!
"
);
return
;
}
alert
(
"
Test message has been sent
"
);
}
var
xmlthing
=
sup
.
CallServerMethod
(
null
,
"
user-dashboard
"
,
"
SendTestMessage
"
,
{
"
uid
"
:
window
.
TARGET_USER
});
xmlthing
.
done
(
callback
);
}
$
(
document
).
ready
(
initialize
);
});
www/aptui/server-ajax.php
View file @
d248a0f8
...
...
@@ -134,7 +134,9 @@ $routing = array("myprofiles" =>
"Quarantine"
=>
"Do_Quarantine"
,
"LinktestControl"
=>
"Do_Linktest"
)),
"Do_Linktest"
,
"dismissExtensionDenied"
=>
"Do_DismissExtensionDenied"
)),
"approveuser"
=>
array
(
"file"
=>
"approveuser.ajax"
,
"guest"
=>
false
,
...
...
@@ -178,6 +180,8 @@ $routing = array("myprofiles" =>
"Do_ExperimentList"
,
"ProjectList"
=>
"Do_ProjectList"
,
"UsageSummary"
=>
"Do_UsageSummary"
,
"ProfileList"
=>
"Do_ProfileList"
,
"Toggle"
=>
...
...
@@ -195,6 +199,8 @@ $routing = array("myprofiles" =>
"Do_ProfileList"
,
"MemberList"
=>
"Do_MemberList"
,
"UsageSummary"
=>
"Do_UsageSummary"
,
"ProjectProfile"
=>
"Do_ProjectProfile"
)),
);
...
...
www/aptui/template/user-dashboard.html
View file @
d248a0f8
...
...
@@ -42,6 +42,7 @@
<div
class=
'panel-body'
>
<div
class=
'row'
>
<div
class=
'col-sm-12'
>
<center
id=
"usage-summary"
></center>
<div>
<!-- Nav tabs -->
<ul
class=
"nav nav-tabs"
role=
"tablist"
>
...
...
@@ -73,6 +74,9 @@
Manage Account
</a></li>
<li><a
href=
"list-datasets.php?user=<%= target_user %>"
>
List Datasets
</a></li>
<li
class=
'divider'
></li>
<li><a
role=
"button"
id=
"sendtestmessage"
>
Send Test Message
</a></li>
<li
role=
"presentation"
>
<a
href=
'<%- emulablink %>'
>
Emulab User Page
</a></li>
...
...
www/aptui/user-dashboard.ajax
View file @
d248a0f8
...
...
@@ -154,6 +154,54 @@ function Do_AccountDetails()
SPITAJAX_RESPONSE
(
$results
);
}
#
# Usage for the user, in pnode hours.
#
function
Do_UsageSummary
()
{
global
$this_user
,
$target_user
;
global
$ajax_args
;
if
(
CheckPageArgs
())
{
return
;
}
list
(
$pcount
,
$phours
)
=
Instance
::
CurrentUsage
(
$target_user
);
list
(
$weekpcount
,
$weekphours
)
=
Instance
::
WeeksUsage
(
$target_user
);
list
(
$monthpcount
,
$monthphours
)
=
Instance
::
MonthsUsage
(
$target_user
);
list
(
$rank
,
$ranktotal
)
=
Instance
::
Ranking
(
$target_user
,
30
);
if
(
$phours
<
2
)
{
$phours
=
sprintf
(
"%.1f"
,
$phours
);
}
else
{
$phours
=
sprintf
(
"%.0f"
,
$phours
);
}
if
(
$weekphours
<
2
)
{
$weekphours
=
sprintf
(
"%.1f"
,
$weekphours
);
}
else
{
$weekphours
=
sprintf
(
"%.0f"
,
$weekphours
);
}
if
(
$monthphours
<
2
)
{
$monthphours
=
sprintf
(
"%.1f"
,
$monthphours
);
}
else
{
$monthphours
=
sprintf
(
"%.0f"
,
$monthphours
);
}
$blob
=
array
(
"pnodes"
=>
$pcount
,
"phours"
=>
$phours
,
"weekpnodes"
=>
$weekpcount
,
"weekphours"
=>
$weekphours
,
"monthpnodes"
=>
$monthpnodes
,
"monthphours"
=>
$monthphours
,
"rankdays"
=>
30
,
"rank"
=>
$rank
,
"ranktotal"
=>
$ranktotal
);
SPITAJAX_RESPONSE
(
$blob
);
}
#
# Toggle flags.
#
...
...
@@ -221,6 +269,42 @@ function Do_Toggle()
SPITAJAX_RESPONSE
(
1
);
}
function
Do_SendTestMessage
()
{
global
$this_user
,
$target_user
;
global
$APTMAIL
;
if
(
CheckPageArgs
())
{
return
;
}
if
(
!
ISADMIN
())
{
SPITAJAX_ERROR
(
1
,
"Only administrators can do this."
);
return
;
}
$target_idx
=
$target_user
->
uid_idx
();
$target_uuid
=
$target_user
->
uuid
();
$target_email
=
$target_user
->
email
();
$target_name
=
$target_user
->
name
();
$target_uid
=
$target_user
->
uid
();
$adminemail
=
$target_user
->
adminEmail
();
TBMAIL
(
"
$target_name
'
$target_uid
' <
$target_email
>"
,
"This is a test"
,
"
\n
"
.
"Dear
$target_name
(
$target_uid
):
\n
"
.
"
\n
"
.
"This is a test message to validate the email address that we
\n
"
.
"have in our database. Please respond to this message
\n
"
.
"as soon as you receive it. If we do not hear back from you, we
\n
"
.
"may be forced to freeze your account.
\n
"
.
"
\n
"
.
"Thank you very much!
\n
"
,
"From:
$adminemail
\n
"
.
"Bcc: stoller"
);
SPITAJAX_RESPONSE
(
1
);
}
# Local Variables:
# mode:php
# End:
...
...
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