Skip to content

Commit

Permalink
remove owner id config from endpoint form in portal links (#1924)
Browse files Browse the repository at this point in the history
* fix project form

* remove owner id config from endpoint form in portal links
  • Loading branch information
Oluwadaminiola authored Feb 9, 2024
1 parent aebfe9c commit 6edcbec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions web/ui/dashboard/src/app/models/endpoint.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div [class]="showAction === 'true' ? 'pt-40px' : 'pt-20px'">
<div convoy-card class="p-24px relative">
<form [formGroup]="addNewEndpointForm">
<div class="grid gap-24px mb-16px" style="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))">
<div class="grid gap-24px" style="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))">
<convoy-input-field>
<label for="name" convoy-label required="true">Endpoint Name</label>
<input id="name" convoy-input autocomplete="name" formControlName="name" placeholder="Enter endpoint name here" />
Expand All @@ -15,13 +15,13 @@
</convoy-input-field>
</div>

<convoy-input-field className="mb-16px">
<convoy-input-field className="mb-24px">
<label for="secret" convoy-label>Endpoint Secret</label>
<div class="flex items-center justify-between w-full h-46px border border-new.gray-200 bg-[#F7F9FC] rounded-[6px] px-16px mb-12px" *ngIf="editMode">
<div class="flex items-center justify-between w-full h-46px border border-new.gray-200 bg-[#F7F9FC] rounded-[6px] px-16px mb-12px" *ngIf="editMode && type !== 'portal'">
<span class="text-12 text-new.gray-600 font-normal truncate">{{ endpointSecret?.value || '' }}</span>
<div class="ml-8px" convoy-copy-button [text]="endpointSecret?.value || ''" notificationText="Endpoint secret copied to clipboard."></div>
</div>
<input *ngIf="!editMode" type="secret" id="secret" convoy-input formControlName="secret" placeholder="Enter endpoint secret here" />
<input *ngIf="!editMode || type === 'portal'" type="secret" id="secret" convoy-input formControlName="secret" placeholder="Enter endpoint secret here" />
</convoy-input-field>

<ng-container *ngIf="showConfig('owner_id')">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 6edcbec

Please sign in to comment.