Replace duplicated code with a call to #redraw()

Signed-off-by: Marko Locher <marko@locher.at>
Return an empty list of datasets if the xhr receives an error

Signed-off-by: Marko Locher <marko@locher.at>
Split redrawing of datasets and reloading into two separate functions, which are called independently

Signed-off-by: Marko Locher <marko@locher.at>