1+ <h2>Proxies</h2>
2+ <table class="table-hover">
3+ <thead>
4+ <tr>
5+ <td><h3>Application</h3></td>
6+ <td><h3>Available</h3></td>
7+ <td><h3>Proxied</h3></td>
8+ <td><h3>Auth</h3></td>
9+ <td><h3>Location</h3></td>
10+ </tr>
11+ </thead>
12+ <tbody class="tbody-data">
13+ <?php
14+ $ output = shell_exec ("if test -f /lsiopy/bin/python3; then /lsiopy/bin/python3 /dashboard/swag-proxies.py; else python3 /dashboard/swag-proxies.py; fi " );
15+ $ results = json_decode ($ output );
16+ $ status = "" ;
17+ $ index = 0 ;
18+ foreach ($ results as $ result => $ data ){
19+ $ tr_class = ($ index % 2 == 0 ) ? 'shaded ' : '' ;
20+ $ status .= '<tr class=" ' .$ tr_class .'"><td class="left-text"><span class="status-text"> ' .$ result .'</span></td><td class="align-td"> ' ;
21+ if ($ data ->status == 1 ) {
22+ $ status .= '<i class="fas fa-check-circle"></i> ' ;
23+ } else {
24+ $ status .= '<i class="fas fa-exclamation-circle" title="The SWAG container can \'t reach ' .$ result .'"></i> ' ;
25+ }
26+ $ status .= '</td><td> ' ;
27+ if (!empty ($ data ->locations )) {
28+ $ locations = $ data ->locations ;
29+ $ location = implode (", " , $ locations );
30+ $ status .= '<i class="fas fa-check-circle"></i></td><td class="align-td"> ' ;
31+ $ auths = implode (PHP_EOL , $ data ->auths );
32+ if ($ data ->auth_status == 1 ) {
33+ $ status .= '<i class="fas fa-lock" title=" ' .$ auths .'"></i> ' ;
34+ } else {
35+ $ status .= '<i class="fas fa-lock-open" title=" ' .$ auths .'"></i> ' ;
36+ }
37+ $ status .= '</td><td class="left-text"><span class="status-text"> ' .$ location .'</span></td> ' ;
38+ } else {
39+ $ error = 'Unable to locate the proxy config for ' .$ result .', it must use the following structure: ' .PHP_EOL ;
40+ $ error .= '	set $upstream_app <container/address>; ' .PHP_EOL ;
41+ $ error .= '	set $upstream_port <port>; ' .PHP_EOL ;
42+ $ error .= '	set $upstream_proto <protocol>; ' .PHP_EOL ;
43+ $ error .= '	proxy_pass $upstream_proto://$upstream_app:$upstream_port; ' .PHP_EOL ;
44+ $ status .= '<i class="fas fa-exclamation-circle" title=" ' .$ error .'"></i></td><td></td><td></td> ' ;
45+ }
46+ $ status .= '</tr> ' ;
47+ $ index ++;
48+ }
49+ echo $ status ;
50+ ?>
51+ </tbody>
52+ </table>
53+ <br/>
0 commit comments