Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
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
edx
edx-platform
Commits
ded1a752
Commit
ded1a752
authored
Jun 30, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4210 from bdero/bdero/fix-sysadmin-dashboard-gitlog-timezone
Make sysadmin dashboard gitlog date timezone-aware
parents
b817e026
36873ffc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
80 deletions
+108
-80
AUTHORS
+3
-2
lms/djangoapps/dashboard/tests/test_sysadmin.py
+32
-0
lms/templates/sysadmin_dashboard_gitlogs.html
+73
-78
No files found.
AUTHORS
View file @
ded1a752
...
@@ -154,4 +154,5 @@ Abdallah Nassif <abdoosh00@gmail.com>
...
@@ -154,4 +154,5 @@ Abdallah Nassif <abdoosh00@gmail.com>
Johnny Brown <johnnybrown7@gmail.com>
Johnny Brown <johnnybrown7@gmail.com>
Ben McMorran <bmcmorran@edx.org>
Ben McMorran <bmcmorran@edx.org>
Mat Peterson <mpeterson@edx.org>
Mat Peterson <mpeterson@edx.org>
Tim Babych <tim.babych@gmail.com>
Tim Babych <tim.babych@gmail.com>
\ No newline at end of file
Brandon DeRosier <btd@cheesekeg.com>
\ No newline at end of file
lms/djangoapps/dashboard/tests/test_sysadmin.py
View file @
ded1a752
...
@@ -16,6 +16,8 @@ from django.test.client import Client
...
@@ -16,6 +16,8 @@ from django.test.client import Client
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
import
mongoengine
import
mongoengine
from
django.utils.timezone
import
utc
as
UTC
from
util.date_utils
import
get_time_display
,
DEFAULT_DATE_TIME_FORMAT
from
student.roles
import
CourseStaffRole
,
GlobalStaff
from
student.roles
import
CourseStaffRole
,
GlobalStaff
from
courseware.tests.modulestore_config
import
TEST_DATA_XML_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_XML_MODULESTORE
...
@@ -507,6 +509,36 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
...
@@ -507,6 +509,36 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
self
.
_rm_edx4edx
()
self
.
_rm_edx4edx
()
def
test_gitlog_date
(
self
):
"""
Make sure the date is timezone-aware and being converted/formatted
properly.
"""
tz_names
=
[
'America/New_York'
,
# UTC - 5
'Asia/Pyongyang'
,
# UTC + 9
'Europe/London'
,
# UTC
'Canada/Yukon'
,
# UTC - 8
'Europe/Moscow'
,
# UTC + 4
]
tz_format
=
DEFAULT_DATE_TIME_FORMAT
self
.
_setstaff_login
()
self
.
_mkdir
(
getattr
(
settings
,
'GIT_REPO_DIR'
))
self
.
_add_edx4edx
()
date
=
CourseImportLog
.
objects
.
first
()
.
created
.
replace
(
tzinfo
=
UTC
)
for
timezone
in
tz_names
:
with
(
override_settings
(
TIME_ZONE
=
timezone
)):
date_text
=
get_time_display
(
date
,
tz_format
,
settings
.
TIME_ZONE
)
response
=
self
.
client
.
get
(
reverse
(
'gitlogs'
))
self
.
assertIn
(
date_text
,
response
.
content
)
self
.
_rm_edx4edx
()
def
test_gitlog_bad_course
(
self
):
def
test_gitlog_bad_course
(
self
):
"""
"""
Make sure we gracefully handle courses that don't exist.
Make sure we gracefully handle courses that don't exist.
...
...
lms/templates/sysadmin_dashboard_gitlogs.html
View file @
ded1a752
<
%
inherit
file=
"/main.html"
/>
<
%
inherit
file=
"/main.html"
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%!
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
utils
.
timezone
import
utc
as
UTC
from
util
.
date_utils
import
get_time_display
,
DEFAULT_DATE_TIME_FORMAT
from
django
.
conf
import
settings
%
>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
...
@@ -46,87 +51,77 @@ textarea {
...
@@ -46,87 +51,77 @@ textarea {
</style>
</style>
<section
class=
"container"
>
<section
class=
"container"
>
<div
class=
"sysadmin-dashboard-wrapper"
>
<div
class=
"sysadmin-dashboard-wrapper"
>
<section
class=
"sysadmin-dashboard-content"
style=
"margin-left:10pt;margin-top:10pt;margin-right:10pt;margin-bottom:20pt"
>
<section
class=
"sysadmin-dashboard-content"
style=
"margin-left:10pt;margin-top:10pt;margin-right:10pt;margin-bottom:20pt"
>
<h1>
${_('Sysadmin Dashboard')}
</h1>
<h1>
${_('Sysadmin Dashboard')}
</h1>
<hr
/>
<hr
/>
<h2
class=
"instructor-nav"
>
<h2
class=
"instructor-nav"
>
<a
href=
"${reverse('sysadmin')}"
>
${_('Users')}
</a>
<a
href=
"${reverse('sysadmin')}"
>
${_('Users')}
</a>
<a
href=
"${reverse('sysadmin_courses')}"
>
${_('Courses')}
</a>
<a
href=
"${reverse('sysadmin_courses')}"
>
${_('Courses')}
</a>
<a
href=
"${reverse('sysadmin_staffing')}"
>
${_('Staffing and Enrollment')}
</a>
<a
href=
"${reverse('sysadmin_staffing')}"
>
${_('Staffing and Enrollment')}
</a>
## Translators: refers to http://git-scm.com/docs/git-log
## Translators: refers to http://git-scm.com/docs/git-log
<a
href=
"${reverse('gitlogs')}"
class=
"active-section"
>
${_('Git Logs')}
</a>
<a
href=
"${reverse('gitlogs')}"
class=
"active-section"
>
${_('Git Logs')}
</a>
</h2>
</h2>
<hr
/>
<hr
/>
<form
name=
"dashform"
method=
"POST"
action=
"${reverse('sysadmin')}"
>
<form
name=
"dashform"
method=
"POST"
action=
"${reverse('sysadmin')}"
>
<input
type=
"hidden"
name=
"csrfmiddlewaretoken"
value=
"${ csrf_token }"
>
<input
type=
"hidden"
name=
"csrfmiddlewaretoken"
value=
"${ csrf_token }"
>
<input
type=
"hidden"
name=
"dash_mode"
value=
""
>
<input
type=
"hidden"
name=
"dash_mode"
value=
""
>
</form>
## Translators: refers to http://git-scm.com/docs/git-log
## Translators: refers to http://git-scm.com/docs/git-log
<h3>
${_('Git Logs')}
</h3>
<h3>
${_('Git Logs')}
</h3>
%if course_id is None:
<table
class=
"stat_table"
>
<thead>
<tr>
<th>
${_('Date')}
</th>
<th>
${_('Course ID')}
</th>
## Translators: Git is a version-control system; see http://git-scm.com/about
<th>
${_('Git Action')}
</th>
</tr>
</thead>
<tbody>
%for cil in cilset[:10]:
<
%
course_id_string =
cil.course_id.to_deprecated_string()
if
cil
.
course_id
else
None
%
>
<tr>
<td>
${cil.created}
</td>
<td><a
href=
"${reverse('gitlogs')}/${course_id_string}"
>
${course_id_string}
</a></td>
<td>
${cil.git_log}
</td>
</tr>
%endfor
</tbody>
</table>
%else:
## Translators: Git is a version-control system; see http://git-scm.com/about
<h2>
${_('Recent git load activity for')} ${course_id}
</h2>
%if error_msg:
<h3>
${_('Error')}:
</h3>
<p>
${error_msg}
</p>
%endif
<table
class=
"stat_table"
>
%if course_id is not None:
<thead>
## Translators: Git is a version-control system; see http://git-scm.com/about
<tr>
<h2>
${_('Recent git load activity for {course_id}').format(course_id=course_id)}
</h2>
<th>
${_('Date')}
</th>
%if error_msg:
<th>
${_('Course ID')}
</th>
<h3>
${_('Error')}:
</h3>
## Translators: Git is a version-control system; see http://git-scm.com/about
<p>
${error_msg}
</p>
<th>
${_('Git Action')}
</th>
%endif
</tr>
%endif
</thead>
<tbody>
% for cil in cilset[:2]:
<
%
course_id_string =
cil.course_id.to_deprecated_string()
if
cil
.
course_id
else
None
%
>
<tr>
<td>
${cil.created}
</td>
<td><a
href=
"${reverse('gitlogs')}/${course_id_string}"
>
${course_id_string}
</a></td>
<td>
${cil.git_log}
</td>
</tr>
<tr>
<td
colspan=
"3"
>
<pre>
${cil.import_log | h}
</pre>
</td>
</tr>
% endfor
</tbody>
</table>
% endif
<table
class=
"stat_table"
>
<thead>
<tr>
<th>
${_('Date')}
</th>
<th>
${_('Course ID')}
</th>
## Translators: Git is a version-control system; see http://git-scm.com/about
<th>
${_('Git Action')}
</th>
</tr>
</thead>
<tbody>
<
%
if
course_id =
=
None:
logs =
cilset[:10]
else:
logs =
cilset[:2]
%
>
% for cil in logs:
<
%
course_id_string =
cil.course_id.to_deprecated_string()
if
cil
.
course_id
else
None
</section>
#
Appropriate
datetime
string
for
current
locale
and
timezone
</div>
date =
get_time_display(cil.created.replace(tzinfo=UTC),
DEFAULT_DATE_TIME_FORMAT
,
coerce_tz=
settings.TIME_ZONE)
%
>
<tr>
<td>
${date}
</td>
<td><a
href=
"${reverse('gitlogs')}/${course_id_string}"
>
${course_id_string}
</a></td>
<td>
${cil.git_log}
</td>
</tr>
%endfor
## Show the full log if viewing information about a specific course
%if course_id is not None:
<tr>
<td
colspan=
"3"
>
<pre>
${cil.import_log | h}
</pre>
</td>
</tr>
%endif
</tbody>
</table>
</section>
</div>
</section>
</section>
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