Skip to content

Commit b070823

Browse files
authored
Merge pull request #17 from Arthur2500/copilot/sub-pr-16
Remove unused imports and variables flagged in code review
2 parents c16a6be + 243d66a commit b070823

File tree

13 files changed

+28
-26
lines changed

13 files changed

+28
-26
lines changed

backend/app/routes/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Authentication routes for user login and password management."""
22
import logging
33
from flask import Blueprint, request, jsonify
4-
from flask_jwt_extended import create_access_token, jwt_required, get_jwt_identity
4+
from flask_jwt_extended import create_access_token, jwt_required
55
from flask_limiter import Limiter
66
from flask_limiter.util import get_remote_address
77
from app.models.user import User

backend/app/routes/groups.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
from app.models.user import User
55
from app.models.group import Group
66
from app.utils.wireguard import generate_keypair
7-
from app.utils.decorators import admin_required
87
from app import db
98
import ipaddress
109
import zipfile
1110
import io
12-
import os
1311

1412
logger = logging.getLogger(__name__)
1513

backend/app/routes/health.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
from flask import Blueprint, jsonify
44
from app import db
5-
from app.models.group import Group
65

76
logger = logging.getLogger(__name__)
87

backend/app/utils/helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
import re
44
from datetime import datetime
5-
from functools import wraps
65
from flask import jsonify
76
from flask_jwt_extended import get_jwt_identity
87
from app.models.user import User

backend/tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from app import create_app, db
1010
from app.routes.auth import limiter
11-
from app.models.user import User
1211

1312

1413
@pytest.fixture

frontend/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ function App() {
6969
<Route path="/dashboard" element={<Dashboard user={user} />} />
7070

7171
{/* Groups */}
72-
<Route path="/groups" element={<GroupList />} />
72+
<Route path="/groups" element={<GroupList user={user} />} />
7373
<Route path="/groups/new" element={<GroupForm />} />
7474
<Route path="/groups/:id" element={<GroupDetail />} />
7575
<Route path="/groups/:id/edit" element={<GroupForm />} />
7676

7777
{/* Clients */}
78-
<Route path="/clients" element={<ClientList />} />
78+
<Route path="/clients" element={<ClientList user={user} />} />
7979
<Route path="/clients/:id" element={<ClientDetail />} />
8080
<Route path="/groups/:groupId/clients/new" element={<ClientForm />} />
8181
<Route path="/clients/:id/edit" element={<ClientForm />} />

frontend/src/components/clients/ClientList.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ import React, { useState, useEffect } from 'react';
22
import { Link } from 'react-router-dom';
33
import clientService from '../../services/client.service';
44
import groupService from '../../services/group.service';
5-
import { Client, Group } from '../../types';
5+
import { Client, Group, User } from '../../types';
66
import { formatBytes, downloadFile, formatDate } from '../../utils/helpers';
77
import { Download, Lock, Unlock, Pencil, Trash2, Search } from 'lucide-react';
88
import './ClientList.css';
99

10-
const ClientList: React.FC = () => {
10+
interface ClientListProps {
11+
user: User | null;
12+
}
13+
14+
const ClientList: React.FC<ClientListProps> = ({ user }) => {
1115
const [clients, setClients] = useState<Client[]>([]);
1216
const [groups, setGroups] = useState<Group[]>([]);
1317
const [loading, setLoading] = useState(true);
@@ -89,9 +93,11 @@ const ClientList: React.FC = () => {
8993
<div className="page-header">
9094
<h1>All Clients</h1>
9195
<div className="header-actions">
92-
<button onClick={() => setShowCreateModal(true)} className="btn-primary">
93-
+ New Client
94-
</button>
96+
{user?.can_create_clients && (
97+
<button onClick={() => setShowCreateModal(true)} className="btn-primary">
98+
+ New Client
99+
</button>
100+
)}
95101
</div>
96102
</div>
97103

frontend/src/components/dashboard/Dashboard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Link } from 'react-router-dom';
33
import statsService from '../../services/stats.service';
44
import groupService from '../../services/group.service';
55
import { StatsOverview, Group, User } from '../../types';
6-
import { formatBytes } from '../../utils/helpers';
76
import { FolderOpen, Monitor, CheckCircle, Users, Plug } from 'lucide-react';
87
import './Dashboard.css';
98

frontend/src/components/groups/GroupDetail.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ const GroupDetail: React.FC = () => {
308308
</div>
309309

310310
{/* Group Traffic Statistics Section */}
311-
{group && (
312-
<GroupTrafficStats groupId={Number(id)} />
313-
)}
311+
<GroupTrafficStats groupId={Number(id)} />
314312

315313
{/* Group Members Section */}
316314
{currentUser && group && (

frontend/src/components/groups/GroupForm.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ const GroupForm: React.FC = () => {
3434
});
3535
const [loading, setLoading] = useState(false);
3636
const [error, setError] = useState('');
37-
const [defaults, setDefaults] = useState<any>(null);
3837

3938
const loadDefaults = useCallback(async () => {
4039
try {
4140
const settingsDefaults = await settingsService.getDefaults();
42-
setDefaults(settingsDefaults);
4341

4442
// Set initial form data with defaults from backend
4543
if (!isEdit) {

0 commit comments

Comments
 (0)