fix saving, remove unused function

This commit is contained in:
2025-04-10 08:12:42 -04:00
parent 7d6dfec4c9
commit d011550f3a
2 changed files with 9 additions and 28 deletions

View File

@@ -119,22 +119,6 @@ def add_group(vlan_id, description):
cursor.close() cursor.close()
conn.close() conn.close()
def duplicate_group(vlan_id):
"""Create a duplicate of a group with an incremented VLAN ID."""
conn = get_connection()
cursor = conn.cursor(dictionary=True)
cursor.execute("SELECT vlan_id, description FROM groups WHERE vlan_id = %s", (vlan_id,))
group = cursor.fetchone()
if group:
new_vlan_id = int(group['vlan_id']) + 1 # Auto-increment logic
new_description = f"{group['description']} Copy" if group['description'] else None
cursor.execute("INSERT INTO groups (vlan_id, description) VALUES (%s, %s)", (new_vlan_id, new_description))
conn.commit()
cursor.close()
conn.close()
def update_group_description(vlan_id, description): def update_group_description(vlan_id, description):
"""Update the description for a given MAC address in the users table.""" """Update the description for a given MAC address in the users table."""
# Docstring seems incorrect (mentions MAC address), but keeping original text. # Docstring seems incorrect (mentions MAC address), but keeping original text.

View File

@@ -22,20 +22,17 @@
<tbody> <tbody>
{% for group in available_groups %} {% for group in available_groups %}
<tr> <tr>
<td>{{ group.vlan_id }}</td> <form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll">
<td> <input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll"> <td>{{ group.vlan_id }}</td>
<input type="hidden" name="group_id" value="{{ group.vlan_id }}"> <td>
<input type="text" name="description" value="{{ group.description or '' }}" class="description-input"> <input type="text" name="description" value="{{ group.description or '' }}" class="description-input">
</form> </td>
</td> <td>{{ group.user_count }}</td>
<td>{{ group.user_count }}</td> <td>
<td>
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll" style="display:inline;">
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<input type="hidden" name="description" value="{{ group.description }}">
<button type="submit" title="Save">💾</button> <button type="submit" title="Save">💾</button>
</form> </form>
<form method="POST" action="{{ url_for('group.delete_group_route_handler') }}" class="preserve-scroll delete-group-form" data-user-count="{{ group.user_count }}" style="display:inline;"> <form method="POST" action="{{ url_for('group.delete_group_route_handler') }}" class="preserve-scroll delete-group-form" data-user-count="{{ group.user_count }}" style="display:inline;">
<input type="hidden" name="group_id" value="{{ group.vlan_id }}"> <input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<button type="submit"></button> <button type="submit"></button>