Support unstable app listing setting in appstore view

This commit is contained in:
Johannes Zellner
2019-04-29 14:58:42 +02:00
parent 0226a5603d
commit 01f59d39e0
2 changed files with 32 additions and 71 deletions

View File

@@ -22,6 +22,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.validAppstoreAccount = false;
$scope.appstoreConfig = null;
$scope.spacesSuffix = '';
$scope.unstableApps = false;
$scope.showView = function (view) {
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already
@@ -328,15 +329,22 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
};
function getAppList(callback) {
AppStore.getApps(function (error, apps) {
if (error) return callback(error);
Client.getUnstableAppsConfig(function (error, unstable) {
if (error) console.error('Error getting unstable apps config. Falling back to only stable apps.', error);
// ensure we have a tags property for further use
apps.forEach(function (app) {
if (!app.manifest.tags) app.manifest.tags = [];
// stash this for search lookups
$scope.unstableApps = error ? false : unstable;
AppStore.getApps($scope.unstableApps, function (error, apps) {
if (error) return callback(error);
// ensure we have a tags property for further use
apps.forEach(function (app) {
if (!app.manifest.tags) app.manifest.tags = [];
});
return callback(null, apps);
});
return callback(null, apps);
});
}
@@ -346,7 +354,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.category = '';
AppStore.getAppsFast(function (error, apps) {
AppStore.getAppsFast($scope.unstableApps, function (error, apps) {
if (error) return $timeout($scope.search, 1000);
var token = $scope.searchString.toUpperCase();
@@ -368,7 +376,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.cachedCategory = $scope.category;
AppStore.getAppsFast(function (error, apps) {
AppStore.getAppsFast($scope.unstableApps, function (error, apps) {
if (error) return $timeout($scope.showCategory.bind(null, event), 1000);
if (!$scope.category) {
@@ -431,27 +439,15 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
var version = $location.search().version;
if (appId) {
if (version) {
AppStore.getAppByIdAndVersion(appId, version, function (error, result) {
if (error) {
$scope.showAppNotFound(appId, version);
console.error(error);
return;
}
AppStore.getAppByIdAndVersion(appId, version || 'latest', function (error, result) {
if (error) {
$scope.showAppNotFound(appId, version);
console.error(error);
return;
}
$scope.appInstall.show(result);
});
} else {
AppStore.getAppById(appId, function (error, result) {
if (error) {
$scope.showAppNotFound(appId, null);
console.error(error);
return;
}
$scope.appInstall.show(result);
});
}
$scope.appInstall.show(result);
});
} else {
$scope.appInstall.reset();
}