Skip to content

Commit 2497e8b

Browse files
Update setup.sh and api.py, and style.css and frequency.html and graphs.html
1 parent 7e4329e commit 2497e8b

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ color_white="\033[1;37m" # White
2424
color_prompt="\033[1;36m" # Cyan for the prompt
2525
color_option="\033[37m" # Blue for options
2626

27+
# function to get the user name
2728
get_user_name() {
2829
if [ "$(whoami)" = "root" ]; then
2930
LOGNAME_USER=$(logname 2>/dev/null) # Redirect any error output to /dev/null
3031
if [ $? -ne 0 ]; then # Check if the exit status of the last command is not 0
31-
echo "No login name found. Using fallback method."
32-
# use head -n 1 for native linux. tail -n 1 works with wsl.
3332
USER_NAME=$(cat /etc/passwd | grep '/home' | cut -d: -f1 | tail -n 1)
3433
else
3534
USER_NAME=$LOGNAME_USER
@@ -39,6 +38,7 @@ get_user_name() {
3938
fi
4039
echo "$USER_NAME"
4140
}
41+
4242
USER_NAME=$(get_user_name)
4343
USER_HOME=/home/$USER_NAME
4444

src/routes/api.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ def graph_data_api():
3939
'2 days': timedelta(days=2),
4040
'3 days': timedelta(days=3),
4141
'1 week': timedelta(weeks=1),
42-
'1 month': timedelta(weeks=4)
42+
'1 month': timedelta(weeks=4),
43+
'3 months': timedelta(weeks=12),
44+
4345
}
44-
start_time = now - time_deltas.get(time_filter, timedelta(days=1))
46+
if time_filter == 'all':
47+
start_time = datetime.min
48+
else:
49+
start_time = now - time_deltas.get(time_filter, timedelta(days=1))
4550

4651
# Fetch entries within the time range
4752
query = SystemInformation.query.filter(SystemInformation.timestamp >= start_time)

src/static/css/style.css

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ body {
135135

136136
/* General Card Styles */
137137
.card {
138-
min-height: 140px;
138+
min-height: 160px;
139139
/* background: linear-gradient(120deg, #e3f2fd, #bbdefb); */
140140
/* background: linear-gradient(135deg, #f5f7fa, #c3cfe2); */
141141
background: linear-gradient(200deg, #f5f7fa, #c3cfe2);
@@ -204,15 +204,11 @@ body {
204204
overflow: hidden;
205205
}
206206

207-
.temp-bar, .disk-bar, .frequency-bar, .cpu-usage-bar, .memory-usage-bar {
208-
height: 25px;
207+
.temp-bar, .disk-bar, .frequency-bar, .cpu-usage-bar, .memory-usage-bar, .battery-bar {
208+
height: 20px;
209209
transition: width 0.3s ease;
210210
}
211211

212-
.battery-bar {
213-
height: 25px;
214-
transition: width 0.3s ease;
215-
}
216212

217213
.cpu-core-visualization {
218214
display: flex;

src/templates/card_comp/cpu/frequency.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h5 class="card-title mb-3">CPU Frequency <i class="fas fa-microchip"></i></h5>
77
{{ system_info['cpu_frequency'] }} MHz
88
</p>
99
<div class="frequency-indicator mt-3">
10-
<div class="frequency-bar" style="width: {{ 100* system_info['cpu_frequency']/system_info['cpu_max_frequency'] }}%;"></div>
10+
<div class="frequency-bar" style="width: {{ 100 * system_info['cpu_frequency'] / (system_info['cpu_max_frequency'] if system_info['cpu_max_frequency'] != 0 else 1) }}%;"></div>
1111
</div>
1212
</div>
1313
</div>

src/templates/graphs/graphs.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ <h2><i class="fas fa-clock"></i> Current Server Time & Time Zone</h2>
3737
<option value="3 days">Last 3 Days</option>
3838
<option value="1 week">Last 1 Week</option>
3939
<option value="1 month">Last 1 Month</option>
40+
<option value="3 months">Last 3 Months</option>
41+
<option value="all">All Time</option>
4042
</select>
4143
</div>
4244
</div>

0 commit comments

Comments
 (0)