You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2014/01/06 21:25:51 UTC

[11/13] git commit: Add Details view, and show plugin info on list view.

Add Details view, and show plugin info on list view.


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/a33443bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/a33443bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/a33443bd

Branch: refs/heads/master
Commit: a33443bd58cb7945cacd560e6725b660d67e82d9
Parents: 9c3b3ee
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Dec 3 11:52:51 2013 -0800
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Mon Jan 6 15:24:13 2014 -0500

----------------------------------------------------------------------
 www/cdvah/index.html         |  1 +
 www/cdvah/js/DetailsCtrl.js  | 16 ++++++++++++++++
 www/cdvah/js/ListCtrl.js     | 13 ++++++++++---
 www/cdvah/js/app.js          |  4 ++++
 www/cdvah/views/details.html | 38 ++++++++++++++++++++++++++++++++++++++
 www/cdvah/views/list.html    | 12 ++++++------
 6 files changed, 75 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/index.html
----------------------------------------------------------------------
diff --git a/www/cdvah/index.html b/www/cdvah/index.html
index 1570336..157623a 100644
--- a/www/cdvah/index.html
+++ b/www/cdvah/index.html
@@ -16,6 +16,7 @@
         <script type="text/javascript" src="js/UrlRemap.js"></script>
         <script type="text/javascript" src="js/ListCtrl.js"></script>
         <script type="text/javascript" src="js/AddCtrl.js"></script>
+        <script type="text/javascript" src="js/DetailsCtrl.js"></script>
         <script type="text/javascript" src="js/Notify.js"></script>
         <link rel="stylesheet" type="text/css" href="css/topcoat-mobile-light.min.css" />
         <link rel="stylesheet" type="text/css" href="css/style.css" />

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/js/DetailsCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/DetailsCtrl.js b/www/cdvah/js/DetailsCtrl.js
new file mode 100644
index 0000000..c5340e2
--- /dev/null
+++ b/www/cdvah/js/DetailsCtrl.js
@@ -0,0 +1,16 @@
+(function(){
+    'use strict';
+
+    /* global myApp */
+    myApp.controller('DetailsCtrl', ['$rootScope', '$scope', '$location', 'AppsService', '$routeParams', function($rootScope, $scope, $location, AppsService, $routeParams) {
+        AppsService.getAppList().then(function(appsList) {
+            if ($routeParams.index >= 0) {
+                $scope.app = appsList[$routeParams.index];
+                $rootScope.appTitle = 'Details for ' + $scope.app.appId;
+            } else {
+                $location.path('/');
+            }
+            //$scope.$apply();
+        });
+    }]);
+})();

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js
index 7d733d7..99712bd 100644
--- a/www/cdvah/js/ListCtrl.js
+++ b/www/cdvah/js/ListCtrl.js
@@ -52,7 +52,8 @@
             });
         };
 
-        $scope.launchApp = function(app){
+        $scope.launchApp = function(app, event){
+            event.stopPropagation();
             return AppsService.launchApp(app)
             .then(null, function(error){
                 console.error('Error during loading of app ' + app.appId + ': ' + error);
@@ -60,7 +61,8 @@
             });
         };
 
-        $scope.updateApp = function(app) {
+        $scope.updateApp = function(app, event) {
+            event.stopPropagation();
             return AppsService.updateApp(app)
             .then(function(){
                 notifier.success('Updated successfully');
@@ -71,7 +73,8 @@
             });
         };
 
-        $scope.removeApp = function(app) {
+        $scope.removeApp = function(app, event) {
+            event.stopPropagation();
             var shouldUninstall = confirm('Are you sure you want to uninstall ' + app.appId + '?');
             if(shouldUninstall) {
                 return AppsService.uninstallApp(app)
@@ -84,6 +87,10 @@
             }
         };
 
+        $scope.showDetails = function(index) {
+            $location.path('/details/' + index);
+        };
+
         initialise();
     }]);
 })();

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/js/app.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/app.js b/www/cdvah/js/app.js
index 48e7dec..cb7079f 100644
--- a/www/cdvah/js/app.js
+++ b/www/cdvah/js/app.js
@@ -11,6 +11,10 @@ myApp.config(['$routeProvider', function($routeProvider){
         templateUrl: 'views/add.html',
         controller: 'AddCtrl'
     });
+    $routeProvider.when('/details/:index', {
+        templateUrl: 'views/details.html',
+        controller: 'DetailsCtrl'
+    });
 }]);
 
 // foo

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/views/details.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/details.html b/www/cdvah/views/details.html
new file mode 100644
index 0000000..2b998c6
--- /dev/null
+++ b/www/cdvah/views/details.html
@@ -0,0 +1,38 @@
+<h2>{{ app.appId }}</h2>
+<div>{{app.url}}</div>
+<div>Last updated: {{app.lastUpdated || 'never'}}</div>
+
+<div class="topcoat-list__container">
+    <h3 class="topcoat-list__header">Missing Plugins: {{ app.plugins.missing.length }}</h3>
+    <ul class="topcoat-list">
+        <li class="topcoat-list__item" ng-repeat="plugin in app.plugins.missing">
+            <div><strong>{{ plugin.id }}</strong>: {{ plugin.version }}</div>
+        </li>
+    </ul>
+</div>
+
+<div class="topcoat-list__container">
+    <h3 class="topcoat-list__header">Older Plugins: {{ app.plugins.older.length }}</h3>
+    <ul class="topcoat-list">
+        <li class="topcoat-list__item" ng-repeat="plugin in app.plugins.older">
+            <div><strong>{{ plugin.id }}</strong></div>
+            <div>App wants {{ plugin.versions.child }}</div>
+            <div>Harness provides {{ plugin.versions.harness }}</div>
+        </li>
+    </ul>
+</div>
+
+<div class="topcoat-list__container">
+    <h3 class="topcoat-list__header">Newer Plugins: {{ app.plugins.newer.length }}</h3>
+    <ul class="topcoat-list">
+        <li class="topcoat-list__item" ng-repeat="plugin in app.plugins.newer">
+            <div><strong>{{ plugin.id }}</strong></div>
+            <div>App wants {{ plugin.versions.child }}</div>
+            <div>Harness provides {{ plugin.versions.harness }}</div>
+        </li>
+    </ul>
+</div>
+<br />
+<div class="buttons">
+    <a href="#/"><button class="topcoat-button">Back</button></a>
+</div>

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/a33443bd/www/cdvah/views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/list.html b/www/cdvah/views/list.html
index 6f8f273..b6cbda4 100644
--- a/www/cdvah/views/list.html
+++ b/www/cdvah/views/list.html
@@ -1,16 +1,16 @@
 <div class="topcoat-list__container">
     <h3 class="topcoat-list__header">Installed Apps</h3>
     <ul class="topcoat-list">
-        <li class="topcoat-list__item" ng-repeat="app in appList">
+        <li class="topcoat-list__item" ng-repeat="app in appList" ng-click="showDetails($index)">
             <div>{{app.appId}}</div>
             <div>{{app.url}}</div>
             <div ng-show="app.updatingStatus === null">Last updated: {{app.lastUpdated || 'never'}}</div>
             <div ng-show="app.updatingStatus !== null">Update in progress: {{app.updatingStatus}}%</div>
-            <div>Plugins: {{ app.plugins.missing.length }} missing, {{ app.plugins.newer.length + app.plugins.older.length }} differ</div>
-            <div>{{ app.plugins }}</div>
-            <button ng-click="launchApp(app)">Launch</button>
-            <button ng-click="updateApp(app)">Update</button>
-            <button ng-click="removeApp(app)">Remove</button>
+            <div ng-show="app.plugins.missing.length + app.plugins.newer.length + app.plugins.older.length > 0">Plugins: {{ app.plugins.missing.length }} missing, {{ app.plugins.newer.length + app.plugins.older.length }} differ</div>
+            <div ng-show="app.plugins.missing.length + app.plugins.newer.length + app.plugins.older.length == 0">Plugins: OK</div>
+            <button ng-click="launchApp(app, $event)">Launch</button>
+            <button ng-click="updateApp(app, $event)">Update</button>
+            <button ng-click="removeApp(app, $event)">Remove</button>
         </li>
     </ul>
 </div>