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
8f6abbfd
Commit
8f6abbfd
authored
May 27, 2015
by
Alessandro Verdura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cancel() on object interface
TNL-925
parent
96037111
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
18 deletions
+28
-18
cms/static/js/factories/import.js
+1
-1
cms/static/js/views/import.js
+27
-17
No files found.
cms/static/js/factories/import.js
View file @
8f6abbfd
...
...
@@ -84,7 +84,7 @@ define([
if
(
serverMsg
.
hasOwnProperty
(
'Stage'
))
{
stage
=
Math
.
abs
(
serverMsg
.
Stage
);
Import
.
error
(
defaults
[
stage
]
+
errMsg
,
stage
);
Import
.
cancel
(
defaults
[
stage
]
+
errMsg
,
stage
);
}
// It could be that the user is simply refreshing the page
// so we need to be sure this is an actual error from the server
...
...
cms/static/js/views/import.js
View file @
8f6abbfd
...
...
@@ -56,6 +56,27 @@ define(
};
/**
* Sets the Import in the "error" status.
*
* Immediately stops any further polling from the server.
* Displays the error message at the list element that corresponds
* to the stage where the error occurred.
*
* @param {string} msg Error message to display.
* @param {int} [stage=current.stage] Stage of import process at which error occurred.
*/
var
error
=
function
(
msg
,
stage
)
{
current
.
stage
=
Math
.
abs
(
stage
||
current
.
stage
);
// Could be negative
current
.
state
=
STATE
.
ERROR
;
destroyEventListeners
();
clearTimeout
(
timeout
.
id
);
updateFeedbackList
(
msg
);
deferred
.
resolve
();
};
/**
* Initializes the event listeners
*
*/
...
...
@@ -190,24 +211,13 @@ define(
var
CourseImport
=
{
/**
* Sets the Import in the "error" status.
*
* Immediately stops any further polling from the server.
* Displays the error message at the list element that corresponds
* to the stage where the error occurred.
* Cancels the import and sets the Object to the error state
*
* @param {string} msg Error message to display.
* @param {int}
[stage=current.stage]
Stage of import process at which error occurred.
* @param {int}
stage
Stage of import process at which error occurred.
*/
error
:
function
(
msg
,
stage
)
{
current
.
stage
=
Math
.
abs
(
stage
||
current
.
stage
);
// Could be negative
current
.
state
=
STATE
.
ERROR
;
destroyEventListeners
();
clearTimeout
(
timeout
.
id
);
updateFeedbackList
(
msg
);
deferred
.
resolve
();
cancel
:
function
(
msg
,
stage
)
{
error
(
msg
,
stage
);
},
/**
...
...
@@ -228,7 +238,7 @@ define(
if
(
current
.
stage
===
STAGE
.
SUCCESS
)
{
success
();
}
else
if
(
current
.
stage
<
STAGE
.
UPLOADING
)
{
// Failed
this
.
error
(
gettext
(
"Error importing course"
));
error
(
gettext
(
"Error importing course"
));
}
else
{
// In progress
updateFeedbackList
();
...
...
@@ -273,7 +283,7 @@ define(
this
.
pollStatus
(
current
.
stage
);
}
else
{
// An import in the upload stage cannot be resumed
this
.
error
(
gettext
(
"There was an error with the upload"
));
error
(
gettext
(
"There was an error with the upload"
));
}
}.
bind
(
this
));
...
...
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