Skip to content

Commit ab3e02c

Browse files
committed
Clear button
Resolves #32
1 parent 0c9d4ae commit ab3e02c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Webhooks have a new “Debounce Key Format” setting, which can be used to debouncing similar webhook requests. ([#27](https://github.com/craftcms/webhooks/issues/27))
88
- Webhook URLs can now be set to environment variables or Twig code. ([#18](https://github.com/craftcms/webhooks/issues/18))
99
- Webhooks can now send PUT requests. ([#21](https://github.com/craftcms/webhooks/issues/21))
10+
- The Activity page now has a “Clear” button, which will clear out all request activity for completed requests. ([#32](https://github.com/craftcms/webhooks/issues/32))
1011
- Added a new `guzzleConfig` plugin setting, which can be set from `config/webhooks.php` to customize the Guzzle config for webhook requests. ([#31](https://github.com/craftcms/webhooks/issues/31))
1112

1213
### Fixed

src/controllers/ActivityController.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ public function actionIndex(): Response
5050
]);
5151
}
5252

53+
/**
54+
* Clears the requests table.
55+
*
56+
* @return Response
57+
* @since 2.3.0
58+
*/
59+
public function actionClear(): Response
60+
{
61+
Craft::$app->getDb()->createCommand()
62+
->delete('{{%webhookrequests}}', ['status' => Plugin::STATUS_DONE])
63+
->execute();
64+
65+
return $this->redirect('webhooks/activity');
66+
}
67+
5368
/**
5469
* Returns request details modal HTML.
5570
*

src/templates/_activity/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@
4545
} %}
4646

4747
{% endblock %}
48+
49+
{% block actionButton %}
50+
{% if requests|length %}
51+
<a class="btn" href="{{ actionUrl('webhooks/activity/clear') }}">{{ 'Clear'|t('webhooks') }}</a>
52+
{% endif %}
53+
{% endblock %}

0 commit comments

Comments
 (0)