simple-python-audit 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple-python-audit
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Ferramenta de profiling com widget flutuante e servidor de gerenciamento de logs.
5
5
  Author-email: Sadson Diego <sadsondiego@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "simple-python-audit"
7
- version = "1.0.0"
7
+ version = "1.1.0"
8
8
  description = "Ferramenta de profiling com widget flutuante e servidor de gerenciamento de logs."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -33,4 +33,4 @@ simple-python-audit-server = "simple_python_audit.server:cli"
33
33
 
34
34
  [tool.setuptools.packages.find]
35
35
  where = ["src"]
36
- include = ["simple_python_audit*"]
36
+ include = ["simple_python_audit*"]
@@ -52,17 +52,31 @@ class LogManagerHandler(http.server.SimpleHTTPRequestHandler):
52
52
  .container { max-width: 1000px; margin: auto; background: white; padding: 25px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.08); }
53
53
  h1 { color: #1a365d; font-size: 1.4rem; border-left: 5px solid #3182ce; padding-left: 15px; }
54
54
  .timezone-badge { font-size: 0.8rem; background: #ebf8ff; color: #2b6cb0; padding: 4px 8px; border-radius: 4px; float: right; }
55
- table { width: 100%; border-collapse: collapse; margin-top: 20px; }
55
+ .toolbar { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
56
+ .filter-input { flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: 0.9rem; outline: none; }
57
+ .filter-input:focus { border-color: #3182ce; box-shadow: 0 0 0 2px rgba(49,130,206,0.2); }
58
+ .file-count { font-size: 0.82rem; color: #718096; white-space: nowrap; }
59
+ table { width: 100%; border-collapse: collapse; margin-top: 16px; }
56
60
  th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
57
61
  th { background: #edf2f7; color: #4a5568; font-size: 0.85rem; }
62
+ th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
63
+ th.sortable:hover { background: #e2e8f0; }
64
+ th.sort-asc::after { content: ' ▲'; font-size: 0.7rem; }
65
+ th.sort-desc::after { content: ' ▼'; font-size: 0.7rem; }
58
66
  .btn { padding: 8px 18px; border-radius: 6px; cursor: pointer; border: none; font-weight: bold; }
59
67
  .btn-danger { background: #e53e3e; color: white; }
60
68
  .btn-danger:disabled { background: #fc8181; opacity: 0.6; }
61
69
  input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
70
+ tr.hidden { display: none; }
62
71
  </style>
63
72
  <script>
73
+ let sortCol = null, sortAsc = true;
74
+
64
75
  function toggleAll(master) {
65
- document.querySelectorAll('.file-check').forEach(cb => cb.checked = master.checked);
76
+ document.querySelectorAll('.file-check:not([style*="none"])').forEach(cb => {
77
+ const row = cb.closest('tr');
78
+ if (!row.classList.contains('hidden')) cb.checked = master.checked;
79
+ });
66
80
  updateButton();
67
81
  }
68
82
  function updateButton() {
@@ -81,16 +95,59 @@ class LogManagerHandler(http.server.SimpleHTTPRequestHandler):
81
95
  if (res.ok) location.reload();
82
96
  }
83
97
  }
98
+ function filterTable() {
99
+ const q = document.getElementById('filter-input').value.toLowerCase();
100
+ let visible = 0;
101
+ document.querySelectorAll('#file-tbody tr').forEach(row => {
102
+ const name = row.dataset.name || '';
103
+ const show = name.toLowerCase().includes(q);
104
+ row.classList.toggle('hidden', !show);
105
+ if (show) visible++;
106
+ });
107
+ document.getElementById('file-count').textContent = `${visible} arquivo(s)`;
108
+ document.getElementById('del-btn').disabled = true;
109
+ document.getElementById('del-btn').innerText = 'Excluir Selecionados (0)';
110
+ document.querySelector('thead input[type=checkbox]').checked = false;
111
+ }
112
+ function sortTable(col) {
113
+ const tbody = document.getElementById('file-tbody');
114
+ if (sortCol === col) { sortAsc = !sortAsc; }
115
+ else { sortCol = col; sortAsc = true; }
116
+
117
+ document.querySelectorAll('th.sortable').forEach(th => {
118
+ th.classList.remove('sort-asc', 'sort-desc');
119
+ if (th.dataset.col === col) th.classList.add(sortAsc ? 'sort-asc' : 'sort-desc');
120
+ });
121
+
122
+ const rows = Array.from(tbody.querySelectorAll('tr'));
123
+ rows.sort((a, b) => {
124
+ let va = a.dataset[col] || '';
125
+ let vb = b.dataset[col] || '';
126
+ if (col === 'size' || col === 'mtime') {
127
+ va = parseFloat(va); vb = parseFloat(vb);
128
+ return sortAsc ? va - vb : vb - va;
129
+ }
130
+ return sortAsc ? va.localeCompare(vb) : vb.localeCompare(va);
131
+ });
132
+ rows.forEach(r => tbody.appendChild(r));
133
+ }
84
134
  </script>
85
135
  </head><body><div class="container">""")
86
136
 
87
137
  r.append(f'<span class="timezone-badge">Timezone: Fortaleza (UTC-3)</span>')
88
138
  r.append(f'<h1>Logs: {displaypath}</h1>')
139
+ r.append(f'<div class="toolbar">')
89
140
  r.append('<button id="del-btn" class="btn btn-danger" onclick="deleteSelected()" disabled>Excluir Selecionados (0)</button>')
90
-
141
+ r.append('<input id="filter-input" class="filter-input" type="text" placeholder="Filtrar por nome..." oninput="filterTable()">')
142
+ r.append(f'<span id="file-count" class="file-count">{len(list_dir)} arquivo(s)</span>')
143
+ r.append('</div>')
144
+
91
145
  r.append('<table><thead><tr>')
92
146
  r.append('<th><input type="checkbox" onclick="toggleAll(this)"></th>')
93
- r.append('<th>Nome do Arquivo</th><th>Tamanho</th><th>Última Modificação</th></tr></thead><tbody>')
147
+ r.append('<th class="sortable" data-col="name" onclick="sortTable(\'name\')">Nome do Arquivo</th>')
148
+ r.append('<th class="sortable" data-col="size" onclick="sortTable(\'size\')">Tamanho</th>')
149
+ r.append('<th class="sortable" data-col="mtime" onclick="sortTable(\'mtime\')">Última Modificação</th>')
150
+ r.append('</tr></thead><tbody id="file-tbody">')
94
151
 
95
152
  for name in list_dir:
96
153
  fullname = os.path.join(path, name)
@@ -107,7 +164,7 @@ class LogManagerHandler(http.server.SimpleHTTPRequestHandler):
107
164
  # DATA EM HORÁRIO DE FORTALEZA
108
165
  mtime_fortaleza = self.get_fortaleza_time(stats.st_mtime)
109
166
 
110
- r.append('<tr>')
167
+ r.append(f'<tr data-name="{name}" data-size="{stats.st_size}" data-mtime="{stats.st_mtime}">')
111
168
  r.append(f'<td><input type="checkbox" class="file-check" value="{urllib.parse.quote(name)}" onclick="updateButton()"></td>')
112
169
  r.append(f'<td><a href="{urllib.parse.quote(name)}">{name}</a></td>')
113
170
  r.append(f'<td>{readable_size}</td>')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple-python-audit
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Ferramenta de profiling com widget flutuante e servidor de gerenciamento de logs.
5
5
  Author-email: Sadson Diego <sadsondiego@gmail.com>
6
6
  License: MIT