From f3014d326fc24bd1e0ab469457981125f86809cb Mon Sep 17 00:00:00 2001 From: Yi-Jacob Date: Wed, 25 Sep 2024 13:57:19 -0400 Subject: [PATCH 1/2] #343 - Fixed dropdown --- .../df-service-details.component.html | 2 +- .../df-service-details.component.ts | 15 +++++++-------- .../df-side-nav/df-side-nav.component.ts | 12 +++++++++--- src/app/shared/types/user.ts | 1 + src/app/shared/utilities/case.ts | 1 - 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/app/adf-services/df-service-details/df-service-details.component.html b/src/app/adf-services/df-service-details/df-service-details.component.html index ef82ecc9..340567a1 100644 --- a/src/app/adf-services/df-service-details/df-service-details.component.html +++ b/src/app/adf-services/df-service-details/df-service-details.component.html @@ -476,7 +476,7 @@

[type]="getControl('type')" [storageServiceId]="getConfigControl('storageServiceId')" [storagePath]="getConfigControl('storagePath')" - [content]="getServiceDocByServicIdControl('content')" + [content]="getServiceDocByServiceIdControl('content')" [cache]="serviceData ? serviceData.name : ''" class="full-width"> 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 c225aab4..4c77f386 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 @@ -220,7 +220,7 @@ export class DfServiceDetailsComponent implements OnInit { } if (data?.serviceDocByServiceId) { data.config.serviceDefinition = data?.serviceDocByServiceId.content; - this.getServiceDocByServicIdControl('content').setValue( + this.getServiceDocByServiceIdControl('content').setValue( data?.serviceDocByServiceId.content ); } @@ -237,12 +237,13 @@ export class DfServiceDetailsComponent implements OnInit { ...data, config: data.config, }); - this.getConfigControl('serviceDefinition').setValue( - data.config.content - ); + if (data?.serviceDocByServiceId) { this.serviceDefinitionType = '' + data?.serviceDocByServiceId.format; + this.getConfigControl('serviceDefinition').setValue( + data.config.content + ); } this.serviceForm.controls['type'].disable(); } else { @@ -367,7 +368,7 @@ export class DfServiceDetailsComponent implements OnInit { return this.serviceForm.get(`config.${name}`) as FormControl; } - getServiceDocByServicIdControl(name: string) { + getServiceDocByServiceIdControl(name: string) { return this.serviceForm.get( `service_doc_by_service_id.${name}` ) as FormControl; @@ -411,9 +412,7 @@ export class DfServiceDetailsComponent implements OnInit { this.serviceDefinitionType ); // } - if (data.service_doc_by_service_id.content === '') { - data.service_doc_by_service_id = null; - } + } else if (this.isScriptService) { params = { ...params, diff --git a/src/app/shared/components/df-side-nav/df-side-nav.component.ts b/src/app/shared/components/df-side-nav/df-side-nav.component.ts index 0ca3d324..2e27db9b 100644 --- a/src/app/shared/components/df-side-nav/df-side-nav.component.ts +++ b/src/app/shared/components/df-side-nav/df-side-nav.component.ts @@ -109,13 +109,19 @@ export class DfSideNavComponent implements OnInit { if (userData?.isRootAdmin) { return of(null); } - if (userData?.isSysAdmin && !userData.roleId) { + if ( + userData?.isSysAdmin && + (!userData.roleId || !userData?.id || !userData?.role_id) + ) { return of(null); } - if (userData?.isSysAdmin && userData.roleId) { + if ( + userData?.isSysAdmin && + (userData.roleId || userData?.id || userData?.role_id) + ) { return this.userDataService.restrictedAccess$; } - if (userData?.roleId) { + if (userData?.roleId || userData?.id || userData?.role_id) { return of([ 'apps', 'users', diff --git a/src/app/shared/types/user.ts b/src/app/shared/types/user.ts index 01c90751..9b65797e 100644 --- a/src/app/shared/types/user.ts +++ b/src/app/shared/types/user.ts @@ -79,4 +79,5 @@ export interface UserSession { sessionToken: string; tokenExpiryDate: Date; roleId: number; + role_id?: number; } diff --git a/src/app/shared/utilities/case.ts b/src/app/shared/utilities/case.ts index f418dafa..0b4e5a8e 100644 --- a/src/app/shared/utilities/case.ts +++ b/src/app/shared/utilities/case.ts @@ -52,7 +52,6 @@ export function mapCamelToSnake(obj: T): T { 'type' in obj && (obj['type'] === 'okta_saml' || obj['type'] === 'saml') ) { - console.log('okta_saml'); for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = (obj as Record)[key]; From c7f0d2627bd44b46354d80f6cc34c002cfca02d8 Mon Sep 17 00:00:00 2001 From: Yi-Jacob Date: Wed, 25 Sep 2024 13:57:47 -0400 Subject: [PATCH 2/2] #343 - Fixed dropdown --- .../df-service-details/df-service-details.component.ts | 1 - 1 file changed, 1 deletion(-) 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 4c77f386..1fc9ea5a 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 @@ -412,7 +412,6 @@ export class DfServiceDetailsComponent implements OnInit { this.serviceDefinitionType ); // } - } else if (this.isScriptService) { params = { ...params,