app.portBindings and newManifest.tcpPorts may be null

This commit is contained in:
Girish Ramakrishnan
2015-07-20 00:09:47 -07:00
commit df9d321ac3
243 changed files with 42623 additions and 0 deletions

29
webadmin/src/js/update.js Normal file
View File

@@ -0,0 +1,29 @@
'use strict';
// create main application module
var app = angular.module('Application', []);
app.controller('Controller', ['$scope', '$http', '$interval', function ($scope, $http, $interval) {
var apiOrigin = '';
function loadWebadmin() {
window.location.href = '/';
}
function fetchProgress() {
$http.get(apiOrigin + '/api/v1/cloudron/progress').success(function(data, status) {
if (status === 404) return; // just wait until we create the progress.json on the server side
if (status !== 200 || typeof data !== 'object') return console.error(status, data);
if (data.update === null) return loadWebadmin();
$('#updateProgressBar').css('width', data.update.percent + '%');
$('#updateProgressMessage').html(data.update.message);
}).error(function (data, status) {
console.error(status, data);
});
}
$interval(fetchProgress, 2000);
fetchProgress();
}]);