aboutsummaryrefslogtreecommitdiff
path: root/labbot/addons/dashboard/templates/sidebar.html
blob: f234f54897cf664dc18c2a0d71648a4368eb3902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
  <div class="position-sticky pt-3 sidebar-sticky">
    <ul class="nav flex-column">
      <li class="nav-item">
        <a class="nav-link" aria-current="page" href="/">
          <span data-feather="home" class="align-text-bottom"></span>
          Dashboard
        </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" aria-current="page" href="/log">
          <span data-feather="file-text" class="align-text-bottom"></span>
          Log
        </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" aria-current="page" href="/settings">
          <span data-feather="settings" class="align-text-bottom"></span>
          Bot Settings
        </a>
      </li>
    </ul>

    <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
      <span>Addon Settings</span>
    </h6>
    <ul class="nav flex-column mb-2">
      {% for addon in bot.addons %}
        <li class="nav-item">
          <a class="nav-link" href="/settings/{{ addon }}">
            <span data-feather="file-plus" class="align-text-bottom"></span>
            {{ addon }}
          </a>
        </li>
      {% endfor %}
    </ul>

    <div class="sidebar-bottom">
      <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
        <span>Health</span>
      </h6>
      <ul class="nav flex-column mb-2">
        <li class="nav-item">
          <a class="nav-link">
            <span data-feather="heart" class="align-text-bottom"></span>
            <span id="bot-health">Unknown</span>
          </a>
        </li>
      </ul>
    </div>
  </div>
</nav>

<script>
  function getHealth()
  {
    var href = window.location.href;
    var osi = -2;
    var nsi = -1;

    while (nsi > osi)
    {
      osi = nsi;
      nsi = href.indexOf("/", nsi+1);
    }
    href = href.slice(0, osi+1) + "health"
    
    var xhttp = new XMLHttpRequest();
    xhttp.onload = function() {
      document.getElementById("bot-health").innerHTML = this.responseText;
    }
    xhttp.open("GET", href, true);
    xhttp.send()
  }
  getHealth()
</script>