Skip to content

Commit

Permalink
refactor(foxy-webhook-form): add support for optional resource info i…
Browse files Browse the repository at this point in the history
…n logs and statuses
  • Loading branch information
pheekus committed Oct 29, 2024
1 parent f513e50 commit 6b82569
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/elements/public/WebhookForm/WebhookForm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ describe('WebhookForm', () => {
'first',
'https://demo.api/hapi/webhook_statuses?webhook_id=0&order=date_created+desc'
);

expect(control).to.have.deep.property('itemProps', {});
element.resourceUri = 'https://demo.api/hapi/transactions/0';
await element.requestUpdate();
expect(control).to.have.deep.property('itemProps', { layout: 'resource' });
});

it('includes only resource-specific statuses when resource uri is set', async () => {
Expand Down Expand Up @@ -248,6 +253,11 @@ describe('WebhookForm', () => {
'first',
'https://demo.api/hapi/webhook_logs?webhook_id=0&order=date_created+desc'
);

expect(control).to.have.deep.property('itemProps', {});
element.resourceUri = 'https://demo.api/hapi/transactions/0';
await element.requestUpdate();
expect(control).to.have.deep.property('itemProps', { layout: 'resource' });
});

it('includes only resource-specific logs when resource uri is set', async () => {
Expand Down
2 changes: 2 additions & 0 deletions src/elements/public/WebhookForm/WebhookForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
limit="10"
item="foxy-webhook-status-card"
.getPageHref=${this.getStatusPageHref}
.itemProps=${this.resourceUri ? { layout: 'resource' } : {}}
>
</foxy-internal-async-list-control>
Expand All @@ -143,6 +144,7 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
limit="10"
item="foxy-webhook-log-card"
.getPageHref=${this.getLogPageHref}
.itemProps=${this.resourceUri ? { layout: 'resource' } : {}}
>
</foxy-internal-async-list-control>
Expand Down

0 comments on commit 6b82569

Please sign in to comment.