staticdash 0.1.3__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.3 → staticdash-0.2.0}/PKG-INFO +8 -1
- {staticdash-0.1.3 → staticdash-0.2.0}/README.md +7 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/pyproject.toml +1 -1
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash/assets/css/style.css +63 -9
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash/dashboard.py +12 -12
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash.egg-info/PKG-INFO +8 -1
- {staticdash-0.1.3 → staticdash-0.2.0}/setup.cfg +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash/__init__.py +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash/assets/js/script.js +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash.egg-info/SOURCES.txt +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash.egg-info/dependency_links.txt +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash.egg-info/requires.txt +0 -0
- {staticdash-0.1.3 → staticdash-0.2.0}/staticdash.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: staticdash
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
|
5
5
|
Author-email: Brian Day <brian.day1@gmail.com>
|
6
6
|
License: CC0-1.0
|
@@ -70,10 +70,17 @@ page3 = Page("summary", "Summary")
|
|
70
70
|
page3.add("Summary and notes can be added here.")
|
71
71
|
page3.add("StaticDash is a lightweight static dashboard generator.")
|
72
72
|
|
73
|
+
# Page 4: Download
|
74
|
+
page4 = Page("download", "Download")
|
75
|
+
page4.add("Here is a button to download a file.")
|
76
|
+
page4.add_download('./test_file.txt', "Download File")
|
77
|
+
page4.add_download('./test_file2.txt', "Download Another File")
|
78
|
+
|
73
79
|
# Register pages
|
74
80
|
dashboard.add_page(page1)
|
75
81
|
dashboard.add_page(page2)
|
76
82
|
dashboard.add_page(page3)
|
83
|
+
dashboard.add_page(page4)
|
77
84
|
|
78
85
|
# Export
|
79
86
|
dashboard.publish(output_dir="output")
|
@@ -56,10 +56,17 @@ page3 = Page("summary", "Summary")
|
|
56
56
|
page3.add("Summary and notes can be added here.")
|
57
57
|
page3.add("StaticDash is a lightweight static dashboard generator.")
|
58
58
|
|
59
|
+
# Page 4: Download
|
60
|
+
page4 = Page("download", "Download")
|
61
|
+
page4.add("Here is a button to download a file.")
|
62
|
+
page4.add_download('./test_file.txt', "Download File")
|
63
|
+
page4.add_download('./test_file2.txt', "Download Another File")
|
64
|
+
|
59
65
|
# Register pages
|
60
66
|
dashboard.add_page(page1)
|
61
67
|
dashboard.add_page(page2)
|
62
68
|
dashboard.add_page(page3)
|
69
|
+
dashboard.add_page(page4)
|
63
70
|
|
64
71
|
# Export
|
65
72
|
dashboard.publish(output_dir="output")
|
@@ -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,12 +138,17 @@ tr:hover {
|
|
89
138
|
margin: 1em 0;
|
90
139
|
}
|
91
140
|
|
92
|
-
|
93
|
-
|
94
|
-
|
141
|
+
.download-button {
|
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;
|
95
150
|
}
|
96
151
|
|
97
|
-
.
|
98
|
-
|
99
|
-
height: auto !important;
|
152
|
+
.download-button:hover {
|
153
|
+
background-color: #547a9f;
|
100
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;"):
|
@@ -126,11 +124,13 @@ class Dashboard:
|
|
126
124
|
file_uuid = f"{uuid.uuid4().hex}_{os.path.basename(src_path)}"
|
127
125
|
dst_path = os.path.join(downloads_dir, file_uuid)
|
128
126
|
shutil.copy2(src_path, dst_path)
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
127
|
+
download_link = f"downloads/{file_uuid}"
|
128
|
+
btn = a(label or os.path.basename(src_path),
|
129
|
+
href=download_link,
|
130
|
+
cls="download-button",
|
131
|
+
download=True)
|
132
|
+
div(btn)
|
133
|
+
div(raw_util("<br>"))
|
134
134
|
|
135
135
|
with open(os.path.join(output_dir, "index.html"), "w") as f:
|
136
136
|
f.write(str(index_doc))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: staticdash
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
|
5
5
|
Author-email: Brian Day <brian.day1@gmail.com>
|
6
6
|
License: CC0-1.0
|
@@ -70,10 +70,17 @@ page3 = Page("summary", "Summary")
|
|
70
70
|
page3.add("Summary and notes can be added here.")
|
71
71
|
page3.add("StaticDash is a lightweight static dashboard generator.")
|
72
72
|
|
73
|
+
# Page 4: Download
|
74
|
+
page4 = Page("download", "Download")
|
75
|
+
page4.add("Here is a button to download a file.")
|
76
|
+
page4.add_download('./test_file.txt', "Download File")
|
77
|
+
page4.add_download('./test_file2.txt', "Download Another File")
|
78
|
+
|
73
79
|
# Register pages
|
74
80
|
dashboard.add_page(page1)
|
75
81
|
dashboard.add_page(page2)
|
76
82
|
dashboard.add_page(page3)
|
83
|
+
dashboard.add_page(page4)
|
77
84
|
|
78
85
|
# Export
|
79
86
|
dashboard.publish(output_dir="output")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|