Skip to content

Commit

Permalink
Fix project settings (#1953)
Browse files Browse the repository at this point in the history
* update convoy version

* fix project settings

* update enpoint table
  • Loading branch information
Oluwadaminiola committed Apr 1, 2024
1 parent 3fb370a commit c59c029
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 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 @@ -24,6 +24,7 @@ export interface ENDPOINT {
status?: string;
secrets?: SECRET[];
name?: string;
url: string;
target_url: string;
url: string;
updated_at: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,35 +137,48 @@ export class CreateProjectComponent implements OnInit {
try {
this.projectDetails = this.privateService.getProjectDetails;

this.setSignatureVersions();

if (this.projectDetails?.type === 'incoming') this.tabs = this.tabs.filter(tab => tab.label !== 'signature history');

this.projectForm.patchValue(this.projectDetails);
this.projectForm.get('config.strategy')?.patchValue(this.projectDetails.config.strategy);
this.projectForm.get('config.signature')?.patchValue(this.projectDetails.config.signature);
this.projectForm.get('config.ratelimit')?.patchValue(this.projectDetails.config.ratelimit);

// set meta events config
this.projectDetails.config.meta_event && this.projectDetails.config.meta_event.is_enabled
? this.projectForm.get('config.meta_event.is_enabled')?.patchValue(this.projectDetails.config.meta_event.is_enabled)
: this.projectForm.get('config.meta_event.is_enabled')?.patchValue(false);


const search_policy = this.projectDetails.config.retention_policy.search_policy.match(/\d+/g);

this.projectForm.get('config.retention_policy.search_policy')?.patchValue(search_policy);
const policy = this.projectDetails.config.retention_policy.policy.match(/\d+/g);
this.projectForm.get('config.retention_policy.policy')?.patchValue(policy);

this.projectForm.get('config.meta_event.type')?.patchValue('http');

let filteredConfigs: string[] = [];
if (this.projectDetails?.type === 'incoming') filteredConfigs.push('signature');
if (!this.projectDetails?.config.retention_policy_enabled) filteredConfigs.push('retention_policy');

this.configurations.filter(item => !filteredConfigs.includes(item.uid)).forEach(config => this.toggleConfigForm(config.uid));
} catch {}
}

const versions = this.projectDetails.config.signature.versions;
if (!versions?.length) return;
this.signatureVersions = this.generalService.setContentDisplayed(versions);
versions.forEach((version: { encoding: any; hash: any }, index: number) => {
this.addVersion();
this.versions.at(index)?.patchValue({
encoding: version.encoding,
hash: version.hash
});
setSignatureVersions() {
const versions = this.projectDetails.config.signature.versions;
if (!versions?.length) return;
this.signatureVersions = this.generalService.setContentDisplayed(versions);
versions.forEach((version: { encoding: any; hash: any }, index: number) => {
this.addVersion();
this.versions.at(index)?.patchValue({
encoding: version.encoding,
hash: version.hash
});
} catch {}
});
}

async createProject() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ <h1 class="text-18 font-bold text-neutral-12 mr-10px">Endpoints</h1>
<tr convoy-table-row *ngFor="let endpoint of endpointGroup.content; let index = index"
[id]="'endpoint' + i" class="border-b border-b-new.primary-25"
(click)="selectedEndpoint = endpoint">
<td convoy-table-cell class="w-[450px]">
<div class="truncate max-w-[440px] pl-16px">{{ endpoint.name }}</div>
<td convoy-table-cell class="w-[300px]">
<div class="truncate max-w-[290px] pl-16px">{{ endpoint.name }}</div>
</td>
<td convoy-table-cell class="w-100px">
<convoy-tag *ngIf="endpoint.status" [color]="endpoint.status | statuscolor"
Expand All @@ -79,10 +79,10 @@ <h1 class="text-18 font-bold text-neutral-12 mr-10px">Endpoints</h1>
<td convoy-table-cell class="relative">
<div convoy-tag color="gray"
class="mr-8px w-[260px] !gap-16px truncate flex items-center">
{{ endpoint.uid }}
{{ endpoint.url }}
<convoy-copy-button size="sm"
[notificationText]="endpoint.name + ' ID has been copied to clipboard'"
[text]="endpoint.uid"></convoy-copy-button>
[notificationText]="endpoint.name + ' Url has been copied to clipboard'"
[text]="endpoint.url"></convoy-copy-button>
</div>
</td>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class EndpointsComponent implements OnInit {

showCreateEndpointModal = this.router.url.split('/')[4] === 'new';
showEditEndpointModal = this.router.url.split('/')[5] === 'edit';
endpointsTableHead = ['Name', 'Status', 'ID', '', '', ''];
endpointsTableHead = ['Name', 'Status', 'Url', '', '', ''];
displayedEndpoints?: { date: string; content: ENDPOINT[] }[];
endpoints?: { pagination?: PAGINATION; content?: ENDPOINT[] };
selectedEndpoint?: ENDPOINT;
Expand Down
2 changes: 1 addition & 1 deletion web/ui/dashboard/src/app/private/private.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="bg-white-100 min-h-screen overflow-y-auto flex flex-col justify-between">
<header class="w-full border-b border-b-neutral-a3 bg-neutral-a2 fixed z-20">
<header class="w-full border-b border-b-neutral-a3 bg-neutral-a2 fixed z-[50]">
<div class="flex items-center justify-between w-full max-w-[1440px] m-auto px-24px py-12px">
<div class="flex items-center">
<a routerLink="/" rel="noreferrer">
Expand Down

0 comments on commit c59c029

Please sign in to comment.