editor: fail gracefully when pulling without credentials set
This commit is contained in:
parent
759a1a96b3
commit
9fe2b229ff
|
@ -219,19 +219,32 @@
|
|||
|
||||
if (event.target.getAttribute('name') == "short-action-pull-all") {
|
||||
event.preventDefault();
|
||||
return gadget.startLongActionNotification()
|
||||
.push(function () {
|
||||
return gadget.getDeclaredGadget("storage");
|
||||
return RSVP.Queue()
|
||||
.push(function () {
|
||||
return RSVP.all([
|
||||
gadget.getParameter("username"),
|
||||
gadget.getParameter("password")
|
||||
]);
|
||||
}).push(function(credential_list) {
|
||||
if (!credential_list[0] && !credential_list[1]) {
|
||||
window.alert("Credentials should be set before pulling.");
|
||||
} else {
|
||||
return gadget.startLongActionNotification()
|
||||
.push(function () {
|
||||
return gadget.getDeclaredGadget("storage");
|
||||
})
|
||||
.push(function (storage_gadget) {
|
||||
return storage_gadget.pullEverything();
|
||||
})
|
||||
.push(function () {
|
||||
return gadget.displayResourceList();
|
||||
})
|
||||
.push(function () {
|
||||
return gadget.stopLongActionNotification();
|
||||
});
|
||||
}
|
||||
return;
|
||||
})
|
||||
.push(function (storage_gadget) {
|
||||
return storage_gadget.pullEverything();
|
||||
})
|
||||
.push(function () {
|
||||
return gadget.displayResourceList();
|
||||
})
|
||||
.push(function () {
|
||||
return gadget.stopLongActionNotification();
|
||||
})
|
||||
}
|
||||
else if (event.target.getAttribute('name') == "short-action-push-all") {
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue