-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: process page improved and load testing scritp added
- Loading branch information
1 parent
eb693e6
commit e742c57
Showing
11 changed files
with
162 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from locust import HttpUser, TaskSet, task, between | ||
from locust.exception import StopUser | ||
|
||
class UserBehavior(TaskSet): | ||
|
||
def on_start(self): | ||
""" Called when a Locust user starts running """ | ||
self.login() | ||
|
||
def login(self): | ||
""" Simulate a user logging in """ | ||
response = self.client.post("/login", { | ||
"username": "admin", | ||
"password": "adminpassword" | ||
}) | ||
if response.status_code == 200 and "Invalid username or password" not in response.text: | ||
print("Login successful") | ||
else: | ||
print("Login failed") | ||
raise StopUser("Login failed") | ||
|
||
@task(1) | ||
def view_dashboard(self): | ||
""" Simulate viewing the dashboard """ | ||
self.client.get("/") | ||
|
||
@task(2) | ||
def view_cpu_usage(self): | ||
""" Simulate viewing CPU usage """ | ||
self.client.get("/cpu_usage") | ||
|
||
@task(1) | ||
def view_disk_usage(self): | ||
""" Simulate viewing disk usage """ | ||
self.client.get("/disk_usage") | ||
|
||
@task(1) | ||
def view_memory_usage(self): | ||
""" Simulate viewing memory usage """ | ||
self.client.get("/memory_usage") | ||
|
||
class WebsiteUser(HttpUser): | ||
tasks = [UserBehavior] | ||
wait_time = between(1, 5) # Time to wait between tasks | ||
|
||
if __name__ == "__main__": | ||
import os | ||
os.system("locust -f locustfile.py --host=http://localhost:5000") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,105 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
font-family: 'Roboto', sans-serif; /* Use a modern font */ | ||
background-color: #f8f9fa; /* Light gray background for contrast */ | ||
margin: 0; | ||
padding: 0; | ||
color: #212529; /* Dark gray text for readability */ | ||
} | ||
|
||
.container { | ||
width: 80%; | ||
margin: 20px auto; | ||
padding: 20px; | ||
background-color: white; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
max-width: 1200px; /* Limit the maximum width */ | ||
margin: 40px auto; /* Increased margin for spacing */ | ||
padding: 30px; /* More padding for content */ | ||
background-color: #ffffff; /* White background for content */ | ||
border-radius: 10px; /* Slightly rounded corners */ | ||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */ | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
color: #343a40; /* Darker shade for the heading */ | ||
text-align: center; | ||
margin-bottom: 20px; | ||
font-weight: 700; /* Bolder font */ | ||
} | ||
|
||
.form-control { | ||
margin-bottom: 20px; | ||
margin-bottom: 25px; /* Consistent spacing */ | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 10px; /* Modern spacing with gap */ | ||
} | ||
|
||
label { | ||
margin-right: 10px; | ||
font-weight: 500; /* Medium font weight for labels */ | ||
} | ||
|
||
input[type="number"] { | ||
width: 60px; | ||
padding: 5px; | ||
margin-right: 10px; | ||
width: 80px; /* Slightly wider input */ | ||
padding: 8px; | ||
border: 1px solid #ced4da; /* Light border */ | ||
border-radius: 5px; | ||
transition: border-color 0.3s; /* Smooth transition on focus */ | ||
} | ||
|
||
input[type="number"]:focus { | ||
border-color: #007bff; /* Blue border on focus */ | ||
outline: none; | ||
} | ||
|
||
button { | ||
padding: 5px 15px; | ||
background-color: #007bff; | ||
color: white; | ||
padding: 8px 20px; | ||
background-color: #007bff; /* Primary color */ | ||
color: #ffffff; /* White text */ | ||
border: none; | ||
border-radius: 4px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s, transform 0.2s; /* Smooth transitions */ | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
background-color: #0056b3; /* Darker blue on hover */ | ||
transform: translateY(-2px); /* Lift effect */ | ||
} | ||
|
||
table { | ||
width: 100%; | ||
border-collapse: collapse; | ||
margin-top: 20px; | ||
font-size: 0.9rem; | ||
} | ||
|
||
th, td { | ||
padding: 10px; | ||
border-bottom: 1px solid #ddd; | ||
padding: 12px 15px; | ||
border-bottom: 1px solid #dee2e6; | ||
text-align: left; | ||
} | ||
|
||
th { | ||
background-color: #007bff; | ||
color: white; | ||
background-color: #0056b3; /* Darker blue for better contrast */ | ||
color: #ffffff; /* White text for visibility */ | ||
font-weight: 600; /* Slightly bolder text */ | ||
text-transform: uppercase; /* Uppercase for a modern touch */ | ||
position: sticky; /* Sticky header for better navigation */ | ||
top: 0; | ||
padding: 15px 10px; /* More padding for a balanced look */ | ||
letter-spacing: 0.5px; /* Slight letter spacing for readability */ | ||
} | ||
|
||
tr:hover { | ||
background-color: #f1f1f1; | ||
background-color: #f1f3f5; /* Light gray on row hover */ | ||
} | ||
|
||
td button { | ||
background-color: #dc3545; | ||
border-radius: 5px; | ||
transition: background-color 0.3s, transform 0.2s; | ||
} | ||
|
||
td button:hover { | ||
background-color: #c82333; | ||
transform: translateY(-2px); | ||
} | ||
|
||
.name { | ||
color: #ffffff; /* White text for visibility */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{% extends 'base.html' %}{% block title %}CPU Usage Details{% endblock %}{% block content %}<h2 class="my-4">CPU Details</h2><div class="container mt-4"><div class="row">{% include 'dasbhboard_comp/cpu/core.html' %} {% include 'dasbhboard_comp/cpu/frequency.html' %} {% include 'dasbhboard_comp/cpu/usages.html' %} {% include 'dasbhboard_comp/cpu/current_temp.html' %} {% include 'dasbhboard_comp/cpu/highest_temp.html' %} {% include 'dasbhboard_comp/cpu/critical_temp.html' %} </div></div>{% endblock %} | ||
{% extends 'base.html' %}{% block title %}CPU Usage Details{% endblock %}{% block content %}<h2 class="my-4">CPU Details | ||
</h2> | ||
<div class="container mt-4"> | ||
<div class="row">{% include 'dasbhboard_comp/cpu/core.html' %} {% include 'dasbhboard_comp/cpu/frequency.html' %} {% | ||
include 'dasbhboard_comp/cpu/usages.html' %} {% include 'dasbhboard_comp/cpu/current_temp.html' %} {% include | ||
'dasbhboard_comp/cpu/highest_temp.html' %} {% include 'dasbhboard_comp/cpu/critical_temp.html' %} </div> | ||
</div>{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters