From 908d29b388c4ebf31a65a940fdb5d5bde80afc41 Mon Sep 17 00:00:00 2001 From: Oleksandr Kitsera Date: Mon, 28 Apr 2025 11:02:21 +0300 Subject: [PATCH 1/2] fix: preserve dashes in service names and ensure consistent formatting in API docs navigation --- .../df-service-details/df-service-details.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/adf-services/df-service-details/df-service-details.component.ts b/src/app/adf-services/df-service-details/df-service-details.component.ts index 92423e4e..40c52cf0 100644 --- a/src/app/adf-services/df-service-details/df-service-details.component.ts +++ b/src/app/adf-services/df-service-details/df-service-details.component.ts @@ -666,10 +666,10 @@ export class DfServiceDetailsComponent implements OnInit { } validateServiceName(name: string): boolean { - const regex = /^[a-zA-Z0-9_]+$/; // Example regex for valid characters + const regex = /^[a-zA-Z0-9_-]+$/; // Updated regex to include hyphen if (!regex.test(name)) { this.warnings.push( - 'Service name can only contain letters, numbers, and underscores.' + 'Service name can only contain letters, numbers, underscores, and hyphens.' ); return false; } @@ -680,7 +680,7 @@ export class DfServiceDetailsComponent implements OnInit { return name .toLowerCase() .replace(/\s+/g, '') - .replace(/[^a-z0-9_]/g, ''); + .replace(/[^a-z0-9_-]/g, ''); } gotoSchema() { @@ -691,7 +691,8 @@ export class DfServiceDetailsComponent implements OnInit { gotoAPIDocs() { const data = this.serviceForm.getRawValue(); this.currentServiceService.setCurrentServiceId(this.serviceData.id); - this.router.navigate([`/api-connections/api-docs/${data.name}`]); + const formattedName = this.formatServiceName(data.name); + this.router.navigate([`/api-connections/api-docs/${formattedName}`]); } goBack() { From 4c507dabe6a3ff2c1c41e04cf4519cbb3c1c83d1 Mon Sep 17 00:00:00 2001 From: Oleksandr Kitsera Date: Mon, 28 Apr 2025 11:06:24 +0300 Subject: [PATCH 2/2] Remove redundunt comments --- .../df-service-details.component.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/app/adf-services/df-service-details/df-service-details.component.ts b/src/app/adf-services/df-service-details/df-service-details.component.ts index 40c52cf0..2f592530 100644 --- a/src/app/adf-services/df-service-details/df-service-details.component.ts +++ b/src/app/adf-services/df-service-details/df-service-details.component.ts @@ -666,7 +666,7 @@ export class DfServiceDetailsComponent implements OnInit { } validateServiceName(name: string): boolean { - const regex = /^[a-zA-Z0-9_-]+$/; // Updated regex to include hyphen + const regex = /^[a-zA-Z0-9_-]+$/; if (!regex.test(name)) { this.warnings.push( 'Service name can only contain letters, numbers, underscores, and hyphens.' @@ -1042,15 +1042,25 @@ export class DfServiceDetailsComponent implements OnInit { next: result => { // Attempt to copy API key to clipboard if (navigator.clipboard) { - navigator.clipboard.writeText(result.apiKey) + navigator.clipboard + .writeText(result.apiKey) .then(() => { - this.snackbarService.openSnackBar('API Created and API Key copied to clipboard', 'success'); + this.snackbarService.openSnackBar( + 'API Created and API Key copied to clipboard', + 'success' + ); }) .catch(() => { - this.snackbarService.openSnackBar('API Created, but failed to copy API Key', 'success'); + this.snackbarService.openSnackBar( + 'API Created, but failed to copy API Key', + 'success' + ); }); } else { - this.snackbarService.openSnackBar('API Created, but failed to copy API Key', 'success'); + this.snackbarService.openSnackBar( + 'API Created, but failed to copy API Key', + 'success' + ); } // Navigate to API docs