PluginProbe
WebTotem Security / 3.0.0
WebTotem Security v3.0.0
3.0.2 3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 All 110 releases
wt-security / includes / templates / monitoring.html.twig

monitoring.html.twig in WebTotem Security 3.0.0, at includes/templates/monitoring.html.twig

205 lines 7.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <script type="text/javascript">
2
3 jQuery(document).ready(function ($) {
4
5
6 let ws;
7 let pingInterval;
8 const HOST_ID = {{ host_id }};
9
10 function sendPing(service) {
11 if (ws && ws.readyState === WebSocket.OPEN) {
12 const payload = {
13 type: "force_check_progress",
14 data: {
15 host_id: HOST_ID,
16 module: service
17 }
18 };
19
20 ws.send(JSON.stringify(payload));
21 }
22 }
23
24 function connect(service) {
25 console.log('start');
26 ws = new WebSocket("{{ ws_url }}?token={{ access_token }}");
27
28 ws.onopen = function() {
29 sendPing(service);
30 pingInterval = setInterval(sendPing, 5000, service);
31 };
32
33 ws.onmessage = function(e) {
34
35 try {
36 const data = JSON.parse(e.data);
37
38 if (data.type === "error") {
39 ws.close(1000, "Closed by server status");
40 console.log(data.data);
41 }
42 if (data.data.status === "finished") {
43 ws.close(1000, "Process finished");
44 console.log('Process finished');
45
46 jQuery('#module-rescan').removeClass('wtotem_rotation').removeAttr('disabled');
47
48 jQuery.post(ajaxurl, {
49 action: 'wtotem_ajax',
50 ajax_action: 'get_module_data',
51 wtotem_page_nonce: '{{ page_nonce }}',
52 service: service,
53 }, function (response) {
54 var data = JSON.parse(response);
55 jQuery('#wtotem_notifications').html(data.notifications);
56 jQuery('#tabs-content-' + service).html(data.content);
57 });
58 }
59
60 } catch(err) {
61 console.log("Error: " + err);
62 jQuery('#module-rescan').removeClass('wtotem_rotation').removeAttr('disabled');
63 }
64 };
65
66 ws.onclose = function(e) {
67 clearInterval(pingInterval);
68 };
69
70 ws.onerror = function(err) {
71 console.log("Error: " + err);
72 };
73 }
74
75 jQuery('.wtotem_body').on('click', '#module-rescan', function (e) {
76 let start_scan_btn = jQuery(this);
77
78 start_scan_btn.addClass('wtotem_rotation');
79 start_scan_btn.attr('disabled', 'disabled');
80 let service = start_scan_btn.attr('data-value');
81
82 setTimeout(connect, 2000, service);
83
84 jQuery.post(ajaxurl, {
85 action: 'wtotem_ajax',
86 ajax_action: 'force_check',
87 wtotem_page_nonce: '{{ page_nonce }}',
88 service: service,
89 }, function (response) {
90 var data = JSON.parse(response);
91 // jQuery('#wtotem_notifications').html(data.notifications);
92
93 });
94
95 });
96
97
98 jQuery('.wtotem_body').on('click', '.force_check', function (event) {
99
100 event.preventDefault();
101 let service = jQuery(this).data('service'),
102 btn = jQuery(this);
103
104 btn.find('img').addClass('wtotem_unit__img_spinner');
105
106 jQuery.post(ajaxurl, {
107 action: 'wtotem_ajax',
108 ajax_action: 'force_check',
109 wtotem_page_nonce: '{{ page_nonce }}',
110 service: service,
111
112 }, function (data) {
113
114 btn.find('img').removeClass('wtotem_unit__img_spinner');
115 if(service === 'ssl'){
116 jQuery('#ssl_data_wrap').html(data.content);
117 } else if(service === 'dec'){
118 jQuery('#domain_data_wrap').html(data.content);
119 } else if(service === 'rc'){
120 jQuery('#reputation_data_wrap').html(data.content);
121 }
122
123 });
124 });
125
126 });
127
128
129 </script>
130 <div class="wtotem_monitoring" id="monitoring">
131 <div class="wtotem_table wt_card">
132 <div class="wtotem_table__row">
133 <div class="wtotem_table__col" {% if domain_module == false %}style="width: 50%"{% endif %}>
134 <div class="wtotem_table__th">
135 <h3 class="h3 wtotem_table__title wtotem_title-info__title">
136 SSL
137 <span class="wtotem_title-info__info wtotem-tooltip wtotem-tooltip-top" data-service="SSL module">
138 <span class="wtotem-tooltip__content">
139 <span class="wtotem-tooltip__header">{{ 'SSL module'|trans }}</span>
140 <span class="wtotem-tooltip__text">{{ 'Displays the status of the SSL Certificate.'|trans }}</span>
141 </span>
142 </span>
143 </h3>
144 <button class="open-path__force-check-btn force_check" data-service="ssl" title="{{ 'ForceCheck'|trans }}">
145 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon">
146 </button>
147 </div>
148
149 <div id="ssl_data_wrap">
150 {% include 'monitoring_ssl.html.twig' with {'ssl': ssl } %}
151 </div>
152
153 </div>
154
155 {% if domain_module != false %}
156 <div class="wtotem_table__col">
157 <div class="wtotem_table__th">
158 <h3 class="h3 wtotem_table__title wtotem_title-info__title">
159 {{ 'Availability'|trans }}
160 </h3>
161
162 <button class="open-path__force-check-btn force_check" data-service="availability" title="{{ 'ForceCheck'|trans }}">
163 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon">
164 </button>
165 </div>
166
167 <div id="domain_data_wrap">
168 {% include 'monitoring_domain.html.twig' with {'domain': domain_module, 'availability': availability } %}
169 </div>
170
171 </div>
172 {% endif %}
173
174 <div class="wtotem_table__col" {% if domain_module == false %}style="width: 50%"{% endif %}>
175 <div class="wtotem_table__th">
176 <h3 class="h3 wtotem_table__title wtotem_title-info__title">{{ 'Reputation'|trans }}
177 <div class="h3 wtotem_title-info__info wtotem-tooltip wtotem-tooltip-top" data-service="Reputation module">
178 <div class="wtotem-tooltip__content">
179 <p class="wtotem-tooltip__header">{{ 'Reputation module'|trans }}</p>
180 <p class="wtotem-tooltip__text">{{ 'Checks website entries in 60+ blacklisting authorities.'|trans }}</p>
181 </div>
182 </div>
183 </h3>
184
185 <button class="open-path__force-check-btn force_check" data-service="rc" title="{{ 'ForceCheck'|trans }}">
186 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon">
187 </button>
188 </div>
189
190 <div id="reputation_data_wrap">
191 {% include 'monitoring_reputation.html.twig' with {'reputation': reputation } %}
192 </div>
193
194 </div>
195 </div>
196 <div class="wtotem_table__footer">
197 <a target="_blank" href="https://wtotem.com/faq/#hs-chat-open" class="wtotem_table__link open_support_dialog" data-service="Monitoring">
198 <div class="wtotem_table__perfomance">
199 <span>{{ 'Need more support?'|trans }} {{ 'Let\'s talk!'|trans }}</span>
200 </div>
201 </a>
202 </div>
203 </div>
204 </div>
205