DSR! 3 жил өмнө
parent
commit
3073957e17

+ 17 - 14
src/pineapple/modules/PineAP/js/module.js

@@ -138,9 +138,11 @@ registerController('PineAPPoolController', ['$api', '$scope', '$timeout', functi
 }]);
 }]);
 
 
 registerController('PineAPSettingsController', ['$api', '$scope', function($api, $scope) {
 registerController('PineAPSettingsController', ['$api', '$scope', function($api, $scope) {
+    $scope.loading = true;
     $scope.disableButton = false;
     $scope.disableButton = false;
-    $scope.saveAlert = false;
     $scope.pineAPenabling = false;
     $scope.pineAPenabling = false;
+    $scope.pineAPDaemonStatus = '';
+    $scope.autostartPineAPStatus = '';
     $scope.settings = {
     $scope.settings = {
         allowAssociations: false,
         allowAssociations: false,
         logEvents: false,
         logEvents: false,
@@ -151,20 +153,19 @@ registerController('PineAPSettingsController', ['$api', '$scope', function($api,
         broadcastSSIDs: false,
         broadcastSSIDs: false,
         connectNotifications: false,
         connectNotifications: false,
         disconnectNotifications: false,
         disconnectNotifications: false,
-        broadcastInterval: 'NORMAL',
-        responseInterval: 'NORMAL',
-        monitorInterface: 'wlan1mon',
-        sourceInterface: 'wlan0',
-        sourceMAC: '00:00:00:00:00:00',
-        targetMAC: 'FF:FF:FF:FF:FF:FF'
+        broadcastInterval: '',
+        responseInterval: '',
+        monitorInterface: '',
+        sourceInterface: '',
+        sourceMAC: '',
+        targetMAC: ''
     };
     };
 
 
     $scope.togglePineAP = function() {
     $scope.togglePineAP = function() {
         $scope.pineAPenabling = true;
         $scope.pineAPenabling = true;
-        var actionString = $scope.settings.pineAPDaemon ? "disable" : "enable";
         $api.request({
         $api.request({
             module: 'PineAP',
             module: 'PineAP',
-            action: actionString
+            action: $scope.settings.pineAPDaemon ? "disable" : "enable"
         }, function(response) {
         }, function(response) {
             if (response.error === undefined) {
             if (response.error === undefined) {
                 $scope.pineAPenabling = false;
                 $scope.pineAPenabling = false;
@@ -174,10 +175,9 @@ registerController('PineAPSettingsController', ['$api', '$scope', function($api,
     };
     };
 
 
     $scope.toggleAutoStart = function() {
     $scope.toggleAutoStart = function() {
-        var actionString = $scope.settings.autostartPineAP ? "disableAutoStart" : "enableAutoStart";
         $api.request({
         $api.request({
             module: 'PineAP',
             module: 'PineAP',
-            action: actionString
+            action: $scope.settings.autostartPineAP ? "disableAutoStart" : "enableAutoStart"
         }, function(response) {
         }, function(response) {
             if (response.error === undefined) {
             if (response.error === undefined) {
                 $scope.getSettings();
                 $scope.getSettings();
@@ -191,7 +191,10 @@ registerController('PineAPSettingsController', ['$api', '$scope', function($api,
             action: 'getPineAPSettings'
             action: 'getPineAPSettings'
         }, function(response) {
         }, function(response) {
             if (response.success === true) {
             if (response.success === true) {
+                $scope.loading = false;
                 $scope.settings = response.settings;
                 $scope.settings = response.settings;
+                $scope.pineAPDaemonStatus = response.settings.pineAPDaemon ? 'Start' : 'Stop';
+                $scope.autostartPineAPStatus = response.settings.autostartPineAP ? 'Enabled' : 'Disabled';
             }
             }
         });
         });
     };
     };
@@ -219,9 +222,9 @@ registerController("PineAPEnterpriseController", ['$api', '$scope', '$timeout',
         encryptionType: "wpa2+ccmp"
         encryptionType: "wpa2+ccmp"
     };
     };
     $scope.certificateSettings = {
     $scope.certificateSettings = {
-        state: "California",
-        country: "US",
-        locality: "San Francisco",
+        state: "San Martin",
+        country: "AR",
+        locality: "Buenos Aires",
         organization: "YOUR ORG",
         organization: "YOUR ORG",
         email: "bounce@example.com",
         email: "bounce@example.com",
         commonname: "YOUR CERTIFICATE AUTHORITY"
         commonname: "YOUR CERTIFICATE AUTHORITY"

+ 34 - 34
src/pineapple/modules/PineAP/module.html

@@ -6,34 +6,18 @@
                     Configuration
                     Configuration
                 </h3>
                 </h3>
             </div>
             </div>
-            <div class="panel-body" ng-hide="notifications.length">
-                <div class="input-group margin-bottom">
+            <div class="panel-body">
+                <div class="alert alert-info" ng-hide="loading || settings.pineAPDaemon">
+                    <strong>Notice:</strong> In order to use some of these features, PineAP must first be enabled.
+                </div>
+                <img src="img/throbber.gif" alt="throbber.gif" ng-show="loading">
+
+                <div class="input-group">
                     <div class="checkbox">
                     <div class="checkbox">
                         <label><input type="checkbox" value="" ng-model="settings.allowAssociations">
                         <label><input type="checkbox" value="" ng-model="settings.allowAssociations">
                             Allow Associations
                             Allow Associations
                         </label>
                         </label>
-                    </div>
-                </div>
-                <div class="input-group margin-bottom">
-                    <span class="input-group-addon">PineAP Daemon: {{ settings.pineAPDaemon ? "Start" : "Stop" }}</span>
-                    <span class="input-group-btn">
-                        <button ng-disabled="pineAPenabling" class="btn btn-default" type="button"
-                                ng-click="togglePineAP()">
-                            <span ng-hide="pineAPenabling">Switch</span>
-                            <img ng-show="pineAPenabling" src="img/throbber.gif">
-                        </button>
-                    </span>
-                </div>
-                <div class="input-group">
-                    <span class="input-group-addon">Autostart PineAP: {{ settings.autostartPineAP ? "Enabled" : "Disabled" }}</span>
-                    <span class="input-group-btn">
-                        <button ng-disabled="pineAPenabling" class="btn btn-default" type="button"
-                                ng-click="toggleAutoStart()">
-                            <span>Switch</span>
-                        </button>
-                    </span>
-                </div>
-                <div class="input-group">
+                    </div>                
                     <div class="checkbox">
                     <div class="checkbox">
                         <label><input type="checkbox" value="" ng-model="settings.logEvents">
                         <label><input type="checkbox" value="" ng-model="settings.logEvents">
                             Log PineAP Events
                             Log PineAP Events
@@ -65,6 +49,30 @@
                         </label>
                         </label>
                     </div>
                     </div>
                 </div>
                 </div>
+
+                <div class="input-group margin-bottom">
+                    <span class="input-group-addon" style="width: unset;">
+                        PineAP Daemon: {{ pineAPDaemonStatus }}
+                    </span>
+                    <span class="input-group-btn">
+                        <button ng-disabled="pineAPenabling" class="btn btn-default" type="button"
+                                ng-click="togglePineAP()">
+                            <span ng-hide="pineAPenabling">Switch</span>
+                            <img ng-show="pineAPenabling" src="img/throbber.gif">
+                        </button>
+                    </span>
+                </div>
+                <div class="input-group margin-bottom">
+                    <span class="input-group-addon" style="width: unset;">
+                        Autostart PineAP: {{ autostartPineAPStatus }}
+                    </span>
+                    <span class="input-group-btn">
+                        <button ng-disabled="pineAPenabling" class="btn btn-default" type="button"
+                                ng-click="toggleAutoStart()">
+                            <span>Switch</span>
+                        </button>
+                    </span>
+                </div>
                 <div class="input-group margin-bottom">
                 <div class="input-group margin-bottom">
                     <span class="input-group-addon">Beacon Response Interval</span>
                     <span class="input-group-addon">Beacon Response Interval</span>
                     <select class="form-control" ng-model="settings.responseInterval">
                     <select class="form-control" ng-model="settings.responseInterval">
@@ -99,20 +107,12 @@
                 </div>
                 </div>
                 <br/>
                 <br/>
                 <div class="input-group">
                 <div class="input-group">
-                    <button class="btn btn-default" ng-hide="disableButton" ng-click="updateSettings()">Save
-                        PineAP Settings
+                    <button class="btn btn-default" ng-hide="disableButton" ng-click="updateSettings()">
+                        Save PineAP Settings
                     </button>
                     </button>
                     <img src="img/throbber.gif" alt="throbber.gif" ng-show="disableButton">
                     <img src="img/throbber.gif" alt="throbber.gif" ng-show="disableButton">
                 </div>
                 </div>
             </div>
             </div>
-            <div class="panel-footer" ng-hide="settings.pineAPDaemon && !saveAlert">
-                <div class="alert alert-info" ng-hide="settings.pineAPDaemon">
-                    <strong>Notice:</strong> In order to use some of these features, PineAP must first be enabled.
-                </div>
-                <div class="alert alert-success" ng-show="saveAlert">
-                    Autostart Configuration Saved
-                </div>
-            </div>
         </div>
         </div>
     </div>
     </div>