Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.        
  3.         var baseURL = "/gateway/apipublic";
  4.        
  5.         $(document).ready(function(){
  6.             setHeader("Logon to the monitor...");
  7.         });
  8.        
  9.        
  10.         function logoff() {
  11.                     var url = baseURL + "/logoff";
  12.             $.ajax(
  13.                     {
  14.                          async : true,
  15.                          type:'POST',
  16.                          contentType: 'application/json',
  17.                          url: url,
  18.                          data:$("#logonPassword").val(),
  19.                          dataType: 'json',
  20.                          
  21.                          success: function(data) {  
  22.                             console.log("logoff success");
  23.                             setHeaderSuccess(data.header);
  24.                             setAuthenticated(false);
  25.                             setAuthenticatedSupport(false);
  26.                             $("#configMenu").prop('disabled', true);
  27.                             $("#statisticsMenu").prop('disabled', true);
  28.                             $("#advancedMenu").prop('disabled', true);
  29.                             $("#report").prop('disabled', true);
  30.                             $("#commandcontrol").prop('disabled', true);
  31.                             $("#waveformdisplay").prop('disabled', true);
  32.  
  33.                             $("#logbrowser").hide();
  34.                             $("#logbrowser").prop('disabled', true);
  35.                          },
  36.                        
  37.                          error: function(data) {  
  38.                              console.log("logon error");
  39.                              alert("Error, "+data.response);
  40.                          }
  41.                      }
  42.                  );
  43.        
  44.         }
  45.        
  46.         function logon() {
  47.        
  48.             var url = baseURL + "/logon";
  49.             $.ajax(
  50.                     {
  51.                          async : true,
  52.                          type:'POST',
  53.                          contentType: 'application/json',
  54.                          url: url,
  55.                          data: $("#logonPassword").val(),
  56.                          dataType: 'json',
  57.                          
  58.                          success: function(data) {  
  59.                             console.log("logon success");
  60.                            
  61.                             if (data.error) {
  62.                                 setAuthenticated(false);
  63.                                 setAuthenticatedSupport(false);
  64.                                 setHeaderError(data.error);
  65.                                 $("#configMenu").prop('disabled', true);
  66.                                 $("#statisticsMenu").prop('disabled', true);
  67.                                 $("#advancedMenu").prop('disabled', true);
  68.                                 $("#report").prop('disabled', true);
  69.                                 $("#commandcontrol").prop('disabled', true);
  70.                                 $("#waveformdisplay").prop('disabled', true);
  71.                                
  72.                                 $("#logbrowser").hide();
  73.                                 $("#logbrowser").prop('disabled', true);
  74.                             }
  75.                             else {
  76.                                 setAuthenticated(true);
  77.                                 setHeaderSuccess(data.header);
  78.                                 $("#configMenu").prop('disabled', false);
  79.                                 $("#statisticsMenu").prop('disabled', false);
  80.                                 $("#advancedMenu").prop('disabled', false);
  81.                                 $("#report").prop('disabled', false);
  82.                                 $("#commandcontrol").prop('disabled', false);
  83.                                 $("#waveformdisplay").prop('disabled', false);
  84.  
  85.                                 if (data.authenticatedSupport) {
  86.                                     setAuthenticatedSupport(true);
  87.                                     $("#logbrowser").show();
  88.                                     $("#logbrowser").prop('disabled', false);
  89.                                 }
  90.                                 else {
  91.                                     setAuthenticatedSupport(false);
  92.                                     $("#logbrowser").hide();
  93.                                     $("#logbrowser").prop('disabled', true);
  94.                                 }
  95.  
  96.                             }
  97.                            
  98.                          },
  99.                        
  100.                          error: function(data) {  
  101.                              console.log("logon error");
  102.                              alert("Error, "+data.response);
  103.                          }
  104.                      }
  105.                  );
  106.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement