re-use existing progress and message properties
now, when we go back to the app grid, it reflects immediately
This commit is contained in:
@@ -1469,16 +1469,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
function refreshApp(appId, callback) {
|
||||
callback = callback || function () {};
|
||||
|
||||
Client.getApp(appId, function (error, app) {
|
||||
Client.refreshAppCache(appId, function (error, app) {
|
||||
if (error && error.statusCode === 404) return $location.path('/apps');
|
||||
if (error) return callback(error);
|
||||
|
||||
// ensure we have amended progress properties set before copy
|
||||
if ($scope.app) {
|
||||
app.taskProgress = $scope.app.taskProgress;
|
||||
app.taskProgressMessage = $scope.app.taskProgressMessage;
|
||||
}
|
||||
|
||||
$scope.app = app;
|
||||
|
||||
// show 'Start App' if app is starting or is stopped
|
||||
@@ -1488,23 +1482,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
$scope.console.startButton = app.runState === RSTATES.STOPPED;
|
||||
}
|
||||
|
||||
if (app.taskId) {
|
||||
Client.getTask(app.taskId, function (error, task) {
|
||||
if (error) return callback(error);
|
||||
|
||||
$scope.app.taskProgress = task && task.percent ? task.percent : 5; // start with 5 to avoid empty progress bar
|
||||
$scope.app.taskProgressMessage = task ? task.message : '';
|
||||
$scope.app.taskMinutesActive = task ? moment.duration(moment.utc().diff(moment.utc(task.creationTime))).asMinutes() : 0;
|
||||
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
$scope.app.taskProgress = 0;
|
||||
$scope.app.taskProgressMessage = '';
|
||||
$scope.app.taskMinutesActive = 0;
|
||||
|
||||
callback();
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user