fix saving, remove unused function
This commit is contained in:
@@ -119,22 +119,6 @@ def add_group(vlan_id, description):
|
||||
cursor.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):
|
||||
"""Update the description for a given MAC address in the users table."""
|
||||
# Docstring seems incorrect (mentions MAC address), but keeping original text.
|
||||
|
||||
@@ -22,20 +22,17 @@
|
||||
<tbody>
|
||||
{% for group in available_groups %}
|
||||
<tr>
|
||||
<td>{{ group.vlan_id }}</td>
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll">
|
||||
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
|
||||
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll">
|
||||
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
|
||||
<td>{{ group.vlan_id }}</td>
|
||||
<td>
|
||||
<input type="text" name="description" value="{{ group.description or '' }}" class="description-input">
|
||||
</form>
|
||||
</td>
|
||||
<td>{{ group.user_count }}</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 }}">
|
||||
</td>
|
||||
<td>{{ group.user_count }}</td>
|
||||
<td>
|
||||
<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;">
|
||||
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
|
||||
<button type="submit">❌</button>
|
||||
|
||||
Reference in New Issue
Block a user