projects
/
qcg-portal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
67ec532
)
fancy error information
author
Maciej Tronowski
<mtro@man.poznan.pl>
Tue, 14 Apr 2015 10:41:32 +0000
(12:41 +0200)
committer
Maciej Tronowski
<mtro@man.poznan.pl>
Tue, 14 Apr 2015 10:41:32 +0000
(12:41 +0200)
qcg/templates/qcg/gridftp.html
patch
|
blob
|
history
diff --git
a/qcg/templates/qcg/gridftp.html
b/qcg/templates/qcg/gridftp.html
index
dd24d7e
..
67bf34f
100644
(file)
--- a/
qcg/templates/qcg/gridftp.html
+++ b/
qcg/templates/qcg/gridftp.html
@@
-27,10
+27,18
@@
$('#status').text(msg);
}
$('#status').text(msg);
}
- function fail() {
- status('Wystąpił błąd.');
- console.error(arguments);
- filex.idle();
+ function failModal(msg) {
+ return function() {
+ var $errorModal = $('#error-modal');
+
+ $errorModal.find('#error-modal-label').text('Błąd serwera');
+ $errorModal.find('.modal-body').html($('<h4>', {text: msg}));
+
+ filex.idle();
+ $errorModal.modal();
+
+ console.error(arguments);
+ };
}
filex.files.on('change:checked reset', function() {
}
filex.files.on('change:checked reset', function() {
@@
-85,7
+93,11
@@
if (keys.length) {
var $errorModal = $('#error-modal'),
if (keys.length) {
var $errorModal = $('#error-modal'),
- $errorList = $errorModal.find('dl').html('');
+ $errorBody = $errorModal.find('.modal-body')
+ .html($('<h4>', {text: 'Wystąpiły problemy podczas usuwania:'})),
+ $errorList = $('<dl>', {'class': 'dl-horizontal'}).appendTo($errorBody);
+
+ $errorModal.find('#error-modal-label').text('Błąd');
for (var i in keys) {
$('<dt>', {text: keys[i]}).appendTo($errorList);
for (var i in keys) {
$('<dt>', {text: keys[i]}).appendTo($errorList);
@@
-102,7
+114,7
@@
if (response.done.length)
filex.reloadFiles();
if (response.done.length)
filex.reloadFiles();
- }, 'json').fail(fail);
+ }, 'json').fail(failModal('Nie udało się usunąć plików'));
$confirmModal.modal('hide');
});
$confirmModal.modal('hide');
});
@@
-123,7
+135,7
@@
$.post($this.attr('action'), $this.serialize(), function() {
status('Katalog utworzono pomyślnie');
filex.reloadFiles();
$.post($this.attr('action'), $this.serialize(), function() {
status('Katalog utworzono pomyślnie');
filex.reloadFiles();
- }, 'json').fail(fail);
+ }, 'json').fail(failModal('Nie udało się utworzyć katalogu'));
});
$('#rename-form').on('show.bs.modal', function() {
});
$('#rename-form').on('show.bs.modal', function() {
@@
-145,7
+157,7
@@
$.post($this.attr('action'), $this.serialize(), function() {
status('Nazwę zmieniono pomyślnie');
filex.reloadFiles();
$.post($this.attr('action'), $this.serialize(), function() {
status('Nazwę zmieniono pomyślnie');
filex.reloadFiles();
- }, 'json').fail(fail);
+ }, 'json').fail(failModal('Nie udało się zmienić nazwy'));
});
$('#compress-form').on('submit', function(e) {
});
$('#compress-form').on('submit', function(e) {
@@
-180,7
+192,7
@@
$.post($this.attr('action'), data, function() {
status('Archiwum utworzono pomyślnie');
filex.reloadFiles();
$.post($this.attr('action'), data, function() {
status('Archiwum utworzono pomyślnie');
filex.reloadFiles();
- }, 'json').fail(fail);
+ }, 'json').fail(failModal('Nie udało się utworzyć archiwum'));
});
$('#btn-extract').on('click', function() {
});
$('#btn-extract').on('click', function() {
@@
-195,7
+207,7
@@
$.post('{% url 'filex:extract' %}', data, function() {
status('Archiwum rozpakowano pomyślnie');
filex.reloadFiles();
$.post('{% url 'filex:extract' %}', data, function() {
status('Archiwum rozpakowano pomyślnie');
filex.reloadFiles();
- }, 'json').fail(fail);
+ }, 'json').fail(failModal('Nie udało się rozpakować archiwum'));
});
})
</script>
});
})
</script>
@@
-234,11
+246,9
@@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
- <h4 class="modal-title" id="error-modal-label">Błąd</h4>
+ <h4 class="modal-title" id="error-modal-label"></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-body">
- <h4>Wystąpiły problemy podczas usuwania:</h4>
- <dl class="dl-horizontal"></dl>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>