Sanoopsn commited on
Commit
1bc6b84
·
verified ·
1 Parent(s): cb9e543

Promote version 683a499 to main

Browse files

Promoted commit 683a49948afe65a664235466ca36b5ead56d6dc3 to main branch

Files changed (2) hide show
  1. components/navbar.js +3 -2
  2. script.js +29 -134
components/navbar.js CHANGED
@@ -36,8 +36,9 @@ class CustomNavbar extends HTMLElement {
36
  <i data-feather="bell"></i>
37
  </button>
38
  <div class="flex items-center space-x-2">
39
- <span class="text-sm font-medium text-gray-700">Admin</span>
40
- </div>
 
41
  </div>
42
  </div>
43
  </nav>
 
36
  <i data-feather="bell"></i>
37
  </button>
38
  <div class="flex items-center space-x-2">
39
+ <img src="http://static.photos/people/1200x630/1" alt="User" class="w-8 h-8 rounded-full">
40
+ <span class="hidden md:inline text-sm font-medium text-gray-700">Admin</span>
41
+ </div>
42
  </div>
43
  </div>
44
  </nav>
script.js CHANGED
@@ -1,117 +1,62 @@
1
-
2
  // Sample data - in a real app this would come from an API
3
  const sampleLogs = [
4
  {
5
  id: 1,
6
  status: 500,
7
  method: 'POST',
8
- time: new Date().toISOString().replace('T', ' ').substring(0, 19),
9
- url: '/api/users',
10
  errorMessage: 'Internal Server Error: Database connection timeout',
11
  errorCode: 'DB_CONN_TIMEOUT',
12
  errorType: 'Database',
13
- resolution: 'Check database connection pool. Verify database server is running and accessible.'
14
  },
15
  {
16
  id: 2,
17
  status: 404,
18
  method: 'GET',
19
- time: new Date(Date.now() - 3600000).toISOString().replace('T', ' ').substring(0, 19),
20
- url: '/api/products/123',
21
- errorMessage: 'Product not found with ID 123',
22
  errorCode: 'RESOURCE_NOT_FOUND',
23
  errorType: 'Validation',
24
- resolution: 'Verify the product ID exists in the database.'
25
  },
26
  {
27
  id: 3,
28
  status: 400,
29
- method: 'POST',
30
- time: new Date(Date.now() - 7200000).toISOString().replace('T', ' ').substring(0, 19),
31
- url: '/api/orders',
32
- errorMessage: 'Invalid request: Missing required fields',
33
  errorCode: 'VALIDATION_ERROR',
34
  errorType: 'Validation',
35
- resolution: 'Check API documentation for required fields.'
36
  },
37
  {
38
  id: 4,
39
- status: 429,
40
- method: 'GET',
41
- time: new Date(Date.now() - 10800000).toISOString().replace('T', ' ').substring(0, 19),
42
- url: '/api/analytics',
43
- errorMessage: 'Rate limit exceeded: 100 requests per minute',
44
- errorCode: 'RATE_LIMIT_EXCEEDED',
45
- errorType: 'Rate Limit',
46
- resolution: 'Implement exponential backoff or reduce request frequency.'
47
- },
48
- {
49
- id: 5,
50
  status: 401,
51
- method: 'PUT',
52
- time: new Date(Date.now() - 14400000).toISOString().replace('T', ' ').substring(0, 19),
53
- url: '/api/settings',
54
- errorMessage: 'Unauthorized: Invalid API key',
55
- errorCode: 'AUTH_FAILED',
56
- errorType: 'Authentication',
57
- resolution: 'Verify API key is correct and has proper permissions.'
58
- },
59
- {
60
- id: 6,
61
- status: 403,
62
- method: 'DELETE',
63
- time: new Date(Date.now() - 18000000).toISOString().replace('T', ' ').substring(0, 19),
64
- url: '/api/users/42',
65
- errorMessage: 'Forbidden: User does not have permission to delete this resource',
66
- errorCode: 'PERMISSION_DENIED',
67
- errorType: 'Authorization',
68
- resolution: 'Check user permissions and roles.'
69
- },
70
- {
71
- id: 7,
72
- status: 502,
73
  method: 'GET',
74
- time: new Date(Date.now() - 21600000).toISOString().replace('T', ' ').substring(0, 19),
75
- url: '/api/inventory',
76
- errorMessage: 'Bad Gateway: Upstream service unavailable',
77
- errorCode: 'UPSTREAM_ERROR',
78
- errorType: 'Infrastructure',
79
- resolution: 'Check health of dependent services and retry with exponential backoff.'
80
  },
81
  {
82
- id: 8,
83
  status: 503,
84
  method: 'POST',
85
- time: new Date(Date.now() - 25200000).toISOString().replace('T', ' ').substring(0, 19),
86
- url: '/api/notifications',
87
- errorMessage: 'Service Unavailable: Maintenance in progress',
88
- errorCode: 'MAINTENANCE_MODE',
89
- errorType: 'Infrastructure',
90
- resolution: 'Retry after maintenance window completes. Check status page for updates.'
91
- },
92
- {
93
- id: 9,
94
- status: 504,
95
- method: 'GET',
96
- time: new Date(Date.now() - 28800000).toISOString().replace('T', ' ').substring(0, 19),
97
- url: '/api/reports',
98
- errorMessage: 'Gateway Timeout: Upstream service took too long to respond',
99
- errorCode: 'TIMEOUT_ERROR',
100
- errorType: 'Performance',
101
- resolution: 'Increase timeout thresholds or optimize slow queries.'
102
- },
103
- {
104
- id: 10,
105
- status: 422,
106
- method: 'PATCH',
107
- time: new Date(Date.now() - 32400000).toISOString().replace('T', ' ').substring(0, 19),
108
- url: '/api/profiles/89',
109
- errorMessage: 'Unprocessable Entity: Invalid email format',
110
- errorCode: 'VALIDATION_ERROR',
111
- errorType: 'Validation',
112
- resolution: 'Validate input data before submission.'
113
  }
114
  ];
 
115
  // DOM elements
116
  const logsTable = document.getElementById('logsTable');
117
  const errorModal = document.getElementById('errorModal');
@@ -123,57 +68,11 @@ const submitTicket = document.getElementById('submitTicket');
123
  let currentLog = null;
124
 
125
  // Function to render logs table
126
- function filterLogs() {
127
- const statusFilter = document.querySelector('select:nth-of-type(1)').value;
128
- const methodFilter = document.querySelector('select:nth-of-type(2)').value;
129
- const timeFilter = document.querySelector('select:nth-of-type(3)').value;
130
- const urlFilter = document.querySelector('input[placeholder="URL Contains"]').value.toLowerCase();
131
- const errorFilter = document.querySelector('input[placeholder="Error Contains"]').value.toLowerCase();
132
-
133
- return sampleLogs.filter(log => {
134
- // Status filter
135
- if (statusFilter !== 'All' && log.status.toString() !== statusFilter) {
136
- return false;
137
- }
138
-
139
- // Method filter
140
- if (methodFilter !== 'All' && log.method !== methodFilter) {
141
- return false;
142
- }
143
-
144
- // Time range filter
145
- const logDate = new Date(log.time);
146
- const now = new Date();
147
-
148
- if (timeFilter === 'Last 24 hours' && (now - logDate) > 24 * 60 * 60 * 1000) {
149
- return false;
150
- } else if (timeFilter === 'Last week' && (now - logDate) > 7 * 24 * 60 * 60 * 1000) {
151
- return false;
152
- } else if (timeFilter === 'Last month' && (now - logDate) > 30 * 24 * 60 * 60 * 1000) {
153
- return false;
154
- }
155
-
156
- // URL contains filter
157
- if (urlFilter && !log.url.toLowerCase().includes(urlFilter)) {
158
- return false;
159
- }
160
-
161
- // Error contains filter
162
- if (errorFilter && !log.errorMessage.toLowerCase().includes(errorFilter)) {
163
- return false;
164
- }
165
-
166
- return true;
167
- });
168
- }
169
-
170
  function renderLogsTable() {
171
  logsTable.innerHTML = '';
172
 
173
- const filteredLogs = filterLogs();
174
-
175
- filteredLogs.forEach(log => {
176
- const row = document.createElement('tr');
177
  row.className = 'hover:bg-gray-50';
178
  row.innerHTML = `
179
  <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${log.id}</td>
@@ -252,15 +151,11 @@ submitTicket.addEventListener('click', () => {
252
  });
253
 
254
  // Initialize the page
255
- document.querySelector('button:contains("Apply Filters")').addEventListener('click', () => {
256
- renderLogsTable();
257
- });
258
-
259
  document.addEventListener('DOMContentLoaded', () => {
260
  renderLogsTable();
261
 
262
  // Close modal when clicking outside
263
- errorModal.addEventListener('click', (e) => {
264
  if (e.target === errorModal) {
265
  closeErrorModal();
266
  }
 
 
1
  // Sample data - in a real app this would come from an API
2
  const sampleLogs = [
3
  {
4
  id: 1,
5
  status: 500,
6
  method: 'POST',
7
+ time: '2023-05-15 14:32:45',
8
+ url: 'https://api.example.com/v1/users',
9
  errorMessage: 'Internal Server Error: Database connection timeout',
10
  errorCode: 'DB_CONN_TIMEOUT',
11
  errorType: 'Database',
12
+ resolution: 'Check database connection pool. Verify database server is running and accessible. Consider increasing connection timeout setting.'
13
  },
14
  {
15
  id: 2,
16
  status: 404,
17
  method: 'GET',
18
+ time: '2023-05-15 14:30:12',
19
+ url: 'https://api.example.com/v1/products/12345',
20
+ errorMessage: 'Product not found with ID 12345',
21
  errorCode: 'RESOURCE_NOT_FOUND',
22
  errorType: 'Validation',
23
+ resolution: 'Verify the product ID exists in the database. Check if the product was deleted. Validate the request parameters.'
24
  },
25
  {
26
  id: 3,
27
  status: 400,
28
+ method: 'PUT',
29
+ time: '2023-05-15 14:25:33',
30
+ url: 'https://api.example.com/v1/orders/678',
31
+ errorMessage: 'Invalid request body: Missing required field "quantity"',
32
  errorCode: 'VALIDATION_ERROR',
33
  errorType: 'Validation',
34
+ resolution: 'Check the API documentation for required fields. Validate the request body before sending. Ensure all required fields are included.'
35
  },
36
  {
37
  id: 4,
 
 
 
 
 
 
 
 
 
 
 
38
  status: 401,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  method: 'GET',
40
+ time: '2023-05-15 14:20:18',
41
+ url: 'https://api.example.com/v1/users/me',
42
+ errorMessage: 'Unauthorized: Invalid or expired access token',
43
+ errorCode: 'INVALID_TOKEN',
44
+ errorType: 'Authentication',
45
+ resolution: 'Check if the access token is valid and not expired. Verify the token signature. Refresh the token if needed.'
46
  },
47
  {
48
+ id: 5,
49
  status: 503,
50
  method: 'POST',
51
+ time: '2023-05-15 14:15:42',
52
+ url: 'https://api.example.com/v1/payments',
53
+ errorMessage: 'Service Unavailable: Payment gateway not responding',
54
+ errorCode: 'GATEWAY_TIMEOUT',
55
+ errorType: 'Integration',
56
+ resolution: 'Check the payment gateway status. Verify network connectivity. Implement retry logic with exponential backoff.'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
  ];
59
+
60
  // DOM elements
61
  const logsTable = document.getElementById('logsTable');
62
  const errorModal = document.getElementById('errorModal');
 
68
  let currentLog = null;
69
 
70
  // Function to render logs table
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  function renderLogsTable() {
72
  logsTable.innerHTML = '';
73
 
74
+ sampleLogs.forEach(log => {
75
+ const row = document.createElement('tr');
 
 
76
  row.className = 'hover:bg-gray-50';
77
  row.innerHTML = `
78
  <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${log.id}</td>
 
151
  });
152
 
153
  // Initialize the page
 
 
 
 
154
  document.addEventListener('DOMContentLoaded', () => {
155
  renderLogsTable();
156
 
157
  // Close modal when clicking outside
158
+ errorModal.addEventListener('click', (e) => {
159
  if (e.target === errorModal) {
160
  closeErrorModal();
161
  }