luma_third_party: Trimmed stf UI

Front-end changes to CrowdSTF that trim away UI features from OpenSTF
that crowd users will not use. Previously the UI showed an array
of controls to modify the android phone, see logs, take screenshots, but
this change trims all controls from the UI except for the phone itself.

Change-Id: Id17833afe01f492f044f76026d6fd46f143bf43c
diff --git a/crowdstf/README.google b/crowdstf/README.google
index c9d0b65..7f99484 100644
--- a/crowdstf/README.google
+++ b/crowdstf/README.google
@@ -12,3 +12,5 @@
   Added gesture capture persistence to db
 Change http://v.io/c/23714
   Added token-based authentication (backend)
+Change http://v.io/c/23716
+  Trimmed OpenSTF UI controls to simple crowd UI
diff --git a/crowdstf/res/app/app.js b/crowdstf/res/app/app.js
index 5a3a4b7..1bf1a6a 100644
--- a/crowdstf/res/app/app.js
+++ b/crowdstf/res/app/app.js
@@ -20,10 +20,6 @@
   ])
     .config(function($routeProvider, $locationProvider) {
       $locationProvider.hashPrefix('!')
-      $routeProvider
-        .otherwise({
-          redirectTo: '/devices'
-        })
     })
 
     .config(function(hotkeysProvider) {
diff --git a/crowdstf/res/app/components/stf/device-context-menu/device-context-menu.jade b/crowdstf/res/app/components/stf/device-context-menu/device-context-menu.jade
index b9b8b32..cfe866d 100644
--- a/crowdstf/res/app/components/stf/device-context-menu/device-context-menu.jade
+++ b/crowdstf/res/app/components/stf/device-context-menu/device-context-menu.jade
@@ -1,31 +1 @@
-.dropdown.context-menu(id='context-menu-{{ $index }}')
-  ul.dropdown-menu(role='menu')
-    li
-      a.pointer(role='menuitem', ng-click='control.back(); $event.preventDefault()')
-        i.fa.fa-mail-reply.fa-fw
-        span(translate) Back
-    li
-      a.pointer(role='menuitem', ng-click='control.home(); $event.preventDefault()')
-        i.fa.fa-home.fa-fw
-        span(translate) Home
-    li.divider
-    li
-      a.pointer(role='menuitem', ng-click='rotateRight(); $event.preventDefault()')
-        i.fa.fa-rotate-left.fa-fw
-        span(translate) Rotate Left
-    li
-      a.pointer(role='menuitem', ng-click='rotateLeft(); $event.preventDefault()')
-        i.fa.fa-rotate-right.fa-fw
-        span(translate) Rotate Right
-    li.divider
-    li
-      a.pointer(role='menuitem', ng-click='saveScreenShot(); $event.preventDefault()')
-        i.fa.fa-camera.fa-fw
-        span(translate) Save ScreenShot
-    li.divider
-    li
-      a.pointer(role='menuitem', ng-click='$root.standalone ? windowClose() : kickDevice(device); $event.preventDefault()')
-        i.fa.fa-sign-out.fa-fw
-        span(translate) Stop Using
-
 .stf-device-context-menu(ng-transclude, context-menu, data-target='context-menu-{{ $index }}').fill-height
diff --git a/crowdstf/res/app/components/stf/device/device-service.js b/crowdstf/res/app/components/stf/device/device-service.js
index 95aeb63..33b689d 100644
--- a/crowdstf/res/app/components/stf/device/device-service.js
+++ b/crowdstf/res/app/components/stf/device/device-service.js
@@ -2,7 +2,9 @@
 var _ = require('lodash')
 var EventEmitter = require('eventemitter3')
 
-module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceService) {
+module.exports = function DeviceServiceFactory($http, $cookies, socket,
+                                               EnhanceDeviceService,
+                                               GroupService) {
   var deviceService = {}
 
   function Tracker($scope, options) {
@@ -144,6 +146,15 @@
     scopedSocket.on('device.add', addListener)
     scopedSocket.on('device.remove', changeListener)
     scopedSocket.on('device.change', changeListener)
+    scopedSocket.on('forceKick', function(serial) {
+      var device = get({serial: serial});
+      GroupService.kick(device, true);
+      $cookies.remove('XSRF-TOKEN');
+      $cookies.remove('ssid');
+      $cookies.remove('ssid.sig');
+      window.location.reload();
+      $scope.destroy();
+    });
 
     this.add = function(device) {
       addListener({
diff --git a/crowdstf/res/app/control-panes/control-panes-controller.js b/crowdstf/res/app/control-panes/control-panes-controller.js
index f026d39..de026cf 100644
--- a/crowdstf/res/app/control-panes/control-panes-controller.js
+++ b/crowdstf/res/app/control-panes/control-panes-controller.js
@@ -75,9 +75,8 @@
           return device
         })
         .catch(function() {
-          $timeout(function() {
-            $location.path('/')
-          })
+          // Ignore redirects to device page, issue warning.
+          console.error('Unable to connect to device, it may not be usable.');
         })
     }
 
diff --git a/crowdstf/res/app/control-panes/control-panes.jade b/crowdstf/res/app/control-panes/control-panes.jade
index 45ee602..2f8aa8f 100644
--- a/crowdstf/res/app/control-panes/control-panes.jade
+++ b/crowdstf/res/app/control-panes/control-panes.jade
@@ -1,18 +1,6 @@
 div(ng-controller='ControlPanesHotKeysCtrl').fill-height
-  div(ng-if='$root.basicMode || $root.standalone').fill-height
-    div.fill-height.basic-remote-control
-      .remote-control
-        div(ng-include='"control-panes/device-control/device-control-standalone.jade"').fill-height
-
   div(ng-if='!$root.basicMode && !$root.standalone')
     div(fa-pane, pane-id='control-device', pane-anchor='west', pane-size='{{remotePaneSize}}', pane-min='200px', pane-max='100% + 2px', pane-handle='4', pane-no-toggle='false')
 
       .remote-control
         div(ng-include='"control-panes/device-control/device-control.jade"').fill-height
-
-    div(fa-pane, pane-id='control-bottom-tabs', pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p
-      .widget-container.fluid-height
-        nice-tabs(key='ControlBottomTabs', direction='below', tabs='belowTabs', filter='$root.platform')
-    div(fa-pane, pane-id='control-top-tabs', pane-anchor='')
-      .widget-container.fluid-height
-        nice-tabs(key='ControlBottomTabs', tabs='topTabs', filter='$root.platform')
diff --git a/crowdstf/res/app/control-panes/device-control/device-control.jade b/crowdstf/res/app/control-panes/device-control/device-control.jade
index 1e1c085..1bef0cc 100644
--- a/crowdstf/res/app/control-panes/device-control/device-control.jade
+++ b/crowdstf/res/app/control-panes/device-control/device-control.jade
@@ -1,45 +1,6 @@
 .interact-control.fill-height.as-table.stf-device-control(ng-controller='DeviceControlCtrl')
   .as-cell.fill-height
     .as-table.fill-height
-      .stf-vnc-navbar.as-row(ng-show='!$root.basicMode && !$root.standalone')
-        .stf-vnc-control-header.as-cell
-          .stf-vnc-right-buttons.pull-right
-            .btn-group
-              label.btn-sm.btn-primary-outline(type='button', ng-click='tryToRotate("portrait")',
-              ng-model='currentRotation', uib-btn-radio='"portrait"',
-              uib-tooltip='{{ "Portrait" | translate }} ({{ "Current rotation:" | translate }} {{ device.display.rotation }}°)', tooltip-placement='bottom').pointer
-                i.fa.fa-mobile
-              label.btn-sm.btn-primary-outline(type='button', ng-click='tryToRotate("landscape")',
-                ng-model='currentRotation', uib-btn-radio='"landscape"',
-              uib-tooltip='{{ "Landscape" | translate }} ({{ "Current rotation:" | translate }} {{ device.display.rotation }}°)', tooltip-placement='bottom').pointer
-                i.fa.fa-mobile.fa-rotate-90
-            .button-spacer
-            button(type='button', ng-model='showScreen', uib-btn-checkbox).btn.btn-xs.btn-info
-              i(ng-show='showScreen', uib-tooltip='{{"Hide Screen"|translate}}', tooltip-placement='bottom').fa.fa-eye
-              i(ng-show='!showScreen', uib-tooltip='{{"Show Screen"|translate}}', tooltip-placement='bottom').fa.fa-eye-slash
-            button(type='button', ng-click='kickDevice(device); $event.stopPropagation()', uib-tooltip='{{"Stop Using"|translate}}', tooltip-placement='bottom').btn.btn-sm.btn-danger-outline
-              i.fa.fa-times
-
-          .device-name-container.pull-left(uib-dropdown)
-            a.stf-vnc-device-name.pointer.unselectable(uib-dropdown-toggle)
-              p
-                .device-small-image
-                  img(ng-src='/static/app/devices/icon/x24/{{ device.image || "E30HT.jpg" }}')
-                span.device-name-text {{ device.enhancedName }}
-                span.caret(ng-show='groupDevices.length > 0')
-
-            ul.dropdown-menu(role='menu', data-toggle='dropdown', ng-show='groupDevices.length > 0').pointer.unselectable
-              li(ng-repeat='groupDevice in groupDevices')
-                a.device-name-menu-element(ng-click='controlDevice(groupDevice); $event.stopPropagation()')
-                  .pull-left
-                    .device-small-image
-                      img(ng-src='/static/app/devices/icon/x24/{{ groupDevice.image || "E30HT.jpg" }}')
-                    span(ng-class='{"current-device": groupDevice.serial === device.serial }') {{ groupDevice.enhancedName }}
-
-                  .pull-right(ng-click='kickDevice(groupDevice); $event.stopPropagation()').kick-device
-                    i.fa.fa-times
-                  .clearfix
-
       .as-row.fill-height
         div(ng-controller='DeviceScreenCtrl', ng-if='device').as-cell.fill-height
           div(ng-file-drop='installFile($files)', ng-file-drag-over-class='dragover').fill-height
@@ -49,9 +10,3 @@
       .stf-vnc-bottom.as-row(ng-hide='$root.standalone')
         .controls.as-cell
           .btn-group.btn-group-justified
-            a(device-control-key='menu', title='{{"Menu"|translate}}').btn.btn-primary.btn-lg.no-transition
-              i.fa.fa-bars
-            a(device-control-key='home', title='{{"Home"|translate}}').btn.btn-primary.btn-lg.no-transition
-              i.fa.fa-home
-            a(device-control-key='back', title='{{"Back"|translate}}').btn.btn-primary.btn-lg.no-transition
-              i.fa.fa-mail-reply
diff --git a/crowdstf/res/app/device-list/index.js b/crowdstf/res/app/device-list/index.js
index 6aa5315..6663d42 100644
--- a/crowdstf/res/app/device-list/index.js
+++ b/crowdstf/res/app/device-list/index.js
@@ -17,7 +17,7 @@
 ])
   .config(['$routeProvider', function($routeProvider) {
     $routeProvider
-      .when('/devices', {
+      .when('/devices-home', {
         template: require('./device-list.jade'),
         controller: 'DeviceListCtrl'
       })
diff --git a/crowdstf/res/app/views/index.jade b/crowdstf/res/app/views/index.jade
index 71a565d..b47d274 100644
--- a/crowdstf/res/app/views/index.jade
+++ b/crowdstf/res/app/views/index.jade
@@ -15,12 +15,6 @@
   body(ng-cloak).bg-1.fill-height.unselectable
     div(ng-controller='LayoutCtrl', basic-mode, admin-mode, standalone, landscape).fill-height
       .pane-top.fill-height(fa-pane)
-        .pane-top-bar(fa-pane, pane-id='menu', pane-anchor='north',
-          pane-size='{{!$root.basicMode && !$root.standalone ? 44 : 0 }}px',
-
-          pane-handle='')
-          div(ng-include='"menu.jade"')
-
         .pane-center(fa-pane, pane-id='main', pane-anchor='center').fill-height
           socket-state
           div(growl)