Sync blocked table and remove whitelist edit
This commit is contained in:
@@ -419,6 +419,7 @@ class Waf extends Page implements HasForms, HasTable
|
|||||||
$this->loadAuditLogs(false);
|
$this->loadAuditLogs(false);
|
||||||
$this->resetTable();
|
$this->resetTable();
|
||||||
$this->dispatch('waf-whitelist-updated');
|
$this->dispatch('waf-whitelist-updated');
|
||||||
|
$this->dispatch('waf-blocked-updated');
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(__('Rule whitelisted'))
|
->title(__('Rule whitelisted'))
|
||||||
@@ -474,6 +475,7 @@ class Waf extends Page implements HasForms, HasTable
|
|||||||
$this->loadAuditLogs(false);
|
$this->loadAuditLogs(false);
|
||||||
$this->resetTable();
|
$this->resetTable();
|
||||||
$this->dispatch('waf-whitelist-updated');
|
$this->dispatch('waf-whitelist-updated');
|
||||||
|
$this->dispatch('waf-blocked-updated');
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(__('Whitelist removed'))
|
->title(__('Whitelist removed'))
|
||||||
@@ -598,6 +600,13 @@ class Waf extends Page implements HasForms, HasTable
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\Livewire\Attributes\On('waf-blocked-updated')]
|
||||||
|
public function refreshBlockedTable(): void
|
||||||
|
{
|
||||||
|
$this->loadAuditLogs(false);
|
||||||
|
$this->resetTable();
|
||||||
|
}
|
||||||
|
|
||||||
protected function filterRecords(array $records, ?string $search): array
|
protected function filterRecords(array $records, ?string $search): array
|
||||||
{
|
{
|
||||||
if (! $search) {
|
if (! $search) {
|
||||||
|
|||||||
@@ -86,28 +86,6 @@ class WafWhitelistTable extends Component implements HasTable, HasSchemas, HasAc
|
|||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('edit')
|
|
||||||
->label(__('Edit'))
|
|
||||||
->icon('heroicon-o-pencil-square')
|
|
||||||
->form($this->whitelistRuleForm())
|
|
||||||
->fillForm(fn (array $record) => Arr::only($record, ['label', 'match_type', 'match_value', 'rule_ids']))
|
|
||||||
->action(function (array $data, array $record): void {
|
|
||||||
$rules = $this->getWhitelistRules();
|
|
||||||
|
|
||||||
foreach ($rules as &$rule) {
|
|
||||||
if (($rule['__key'] ?? '') === ($record['__key'] ?? '')) {
|
|
||||||
$rule = array_merge($rule, $this->normalizeRule($data));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->persistWhitelistRules($rules);
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title(__('Whitelist rule updated'))
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
}),
|
|
||||||
Action::make('delete')
|
Action::make('delete')
|
||||||
->label(__('Delete'))
|
->label(__('Delete'))
|
||||||
->icon('heroicon-o-trash')
|
->icon('heroicon-o-trash')
|
||||||
|
|||||||
Reference in New Issue
Block a user