Skip to content

Commit

Permalink
Reformat all templates
Browse files Browse the repository at this point in the history
Set a default value for size converter
  • Loading branch information
dormant-user committed Nov 30, 2024
1 parent d682ba6 commit 4f84c9c
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 215 deletions.
2 changes: 1 addition & 1 deletion docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<title>PyNinja &#8212; PyNinja documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
Expand Down
32 changes: 16 additions & 16 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,14 @@ <h2 id="_">_</h2>
<li><a href="index.html#pyninja.features.gpu._darwin">(in module pyninja.features.gpu)</a>
</li>
</ul></li>
<li><a href="index.html#pyninja.modules.enums.StrEnum._generate_next_value_">_generate_next_value_() (pyninja.modules.enums.StrEnum method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.features.cpu._linux">_linux() (in module pyninja.features.cpu)</a>

<ul>
<li><a href="index.html#pyninja.features.gpu._linux">(in module pyninja.features.gpu)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.modules.enums.StrEnum._member_map_">_member_map_ (pyninja.modules.enums.StrEnum attribute)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.StrEnum._member_names_">_member_names_ (pyninja.modules.enums.StrEnum attribute)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.StrEnum._member_type_">_member_type_ (pyninja.modules.enums.StrEnum attribute)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.StrEnum._value2member_map_">_value2member_map_ (pyninja.modules.enums.StrEnum attribute)</a>
</li>
<li><a href="index.html#pyninja.features.cpu._windows">_windows() (in module pyninja.features.cpu)</a>

<ul>
Expand Down Expand Up @@ -523,10 +513,22 @@ <h2 id="M">M</h2>
</li>
<li><a href="index.html#pyninja.modules.models.RateLimit.max_requests">max_requests (pyninja.modules.models.RateLimit attribute)</a>
</li>
<li><a href="index.html#pyninja.modules.models.GPULib.model_computed_fields">model_computed_fields (pyninja.modules.models.GPULib attribute)</a>

<ul>
<li><a href="index.html#pyninja.modules.models.WSSession.model_computed_fields">(pyninja.modules.models.WSSession attribute)</a>
</li>
</ul></li>
<li><a href="index.html#pyninja.modules.models.GPULib.model_config">model_config (pyninja.modules.models.GPULib attribute)</a>

<ul>
<li><a href="index.html#pyninja.modules.models.WSSession.model_config">(pyninja.modules.models.WSSession attribute)</a>
</li>
</ul></li>
<li><a href="index.html#pyninja.modules.models.GPULib.model_fields">model_fields (pyninja.modules.models.GPULib attribute)</a>

<ul>
<li><a href="index.html#pyninja.modules.models.WSSession.model_fields">(pyninja.modules.models.WSSession attribute)</a>
</li>
</ul></li>
<li>
Expand Down Expand Up @@ -958,11 +960,11 @@ <h2 id="S">S</h2>
<li><a href="index.html#pyninja.modules.models.ServiceStatus">ServiceStatus (class in pyninja.modules.models)</a>
</li>
<li><a href="index.html#pyninja.modules.models.Session">Session (class in pyninja.modules.models)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.Templates.session">session (pyninja.modules.enums.Templates attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.modules.enums.Templates.session">session (pyninja.modules.enums.Templates attribute)</a>
</li>
<li><a href="index.html#pyninja.monitor.authenticator.session_error">session_error() (in module pyninja.monitor.authenticator)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.Cookies.session_token">session_token (pyninja.modules.enums.Cookies attribute)</a>
Expand All @@ -978,8 +980,6 @@ <h2 id="S">S</h2>
<li><a href="index.html#pyninja.modules.models.ServiceStatus.status_code">status_code (pyninja.modules.models.ServiceStatus attribute)</a>
</li>
<li><a href="index.html#pyninja.features.service.stopped">stopped() (in module pyninja.features.service)</a>
</li>
<li><a href="index.html#pyninja.modules.enums.StrEnum">StrEnum (class in pyninja.modules.enums)</a>
</li>
<li><a href="index.html#pyninja.monitor.resources.system_resources">system_resources() (in module pyninja.monitor.resources)</a>
</li>
Expand Down
87 changes: 39 additions & 48 deletions docs/index.html

Large diffs are not rendered by default.

Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyninja/executors/squire.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ def size_converter(byte_size: int | float) -> str:
Returns:
str:
Converted understandable size.
Converted human-readable size.
"""
if byte_size:
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
index = int(math.floor(math.log(byte_size, 1024)))
return (
f"{format_nos(round(byte_size / pow(1024, index), 2))} {size_name[index]}"
)
return "0 B"


def process_command(
Expand Down
229 changes: 116 additions & 113 deletions pyninja/monitor/templates/disk_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="https://thevickypedia.github.io/open-source/nightmode/night.js" defer></script>
<link rel="stylesheet" type="text/css" href="https://thevickypedia.github.io/open-source/nightmode/night.css">
<style>
<style>
body {
overflow-x: hidden;
margin-left: 2%;
}

h2 {
font-family:"Courier", Courier, monospace;
font-size:100%;
font-family: "Courier", Courier, monospace;
font-size: 100%;
}

h1 {
Expand Down Expand Up @@ -61,6 +61,7 @@
font-size: 16px;
cursor: pointer;
}

footer {
bottom: 20px;
width: 100%;
Expand All @@ -75,145 +76,147 @@
border: 1px solid black;
border-collapse: collapse;
margin-bottom: 20px;
font-family:"Courier", Courier, monospace;
font-size:100%;
font-family: "Courier", Courier, monospace;
font-size: 100%;
min-width: 20%
}

th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}

.nested-table {
margin-left: 20px;
border: 1px solid #ddd;
}

.nested-table th, .nested-table td {
padding: 5px;
border: 1px solid #ddd;
}

details {
margin-bottom: 20px;
}

summary {
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body translate="no">
<div class="toggler fa fa-moon-o"></div>
<button class="docs" onclick="goDocs()"><i class="fa fa-book"></i> Docs</button>
<button class="redoc" onclick="goReDoc()"><i class="fa fa-file"></i> ReDoc</button>
<button class="logout" onclick="logOut()"><i class="fa fa-sign-out"></i> Logout</button>
<h1>PyNinja - Disk Monitor</h1>
{% for row in data %}
<details>
<summary>
<strong>{{ row.model | default(row.id) }}</strong>
</summary>

<div>
<h2>Attributes</h2>
{% if row.Attributes %}
<table class="nested-table">
<thead>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Attributes.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No attributes available.</p>
{% endif %}
</div>

<div>
<h2>Info</h2>
{% if row.Info %}
<table class="nested-table">
<thead>
<tr>
<th>Info Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Info.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No info available.</p>
{% endif %}
</div>

<div>
<h2>Partition</h2>
{% if row.Partition %}
<table class="nested-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Partition.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No partitions available.</p>
{% endif %}
</div>

<div>
<h2>Usage</h2>
{% if row.Usage %}
<table class="nested-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Usage.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No usage metrics available.</p>
{% endif %}
</div>
</details>
{% endfor %}
<div class="toggler fa fa-moon-o"></div>
<button class="docs" onclick="goDocs()"><i class="fa fa-book"></i> Docs</button>
<button class="redoc" onclick="goReDoc()"><i class="fa fa-file"></i> ReDoc</button>
<button class="logout" onclick="logOut()"><i class="fa fa-sign-out"></i> Logout</button>
<h1>PyNinja - Disk Monitor</h1>
{% for row in data %}
<details>
<summary>
<strong>{{ row.model | default(row.id) }}</strong>
</summary>
<div>
<h2>Attributes</h2>
{% if row.Attributes %}
<table class="nested-table">
<thead>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Attributes.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No attributes available.</p>
{% endif %}
</div>
<div>
<h2>Info</h2>
{% if row.Info %}
<table class="nested-table">
<thead>
<tr>
<th>Info Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Info.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No info available.</p>
{% endif %}
</div>
<div>
<h2>Partition</h2>
{% if row.Partition %}
<table class="nested-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Partition.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No partitions available.</p>
{% endif %}
</div>
<div>
<h2>Usage</h2>
{% if row.Usage %}
<table class="nested-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in row.Usage.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No usage metrics available.</p>
{% endif %}
</div>
</details>
{% endfor %}
<script>
setInterval(() => {
window.location.reload()
}, interval);

function logOut() {
window.location.href = window.location.origin + "{{ logout }}";
}
Expand Down
Loading

0 comments on commit 4f84c9c

Please sign in to comment.