Browse Source

Changed formatting for dashboard

pull/1/head
Ravi Shah 5 years ago
parent
commit
5a199633d7
  1. 39
      Web_Dashboard/app.py
  2. 38
      Web_Dashboard/static/styles.css
  3. 89
      Web_Dashboard/templates/index.html

39
Web_Dashboard/app.py

@ -14,33 +14,54 @@ def index():
laptop = []
with open(smartphone_file, 'r', newline='') as file:
bad_smartphone = []
bad_smartphone_2 = []
bad_smartphone_3 = []
reader = csv.reader(file)
for row in reader:
smartphone.append(row)
if row[2] == '1':
message = "The " + row[0] + " " + row[1] + " is a very unrepairable device with a Repairability Score of only 1/10."
message = row[0] + " " + row[1]
bad_smartphone.append(message)
print(bad_smartphone)
if row[2] == '2':
message = row[0] + " " + row[1]
bad_smartphone_2.append(message)
if row[2] == '3':
message = row[0] + " " + row[1]
bad_smartphone_3.append(message)
with open(tablet_file, 'r', newline='') as file:
bad_tablet = []
bad_tablet_2 = []
bad_tablet_3 = []
reader = csv.reader(file)
for row in reader:
tablet.append(row)
if row[2] == '1':
message = "The " + row[0] + " " + row[1] + " is a very unrepairable device with a Repairability Score of only 1/10."
message = row[0] + " " + row[1]
bad_tablet.append(message)
print(bad_tablet)
if row[2] == '2':
message = row[0] + " " + row[1]
bad_tablet_2.append(message)
if row[2] == '3':
message = row[0] + " " + row[1]
bad_tablet_3.append(message)
with open(laptop_file, 'r', newline='') as file:
bad_laptop = []
bad_laptop_2 = []
bad_laptop_3 = []
reader = csv.reader(file)
for row in reader:
laptop.append(row)
if row[2] == '1':
message = "The " + row[0] + " " + row[1] + " is a very unrepairable device with a Repairability Score of only 1/10."
message = row[0] + " " + row[1]
bad_laptop.append(message)
print(bad_laptop)
return render_template('index.html', smartphone=bad_smartphone, tablet=bad_tablet, laptop=bad_laptop)
if row[2] == '2':
message = row[0] + " " + row[1]
bad_laptop_2.append(message)
if row[2] == '3':
message = row[0] + " " + row[1]
bad_laptop_3.append(message)
return render_template('index.html', smartphone=bad_smartphone, tablet=bad_tablet, laptop=bad_laptop,smartphone_3=bad_smartphone_3, tablet_3=bad_tablet_3, laptop_3=bad_laptop_3, smartphone_2=bad_smartphone_2, tablet_2=bad_tablet_2, laptop_2=bad_laptop_2)
2
if __name__ == '__main__':
app.run(host='0.0.0.0', port=1235) #Run the webserver
app.run(host='0.0.0.0', port=1235) #Run the webserver2

38
Web_Dashboard/static/styles.css

@ -1,8 +1,23 @@
body::-webkit-scrollbar {
width: 12px; /* width of the entire scrollbar */
}
body::-webkit-scrollbar-track {
background: #0d2f64; /* color of the tracking area */
}
body::-webkit-scrollbar-thumb {
background-color: blue; /* color of the scroll thumb */
border-radius: 20px; /* roundness of the scroll thumb */
border: 3px solid #040e1e; /* creates padding around scroll thumb */
}
* {box-sizing: border-box;}
body {
margin: 0;
background-color: #0d2f64;
scrollbar-width: thin;
}
.header {
@ -13,14 +28,21 @@ body {
padding: 20px 10px;
}
li {
.list {
color: white;
font-size: 22.5px;
text-align: center;
}
h2 {
color: white;
text-align: center;
font-size: 32.5px;
}
h3 {
color: white;
text-align: center;
}
p {
@ -120,3 +142,17 @@ a.active {
height: calc((100vh - 222px)*0.5)
}
}
.column::-webkit-scrollbar {
width: 12px; /* width of the entire scrollbar */
}
.column::-webkit-scrollbar-track {
background: #0d2f64; /* color of the tracking area */
}
.column::-webkit-scrollbar-thumb {
background-color: blue; /* color of the scroll thumb */
border-radius: 20px; /* roundness of the scroll thumb */
border: 3px solid #040e1e; /* creates padding around scroll thumb */
}

89
Web_Dashboard/templates/index.html

@ -11,38 +11,89 @@
</head>
<body>
<div class="header">
<a href="https://github.com/Rav4s/iFixit-Repairability-Dashboard" class="text">iFixit Repairability Score Dashboard - Worst Offenders</a>
<a href="https://github.com/Rav4s/iFixit-Repairability-Dashboard" class="text">Worst Offenders</a>
</div>
<div class="row">
<div class="column" style="background-color:#081c3d; overflow: auto;">
<div class="column" style="background-color:#081c3d; overflow: auto; scrollbar-width: thin;">
<h2>Smartphones</h2>
<p>
<ul>
<h3 style="color: #FF4136;">1/10</h3>
<div class="list">
<p>
{% for each in smartphone %}
<li>{{ each }}</li>
<p>{{ each }}</p>
{% endfor %}
</ul>
</p>
</p>
</div>
<h3 style="color: #FF8024;">2/10</h3>
<div class="list">
<p>
{% for each in smartphone_2 %}
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
<h3 style="color: #FFC012;">3/10</h3>
<div class="list">
<p>
{% for each in smartphone_3 %}
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
</div>
<div class="column" style="background-color:#06152e; overflow: auto;">
<div class="column" style="background-color:#06152e; overflow: auto; scrollbar-width: thin;">
<h2>Tablets</h2>
<p>
<ul>
<h3 style="color: #FF4136;">1/10</h3>
<div class="list">
<p>
{% for each in tablet %}
<li>{{ each }}</li>
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
<h3 style="color: #FF8024;">2/10</h3>
<div class="list">
<p>
{% for each in tablet_2 %}
<p>{{ each }}</p>
{% endfor %}
</ul>
</p>
</p>
</div>
<h3 style="color: #FFC012;">3/10</h3>
<div class="list">
<p>
{% for each in tablet_3 %}
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
</div>
<div class="column" style="background-color:#040e1e; overflow: auto;">
<div class="column" style="background-color:#040e1e; overflow: auto; scrollbar-width: thin;">
<h2>Laptops</h2>
<p>
<ul>
<h3 style="color: #FF4136;">1/10</h3>
<div class="list">
<p>
{% for each in laptop %}
<li>{{ each }}</li>
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
<h3 style="color: #FF8024;">2/10</h3>
<div class="list">
<p>
{% for each in laptop_2 %}
<p>{{ each }}</p>
{% endfor %}
</p>
</div>
<h3 style="color: #FFC012;">3/10</h3>
<div class="list">
<p>
{% for each in laptop_3 %}
<p>{{ each }}</p>
{% endfor %}
</ul>
</p>
</p>
</div>
</div>
</div>
<div class="header" style="padding: 10px 10px;">

Loading…
Cancel
Save