staticdash 0.1.4__tar.gz → 0.2.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.
- {staticdash-0.1.4 → staticdash-0.2.0}/PKG-INFO +1 -1
- {staticdash-0.1.4 → staticdash-0.2.0}/pyproject.toml +1 -1
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash/assets/css/style.css +62 -22
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash/dashboard.py +5 -23
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash.egg-info/PKG-INFO +1 -1
- {staticdash-0.1.4 → staticdash-0.2.0}/README.md +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/setup.cfg +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash/__init__.py +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash/assets/js/script.js +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash.egg-info/SOURCES.txt +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash.egg-info/dependency_links.txt +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash.egg-info/requires.txt +0 -0
- {staticdash-0.1.4 → staticdash-0.2.0}/staticdash.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "staticdash"
|
7
|
-
version = "0.
|
7
|
+
version = "0.2.0"
|
8
8
|
description = "A lightweight static HTML dashboard generator with Plotly and pandas support."
|
9
9
|
authors = [
|
10
10
|
{ name = "Brian Day", email = "brian.day1@gmail.com" }
|
@@ -12,9 +12,24 @@ body {
|
|
12
12
|
width: 240px;
|
13
13
|
height: 100vh;
|
14
14
|
background-color: #2c3e50;
|
15
|
-
padding: 20px;
|
15
|
+
padding: 20px 20px 60px 20px;
|
16
16
|
box-sizing: border-box;
|
17
17
|
overflow-y: auto;
|
18
|
+
scrollbar-width: thin;
|
19
|
+
scrollbar-color: #888 #2c3e50;
|
20
|
+
}
|
21
|
+
|
22
|
+
#sidebar::-webkit-scrollbar {
|
23
|
+
width: 6px;
|
24
|
+
}
|
25
|
+
|
26
|
+
#sidebar::-webkit-scrollbar-track {
|
27
|
+
background: #2c3e50;
|
28
|
+
}
|
29
|
+
|
30
|
+
#sidebar::-webkit-scrollbar-thumb {
|
31
|
+
background-color: #888;
|
32
|
+
border-radius: 3px;
|
18
33
|
}
|
19
34
|
|
20
35
|
#sidebar h1 {
|
@@ -29,12 +44,40 @@ body {
|
|
29
44
|
text-decoration: none;
|
30
45
|
margin: 10px 0;
|
31
46
|
font-weight: bold;
|
32
|
-
|
47
|
+
padding: 10px 15px;
|
48
|
+
border-radius: 10px;
|
49
|
+
transition: background-color 0.3s, color 0.3s;
|
33
50
|
}
|
34
51
|
|
35
|
-
.nav-link.active,
|
36
52
|
.nav-link:hover {
|
37
53
|
color: #ffffff;
|
54
|
+
background-color: #34495e;
|
55
|
+
}
|
56
|
+
|
57
|
+
.nav-link.active {
|
58
|
+
color: #ffffff;
|
59
|
+
background-color: #1abc9c;
|
60
|
+
}
|
61
|
+
|
62
|
+
#sidebar-footer {
|
63
|
+
position: fixed;
|
64
|
+
bottom: 20px;
|
65
|
+
left: 20px;
|
66
|
+
width: 200px;
|
67
|
+
font-size: 12px;
|
68
|
+
color: #7f8c8d;
|
69
|
+
text-align: center;
|
70
|
+
line-height: 1.4;
|
71
|
+
background-color: #2c3e50;
|
72
|
+
}
|
73
|
+
|
74
|
+
#sidebar-footer a {
|
75
|
+
color: #1abc9c;
|
76
|
+
text-decoration: none;
|
77
|
+
}
|
78
|
+
|
79
|
+
#sidebar-footer a:hover {
|
80
|
+
text-decoration: underline;
|
38
81
|
}
|
39
82
|
|
40
83
|
#content {
|
@@ -53,6 +96,12 @@ body {
|
|
53
96
|
|
54
97
|
.plot-container {
|
55
98
|
margin: 20px 0;
|
99
|
+
width: 100%;
|
100
|
+
}
|
101
|
+
|
102
|
+
.plot-container .plotly-graph-div {
|
103
|
+
width: 100% !important;
|
104
|
+
height: auto !important;
|
56
105
|
}
|
57
106
|
|
58
107
|
table {
|
@@ -89,26 +138,17 @@ tr:hover {
|
|
89
138
|
margin: 1em 0;
|
90
139
|
}
|
91
140
|
|
92
|
-
|
93
|
-
.plot-container {
|
94
|
-
width: 100%;
|
95
|
-
}
|
96
|
-
|
97
|
-
.plot-container .plotly-graph-div {
|
98
|
-
width: 100% !important;
|
99
|
-
height: auto !important;
|
100
|
-
}
|
101
|
-
|
102
141
|
.download-button {
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
142
|
+
display: inline-block;
|
143
|
+
padding: 0.5em 1em;
|
144
|
+
margin: 1em 0;
|
145
|
+
background-color: #2c3e50;
|
146
|
+
color: white;
|
147
|
+
text-decoration: none;
|
148
|
+
border-radius: 5px;
|
149
|
+
font-weight: bold;
|
111
150
|
}
|
151
|
+
|
112
152
|
.download-button:hover {
|
113
|
-
|
153
|
+
background-color: #547a9f;
|
114
154
|
}
|
@@ -3,10 +3,9 @@ import shutil
|
|
3
3
|
import uuid
|
4
4
|
import pandas as pd
|
5
5
|
import plotly.graph_objects as go
|
6
|
-
import plotly.express as px
|
7
6
|
from dominate import document
|
8
7
|
from dominate.tags import div, h1, h2, p, a, script, link, table, thead, tr, th, tbody, td, span
|
9
|
-
from dominate.util import raw as raw_util
|
8
|
+
from dominate.util import raw as raw_util
|
10
9
|
|
11
10
|
class Page:
|
12
11
|
def __init__(self, slug, title):
|
@@ -26,7 +25,7 @@ class Page:
|
|
26
25
|
table_id = f"table-{len(self.elements)}"
|
27
26
|
html = df.to_html(classes="table-hover table-striped", index=False, border=0, table_id=table_id)
|
28
27
|
self.elements.append(("table", (html, table_id)))
|
29
|
-
|
28
|
+
|
30
29
|
def add_download(self, file_path, label=None):
|
31
30
|
if not os.path.isfile(file_path):
|
32
31
|
raise FileNotFoundError(f"File not found: {file_path}")
|
@@ -70,13 +69,10 @@ class Dashboard:
|
|
70
69
|
assets_src = os.path.join(os.path.dirname(__file__), "assets")
|
71
70
|
assets_dst = os.path.join(output_dir, "assets")
|
72
71
|
|
73
|
-
# Ensure directories exist
|
74
72
|
os.makedirs(pages_dir, exist_ok=True)
|
75
73
|
os.makedirs(downloads_dir, exist_ok=True)
|
76
74
|
shutil.copytree(assets_src, assets_dst, dirs_exist_ok=True)
|
77
75
|
|
78
|
-
|
79
|
-
# Generate each page
|
80
76
|
for page in self.pages:
|
81
77
|
doc = document(title=page.title)
|
82
78
|
with doc.head:
|
@@ -98,7 +94,6 @@ class Dashboard:
|
|
98
94
|
with open(os.path.join(pages_dir, f"{page.slug}.html"), "w") as f:
|
99
95
|
f.write(str(doc))
|
100
96
|
|
101
|
-
# Generate index.html with navigation
|
102
97
|
index_doc = document(title=self.title)
|
103
98
|
with index_doc.head:
|
104
99
|
index_doc.head.add(link(rel="stylesheet", href="assets/css/style.css"))
|
@@ -109,6 +104,9 @@ class Dashboard:
|
|
109
104
|
h1(self.title)
|
110
105
|
for page in self.pages:
|
111
106
|
a(page.title, cls="nav-link", href="#", **{"data-target": f"page-{page.slug}"})
|
107
|
+
with div(id="sidebar-footer"):
|
108
|
+
a("Produced by staticdash", href="https://pypi.org/project/staticdash/", target="_blank")
|
109
|
+
|
112
110
|
with div(id="content"):
|
113
111
|
for page in self.pages:
|
114
112
|
with div(id=f"page-{page.slug}", cls="page-section", style="display:none;"):
|
@@ -121,34 +119,18 @@ class Dashboard:
|
|
121
119
|
elif kind == "table":
|
122
120
|
table_html, _ = content
|
123
121
|
div(raw_util(table_html))
|
124
|
-
# elif kind == "download":
|
125
|
-
# src_path, label = content
|
126
|
-
# file_uuid = f"{uuid.uuid4().hex}_{os.path.basename(src_path)}"
|
127
|
-
# dst_path = os.path.join(downloads_dir, file_uuid)
|
128
|
-
# shutil.copy2(src_path, dst_path)
|
129
|
-
# a(label or os.path.basename(src_path),
|
130
|
-
# href=f"{downloads_dir}/{file_uuid}",
|
131
|
-
# cls="download-button",
|
132
|
-
# download=True)
|
133
122
|
elif kind == "download":
|
134
123
|
src_path, label = content
|
135
124
|
file_uuid = f"{uuid.uuid4().hex}_{os.path.basename(src_path)}"
|
136
125
|
dst_path = os.path.join(downloads_dir, file_uuid)
|
137
126
|
shutil.copy2(src_path, dst_path)
|
138
|
-
|
139
|
-
# Use relative link from HTML to downloads/ folder
|
140
127
|
download_link = f"downloads/{file_uuid}"
|
141
|
-
|
142
|
-
# Create button and append it to the current div
|
143
128
|
btn = a(label or os.path.basename(src_path),
|
144
129
|
href=download_link,
|
145
130
|
cls="download-button",
|
146
131
|
download=True)
|
147
|
-
|
148
132
|
div(btn)
|
149
133
|
div(raw_util("<br>"))
|
150
134
|
|
151
|
-
|
152
|
-
|
153
135
|
with open(os.path.join(output_dir, "index.html"), "w") as f:
|
154
136
|
f.write(str(index_doc))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|