6 changed files with 228 additions and 0 deletions
-
BINWeb_Dashboard/__pycache__/app.cpython-39.pyc
-
46Web_Dashboard/app.py
-
7Web_Dashboard/static/bootstrap.min.css
-
1Web_Dashboard/static/bootstrap.min.css.map
-
122Web_Dashboard/static/styles.css
-
52Web_Dashboard/templates/index.html
Binary file not shown.
@ -0,0 +1,46 @@ |
|||||
|
import time |
||||
|
import csv |
||||
|
from flask import Flask, make_response, request, render_template, redirect, url_for, send_from_directory #Import flask web server and additional components |
||||
|
|
||||
|
app = Flask(__name__) |
||||
|
smartphone_file = "/home/ravi/Documents/Git/iFixit-Repairability-Dashboard/smartphone.csv" |
||||
|
tablet_file = "/home/ravi/Documents/Git/iFixit-Repairability-Dashboard/tablet.csv" |
||||
|
laptop_file = "/home/ravi/Documents/Git/iFixit-Repairability-Dashboard/laptop.csv" |
||||
|
|
||||
|
@app.route('/') |
||||
|
def index(): |
||||
|
smartphone = [] |
||||
|
tablet = [] |
||||
|
laptop = [] |
||||
|
with open(smartphone_file, 'r', newline='') as file: |
||||
|
bad_smartphone = [] |
||||
|
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." |
||||
|
bad_smartphone.append(message) |
||||
|
print(bad_smartphone) |
||||
|
with open(tablet_file, 'r', newline='') as file: |
||||
|
bad_tablet = [] |
||||
|
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." |
||||
|
bad_tablet.append(message) |
||||
|
print(bad_tablet) |
||||
|
with open(laptop_file, 'r', newline='') as file: |
||||
|
bad_laptop = [] |
||||
|
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." |
||||
|
bad_laptop.append(message) |
||||
|
print(bad_laptop) |
||||
|
|
||||
|
return render_template('index.html', smartphone=bad_smartphone, tablet=bad_tablet, laptop=bad_laptop) |
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
app.run(host='0.0.0.0', port=1235) #Run the webserver |
||||
7
Web_Dashboard/static/bootstrap.min.css
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
Web_Dashboard/static/bootstrap.min.css.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,122 @@ |
|||||
|
* {box-sizing: border-box;} |
||||
|
|
||||
|
body { |
||||
|
margin: 0; |
||||
|
background-color: #0d2f64; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
overflow: hidden; |
||||
|
background-color: #0d2f64; |
||||
|
color: white; |
||||
|
text-align: center; |
||||
|
padding: 20px 10px; |
||||
|
} |
||||
|
|
||||
|
li { |
||||
|
color: white; |
||||
|
font-size: 22.5px; |
||||
|
} |
||||
|
|
||||
|
h2 { |
||||
|
color: white; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
p { |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
a { |
||||
|
float: left; |
||||
|
color: white; |
||||
|
text-align: center; |
||||
|
padding: 12px; |
||||
|
text-decoration: none; |
||||
|
font-size: 18px; |
||||
|
line-height: 25px; |
||||
|
border-radius: 4px; |
||||
|
} |
||||
|
|
||||
|
a.none { |
||||
|
float: none; |
||||
|
color: dodgerblue; |
||||
|
text-align: inherit; |
||||
|
padding: 0px; |
||||
|
text-decoration: none; |
||||
|
font-size: 16px; |
||||
|
line-height: 24px; |
||||
|
border-radius: 0px; |
||||
|
} |
||||
|
|
||||
|
a.overridefloat { |
||||
|
float: none; |
||||
|
text-align: center; |
||||
|
padding: 12px; |
||||
|
text-decoration: none; |
||||
|
font-size: 18px; |
||||
|
line-height: 25px; |
||||
|
border-radius: 4px; |
||||
|
background-color: dodgerblue; |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
a.overridefloat:hover { |
||||
|
background-color: #45a3ff; |
||||
|
} |
||||
|
|
||||
|
a.text { |
||||
|
font-size: 25px; |
||||
|
font-weight: bold; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
a:hover { |
||||
|
color: #FFFF00; |
||||
|
} |
||||
|
|
||||
|
a.active { |
||||
|
background-color: dodgerblue; |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
.header-right { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
@media screen and (max-width: 500px) { |
||||
|
.header a { |
||||
|
float: none; |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
.header-right { |
||||
|
float: none; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.column { |
||||
|
float: left; |
||||
|
width: 33.33%; |
||||
|
width: calc(100% / 3); |
||||
|
padding: 10px; |
||||
|
height: calc(100vh - 149px) |
||||
|
} |
||||
|
|
||||
|
.row:after { |
||||
|
content: ""; |
||||
|
display: table; |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
.row { |
||||
|
margin-left: 0px; |
||||
|
margin-right: 0px; |
||||
|
} |
||||
|
|
||||
|
@media screen and (max-width: 1200px) { |
||||
|
.column { |
||||
|
width: 100%; |
||||
|
height: calc((100vh - 222px)*0.5) |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
<html> |
||||
|
<head> |
||||
|
<title>Worst Offenders</title> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
<link href="static/bootstrap.min.css" rel="stylesheet" media="screen"> |
||||
|
<link href="static/styles.css" rel="stylesheet" media="screen"> |
||||
|
<link rel="manifest" href="static/site.webmanifest"> |
||||
|
<link rel="apple-touch-icon" sizes="180x180" href="static/apple-touch-icon.png"> |
||||
|
<link rel="icon" type="image/png" sizes="32x32" href="static/favicon-32x32.png"> |
||||
|
<link rel="icon" type="image/png" sizes="16x16" href="static/favicon-16x16.png"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="header"> |
||||
|
<a href="https://github.com/Rav4s/iFixit-Repairability-Dashboard" class="text">iFixit Repairability Score Dashboard - Worst Offenders</a> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="column" style="background-color:#081c3d; overflow: auto;"> |
||||
|
<h2>Smartphones</h2> |
||||
|
<p> |
||||
|
<ul> |
||||
|
{% for each in smartphone %} |
||||
|
<li>{{ each }}</li> |
||||
|
{% endfor %} |
||||
|
</ul> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div class="column" style="background-color:#06152e; overflow: auto;"> |
||||
|
<h2>Tablets</h2> |
||||
|
<p> |
||||
|
<ul> |
||||
|
{% for each in tablet %} |
||||
|
<li>{{ each }}</li> |
||||
|
{% endfor %} |
||||
|
</ul> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div class="column" style="background-color:#040e1e; overflow: auto;"> |
||||
|
<h2>Laptops</h2> |
||||
|
<p> |
||||
|
<ul> |
||||
|
{% for each in laptop %} |
||||
|
<li>{{ each }}</li> |
||||
|
{% endfor %} |
||||
|
</ul> |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="header" style="padding: 10px 10px;"> |
||||
|
<p style="text-align:center;">Made with ❤️ by <a class="none" href="https://www.yeetpc.com/about.html" target="_blank" rel="noopener">Ravi Shah</a></p> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue