Browse Source

Panel - Minor changes

DSR! 3 năm trước cách đây
mục cha
commit
88f3707a52

+ 4 - 2
README.md

@@ -15,6 +15,8 @@ The following functionalities are modified looking for a better user experience
  - Fix mobile view
  - Add Chevron icon to accordions (size +1K)
  - Change notification time from 6000 to 20000 (decrease RPM from 10 to 3)
+ - Added more refresh buttons
+ - Fixed several bugs found in the panel
  - Project minification (Optional: use packer tools)
 
 ## Recon:
@@ -40,12 +42,12 @@ The following functionalities are modified looking for a better user experience
  - Add wireless config editor
  - Add tabs
  - Add Info block
- - Decrease initial requests (from 8 to 3)
+ - Decrease initial requests (from 8 to 2)
 
 ## Advanced:
  - Add Manual upgrade
  - Add tabs
- - Decrease initial requests (from 8 to 5)
+ - Decrease initial requests (from 8 to 3)
 
 ## Setup:
  - Fix character bad used

+ 3 - 2
src/pineapple/js/services.js

@@ -6,7 +6,6 @@
         this.deviceCallbacks = [];
 
         this.request = (function(data, callback, scope) {
-
             return $http.post('/api/', data).
             then(function(response){
                 if (response.data.error === "Not Authenticated") {
@@ -40,6 +39,7 @@
                 callback(data);
             }, this);
         });
+
         this.logout = (function(callback){
             return this.request({system: 'authentication', action: 'logout'}, callback);
         });
@@ -53,7 +53,6 @@
             this.navbarReloader();
         });
 
-
         this.checkAuth = (function(callback){
             return this.request({system: 'authentication', action: 'checkAuth'}, function(data){
                 if (callback !== undefined) {
@@ -70,12 +69,14 @@
                 callback(data);
             });
         };
+
         this.clearNotifications = function(){
             this.request({
                 system: 'notifications',
                 action: 'clearNotifications'
             });
         };
+
         this.addNotification = function(notificationMessage){
             this.request({
                 system: 'notifications',

+ 5 - 21
src/pineapple/modules/Advanced/js/module.js

@@ -31,16 +31,6 @@ registerController("AdvancedResourcesController", ['$api', '$scope', '$timeout',
         });
     });
 
-    $scope.getDevice = (function() {
-        $api.request({
-            module: 'Configuration',
-            action: 'getDevice'
-        }, function(response) {
-            $scope.device = response.device;
-        });
-    });
-
-    $scope.getDevice();
     $scope.reloadData();
 
     $api.onDeviceIdentified(function(device, scope) {
@@ -55,16 +45,6 @@ registerController("AdvancedUSBController", ['$api', '$scope', '$timeout', '$int
     $scope.fstabSaved = false;
     $scope.device = "";
 
-    $scope.getDevice = (function() {
-        $scope.device = "";
-        $api.request({
-            module: 'Configuration',
-            action: 'getDevice'
-        }, function(response) {
-            $scope.device = response.device;
-        });
-    });
-
     $scope.formatSDCard = (function() {
         $api.request({
             module: 'Advanced',
@@ -128,8 +108,12 @@ registerController("AdvancedUSBController", ['$api', '$scope', '$timeout', '$int
         });
     });
 
-    $scope.getDevice();
     $scope.reloadData();
+    
+    $api.onDeviceIdentified(function(device, scope) {
+        scope.device = device;
+    }, $scope);
+
 
     $scope.$on('$destroy', function() {
         $interval.cancel($scope.SDCardInterval);

+ 4 - 7
src/pineapple/modules/Configuration/js/module.js

@@ -11,13 +11,6 @@ registerController("ConfigurationGeneralController", ['$api', '$scope', '$timeou
 	$scope.device = "";
 	$scope.resetMessage = "";
 
-    $api.request({
-        module: 'Configuration',
-        action: 'getDevice'
-    }, function(response){
-        $scope.device = response.device;
-    });
-
 	$scope.haltPineapple = (function() {
 		if (confirm("Are you sure you want to shutdown your WiFi Pineapple?")) {
 			$api.request({
@@ -157,6 +150,10 @@ registerController("ConfigurationGeneralController", ['$api', '$scope', '$timeou
 	});
 
 	$scope.getCurrentTimeZone();
+
+	$api.onDeviceIdentified(function(device, scope) {
+		scope.device = device;
+	}, $scope);
 }]);
 
 registerController('ConfigurationLandingPageController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {

+ 20 - 11
src/pineapple/modules/Networking/js/module.js

@@ -50,6 +50,7 @@ registerController('NetworkingRouteController', ['$api', '$scope', '$timeout', f
 }]);
 
 registerController('NetworkingAccessPointsController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
+    $scope.loading = false;
     $scope.apConfigurationSaved = false;
     $scope.apConfigurationError = "";
     $scope.apAvailableChannels = [];
@@ -85,11 +86,13 @@ registerController('NetworkingAccessPointsController', ['$api', '$scope', '$time
     });
 
     $scope.reloadData = (function() {
+        $scope.loading = true;
         $api.request({
             module: "Networking",
             action: "getAPConfig"
         }, function(response) {
             if (response.error === undefined) {
+                $scope.loading = false;
                 $scope.apConfig = response;
                 if ($scope.apConfig['selectedChannel'] === true) {
                     $scope.apConfig['selectedChannel'] = "1";
@@ -111,6 +114,7 @@ registerController('NetworkingClientModeController', ['$api', '$scope', '$timeou
     $scope.connected = true;
     $scope.connecting = false;
     $scope.noNetworkFound = false;
+    $scope.loading = false;
 
     $scope.getInterfaces = (function() {
         $api.request({
@@ -160,11 +164,13 @@ registerController('NetworkingClientModeController', ['$api', '$scope', '$timeou
     });
 
     $scope.reloadData = (function() {
+        $scope.loading = true;
         $api.request({
             module: 'Networking',
             action: 'checkConnection'
         }, function(response) {
             if (response.error === undefined) {
+                $scope.loading = false;
                 if (response.connected) {
                     $scope.connected = true;
                     $scope.connectedInterface = response.interface;
@@ -205,16 +211,6 @@ registerController('NetworkingFirewallController', ['$api', '$scope', '$timeout'
     $scope.WANUIAccess = false;
     $scope.device = '';
 
-    $scope.getDevice = (function() {
-        $api.request({
-            module: 'Configuration',
-            action: 'getDevice'
-        }, function(response) {
-            $scope.device = response.device;
-        });
-    });
-    $scope.getDevice();
-
     $scope.reloadData = (function() {
         $api.request({
             module: 'Networking',
@@ -243,6 +239,10 @@ registerController('NetworkingFirewallController', ['$api', '$scope', '$timeout'
         })
     });
 
+    $api.onDeviceIdentified(function(device, scope) {
+        scope.device = device;
+    }, $scope);
+
     //$scope.reloadData();
 }]);
 
@@ -252,13 +252,16 @@ registerController('NetworkingMACAddressesController', ['$api', '$scope', '$time
     $scope.newMac = "";
     $scope.modifyingMAC = false;
     $scope.forceReload = false;
+    $scope.loading = false;
 
     $scope.reloadData = (function() {
+        $scope.loading = true;
         $api.request({
             module: 'Networking',
             action: 'getMacData'
         }, function(response) {
             if (response.error === undefined) {
+                $scope.loading = false;
                 $scope.interfaces = response;
             }
         });
@@ -322,6 +325,7 @@ registerController('NetworkingMACAddressesController', ['$api', '$scope', '$time
 }]);
 
 registerController('NetworkingAdvancedController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
+    $scope.loading = false;
     $scope.hostnameUpdated = false;
     $scope.wirelessReset = false;
     $scope.wirelessUpdated = false;
@@ -331,12 +335,14 @@ registerController('NetworkingAdvancedController', ['$api', '$scope', '$timeout'
     };
 
     $scope.reloadData = (function() {
+        $scope.loading = true;
         $scope.data['wireless'] = 'Loading...';
         $api.request({
             module: 'Networking',
             action: 'getAdvancedData'
         }, function(response) {
             if (response.error === undefined) {
+                $scope.loading = false;
                 $scope.data = response;
             }
         });
@@ -493,16 +499,19 @@ registerController("OUILookupController", ['$api', '$scope', '$timeout', '$http'
 }]);
 
 registerController('NetworkingInfoController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
-    $scope.info = '';
+    $scope.info = 'Use buttons for load info';
+    $scope.loading = false;
 
     $scope.getInfoData = (function(type) {
         $scope.info = 'Loading...';
+        $scope.loading = true;
         $api.request({
             module: 'Networking',
             action: 'getInfoData',
             type: type
         }, function(response) {
             if (response.error === undefined) {
+                $scope.loading = false;
                 $scope.info = response;
             }
         });

+ 30 - 5
src/pineapple/modules/Networking/module.html

@@ -67,6 +67,11 @@
                                     <li ng-disabled="waiting" ng-click="resetMac()"><a>Restore Default MAC Address</a></li>
                                 </ul>
                             </span>
+                            <span class="pull-right">
+                                <button class="btn btn-default btn-xs btn-fixed-length" ng-disabled="loading" ng-click="reloadData();">
+                                    Refresh
+                                </button>
+                            </span>
                         </h3>
                     </div>
                     <div class="panel-body">
@@ -109,7 +114,14 @@
                 <div class="controller" ng-controller="NetworkingClientModeController">
                     <div class="panel panel-default">
                         <div class="panel-heading">
-                            <h3 class="panel-title">WiFi Client Mode</h3>
+                            <h3 class="panel-title">
+                                WiFi Client Mode
+                                <span class="pull-right">
+                                    <button class="btn btn-default btn-xs btn-fixed-length" ng-disabled="loading" ng-click="reloadData();">
+                                        Refresh
+                                    </button>
+                                </span>
+                            </h3>
                         </div>
                         <div class="panel-body">
                             <div class="col-md-12" ng-show="connected">
@@ -219,9 +231,10 @@
                     <div class="panel-body">
                         <div class="col-md-12">
                             <div class="row">
-                                <button class="btn btn-default" ng-click="getInfoData(1)">ifconfig</button>
-                                <button class="btn btn-default" ng-click="getInfoData(2)">iw dev</button>
-                                <button class="btn btn-default" ng-click="getInfoData(3)">airmon-ng</button>
+                                <button class="btn btn-default" ng-click="getInfoData(1)" ng-disabled="loading">ifconfig</button>
+                                <button class="btn btn-default" ng-click="getInfoData(2)" ng-disabled="loading">iw dev</button>
+                                <button class="btn btn-default" ng-click="getInfoData(3)" ng-disabled="loading">airmon-ng</button>
+                                <img src="img/throbber.gif" ng-hide="!loading">
                             </div>
                             <br/>
                             <div class="row">
@@ -288,7 +301,14 @@
             <div class="col-md-6 controller" ng-controller="NetworkingAccessPointsController">
                 <div class="panel panel-default">
                     <div class="panel-heading">
-                        <h3 class="panel-title">Access Points</h3>
+                        <h3 class="panel-title">
+                            Access Points
+                            <span class="pull-right">
+                                <button class="btn btn-default btn-xs btn-fixed-length" ng-disabled="loading" ng-click="reloadData();">
+                                    Refresh
+                                </button>
+                            </span>
+                        </h3>
                     </div>
                     <div class="panel-body">
                         <div class="col-md-12">
@@ -412,6 +432,11 @@
                                     <li ng-click="resetWirelessConfig()"><a>Reset WiFi Config to Defaults</a></li>
                                 </ul>
                             </span>
+                            <span class="pull-right">
+                                <button class="btn btn-default btn-xs btn-fixed-length" ng-disabled="loading" ng-click="reloadData();">
+                                    Refresh
+                                </button>
+                            </span>
                         </h3>
                     </div>
                     <div class="panel-body">

+ 0 - 1
src/pineapple/modules/PineAP/module.html

@@ -81,7 +81,6 @@
                         <option value="AGGRESSIVE">Aggressive</option>
                     </select>
                 </div>
-                <br/>
                 <div class="input-group margin-bottom">
                     <span class="fixed-addon-width-3 input-group-addon">Monitor Interface</span>
                     <input type="text" maxlength="8" class="form-control" ng-model="settings.monitorInterface">