diff --git a/src/js/client.js b/src/js/client.js index 2f580d5b1..35cc51ed6 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1112,6 +1112,23 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N } }; + // this requires app:manage permissions + Client.prototype.refreshAppCache = function (id, callback) { + var that = this; + + callback = typeof callback === 'function' ? callback : function () {}; + + this.getApp(id, function (error, app) { + if (error) return callback(error); + + that._updateAppCache(app); + + that._installedApps = that._installedApps.sort(function (app1, app2) { return app1.fqdn.localeCompare(app2.fqdn); }); + + callback(null, app); + }); + }; + Client.prototype.refreshInstalledApps = function (callback) { var that = this; diff --git a/src/views/apps.js b/src/views/apps.js index 5ab63376b..35a16e1dd 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -165,7 +165,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appConfigure.busy = false; - Client.refreshInstalledApps(); // reflect the new app state immediately + Client.refreshAppCache($scope.appConfigure.app.id); // reflect the new app state immediately $('#appConfigureModal').modal('hide'); @@ -220,7 +220,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location } // reflect the new app state immediately - Client.refreshInstalledApps(waitForBackupFinish); + Client.refreshAppCache($scope.appRestore.app.id, waitForBackupFinish); }); }, @@ -234,7 +234,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location backupId: $scope.appRestore.selectedBackup.id }; - Client.cloneApp($scope.appRestore.app.id, data, function (error) { + Client.cloneApp($scope.appRestore.app.id, data, function (error, clonedApp) { $scope.appRestore.busy = false; if (error) { @@ -251,7 +251,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $('#appRestoreModal').modal('hide'); } - Client.refreshInstalledApps(); // reflect the new app state immediately + Client.refreshAppCache(clonedApp.id); // reflect the new app state immediately }); }, @@ -303,7 +303,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appRestore.busy = false; - Client.refreshInstalledApps(); // reflect the new app state immediately + Client.refreshAppCache($scope.appRestore.app.id); // reflect the new app state immediately }); } }; @@ -495,7 +495,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appUninstall.busy = false; - Client.refreshInstalledApps(); // reflect the new app state immediately + Client.refreshAppCache($scope.appUninstall.app.id); // reflect the new app state immediately }); }; @@ -521,7 +521,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appUpdate.busy = false; - Client.refreshInstalledApps(); // reflect the new app state immediately + Client.refreshAppCache($scope.appUpdate.app.id); // reflect the new app state immediately }); };