Skip to content

Commit f23f7b6

Browse files
author
Lasim
committed
refactor: remove unnecessary console logs and improve user walkthrough handling
1 parent 80ff8ed commit f23f7b6

File tree

8 files changed

+6
-49
lines changed

8 files changed

+6
-49
lines changed

services/backend/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"compilerOptions": {
33
"target": "ES2022",
44
"module": "commonjs",
5-
"moduleResolution": "node",
65
"outDir": "dist",
76
"rootDir": "src",
87
"strict": true,

services/frontend/src/components/mcp-server/McpInstallationsList.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,36 +159,31 @@ const cancelRemoval = () => {
159159
160160
// Event handlers for walkthrough overlay
161161
const handleWalkthroughOverlayShow = () => {
162-
console.log('Showing walkthrough overlay for step 1')
163162
showWalkthroughOverlay.value = true
164163
showWalkthroughBorder.value = true
165164
showWalkthroughHighZIndex.value = true
166165
}
167166
168167
const handleWalkthroughOverlayHide = () => {
169-
console.log('Hiding walkthrough overlay')
170168
showWalkthroughOverlay.value = false
171169
showWalkthroughBorder.value = false
172170
showWalkthroughHighZIndex.value = false
173171
}
174172
175173
// Event handlers for step-specific z-index control
176174
const handleWalkthroughStep1Active = () => {
177-
console.log('Step 1 active: MCP liste should be visible (high z-index)')
178175
// Step 1: MCP liste should be visible (high z-index)
179176
showWalkthroughHighZIndex.value = true
180177
showWalkthroughBorder.value = true
181178
}
182179
183180
const handleWalkthroughStep2Active = () => {
184-
console.log('Step 2 active: MCP liste should be hidden under overlay (no high z-index)')
185181
// Step 2: MCP liste should be hidden under overlay (no high z-index)
186182
showWalkthroughHighZIndex.value = false
187183
showWalkthroughBorder.value = false
188184
}
189185
190186
onMounted(() => {
191-
console.log('McpInstallationsList mounted - registering walkthrough event listeners')
192187
// Listen for walkthrough overlay events
193188
eventBus.on('walkthrough-overlay-show', handleWalkthroughOverlayShow)
194189
eventBus.on('walkthrough-overlay-hide', handleWalkthroughOverlayHide)

services/frontend/src/components/walkthrough/UserWalkthroughPopover.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const positionTrigger = () => {
9595
isPositioned.value = true
9696
isOpen.value = true
9797
98-
console.log(`Successfully positioned walkthrough popover for step ${props.step}`)
9998
} else {
10099
console.warn(`Target element '${props.targetElement}' not found for walkthrough step ${props.step}`)
101100
return // Stop - no infinite retries
@@ -111,7 +110,6 @@ watch(() => props.open, (newValue) => {
111110
isPositioned.value = false
112111
113112
// Emit walkthrough step opened event
114-
console.log(`Emitting walkthrough-step-opened for step ${props.step}`)
115113
eventBus.emit('walkthrough-step-opened', { step: props.step })
116114
// Note: walkthrough-overlay-show and step-specific events are now emitted after positioning
117115
@@ -121,7 +119,6 @@ watch(() => props.open, (newValue) => {
121119
122120
// Emit overlay events AFTER positioning to ensure all components are mounted
123121
setTimeout(() => {
124-
console.log(`Emitting walkthrough-overlay-show for step ${props.step} (after positioning)`)
125122
eventBus.emit('walkthrough-overlay-show')
126123
127124
// Also emit step-specific events with proper timing
@@ -178,7 +175,6 @@ function handleNextStep() {
178175
closePopover()
179176
} else {
180177
// Final step - finish walkthrough
181-
console.log('User clicked finish on walkthrough step 2')
182178
eventBus.emit('walkthrough-finish')
183179
closePopover()
184180
}

services/frontend/src/services/globalSettingsService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getEnv } from '@/utils/env'
2+
import { UserPreferencesService } from './userPreferencesService'
23

34
/**
45
* Service for fetching global settings
@@ -50,12 +51,12 @@ export class GlobalSettingsService {
5051

5152
/**
5253
* Get the user walkthrough visibility setting
54+
* Uses user preferences for proper permissions (no 403 errors for normal users)
5355
*/
5456
static async shouldShowUserWalkthrough(): Promise<boolean> {
5557
try {
56-
const value = await this.getSetting('global.show_user_walkthrough')
57-
// Convert string to boolean - 'true' becomes true, anything else becomes false
58-
return value === 'true'
58+
// Use UserPreferencesService for consistent architecture and proper permissions
59+
return await UserPreferencesService.shouldShowWalkthrough()
5960
} catch (error) {
6061
console.error('Failed to check user walkthrough setting:', error)
6162
return false // Default to not showing walkthrough on error

services/frontend/src/services/userPreferencesService.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export class UserPreferencesService {
6666
throw new Error(data.error || 'Invalid response from server')
6767
}
6868

69-
console.log('Successfully fetched user preferences:', data.preferences)
7069
return data.preferences
7170

7271
} catch (error) {
@@ -80,8 +79,6 @@ export class UserPreferencesService {
8079
*/
8180
static async updateUserPreferences(updates: UpdateUserPreferencesInput): Promise<UserPreferences> {
8281
try {
83-
console.log('Updating user preferences:', updates)
84-
8582
const response = await fetch(`${this.baseUrl}/api/users/me/preferences`, {
8683
method: 'POST',
8784
headers: {
@@ -104,8 +101,6 @@ export class UserPreferencesService {
104101
throw new Error(data.error || 'Failed to update preferences')
105102
}
106103

107-
console.log('Successfully updated user preferences:', data.message)
108-
109104
// Return updated preferences by fetching them again
110105
return await this.getUserPreferences()
111106

@@ -173,8 +168,6 @@ export class UserPreferencesService {
173168
*/
174169
static async completeWalkthrough(): Promise<void> {
175170
try {
176-
console.log('Marking walkthrough as completed via API')
177-
178171
const response = await fetch(`${this.baseUrl}/api/users/me/preferences/walkthrough/complete`, {
179172
method: 'POST',
180173
headers: {
@@ -196,8 +189,6 @@ export class UserPreferencesService {
196189
throw new Error(data.error || 'Failed to complete walkthrough')
197190
}
198191

199-
console.log('Successfully completed walkthrough:', data.message)
200-
201192
} catch (error) {
202193
console.error('Error completing walkthrough:', error)
203194
throw error
@@ -209,8 +200,6 @@ export class UserPreferencesService {
209200
*/
210201
static async cancelWalkthrough(): Promise<void> {
211202
try {
212-
console.log('Marking walkthrough as cancelled via API')
213-
214203
const response = await fetch(`${this.baseUrl}/api/users/me/preferences/walkthrough/cancel`, {
215204
method: 'POST',
216205
headers: {
@@ -232,8 +221,6 @@ export class UserPreferencesService {
232221
throw new Error(data.error || 'Failed to cancel walkthrough')
233222
}
234223

235-
console.log('Successfully cancelled walkthrough:', data.message)
236-
237224
} catch (error) {
238225
console.error('Error cancelling walkthrough:', error)
239226
throw error
@@ -308,8 +295,6 @@ export class UserPreferencesService {
308295
*/
309296
static async acknowledgeNotification(notificationId: string): Promise<void> {
310297
try {
311-
console.log('Acknowledging notification:', notificationId)
312-
313298
const response = await fetch(`${this.baseUrl}/api/users/me/preferences/notifications/acknowledge`, {
314299
method: 'POST',
315300
headers: {
@@ -334,8 +319,6 @@ export class UserPreferencesService {
334319
throw new Error(data.error || 'Failed to acknowledge notification')
335320
}
336321

337-
console.log('Successfully acknowledged notification:', data.message)
338-
339322
} catch (error) {
340323
console.error('Error acknowledging notification:', error)
341324
throw error

services/frontend/src/views/Logout.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,16 @@ const message = ref(t('logout.inProgressMessage'))
3535
onMounted(async () => {
3636
isLoading.value = true;
3737
message.value = t('logout.inProgressMessage');
38-
console.log('Attempting to logout from backend...');
39-
4038
try {
4139
// Use the UserService logout method which handles cache clearing
4240
await UserService.logout();
43-
console.log('Logout successful');
4441
message.value = t('logout.successMessage') || t('logout.inProgressMessage');
4542
} catch (error) {
4643
console.error('Error during logout:', error);
4744
message.value = t('common.error');
4845
} finally {
4946
isLoading.value = false;
5047
setTimeout(() => {
51-
console.log('Redirecting to login page...');
5248
router.push('/login');
5349
}, 2000); // Redirect after 2 seconds to allow user to see final message
5450
}

services/frontend/src/views/admin/mcp-server-catalog/edit/[id].vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ const handleSubmit = async (formData: McpServerFormData) => {
236236
const newEnvSchemaItems: any[] = []
237237
envVarsFromInstallation.forEach(envVarName => {
238238
if (!allExistingEnvNames.includes(envVarName)) {
239-
console.log('Edit[id].vue: Auto-adding missing env var to team_env_schema:', envVarName)
240239
newEnvSchemaItems.push({
241240
name: envVarName,
242241
type: 'string',
@@ -247,7 +246,6 @@ const handleSubmit = async (formData: McpServerFormData) => {
247246
visible_to_users: true
248247
})
249248
} else {
250-
console.log('Edit[id].vue: Env var already exists in configuration schema:', envVarName)
251249
}
252250
})
253251
@@ -257,7 +255,6 @@ const handleSubmit = async (formData: McpServerFormData) => {
257255
...finalConfigurationSchema,
258256
team_env_schema: [...existingTeamEnvSchema, ...newEnvSchemaItems]
259257
}
260-
console.log('Edit[id].vue: Updated team_env_schema with', newEnvSchemaItems.length, 'new items')
261258
}
262259
}
263260
}

services/frontend/src/views/mcp-server/index.vue

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ const checkWalkthroughSetting = async (): Promise<void> => {
101101
const globalWalkthroughEnabled = await GlobalSettingsService.shouldShowUserWalkthrough()
102102
103103
if (!globalWalkthroughEnabled) {
104-
console.log('Walkthrough disabled globally')
105104
showUserWalkthrough.value = false
106105
return
107106
}
@@ -111,7 +110,6 @@ const checkWalkthroughSetting = async (): Promise<void> => {
111110
const isWalkthroughCompleted = userPreferences.walkthrough_completed || false
112111
113112
if (isWalkthroughCompleted) {
114-
console.log('User has already completed the walkthrough')
115113
showUserWalkthrough.value = false
116114
// Also sync to local storage for consistency
117115
eventBus.setState('walkthrough_completed', true)
@@ -120,7 +118,6 @@ const checkWalkthroughSetting = async (): Promise<void> => {
120118
121119
// Step 3: Show walkthrough only if globally enabled AND user hasn't completed it
122120
showUserWalkthrough.value = true
123-
console.log('Walkthrough enabled globally and user has not completed it yet')
124121
125122
} catch (error) {
126123
console.error('Error checking walkthrough setting:', error)
@@ -214,7 +211,6 @@ const handleNotificationShow = (data: { message: string; type: string }) => {
214211
215212
// Walkthrough event handlers
216213
const handleWalkthroughNextStep = (data: { fromStep: number; toStep: number }) => {
217-
console.log('Walkthrough next step:', data)
218214
if (data.fromStep === 1 && data.toStep === 2) {
219215
// Hide step 1
220216
showUserWalkthrough.value = false
@@ -233,13 +229,9 @@ const handleWalkthroughNextStep = (data: { fromStep: number; toStep: number }) =
233229
234230
// UPDATED: Enhanced walkthrough finish handler with API call
235231
const handleWalkthroughFinish = async () => {
236-
console.log('Walkthrough finished - updating user preferences')
237-
238232
try {
239-
// Step 1: Use specialized walkthrough completion endpoint
240-
await UserPreferencesService.completeWalkthrough()
241-
242-
console.log('Successfully completed walkthrough via API')
233+
// Step 1: Use generic preference endpoint (avoids Content-Type header issue)
234+
await UserPreferencesService.setUserPreference('walkthrough_completed', true)
243235
244236
// Step 2: Update local storage for consistency
245237
eventBus.setState('walkthrough_completed', true)
@@ -253,8 +245,6 @@ const handleWalkthroughFinish = async () => {
253245
// Step 4: Emit completion event for any listening components
254246
eventBus.emit('walkthrough-completed')
255247
256-
console.log('Walkthrough completion stored in both API and local storage')
257-
258248
// Optional: Show success toast
259249
toast.success('Welcome tour completed!')
260250

0 commit comments

Comments
 (0)