re-use existing progress and message properties

now, when we go back to the app grid, it reflects immediately
This commit is contained in:
Girish Ramakrishnan
2020-06-08 17:53:29 -07:00
parent 94b6f5bffd
commit 81bf84b50a
3 changed files with 9 additions and 26 deletions
+2 -2
View File
@@ -429,7 +429,7 @@
<h1>
<a ng-href="{{ app | applicationLink }}" target="_blank" ng-class="{ 'hand': (app | appIsInstalledAndHealthy) }" ng-click="(app | appIsInstalledAndHealthy) && app.pendingPostInstallConfirmation && postInstallMessage.show(true)">{{ app.label || app.fqdn }} <sup ng-show="app | appIsInstalledAndHealthy"><i class="fas fa-external-link-alt" style="font-size: 12px;"></i></sup></a>
<br/>
<span class="text-small">{{ app | installationStateLabel }} {{ app.taskProgressMessage ? ' - ' + app.taskProgressMessage : '' }}</span>
<span class="text-small">{{ app | installationStateLabel }} {{ app.message ? ' - ' + app.message : '' }}</span>
<span class="text-small" ng-show="app.error"> : {{ app.error.reason + ' - ' + app.error.message }}</span>
</h1>
<div>
@@ -453,7 +453,7 @@
<div class="row" ng-show="app.taskId">
<div class="col-sm-8 col-sm-offset-2" style="height: 10px; display: flex; align-items: center;">
<div class="progress progress-striped active animateMeOpacity" style="height: 10px; flex-grow: 1;">
<div class="progress-bar progress-bar-success" role="progressbar" style="width: {{ app.taskProgress }}%"></div>
<div class="progress-bar progress-bar-success" role="progressbar" style="width: {{ app.progress || 5 }}%"></div>
</div>
<div ng-show="app.taskMinutesActive >= 5" class="text-danger hand" style="margin: 0 4px;" ng-click="stopAppTask(app.taskId)" uib-tooltip="Cancel Task"><i class="fas fa-times"></i></div>
</div>
+2 -24
View File
@@ -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();
});
}