JOE
2018-10-29 ea2e7e14933cfc6ef9934feef89cf2c4c5c40a98
commit | author | age
b09781 1 {{>layout/header-temp}}
J 2 <body>
3 <div class="content">
4     <h2>Module List&nbsp;</h2>
5     {{#modules}}
6     <h3 data-path="{{path}}" data-id="{{id}}">
7         {{name}} : <span id="{{id}}" class="test-result"></span>
8     </h3>
9     {{/modules}}
10 </div>
11 <script>
12     $(function(){
13         function getStatus(code) {
14             switch (code){
15                 case 401:
16                     code = '401 - UNAUTHORIZED.';
17                     break;
18                 case 403:
19                     code = '403 - Access Denied.';
20                     break;
21                 case 406:
22                     code = '403 - Access Denied.';
23                     break;
24                 default:
25                     code = '200 - SUCCESS.';
26                     break;
27             }
28             return code;
29         }
30
31         $.each($('h3'), function () {
32             const id = $(this).attr('data-id');
33             const path = $(this).attr('data-path');
34                 $.ajax({
35                     method: "GET",
3890d3 36                     url: "{{context}}"+path,
b09781 37                     data: {
J 38                         //for component api - /geo-location-circle
ea2e7e 39                         // zlevel: 8,
J 40                         // locids: "1,2",
41                         // bound: "1,2,3,4",
42                         // //for members api
43                         // memberId: "5b6974345389967bdf999a45"
b09781 44                     }
J 45                 })
46                 .done(function( data ) {
47                     if(-1 < path.search(/\/accounts|\/modules|\/roles|\/segments|\/customer-data/)){
48                         if((typeof data.resultCode == 'undefined') && -1 < String(data).indexOf('ERROR 403')){
49                             var tempData = {};
50                             tempData.resultCode = 403;
51                             data = tempData;
52                         }
53                     }
54
55                     var resultMessage = getStatus(data.resultCode);
56
57                     if(200 < data.resultCode){
58                         $('#'+id).addClass('error');
59                     }
60
61                     $('#'+id).text(resultMessage);
62                 })
63                 .fail(function(e) {
64                     $('#'+id).addClass('error');
65                     $('#'+id).text(e.status + " - " + e.message);
66                 });
67         });
68
69
70
71     });
72 </script>
73 {{>layout/footer}}