From 6edcbecca8346867a6524c0598c15577fac1447e Mon Sep 17 00:00:00 2001 From: Pelumi Muyiwa-Oni Date: Fri, 9 Feb 2024 10:51:47 +0000 Subject: [PATCH] remove owner id config from endpoint form in portal links (#1924) * fix project form * remove owner id config from endpoint form in portal links --- web/ui/dashboard/src/app/models/endpoint.model.ts | 1 + .../create-endpoint/create-endpoint.component.html | 8 ++++---- .../create-endpoint/create-endpoint.component.ts | 14 +++++++++----- .../create-project-component.component.ts | 5 +++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/web/ui/dashboard/src/app/models/endpoint.model.ts b/web/ui/dashboard/src/app/models/endpoint.model.ts index 44b9813eb6..e464c32a5c 100644 --- a/web/ui/dashboard/src/app/models/endpoint.model.ts +++ b/web/ui/dashboard/src/app/models/endpoint.model.ts @@ -18,6 +18,7 @@ export interface ENDPOINT { api_key: { header_value: string; header_name: string }; }; created_at: string; + owner_id?:string; description: string; events?: any; status?: string; diff --git a/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.html b/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.html index 43c8235ee7..e9269c5e6a 100644 --- a/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.html +++ b/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.html @@ -1,7 +1,7 @@
-
+
@@ -15,13 +15,13 @@
- + -
+
{{ endpointSecret?.value || '' }}
- + diff --git a/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.ts b/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.ts index a66ada58b4..b62bd3d1d6 100644 --- a/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.ts +++ b/web/ui/dashboard/src/app/private/components/create-endpoint/create-endpoint.component.ts @@ -75,10 +75,7 @@ export class CreateEndpointComponent implements OnInit { token: string = this.route.snapshot.params.token; @Input('endpointId') endpointUid: string = this.route.snapshot.params.id; enableMoreConfig = false; - configurations = [ - { uid: 'http_timeout', name: 'Timeout ', show: false }, - { uid: 'owner_id', name: 'Owner ID ', show: false } - ]; + configurations = [{ uid: 'http_timeout', name: 'Timeout ', show: false }]; endpointCreated: boolean = false; endpointSecret?: SECRET; private rbacService = inject(RbacService); @@ -95,7 +92,13 @@ export class CreateEndpointComponent implements OnInit { async ngOnInit() { if (this.type !== 'portal') - this.configurations.push({ uid: 'rate_limit', name: 'Rate Limit ', show: false }, { uid: 'alert_config', name: 'Notifications', show: false }, { uid: 'auth', name: 'Auth', show: false }, { uid: 'signature', name: 'Signature Format', show: false }); + this.configurations.push( + { uid: 'owner_id', name: 'Owner ID ', show: false }, + { uid: 'rate_limit', name: 'Rate Limit ', show: false }, + { uid: 'alert_config', name: 'Notifications', show: false }, + { uid: 'auth', name: 'Auth', show: false }, + { uid: 'signature', name: 'Signature Format', show: false } + ); if (this.endpointUid && this.editMode) this.getEndpointDetails(); if (!(await this.rbacService.userCanAccess('Endpoints|MANAGE'))) this.addNewEndpointForm.disable(); } @@ -165,6 +168,7 @@ export class CreateEndpointComponent implements OnInit { name: endpointDetails.title, url: endpointDetails.target_url }); + if (endpointDetails.owner_id) this.toggleConfigForm('owner_id'); if (endpointDetails.support_email) this.toggleConfigForm('alert_config'); if (endpointDetails.authentication.api_key.header_value || endpointDetails.authentication.api_key.header_name) this.toggleConfigForm('auth'); diff --git a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts index 3e05026477..9525d7eeb4 100644 --- a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts +++ b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts @@ -169,9 +169,10 @@ export class CreateProjectComponent implements OnInit { async createProject() { const projectFormModal = document.getElementById('projectForm'); - if (this.projectForm.get('name')?.invalid && this.projectForm.get('type')?.invalid) { + if (this.projectForm.get('name')?.invalid || this.projectForm.get('type')?.invalid) { projectFormModal?.scroll({ top: 0 }); - return this.projectForm.markAllAsTouched(); + this.projectForm.markAllAsTouched(); + return; } const projectData = this.getProjectData();