Add testing section in appstore and mark testing apps

This is not some final design to indicate which app is in testing
but the logistics are there, mainly css from now

Fixes #451
This commit is contained in:
Johannes Zellner
2015-07-27 17:09:57 +02:00
parent c4bb56dc95
commit 804105ce2b
3 changed files with 37 additions and 18 deletions

View File

@@ -94,11 +94,13 @@
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'sync' }" category="sync">Media Sync</a>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'git' }" category="git">Code Hosting</a>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'wiki' }" category="wiki">Wiki</a>
<br/>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'testing' }" category="testing" ng-show="config.developerMode">Testing</a>
</div>
<div class="col-md-10" ng-show="ready && apps.length">
<div class="row-no-margin">
<div class="col-sm-1 appstore-item" ng-repeat="app in apps">
<div class="appstore-item-content highlight" ng-click="showInstall(app)">
<div class="appstore-item-content highlight" ng-click="showInstall(app)" ng-class="{ 'appstore-item-content-testing': app.publishState === 'testing' }">
<div class="appstore-item-content-icon col-same-height">
<img ng-src="{{app.iconUrl}}" onerror="this.onerror=null;this.src='img/appicon_fallback.png'" class="app-icon"/>
</div>

View File

@@ -20,6 +20,25 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
mediaLinks: []
};
function getAppList(callback) {
AppStore.getApps(function (error, apps) {
if (error) return callback(error);
Client.getNonApprovedApps(function (error, result) {
if (error) return callback(error);
// add testing tag to the manifest for UI and search reasons
result.forEach(function (app) {
app.manifest.tags.push('testing');
});
callback(null, apps.concat(result));
});
});
}
// TODO does not support testing apps in search
$scope.search = function () {
if (!$scope.searchString) return $scope.showCategory(null, $scope.cachedCategory);
@@ -49,7 +68,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.ready = false;
AppStore.getApps(function (error, apps) {
getAppList(function (error, apps) {
if (error) return $timeout($scope.showCategory.bind(null, event), 1000);
if (!$scope.category) {
@@ -156,28 +175,21 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
function refresh() {
$scope.ready = false;
AppStore.getApps(function (error, apps) {
getAppList(function (error, apps) {
if (error) {
console.error(error);
return $timeout(refresh, 1000);
}
Client.getNonApprovedApps(function (error, result) {
if (error) {
console.error(error);
return $timeout(refresh, 1000);
}
$scope.apps = apps;
$scope.apps = apps.concat(result);
// 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]);
}
// 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;
});
$scope.ready = true;
});
}