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 2013/05/23 22:03:28 UTC
[05/30] git commit: Display date and time of app installation
Display date and time of app installation
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/7531ee5d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/7531ee5d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/7531ee5d
Branch: refs/heads/master
Commit: 7531ee5d1554aad104a33b387c8e681ed60310f5
Parents: 1352f29
Author: Shravan Narayan <sh...@google.com>
Authored: Thu May 2 14:26:47 2013 -0400
Committer: Shravan Narayan <sh...@google.com>
Committed: Thu May 2 17:55:46 2013 -0400
----------------------------------------------------------------------
www/js/AppsService.js | 15 ++++++++++-----
www/js/ListCtrl.js | 11 +++++++++--
www/views/list.html | 10 +++++-----
3 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7531ee5d/www/js/AppsService.js
----------------------------------------------------------------------
diff --git a/www/js/AppsService.js b/www/js/AppsService.js
index 7cc4891..17a1638 100644
--- a/www/js/AppsService.js
+++ b/www/js/AppsService.js
@@ -53,6 +53,7 @@
"Name" : appName,
"Source" : appSource,
"Data" : appSourcePattern
+ "Installed" : (new Date()).toLocaleString()
});
return ResourcesLoader.writeJSONFileContents(APPS_JSON, result);
});
@@ -124,7 +125,7 @@
return {
//return promise with the array of apps
- getAppsList : function() {
+ getAppsList : function(getFullEntries) {
return ResourcesLoader.ensureDirectoryExists(APPS_JSON)
.then(function() {
return ResourcesLoader.readJSONFileContents(APPS_JSON);
@@ -134,7 +135,11 @@
var newAppsList = [];
for(var i = 0; i < result.installedApps.length; i++){
- newAppsList.push(result.installedApps[i].Name);
+ if(getFullEntries) {
+ newAppsList.push(result.installedApps[i]);
+ } else {
+ newAppsList.push(result.installedApps[i].Name);
+ }
}
return newAppsList;
@@ -164,7 +169,7 @@
},
addAppFromPattern : function(appName, appSourcePattern) {
- return this.getAppsList()
+ return this.getAppsList(false /* App names only */)
.then(function(appsList){
if(appsList.indexOf(appName) !== -1) {
throw new Error("An app with this name already exists");
@@ -174,7 +179,7 @@
},
uninstallApp : function(appName) {
- return removeApp(appName, true);
+ return removeApp(appName);
},
getLastRunApp : function() {
@@ -225,7 +230,7 @@
},
updateApp : function(appName){
- return removeApp(appName, true)
+ return removeApp(appName)
.then(function(entry){
if(entry.Source === "pattern") {
return addNewAppFromPattern(entry.Name, entry.Data);
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7531ee5d/www/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/js/ListCtrl.js b/www/js/ListCtrl.js
index b3a11be..d906f7c 100644
--- a/www/js/ListCtrl.js
+++ b/www/js/ListCtrl.js
@@ -37,9 +37,16 @@
}
$scope.loadAppsList = function(callApply) {
- return AppsService.getAppsList()
+ return AppsService.getAppsList(true /* get full information about the app */)
.then(function(newAppsList){
- newAppsList.sort();
+ newAppsList.sort(function(a, b){
+ if(a.Name < b.Name) {
+ return -1;
+ } else if(a.Name > b.Name) {
+ return 1;
+ }
+ return 0;
+ });
//clear the old apps list
$scope.appsList.splice(0, $scope.appsList.length);
angular.extend($scope.appsList, newAppsList);
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7531ee5d/www/views/list.html
----------------------------------------------------------------------
diff --git a/www/views/list.html b/www/views/list.html
index 1735b8d..c111953 100644
--- a/www/views/list.html
+++ b/www/views/list.html
@@ -1,10 +1,10 @@
<ul>
<li ng-repeat="app in appsList">
- <p>{{app}}</p>
- <button ng-click="launchApp(app)">Launch</button>
- <button ng-click="refreshApp(app)">Update</button>
- <button ng-click="removeApp(app)">Remove</button>
- <br />
+ <p>{{app.Name}}</p>
+ <p>Installed on: {{app.Installed}}</p>
+ <button ng-click="launchApp(app.Name)">Launch</button>
+ <button ng-click="refreshApp(app.Name)">Update</button>
+ <button ng-click="removeApp(app.Name)">Remove</button>
</li>
</ul>
<button ng-click="loadAppsList()">Reload Apps List</button>