diff --git a/lib/roles/device/plugins/install.js b/lib/roles/device/plugins/install.js index 5a750f7a..937f2f51 100644 --- a/lib/roles/device/plugins/install.js +++ b/lib/roles/device/plugins/install.js @@ -134,11 +134,11 @@ module.exports = syrup.serial() }) router.on(wire.UninstallMessage, function(channel, message) { - log.info('Uninstalling "%s"', message.package) + log.info('Uninstalling "%s"', message.packageName) var seq = 0 - adb.uninstall(options.serial, message.package) + adb.uninstall(options.serial, message.packageName) .then(function() { push.send([ channel diff --git a/lib/wire/wire.proto b/lib/wire/wire.proto index 0df651d6..5c0d4d27 100644 --- a/lib/wire/wire.proto +++ b/lib/wire/wire.proto @@ -331,7 +331,7 @@ message InstallMessage { } message UninstallMessage { - required string package = 1; + required string packageName = 1; } message LaunchActivityMessage { diff --git a/res/app/components/stf/common-ui/index.js b/res/app/components/stf/common-ui/index.js index 4cc5015c..98c02311 100644 --- a/res/app/components/stf/common-ui/index.js +++ b/res/app/components/stf/common-ui/index.js @@ -6,5 +6,6 @@ module.exports = angular.module('stf/common-ui', [ require('./table').name, require('./notifications').name, require('./ng-enter').name, - require('./tooltips').name + require('./tooltips').name, + require('./tree').name ]) \ No newline at end of file diff --git a/res/app/components/stf/common-ui/tree/index.js b/res/app/components/stf/common-ui/tree/index.js new file mode 100644 index 00000000..630bf316 --- /dev/null +++ b/res/app/components/stf/common-ui/tree/index.js @@ -0,0 +1,8 @@ +require('angular-tree-control/css/tree-control.css') +require('./tree.css') +require('angular-tree-control') + +module.exports = angular.module('stf.tree', [ + 'treeControl' +]) + .factory('TreeService', require('./tree-service')) diff --git a/res/app/components/stf/common-ui/tree/tree-service.js b/res/app/components/stf/common-ui/tree/tree-service.js new file mode 100644 index 00000000..9f4cdd3c --- /dev/null +++ b/res/app/components/stf/common-ui/tree/tree-service.js @@ -0,0 +1,52 @@ +module.exports = function () { + var treeService = {} + + var tree = [ + {name: 'glossary', children: [ + {name: 'title'} + ]} + ] + + function createTreeFromJSON(tree, json) { + + + (function updateRecursive(item) { + if (item.iconSrc) { + item.iconSrcFullpath = 'some value..'; + } + _.each(item.items, updateRecursive); + })(json); + } + + + $scope.treeOptions = { + nodeChildren: 'children', + dirSelectable: true, + injectClasses: { + ul: "a1", + li: "a2", + liSelected: "a7", + iExpanded: "a3", + iCollapsed: "a4", + iLeaf: "a5", + label: "a6", + labelSelected: "a8" + } + } + + $scope.treeData = [ + { "name": "Joe", "age": "21", "children": [ + { "name": "Smith", "age": "42", "children": [] }, + { "name": "Gary", "age": "21", "children": [ + { "name": "Jenifer", "age": "23", "children": [ + { "name": "Dani", "age": "32", "children": [] }, + { "name": "Max", "age": "34", "children": [] } + ]} + ]} + ]}, + { "name": "Albert", "age": "33", "children": [] }, + { "name": "Ron", "age": "29", "children": [] } + ]; + + return treeService +} \ No newline at end of file diff --git a/res/app/components/stf/common-ui/tree/tree.css b/res/app/components/stf/common-ui/tree/tree.css new file mode 100644 index 00000000..ebe5ac2c --- /dev/null +++ b/res/app/components/stf/common-ui/tree/tree.css @@ -0,0 +1,3 @@ +.stf-tree { + +} \ No newline at end of file diff --git a/res/app/components/stf/control/control-service.js b/res/app/components/stf/control/control-service.js index 6b968ce2..259a48a6 100644 --- a/res/app/components/stf/control/control-service.js +++ b/res/app/components/stf/control/control-service.js @@ -157,7 +157,7 @@ module.exports = function ControlServiceFactory( this.uninstall = function(pkg) { var tx = TransactionService.create(target) socket.emit('device.uninstall', channel, tx.channel, { - package: pkg + packageName: pkg }) return tx } diff --git a/res/app/control-panes/dashboard/upload/index.js b/res/app/control-panes/dashboard/upload/index.js index dacf1a16..da549820 100644 --- a/res/app/control-panes/dashboard/upload/index.js +++ b/res/app/control-panes/dashboard/upload/index.js @@ -1,7 +1,7 @@ require('./upload.css') module.exports = angular.module('stf.upload', [ - + require('stf/common-ui/tree').name ]) .run(["$templateCache", function ($templateCache) { $templateCache.put('control-panes/dashboard/upload/upload.jade', diff --git a/res/app/control-panes/dashboard/upload/upload-controller.js b/res/app/control-panes/dashboard/upload/upload-controller.js index a7bb6272..41a48bb9 100644 --- a/res/app/control-panes/dashboard/upload/upload-controller.js +++ b/res/app/control-panes/dashboard/upload/upload-controller.js @@ -7,6 +7,11 @@ module.exports = function UploadCtrl($scope, $rootScope, SettingsService, gettex } $rootScope.install = function ($files) { + $scope.installation = { + progress: 0, + lastData: 'uploading' + } + return $rootScope.control.install($files) .then(function (tx) { var manifest = tx.manifest @@ -20,13 +25,25 @@ module.exports = function UploadCtrl($scope, $rootScope, SettingsService, gettex .then(function (result) { $scope.$apply(function () { result.manifest = manifest - console.log(manifest) + $scope.treeData = manifest $scope.installation = result }) }) }) } + $scope.uninstall = function (packageName) { + console.log('first') + var tx = $rootScope.control.uninstall(packageName) + return tx.promise.then(function (result) { + if (result.success) { + //$scope.clear() + } else { + console.error(result.error) + } + }) + } + // // $scope.installEnabled = true // SettingsService.bind($scope, { diff --git a/res/app/control-panes/dashboard/upload/upload.css b/res/app/control-panes/dashboard/upload/upload.css index f974e3b5..52cfe411 100644 --- a/res/app/control-panes/dashboard/upload/upload.css +++ b/res/app/control-panes/dashboard/upload/upload.css @@ -38,4 +38,8 @@ .stf-upload .upload-status { margin-top: 15px; +} + +.stf-upload .manifest-text { + font-size: 10px; } \ No newline at end of file diff --git a/res/app/control-panes/dashboard/upload/upload.jade b/res/app/control-panes/dashboard/upload/upload.jade index 694c467b..f7938f95 100644 --- a/res/app/control-panes/dashboard/upload/upload.jade +++ b/res/app/control-panes/dashboard/upload/upload.jade @@ -27,15 +27,20 @@ tooltip='Upload From Link', ng-disabled='!remoteUrl') i.fa.fa-upload + //treecontrol.tree-classic(tree-model='treeData', options='treeOptions') + span employee: {{node.name}} age {{node.age}} + .upload-status(ng-if='installation') accordion(close-others='false') accordion-group(is-open='true') accordion-heading i.fa.fa-file-o - span {{installation.manifest.application.name}} + span {{installation.manifest.package || "App" }} div(ng-switch='installation.lastData') + strong(ng-switch-when='uploading') + span(translate) Starting to upload... strong(ng-switch-when='pushing_app') span(translate) Pushing app... strong(ng-switch-when='installing_app') @@ -43,7 +48,18 @@ strong(ng-switch-when='launching_app') span(translate) Launching activity... strong(ng-switch-when='success') - //pre {{ installation.manifest }} + button.btn.btn-sm.btn-danger-outline.pull-right( + ng-click='uninstall(installation.manifest.package)', ng-show='installation.settled') + i.fa.fa-trash-o + span(translate) Uninstall + + button.btn.btn-sm.btn-primary-outline(btn-checkbox, ng-model='showManifest') + i.fa.fa-list + span(ng-if='showManifest') Hide Manifest + span(ng-if='!showManifest') Show Manifest + pre.manifest-text(ng-if='showManifest') {{ installation.manifest | json }} + + strong(ng-switch-when='fail') span(translate) Installation failed