diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index b3bd68b4d..d602f8474 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -324,6 +324,15 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', }).error(defaultErrorHandler(callback)); }; + Client.prototype.getNonApprovedApps = function (callback) { + if (!this._config.developerMode) return callback(null, []); + + $http.get(client.apiOrigin + '/api/v1/developer/apps').success(function (data, status) { + if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data)); + callback(null, data.apps || []); + }).error(defaultErrorHandler(callback)); + }; + Client.prototype.getApp = function (appId, callback) { var appFound = null; this._installedApps.some(function (app) { diff --git a/webadmin/src/views/appstore.js b/webadmin/src/views/appstore.js index ca3dafc07..8a4204c02 100644 --- a/webadmin/src/views/appstore.js +++ b/webadmin/src/views/appstore.js @@ -162,15 +162,22 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca return $timeout(refresh, 1000); } - $scope.apps = apps; + Client.getNonApprovedApps(function (error, result) { + if (error) { + console.error(error); + return $timeout(refresh, 1000); + } - // show install app dialog immediately if an app id was passed in the query - if ($routeParams.appId) { - var found = apps.filter(function (app) { return (app.id === $routeParams.appId); }); - if (found.length) $scope.showInstall(found[0]); - } + $scope.apps = apps.concat(result); - $scope.ready = true; + // show install app dialog immediately if an app id was passed in the query + if ($routeParams.appId) { + var found = apps.filter(function (app) { return (app.id === $routeParams.appId); }); + if (found.length) $scope.showInstall(found[0]); + } + + $scope.ready = true; + }); }); }