sysview-py 0.2.1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sysview-py
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: Add your description here
5
5
  Author: Michael Wilson
6
6
  Author-email: Michael Wilson <mw@1wilson.org>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sysview-py"
3
- version = "0.2.1"
3
+ version = "0.3.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -20,7 +20,6 @@ def main():
20
20
  sysview.read_hosts()
21
21
  sysview.get_latest_reports()
22
22
  sysview.update_html()
23
- print("finished")
24
23
 
25
24
 
26
25
  if __name__ == "__main__":
@@ -14,6 +14,11 @@ class Host:
14
14
  self.name = name
15
15
  self.report_types = report_types
16
16
  self.reports = reports
17
+ self.url_path = f"hosts/{self.name}/host.html"
18
+
19
+ @property
20
+ def description(self):
21
+ return f"Last updated {self.last_updated}"
17
22
 
18
23
  @property
19
24
  def last_updated(self):
@@ -87,6 +92,18 @@ class ReportItem:
87
92
  def __repr__(self):
88
93
  return f"ReportItem(command={self.command}, status={self.status})"
89
94
 
95
+ @property
96
+ def description(self):
97
+ return f"{self.status_text}\nUpdated: {self.date}"
98
+
99
+ @property
100
+ def name(self):
101
+ return self.command
102
+
103
+ @property
104
+ def url_path(self):
105
+ return f"{self.report_type}_{self.id}.html"
106
+
90
107
  @property
91
108
  def status(self):
92
109
  age = datetime.now() - self.date
@@ -0,0 +1,67 @@
1
+ #OK {
2
+ background-color: #C1E1C1;
3
+ text-align: center;
4
+ color: black;
5
+ }
6
+
7
+ #WARNING {
8
+ background-color: #FAC898;
9
+ text-align: center;
10
+ color: black;
11
+ }
12
+
13
+ #CRITICAL {
14
+ background-color: #FAA0A0;
15
+ text-align: center;
16
+ color: black;
17
+ }
18
+
19
+ #UNKNOWN {
20
+ background-color: #A7C7E7;
21
+ text-align: center;
22
+ color: black;
23
+ }
24
+
25
+ .active {
26
+ background-color: dimgrey;
27
+ }
28
+
29
+ :root {
30
+ width: 100%;
31
+ color-scheme: dark;
32
+ --bg: #212121;
33
+ --accent-bg: #2b2b2b;
34
+ --text: #dcdcdc;
35
+ --text-light: #ababab;
36
+ --accent: #ffb300;
37
+ --accent-hover: #ffe099;
38
+ --accent-text: var(--bg);
39
+ --code: #f06292;
40
+ --preformatted: #ccc;
41
+ --disabled: #111;
42
+ }
43
+
44
+ .card-container {
45
+ display: flex;
46
+ flex-wrap: wrap;
47
+ gap: 1rem;
48
+ justify-content: center;
49
+ padding: 1rem;
50
+
51
+ }
52
+ .card {
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 1rem;
56
+ width: 300px;
57
+ border: 1px solid #ddd;
58
+ border-radius: 8px;
59
+ padding: 1rem;
60
+ }
61
+
62
+ @media (max-width: 768px) {
63
+ .card-container {
64
+ flex-direction: column;
65
+ align-items: center;
66
+ }
67
+ }
@@ -53,12 +53,12 @@ class Sysview:
53
53
  loader=PackageLoader("sysview_py"),
54
54
  autoescape=select_autoescape()
55
55
  )
56
- html = env.get_template("index.html").render(hosts=self.hosts, title="Hosts", active="Hosts", path="")
56
+ html = env.get_template("card_view.html").render(items=self.hosts, title="Hosts", active="Hosts", path="")
57
57
  html_path = self.html_root / "index.html"
58
58
  with open(html_path, 'w') as f:
59
59
  f.write(html)
60
60
  for host in self.hosts:
61
- html = env.get_template("host.html").render(host=host, title=host.name, active="Hosts", path="../../")
61
+ html = env.get_template("card_view.html").render(items=host.all_items, title=host.name, active="Hosts", path="../../")
62
62
  host_dir = self.html_hosts / host.name
63
63
  host_dir.mkdir()
64
64
  html_path = host_dir / "host.html"
@@ -72,7 +72,7 @@ class Sysview:
72
72
  f.write(html)
73
73
  with open(raw_path, 'w') as f:
74
74
  f.write(item.raw_item)
75
- html = env.get_template("services.html").render(services=self.all_services, title="Services", active="Services", path="")
75
+ html = env.get_template("card_view.html").render(items=self.all_services, title="Services", active="Services", path="")
76
76
  html_path = self.html_root / f"services.html"
77
77
  with open(html_path, 'w') as f:
78
78
  f.write(html)
@@ -0,0 +1,25 @@
1
+ <html>
2
+ {% include 'header.html' %}
3
+ {% if items[0].report_id is defined and active == 'Hosts' %}
4
+ <h2>{{ items[0].host }}</h2>
5
+ <p>Updated: {{ items[0].date }}</p>
6
+ {% endif %}
7
+ <section class="card-container">
8
+ {% for item in items %}
9
+ <article id="{{item.status }}" class="card">
10
+ {% if active == 'Hosts' %}
11
+ <a id="{{ item.status }}" href="{{ item.url_path }}">{{ item.name }}</a>
12
+ {% else %}
13
+ <a id="{{ item.status }}" href="hosts/{{ item.host }}/{{ item.url_path }}">{{ item.name }}</a>
14
+ {{ item.host }}
15
+ {% endif %}
16
+ {% if item.last_updated is defined %}
17
+ {{ item.last_updated }}
18
+ {% elif item.date is defined %}
19
+ {{ item.date }}
20
+ {% endif %}
21
+ </article>
22
+ {% endfor %}
23
+ </section>
24
+ {% include 'footer.html' %}
25
+ </html>
@@ -21,6 +21,5 @@
21
21
  <a href="{{ path }}services.html">Services</a>
22
22
  {% endif %}
23
23
  </nav>
24
- <h1>{{ title }}</h1>
25
24
  </header>
26
25
  <main>
@@ -14,7 +14,7 @@
14
14
  <td><a href="hosts/{{ item.host }}/{{ item.report_type}}_{{ item.id }}.html">{{ item.command }}</a></td>
15
15
  <td>{{ item.status_text }}</td>
16
16
  <td>{{ item.date }}</td>
17
- <td class="{{ item.status }}"></td>
17
+ <td id="{{ item.status }}"></td>
18
18
  </tr>
19
19
  {% endfor %}
20
20
  </table>
@@ -1,38 +0,0 @@
1
- .OK {
2
- color: black;
3
- background-color: green;
4
- }
5
-
6
- .WARNING {
7
- color: black;
8
- background-color: gold;
9
- }
10
-
11
- .CRITICAL {
12
- color: black;
13
- background-color: crimson;
14
- }
15
-
16
- .UNKNOWN {
17
- color: black;
18
- background-color: purple;
19
- }
20
-
21
- .active {
22
- background-color: dimgrey;
23
- }
24
-
25
- :root {
26
- width: 100%;
27
- color-scheme: dark;
28
- --bg: #212121;
29
- --accent-bg: #2b2b2b;
30
- --text: #dcdcdc;
31
- --text-light: #ababab;
32
- --accent: #ffb300;
33
- --accent-hover: #ffe099;
34
- --accent-text: var(--bg);
35
- --code: #f06292;
36
- --preformatted: #ccc;
37
- --disabled: #111;
38
- }
File without changes