Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
8045e0f5
Commit
8045e0f5
authored
Jun 01, 2015
by
Sven Marnach
Committed by
Jonathan Piacenti
Jun 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable buttons and show spinner when waiting for status update.
parent
091ccda8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
problem_builder/public/js/data_export.js
+15
-4
No files found.
problem_builder/public/js/data_export.js
View file @
8045e0f5
...
@@ -23,13 +23,22 @@ function DataExportBlock(runtime, element) {
...
@@ -23,13 +23,22 @@ function DataExportBlock(runtime, element) {
}
}
if
(
statusChanged
)
updateView
();
if
(
statusChanged
)
updateView
();
}
}
function
showSpinner
()
{
$startButton
.
prop
(
'disabled'
,
true
);
$cancelButton
.
prop
(
'disabled'
,
true
);
$downloadButton
.
prop
(
'disabled'
,
true
);
$deleteButton
.
prop
(
'disabled'
,
true
);
$
(
'.data-export-status'
,
element
).
empty
().
append
(
$
(
'<i>'
).
addClass
(
'icon fa fa-spinner fa-spin'
)
);
}
function
updateView
()
{
function
updateView
()
{
var
$statusArea
=
$
(
'.data-export-status'
,
element
);
var
$statusArea
=
$
(
'.data-export-status'
,
element
);
$statusArea
.
empty
();
$statusArea
.
empty
();
$startButton
.
toggle
(
!
status
.
export_pending
);
$startButton
.
toggle
(
!
status
.
export_pending
)
.
prop
(
'disabled'
,
false
)
;
$cancelButton
.
toggle
(
status
.
export_pending
);
$cancelButton
.
toggle
(
status
.
export_pending
)
.
prop
(
'disabled'
,
false
)
;
$downloadButton
.
toggle
(
Boolean
(
status
.
download_url
));
$downloadButton
.
toggle
(
Boolean
(
status
.
download_url
))
.
prop
(
'disabled'
,
false
)
;
$deleteButton
.
toggle
(
Boolean
(
status
.
last_export_result
));
$deleteButton
.
toggle
(
Boolean
(
status
.
last_export_result
))
.
prop
(
'disabled'
,
false
)
;
if
(
status
.
last_export_result
)
{
if
(
status
.
last_export_result
)
{
if
(
status
.
last_export_result
.
error
)
{
if
(
status
.
last_export_result
.
error
)
{
$statusArea
.
append
(
$
(
'<p>'
).
text
(
$statusArea
.
append
(
$
(
'<p>'
).
text
(
...
@@ -65,6 +74,7 @@ function DataExportBlock(runtime, element) {
...
@@ -65,6 +74,7 @@ function DataExportBlock(runtime, element) {
success
:
updateStatus
,
success
:
updateStatus
,
dataType
:
'json'
,
dataType
:
'json'
,
});
});
showSpinner
();
});
});
}
}
addHandler
(
$startButton
,
'start_export'
);
addHandler
(
$startButton
,
'start_export'
);
...
@@ -73,5 +83,6 @@ function DataExportBlock(runtime, element) {
...
@@ -73,5 +83,6 @@ function DataExportBlock(runtime, element) {
$downloadButton
.
on
(
'click'
,
function
()
{
$downloadButton
.
on
(
'click'
,
function
()
{
window
.
location
.
href
=
status
.
download_url
;
window
.
location
.
href
=
status
.
download_url
;
});
});
showSpinner
();
getStatus
();
getStatus
();
}
}
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