fix: replace notify calls with dispatch for consistent notification handling
This commit is contained in:
@@ -554,7 +554,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Firewall policies updated successfully', 'success');
|
||||
$this->dispatch('notify', 'Firewall policies updated successfully', 'success');
|
||||
$this->loadFirewallOptions();
|
||||
} else {
|
||||
$this->error = 'Failed to update firewall policies';
|
||||
@@ -717,7 +717,7 @@ class Firewall extends Component
|
||||
}
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Rule ' . ($this->editingRuleIndex !== null ? 'updated' : 'created') . ' successfully', 'success');
|
||||
$this->dispatch('notify', 'Rule ' . ($this->editingRuleIndex !== null ? 'updated' : 'created') . ' successfully', 'success');
|
||||
$this->resetRuleForm();
|
||||
$this->editingRuleIndex = null;
|
||||
$this->showRuleForm = false;
|
||||
@@ -754,7 +754,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Rule ' . ($newEnable == 1 ? 'enabled' : 'disabled'), 'success');
|
||||
$this->dispatch('notify', 'Rule ' . ($newEnable == 1 ? 'enabled' : 'disabled'), 'success');
|
||||
$this->loadFirewallRules();
|
||||
} else {
|
||||
$this->error = 'Failed to toggle rule';
|
||||
@@ -794,7 +794,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Rule deleted successfully', 'success');
|
||||
$this->dispatch('notify', 'Rule deleted successfully', 'success');
|
||||
$this->loadFirewallRules();
|
||||
} else {
|
||||
$this->error = 'Failed to delete rule';
|
||||
@@ -825,7 +825,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Rules reordered successfully', 'success');
|
||||
$this->dispatch('notify', 'Rules reordered successfully', 'success');
|
||||
$this->loadFirewallRules();
|
||||
} else {
|
||||
$this->error = 'Failed to reorder rules';
|
||||
@@ -931,7 +931,7 @@ class Firewall extends Component
|
||||
}
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Alias ' . ($this->editingAliasName ? 'updated' : 'created') . ' successfully', 'success');
|
||||
$this->dispatch('notify', 'Alias ' . ($this->editingAliasName ? 'updated' : 'created') . ' successfully', 'success');
|
||||
$this->resetAliasForm();
|
||||
$this->editingAliasName = null;
|
||||
$this->showAliasForm = false;
|
||||
@@ -971,7 +971,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('Alias deleted successfully', 'success');
|
||||
$this->dispatch('notify', 'Alias deleted successfully', 'success');
|
||||
$this->loadAliases();
|
||||
} else {
|
||||
$this->error = 'Failed to delete alias';
|
||||
@@ -1054,7 +1054,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('IPSet created successfully', 'success');
|
||||
$this->dispatch('notify', 'IPSet created successfully', 'success');
|
||||
$this->resetIPSetForm();
|
||||
$this->showIPSetForm = false;
|
||||
$this->loadIPSets();
|
||||
@@ -1093,7 +1093,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('IPSet deleted successfully', 'success');
|
||||
$this->dispatch('notify', 'IPSet deleted successfully', 'success');
|
||||
$this->loadIPSets();
|
||||
|
||||
// Clear selected IPSet if it was deleted
|
||||
@@ -1196,7 +1196,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('IP/CIDR added to IPSet successfully', 'success');
|
||||
$this->dispatch('notify', 'IP/CIDR added to IPSet successfully', 'success');
|
||||
$this->memberCidr = '';
|
||||
$this->memberComment = '';
|
||||
$this->memberNomatch = false;
|
||||
@@ -1240,7 +1240,7 @@ class Firewall extends Component
|
||||
);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->notify('IP/CIDR removed from IPSet successfully', 'success');
|
||||
$this->dispatch('notify', 'IP/CIDR removed from IPSet successfully', 'success');
|
||||
$this->loadIPSetMembers($this->selectedIPSetName);
|
||||
} else {
|
||||
$this->error = 'Failed to remove member';
|
||||
@@ -1368,7 +1368,7 @@ class Firewall extends Component
|
||||
$this->lastLogRefresh = now()->format('Y-m-d H:i:s');
|
||||
|
||||
// Notify user of successful refresh
|
||||
$this->notify('Loaded ' . count($this->firewallLogs) . ' firewall log entries', 'success');
|
||||
$this->dispatch('notify', 'Loaded ' . count($this->firewallLogs) . ' firewall log entries', 'success');
|
||||
|
||||
Log::info('Firewall log parsing summary', [
|
||||
'total_raw_logs' => count($allRawLogs),
|
||||
@@ -1933,7 +1933,7 @@ class Firewall extends Component
|
||||
'outgoing_policy' => $configData['policyOut'],
|
||||
]);
|
||||
|
||||
$this->notify('Configuration saved successfully', 'success');
|
||||
$this->dispatch('notify', 'Configuration saved successfully', 'success');
|
||||
$this->closeSaveConfigModal();
|
||||
$this->loadSavedConfigurations();
|
||||
} catch (\Exception $e) {
|
||||
@@ -2214,9 +2214,9 @@ class Firewall extends Component
|
||||
$message = 'Configuration applied successfully';
|
||||
if ($incompatibleRulesDisabled > 0) {
|
||||
$message .= ". {$incompatibleRulesDisabled} rule(s) were disabled due to incompatibility with this VPS.";
|
||||
$this->notify($message, 'warning');
|
||||
$this->dispatch('notify', $message, 'warning');
|
||||
} else {
|
||||
$this->notify($message, 'success');
|
||||
$this->dispatch('notify', $message, 'success');
|
||||
}
|
||||
|
||||
$this->closeApplyConfigModal();
|
||||
@@ -2276,7 +2276,7 @@ class Firewall extends Component
|
||||
|
||||
$config->delete();
|
||||
|
||||
$this->notify('Configuration deleted successfully', 'success');
|
||||
$this->dispatch('notify', 'Configuration deleted successfully', 'success');
|
||||
$this->cancelDeleteConfiguration();
|
||||
$this->loadSavedConfigurations();
|
||||
} catch (\Exception $e) {
|
||||
@@ -2355,7 +2355,7 @@ class Firewall extends Component
|
||||
'configuration_name' => trim($this->renameConfigName),
|
||||
]);
|
||||
|
||||
$this->notify('Configuration renamed successfully', 'success');
|
||||
$this->dispatch('notify', 'Configuration renamed successfully', 'success');
|
||||
$this->closeRenameConfigModal();
|
||||
$this->loadSavedConfigurations();
|
||||
} catch (\Exception $e) {
|
||||
@@ -2604,9 +2604,9 @@ class Firewall extends Component
|
||||
$totalCount = count($results);
|
||||
|
||||
if ($successCount === $totalCount) {
|
||||
$this->notify("Configuration applied to all {$successCount} servers successfully", 'success');
|
||||
$this->dispatch('notify', "Configuration applied to all {$successCount} servers successfully", 'success');
|
||||
} elseif ($successCount > 0) {
|
||||
$this->notify("Configuration applied to {$successCount} of {$totalCount} servers", 'warning');
|
||||
$this->dispatch('notify', "Configuration applied to {$successCount} of {$totalCount} servers", 'warning');
|
||||
} else {
|
||||
$this->error = 'Failed to apply configuration to any servers';
|
||||
$this->showErrorModal = true;
|
||||
|
||||
Reference in New Issue
Block a user