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
c62691e9
Commit
c62691e9
authored
Aug 27, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scaffolding for import progress reporting
parent
4bb9dcf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
2 deletions
+99
-2
cms/djangoapps/contentstore/views/import_export.py
+28
-1
cms/static/sass/views/_import.scss
+49
-0
cms/templates/import.html
+22
-1
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
c62691e9
...
...
@@ -240,6 +240,34 @@ def import_course(request, org, course, name):
})
})
@ensure_csrf_cookie
@login_required
def
get_import_status
(
request
,
course
,
filename
):
"""
Returns an integer corresponding to the status of a file import. These are:
0 : No status file found (import done or upload still in progress)
1 : Extracting file
2 : Validating.
3 : Importing to mongo
4 : Error reading file (e.g., converting contents to int)
"""
data_root
=
path
(
settings
.
GITHUB_REPO_ROOT
)
status_file
=
data_root
/
(
course
+
filename
+
".lock"
)
if
not
os
.
path
.
isfile
(
status_file
):
return
JsonResponse
({
"ImportStatus"
:
0
})
with
open
(
status_file
,
"r"
)
as
f
:
try
:
status
=
int
(
f
.
read
())
except
ValueError
:
status
=
4
return
JsonResponse
({
"ImportStatus"
:
status
})
@ensure_csrf_cookie
@login_required
...
...
@@ -319,7 +347,6 @@ def generate_export_course(request, org, course, name):
response
[
'Content-Length'
]
=
os
.
path
.
getsize
(
export_file
.
name
)
return
response
@ensure_csrf_cookie
@login_required
def
export_course
(
request
,
org
,
course
,
name
):
...
...
cms/static/sass/views/_import.scss
View file @
c62691e9
// studio - views - course import
// ====================
@-webkit-keyframes
opacity
{
0
%
{
opacity
:
1
;
}
100
%
{
opacity
:
0
;
}
}
@-moz-keyframes
opacity
{
0
%
{
opacity
:
1
;
}
100
%
{
opacity
:
0
;
}
}
.view-import
{
...
...
@@ -85,6 +94,8 @@
}
}
.progress-bar
{
display
:
none
;
width
:
350px
;
...
...
@@ -109,3 +120,41 @@
line-height
:
48px
;
}
}
.not-started
{
opacity
:
0
.4
;
}
.not-started
span
{
display
:
none
;
}
.done
{
opacity
:
0
.7
;
}
.done
span
{
display
:
none
;
}
.in-progress
span
{
-webkit-animation-name
:
opacity
;
-webkit-animation-duration
:
1s
;
-webkit-animation-iteration-count
:
infinite
;
-moz-animation-name
:
opacity
;
-moz-animation-duration
:
1s
;
-moz-animation-iteration-count
:
infinite
;
}
.in-progress
span
:nth-child
(
2
)
{
-webkit-animation-delay
:
300ms
;
-moz-animation-delay
:
300ms
;
}
.in-progress
span
:nth-child
(
3
)
{
-webkit-animation-delay
:
600ms
;
-moz-animation-delay
:
600ms
;
}
cms/templates/import.html
View file @
c62691e9
...
...
@@ -35,7 +35,26 @@
<input
type=
"file"
name=
"course-data"
class=
"file-input"
>
<input
type=
"submit"
value=
"${_('Replace my course with the one above')}"
class=
"submit-button"
>
<input
type=
"hidden"
name=
"csrfmiddlewaretoken"
value=
"${csrf_token}"
>
<p
class=
"status-block"
>
Unpacking...
</p>
<div
id=
"status-infos"
class=
"status-infos"
>
<p
class=
"status-info in-progress"
>
Unpacking
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
</p>
<p
class=
"status-info not-started"
>
Verifying
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
</p>
<p
class=
"status-info not-started"
>
Importing
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
<span
class=
"loading-dots"
>
.
</span>
</p>
</div>
<div
class=
"progress-bar"
>
<div
class=
"progress-fill"
></div>
<div
class=
"percent"
>
0%
</div>
...
...
@@ -57,6 +76,8 @@ var status = $('#status');
var
statusBlock
=
$
(
'.status-block'
);
var
submitBtn
=
$
(
'.submit-button'
);
var
allStats
=
$
(
'#status-infos'
);
$
(
'#fileupload'
).
fileupload
({
...
...
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