Blame view

sources/core/js/update.js 1.24 KB
03e52840d   Kload   Init
1
2
3
4
5
6
7
  $(document).ready(function () {
  	var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php');
  	updateEventSource.listen('success', function(message) {
  		$('<span>').append(message).append('<br />').appendTo($('.update'));
  	});
  	updateEventSource.listen('error', function(message) {
  		$('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
31b7f2792   Kload   Upgrade to ownclo...
8
  		message = t('core', 'Please reload the page.');
03e52840d   Kload   Init
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  		$('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  		updateEventSource.close();
  	});
  	updateEventSource.listen('failure', function(message) {
  		$('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  		$('<span>')
  		.addClass('error bold')
  		.append('<br />')
  		.append(t('core', 'The update was unsuccessful. Please report this issue to the <a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.'))
  		.appendTo($('.update'));
  	});
  	updateEventSource.listen('done', function(message) {
  		$('<span>').addClass('bold').append('<br />').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update'));
  		setTimeout(function () {
  			window.location.href = OC.webroot;
  		}, 3000);
  	});
  });