diff --git a/src/js/index.js b/src/js/index.js index 137de30e6..1069e1993 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -110,19 +110,6 @@ app.config(['$routeProvider', function ($routeProvider) { }).otherwise({ redirectTo: '/'}); }]); -app.filter('installError', function () { - return function (app) { - if (!app) return false; - if (app.installationState === ISTATES.ERROR) return true; - if (app.installationState === ISTATES.INSTALLED) { - // app.health can also be null to indicate insufficient data - if (app.health === HSTATES.UNHEALTHY || app.health === HSTATES.ERROR || app.health === HSTATES.DEAD) return true; - } - - return false; - }; -}); - app.filter('activeTask', function () { return function (app) { if (!app) return false; diff --git a/src/views/apps.html b/src/views/apps.html index 94c1a95e6..bd849ded8 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -230,7 +230,7 @@
- +
diff --git a/src/views/apps.js b/src/views/apps.js index acf3737f0..3d8f693b7 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -3,6 +3,9 @@ /* global angular:false */ /* global $:false */ /* global APP_TYPES */ +/* global HSTATES */ +/* global ISTATES */ +/* global RSTATES */ angular.module('Application').controller('AppsController', ['$scope', '$translate', '$interval', '$location', 'Client', function ($scope, $translate, $interval, $location, Client) { var ALL_DOMAINS_DOMAIN = { _alldomains: true, domain: 'All Domains' }; // dummy record for the single select filter @@ -71,6 +74,33 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat else localStorage.selectedDomain = newVal.domain; }); + // handles various states and triggers a href or configure/repair view + $scope.onAppClick = function (app, $event) { + function stopEvent() { + $event.originalEvent.stopPropagation(); + $event.originalEvent.preventDefault(); + } + + if (app.installationState === ISTATES.ERROR) { + if ($scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); + + return stopEvent(); + } else if (app.installationState === ISTATES.INSTALLED) { + // app.health can also be null to indicate insufficient data + if (app.runState === RSTATES.STOPPED) return stopEvent(); + + if (app.health === HSTATES.UNHEALTHY || app.health === HSTATES.ERROR || app.health === HSTATES.DEAD) { + if ($scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); + return stopEvent(); + } + + if (app.pendingPostInstallConfirmation) { + $scope.appPostInstallConfirm.show(app); + return stopEvent(); + } + } + }; + $scope.clearAllFilter = function () { $scope.selectedState = $scope.states[0]; $scope.selectedTags = [];