You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/05/20 21:52:52 UTC

[2/5] git commit: Delete Add / Edit screens (Allow add/update from server only).

Delete Add / Edit screens (Allow add/update from server only).


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/de9b2855
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/de9b2855
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/de9b2855

Branch: refs/heads/master
Commit: de9b2855ed01de82ea9b973486bda8eb73422179
Parents: 1fc7bf4
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu May 15 16:06:32 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue May 20 14:20:55 2014 -0400

----------------------------------------------------------------------
 www/cdvah/css/style.css       |   9 +++
 www/cdvah/harnessmenu.html    |   1 -
 www/cdvah/js/AddCtrl.js       | 118 -------------------------------------
 www/cdvah/js/HarnessServer.js |   2 +-
 www/cdvah/js/ListCtrl.js      |  15 -----
 www/cdvah/js/app.js           |   8 ---
 www/cdvah/views/add.html      |  55 -----------------
 www/cdvah/views/details.html  |   8 +--
 www/cdvah/views/list.html     |  23 ++++----
 www/cdvahcm/contextMenu.html  |   3 -
 10 files changed, 24 insertions(+), 218 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/css/style.css
----------------------------------------------------------------------
diff --git a/www/cdvah/css/style.css b/www/cdvah/css/style.css
index b26fecf..daab765 100644
--- a/www/cdvah/css/style.css
+++ b/www/cdvah/css/style.css
@@ -16,6 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
 */
+.listen {
+    padding: 2px 20px;
+}
+
+.plugin-list-item {
+    padding-top: 0.2rem;
+    padding-bottom: 0.2rem;
+}
+
 .buttons {
     margin: 15px;
 }

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/harnessmenu.html
----------------------------------------------------------------------
diff --git a/www/cdvah/harnessmenu.html b/www/cdvah/harnessmenu.html
index 883f556..9a562fa 100644
--- a/www/cdvah/harnessmenu.html
+++ b/www/cdvah/harnessmenu.html
@@ -33,7 +33,6 @@
         <script type="text/javascript" src="js/PluginMetadata.js"></script>
         <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>
         <script type="text/javascript" src="js/HttpServer.js"></script>

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/js/AddCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/AddCtrl.js b/www/cdvah/js/AddCtrl.js
deleted file mode 100644
index 021fb58..0000000
--- a/www/cdvah/js/AddCtrl.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-*/
-(function(){
-    'use strict';
-
-    /* global myApp */
-    myApp.controller('AddCtrl', ['$q', 'notifier', '$location', '$rootScope', '$scope', '$window', '$routeParams', 'AppsService', 'urlCleanup', function($q, notifier, $location, $rootScope, $scope, $window, $routeParams, AppsService, urlCleanup) {
-        $scope.editing = $routeParams.appId;
-        var editingApp;
-
-        $rootScope.appTitle = $scope.editing ? 'Edit App' : 'Add App';
-
-        if ($scope.editing) {
-            AppsService.getAppList().then(function(appList) {
-                appList.forEach(function(app) {
-                    if (app.appId == $scope.editing) {
-                        editingApp = app;
-                        $scope.editingApp = app;
-                        $scope.appData = {
-                            appId: app.appId,
-                            appUrl: app.url,
-                            installerType: app.type
-                        };
-                    }
-                });
-                if (!$scope.appData) {
-                    notifier.error('Could not find app to edit');
-                }
-            });
-        } else {
-            $scope.appData = {
-                appUrl: '',
-                installerType: 'serve'
-            };
-        }
-
-        $scope.selectTemplate = function() {
-            $scope.appData.appUrl = $scope.appData.serveTemplateValue;
-        };
-
-        $scope.addApp = function() {
-            if ($scope.editing) {
-                // Update the app, write them out, and return to the list.
-                // We deliberately disallow changing the type, since that wouldn't work at all.
-                var oldUrl = editingApp.url;
-                editingApp.appId = $scope.appData.appId;
-                editingApp.url = urlCleanup($scope.appData.appUrl);
-                var urlChanged = oldUrl != editingApp.url;
-                var p = AppsService.editApp($scope.editing, editingApp).then(function() {
-                    notifier.success('App edited');
-                    $location.path('/');
-                });
-
-                if (urlChanged) {
-                    return p.then(function() {
-                        // If the URL changed, trigger an update.
-                        return AppsService.updateApp(editingApp);
-                    }).then(function() {
-                        notifier.success('Updated app due to URL change');
-                    }, function(err) {
-                        notifier.error(err);
-                    });
-                }
-                return p;
-            }
-            return AppsService.addApp($scope.appData.installerType, $scope.appData.appUrl)
-            .then(function(handler) {
-                notifier.success('App Added. Updating...');
-                $location.path('/');
-                return AppsService.updateApp(handler);
-            })
-            .then(function(){
-                notifier.success('Updated successfully');
-            }, function(error) {
-                notifier.error(error);
-            });
-        };
-
-        // True if the optional barcodescanner plugin is installed.
-        $scope.qrEnabled = !!(cordova.plugins && cordova.plugins.barcodeScanner);
-
-        // Scans a QR code, placing the URL into the currently selected of source and pattern.
-        $scope.fetchQR = function() {
-            var deferred = $q.defer();
-            $window.cordova.plugins.barcodeScanner.scan(function(result) {
-                if (!result || result.cancelled || !result.text) {
-                    notifier.error('No QR code received.');
-                    deferred.reject('No QR code received.');
-                } else {
-                    $scope.appData.appUrl = result.text;
-                    notifier.success('QR code received');
-                    deferred.resolve();
-                }
-            },
-            function(error) {
-                notifier.error(error);
-                deferred.reject(error);
-            });
-            return deferred.promise;
-        };
-    }]);
-})();

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/js/HarnessServer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/HarnessServer.js b/www/cdvah/js/HarnessServer.js
index 06d6922..26097be 100644
--- a/www/cdvah/js/HarnessServer.js
+++ b/www/cdvah/js/HarnessServer.js
@@ -153,7 +153,7 @@
 
         function getListenAddress() {
             if (listenAddress) {
-                return listenAddress;
+                return $q.when(listenAddress);
             }
             var deferred = $q.defer();
             chrome.socket.getNetworkList(function(interfaces) {

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js
index 46eadb9..383762b 100644
--- a/www/cdvah/js/ListCtrl.js
+++ b/www/cdvah/js/ListCtrl.js
@@ -66,16 +66,6 @@
             });
         };
 
-        $scope.updateApp = function(app, event) {
-            event.stopPropagation();
-            return AppsService.updateApp(app)
-            .then(function(){
-                notifier.success('Updated successfully');
-            }, function(error) {
-                notifier.error(error);
-            });
-        };
-
         $scope.removeApp = function(app, event) {
             event.stopPropagation();
             var shouldUninstall = confirm('Are you sure you want to uninstall ' + app.appId + '?');
@@ -87,11 +77,6 @@
             }
         };
 
-        $scope.editApp = function(app, event) {
-            event.stopPropagation();
-            $location.path('/edit/' + app.appId);
-        };
-
         $scope.showDetails = function(index) {
             $location.path('/details/' + index);
         };

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/js/app.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/app.js b/www/cdvah/js/app.js
index 01b82ce..c570e82 100644
--- a/www/cdvah/js/app.js
+++ b/www/cdvah/js/app.js
@@ -25,14 +25,6 @@ myApp.config(['$routeProvider', function($routeProvider){
         templateUrl: 'views/list.html',
         controller: 'ListCtrl'
     });
-    $routeProvider.when('/add', {
-        templateUrl: 'views/add.html',
-        controller: 'AddCtrl'
-    });
-    $routeProvider.when('/edit/:appId', {
-        templateUrl: 'views/add.html',
-        controller: 'AddCtrl'
-    });
     $routeProvider.when('/details/:index', {
         templateUrl: 'views/details.html',
         controller: 'DetailsCtrl'

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/views/add.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/add.html b/www/cdvah/views/add.html
deleted file mode 100644
index ec63bfe..0000000
--- a/www/cdvah/views/add.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<form name="addForm" ng-controller="AddCtrl">
-  <div>
-    <label ng-show="editing">App name<br />
-        <div><input type="text" class="topcoat-text-input" ng-model="appData.appId" autocapitalize="on" /></div>
-    </label>
-  </div>
-  <div>
-    <label ng-show="!editing">How to retrieve the app:<br>
-        <select ng-model="appData.installerType">
-            <option value="serve">cordova serve</option>
-        </select>
-    </label>
-  </div>
-  <div>
-    <label>Enter URL
-        <div><input class="topcoat-text-input" style="width:100%;-webkit-box-sizing:border-box" type="text" ng-model="appData.appUrl" autocorrect="off" autocapitalize="off"></div>
-    </label>
-  </div>
-  <div>
-    <button class="topcoat-button" ng-click="fetchQR(appData, 'appUrl')" ng-show="qrEnabled">QR Code</button>
-  </div>
-  <div>
-    <select ng-model="appData.serveTemplateValue" ng-change="selectTemplate()">
-        <option value="">Template</option>
-        <option value="goo.gl/">goo.gl</option>
-        <option value="localhost:8000">localhost</option>
-        <option value="KEY.t.proxylocal.com">ProxyLocal</option>
-        <option value="KEY.localtunnel.com">LocalTunnel</option>
-        <option value="KEY.ngrok.com">ngrok</option>
-    </select>
-  </div>
-  <div class="buttons">
-      <button ng-click="addApp()" class="topcoat-button--cta">{{ editing ? 'Edit' : 'Add' }}</button>
-      <a href="#/"><button class="topcoat-button" ng-click="back()">Back</button></a>
-  </div>
-</form>
-

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/views/details.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/details.html b/www/cdvah/views/details.html
index e61a4cf..cc6945c 100644
--- a/www/cdvah/views/details.html
+++ b/www/cdvah/views/details.html
@@ -17,13 +17,11 @@
   under the License.
 -->
 <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">
+        <li class="topcoat-list__item plugin-list-item" ng-repeat="plugin in app.plugins.missing">
             <div><strong>{{ plugin.id }}</strong>: {{ plugin.version }}</div>
         </li>
     </ul>
@@ -32,7 +30,7 @@
 <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">
+        <li class="topcoat-list__item plugin-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>
@@ -43,7 +41,7 @@
 <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">
+        <li class="topcoat-list__item plugin-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>

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvah/views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/list.html b/www/cdvah/views/list.html
index 98492e8..42af081 100644
--- a/www/cdvah/views/list.html
+++ b/www/cdvah/views/list.html
@@ -16,29 +16,28 @@
   specific language governing permissions and limitations
   under the License.
 -->
+<div class="listen">
+    Listening. IP = <strong>{{ipAddress}}</strong>
+</div>
 <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" ng-click="showDetails($index)">
+        <li class="topcoat-list__item" ng-repeat="app in appList">
             <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 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:
+                <span style="color:#c00" ng-show="app.plugins.missing.length">{{ app.plugins.missing.length }} missing</span><span ng-show="app.plugins.missing.length && (app.plugins.older.length || app.plugins.newer.length)">, </span>
+                <span style="color:#822" ng-show="app.plugins.older.length">{{ app.plugins.older.length }} outdated<span><span ng-show="app.plugins.older.length && app.plugins.newer.length">, </span>
+                <span ng-show="app.plugins.newer.length">{{ app.plugins.newer.length }} newer</span>
+            </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>
-            <button ng-click="editApp(app, $event)">Edit</button>
+            <button ng-click="showDetails($index)">Details</button>
         </li>
     </ul>
 </div>
-<br />
-<div class="buttons">
-    <a href="#/add"><button class="topcoat-button--cta">Add app</button></a>
-</div>
 
-<div class="listen">
-    Listening. IP = <strong>{{ipAddress}}</strong>
-</div>
 

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de9b2855/www/cdvahcm/contextMenu.html
----------------------------------------------------------------------
diff --git a/www/cdvahcm/contextMenu.html b/www/cdvahcm/contextMenu.html
index 5311fc6..39848aa 100644
--- a/www/cdvahcm/contextMenu.html
+++ b/www/cdvahcm/contextMenu.html
@@ -65,9 +65,6 @@
     <p>Tap Anywhere to Close</p>
     <ul>
         <li>
-            <button class="fullwidthElement" onclick="sendEvent('updateApp')">Update</button>
-        </li>
-        <li>
             <button class="fullwidthElement" onclick="sendEvent('restartApp')">Restart</button>
         </li>
         <li>